0% found this document useful (0 votes)
75 views408 pages

MC Series Small PLC Programming Reference Manual

Uploaded by

a.elsayed.ragab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views408 pages

MC Series Small PLC Programming Reference Manual

Uploaded by

a.elsayed.ragab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 408

MC Series Small PLC

Programming Manual
MC Series Small PLC
Programming Manual

Version V2.3
Revision date March 10, 2013

Megmeet provides customers with technical support. Users may contact the nearest Megmeet local
sales office or service center.

Copyright © 2013 by Shenzhen Megmeet Control Technology Co., Ltd.


All rights reserved. The contents in this document are subject to change without notice.

Shenzhen Megmeet Control Technology Co., Ltd.


Address: 5th Floor,Block B,Ziguang Information Harbor, Langshan Rd, Science& Technology Park,
Nahshan District, Shenzhen

Homepage: www.megmeet-ia.com
Prologue
Target reader
This book is suitable for the automation personnel who need to master the PLC programming, system design and
commissioning. This book can also serve as a reference for anyone who are interested in futhering their PLC
programming knowledge.
Content of this book
This book details the principles, hardware resources, programming languages and instructions of the MC series
small PLC. A variety of application illustrations are used to help you understand the rich functions of the PLC.
Features of this book
The chapters in this book develops from general to details, each having its independent topic. You can either
read thoroughly to gain overall knowledge of the MC series small PLC, or consult in some of the chapters for
technical reference.
Reading instructions
1. For readers unfamiliar with PLC
It is recommended to start with chapters 1~4 to learn the basic PLC knowledge, including PLC function
description, programming languages, elements & data, addressing modes, program annotating function,
main program and subprograms. Afterwards, you can read other chapters to cater for your needs.
2. For readers familiar with PLC
You can jump directly to Chapter 5 Basic Instructions and Chapter 6 Application Instructions, which
provide complete and detailed explanation for the instructions of Megmeet MC series PLC. In addition, the
0Instruction Index and 0Classified Instruction Index provide tools for Position the instructions in the orders
of alphabet and classification respectively.
Related documents
You can refer to the following books while reading this book:
 MC80 Series PLC User Manual
 MC100 Series PLC User Manual
 MC200 Series PLC User Manual
 MC280 Series PLC User Manual
 X-builder Programming Software User Manual
4 Chapter 1 Product Overview

Contents

Chapter 1 Product Overview..........................................................................................................................................................................5


Chapter 2 PLC Function Description..........................................................................................................................................................19
Chapter 3 Element And Data.......................................................................................................................................................................44
Chapter 4 Programming Concepts............................................................................................................................................................. 59
Chapter 5 Basic Instructions........................................................................................................................................................................69
Chapter 6 Application Instructions.............................................................................................................................................................. 85
Chapter 7 SFC Tutor...................................................................................................................................................................................271
Chapter 8 Using High Speed I/O.............................................................................................................................................................. 292
Chapter 9 Using Interrupts.........................................................................................................................................................................302
Chapter 10 Using Communication Function........................................................................................................................................... 312
Chapter 11 Motion Control Tutor.............................................................................................................................................................. 333
Special Auxiliary Relay............................................................................................................................................................................... 352
Special Data Register................................................................................................................................................................................. 365
Reserved Elements.....................................................................................................................................................................................381
Inverter Instruction Error Code..................................................................................................................................................................382
System Error Code......................................................................................................................................................................................383
Modbus Communication Protocol (MC series)....................................................................................................................................... 385
Modbus Communication Error Code........................................................................................................................................................394
ASCII Code Table....................................................................................................................................................................................... 395
Instruction Index.......................................................................................................................................................................................... 396
Classified Instruction Index........................................................................................................................................................................404
High Speed Counter Comparison Table..................................................................................................................................................411
Chapter 1 Product Overview

This chapter presents the product makeup, platform of the programming software and network configuration of the MC
series small PLC.
Chapter 1 Product Overview..........................................................................................................................................................................5
1.1 Product Introduction........................................................................................................................................................................ 6
1.1.1 Product Specification..........................................................................................................................................................6
1.1.2 Outline Of MC80 Series Basic Module............................................................................................................................ 9
1.1.3 Outline Of MC100 Series Basic Module........................................................................................................................10
1.1.4 Outline of MC200 Series Basic Module.........................................................................................................................10
1.1.5 Outline of MC280 Series Basic Module.........................................................................................................................11
1.2 X-builder Programming Software................................................................................................................................................12
1.2.1 Basic Configuration...........................................................................................................................................................12
1.2.2 X-builder Installation......................................................................................................................................................... 12
1.2.3 X-builder Operation Interface..........................................................................................................................................12
1.2.4 Programming Cable..........................................................................................................................................................13
1.3 Communication Function..............................................................................................................................................................15
1.3.1 Modbus Protocol Network............................................................................................................................................... 15
1.3.2 MCbus Protocol Network................................................................................................................................................. 15
1.3.3 Free Port Protocol Network............................................................................................................................................. 15
1.4 Makeup Of Document System Of MC Series Small PLCs..................................................................................................... 15
1.4.1 Model Selection Instruction............................................................................................................................................. 15
1.4.2 Basic Module User Manual............................................................................................................................................. 15
1.4.3 Programming Manual....................................................................................................................................................... 15
1.4.4 Programming Software User Manual.............................................................................................................................18
1.4.5 I/O Extension Module User Manual............................................................................................................................... 18
1.4.6 Special Module User Manual.......................................................................................................................................... 18
6 Chapter 1 Product Overview

1.1 Product Introduction


This chapter presents the product makeup, platform of the programming software and network configuration of the MC
series small PLC. Product Introduction
The MC series small PLC, comprising the MC100 mini-scale series and MC200 small series, is a high performance
product suitable for modern industrial control.
The MC series PLC products have integrated structure, built-in high performance microprocessor, operation control
system, integrated I/O and extension bus. The series also include I/O modules and special modules. The basic module
has 2 integrated communication ports, and the system can connect to the profibus network through a profibus
extension module. The basic module I/O is capable of high-speed counting and high-speed output that can be used for
exact Position. The powerful X-builder programming software provides 3 standard programming languages and
commissioning & monitoring functions, and boasts complete user program protection mechanism.

1.1.1 Product Specification


Table 1-1 PLC basic module
MC280 MC200 MC100 MC80
10-input /6-output
10-input /6-output 14-input /10-output
10-input /6-output
14-input /10-output 16-input /14-output
16-input /16-output 14-input /10-output
20-input /12-output 24-input /16-output
Digital I/O points 36-input /24-output 16-input /14-output
24-input /16-output 36-input /24-output
40-input /40-output 24-input /16-output
32-input /32-output 16-input
36-input /24-output
40-input /40-output /14-output/2-analog
input/1-analog output
Total number of
512 512 128 60
supported I/O points
Max. number of
8 8 4 /
special modules
4×200kHz, 4×100
2×100kHz (for 2×100kHz (for 2×50kHz (for
High speed pulse kHz(8 axles)
transistor output transistor output transistor output
output 4×200kHz, 2×100
only) only) only)
kHz(6 axles)
Single phase
8×100 kHz 6: 2(50kHz) + 4 (10kHz)
counting channel
AB phase counting
4×50kHz 2: 1 (30kHz) + 1 (5kHz)
channel
I/O Max. total frequency
800kHz 80kHz 60kHz 60kHz
of high-speed counter
X0 ~ X7,X10~ X17(X0 ~
X0 ~ X7 X0 ~ X7
X3 and X4 ~ X7 can be X0 ~ X17
Input filtering Input filtering
Digital filtering set seperately), Input Input filtering
constant: 0, 8, 16, 32, constant: 0, 8, 16,
filtering constant: 0 ~ constant: 0 ~ 60ms
64ms 32, 64ms
60ms
2A/1 piont
Resistive
8A/4-point-group common terminal
Max. load
8A/8 point-group common terminal
relay
Inductive
output 220Vac, 80VA
load
current
Illuminatio
220Vac, 100W
n
Y0~Y7: 0.3A/1 point
Max. Others: 0.3A/1 point,
transist 0.8A/4 points, 1.6A/8 Y0, Y1: 0.3A/1 point
Resistive
or points. Others: 0.3A/1 point, 0.8A/4 points, 1.6A/8 points.
load
output For each point above For each point above 8-point, the total current raises 0.1A.
current 8-point, the total current
raises 0.1A.
MC280 MC200 MC100 MC80
Inductive
/ Y0, Y1: 7.2W/24Vdc. Others: 12W/24Vdc
load
Illuminatio
/ Y0, Y1: 0.9W/24Vdc. Others: 1.5W/24Vdc
n

User program 32k steps (64kByte) 12k steps (24kByte) 16k steps (24kByte) 6k steps (12kByte)

Memory hold upon


Yes
power failure
Registor Max. number of
User set (up to 200
memory hold All elements 320 bit elements, or 180 word elements
C elements)
elements
Hardware support
Backup battery. Life
and sustainable Backup battery. EEPROM. Permanent
span: 1 year.
period
8 Chapter 1 Product Overview

MC280 MC200 MC100 MC80


100ms precision: T0 ~
T209
100ms precision: T0 ~ T209
10ms precision: T210 ~
Timer 10ms precision: T210 ~ T251
T479
1ms precision: T252 ~ T255
1ms precision: T480 ~
T511
16-bit up counter: C0 ~
C199
32-bit bi-directional 16-bit up counter: C0 ~ C199
Counter counter: C200 ~ C235 32-bit bi-directional counter: C200 ~ C235
32-bit high speed 32-bit high speed counter: C236 ~ C259
Element counter: C236 ~ C259
s
C301 ~ C306
D0 ~
Data register D0 ~ D7999 D0 ~ D7999 D0 ~ D3999
D7999,R0~R32767
Local data register V0 ~ V63
Offset addressing
Z0 ~ Z15
register
Special data register SD0 ~ SD511 SD0 ~ SD255
Auxiliary relay M0 ~ M10239 M0 ~ M1999 M0 ~ M2047 M0 ~ M1023
Local auxiliary relay LM0 ~ LM63
Special auxiliary relay SM0 ~ SM511 SM0 ~ SM255
State relay S0 ~ S4095 S0 ~ S991 S0 ~ S1023 S0 ~ S1023
Internal timed
3 3 3 3
interrupt
External interrupt 16 16 16 16
High-speed counter
8 6 6 6
interrupt
Serial port interrupt 12 10 8 4
Interrupt
PTO output complete
6 2 2 2
interrupt
Interpolation
3 / / /
complete interrupt
Pass point interrupt 6 / / /
Power failure interrupt 1 1 1 1
Basic instruction
0.065µS 0.09µS 0.3µS 0.3µS
processing time
Yes Yes Yes Yes
General (power-failure (power-failure (power-failure (power-failure
Real time clock
memory-hold time: >3 memory-hold memory-hold time: 100 memory-hold
year) time: >3 year) hs) time: 100 hs)
Analog potentiometer / 2 (precision: 8-bit) 2 (precision: 8-bit) /
PORT0: RS-232 PORT0: RS-232
PORT0: RS-232
Commun Ports PORT1: RS-485 PORT1: PORT0: RS-23
PORT1: RS-232/RS-485
ication PORT2: RS-485 RS-232/RS-485
Protocol Modbus, Free port, Programming port
Access Password type Upload, download, monitoring, subprogram, formatting enabling
control
and user
program Upload disabling Yes
protectio
n
Real time clock
Yes Yes Yes /
Applicati instruction
on Date and clock
instructio comparison Yes Yes Yes /
n instruction
Float-point instruction Yes Yes Yes /
MC280 MC200 MC100 MC80
DRVI instruction
Position instruction Yes Yes Yes
only
High speed IO PLS instruction
Yes Yes Yes
instruction enabling
MODBUS and
Yes Yes Yes /
inverter instruction
R/W EEPROM
Yes Yes Yes /
instruction
Control count
Yes Yes Yes PID instruction only
instruction
Word string
Yes / / /
instruction
Large quantity data
Yes / / /
process instrution
Data table instruction Yes / / /
Motion control Yes / / /
220Vac/15VA/inducti
1s ON / 1s OFF, 3,200,000 times
Life span ve
of output 220Vac/30VA/
1s ON / 1s OFF, 1,200,000 times
relay inductive
contacts 220Vac/72VA/
1s ON / 1s OFF, 300,000 times
inductive
Power
Input voltage range 85Vac ~ 264Vac (for normal operation)
supply
Note:
1.See MC100 Series PLC User Manual for the speicifcation, installation instruction, operation and maintenance of MC100 series
PLCs.
2.See MC200 Series PLC User Manual for the speicifcation, installation instruction, operation and maintenance of MC200 series
PLCs.
3.See MC280 Series PLC User Manual for the speicifcation, installation instruction, operation and maintenance of MC280 series
PLCs.
4. Power failure memory hold time is 3 year at 25℃

MC280 is enhanced to MC200E, the difference as below:

model MC280 MC280 MC280 MC200E MC200E MC200E


function 8 axles 6 axles 4 axles 8 axles 6 axles 4 axles
GEARBOX √ √ √ / / /
CAMBOX √ √ √ / / /
LIN √ √ √ / / /
CW √ √ √ / / /
CCW √ √ √ / / /
G code √ √ √ / / /

MC200E belongs to MC280 and will not be existed as a serial product in the following chapter.

1.1.2 Outline Of MC80 Series Basic Module


The structure of the MC80 series basic module is shown in the following figure (example: MC80-1614BRA):
10 Chapter 1 Product Overview

PORT0 is RS232 for communication, and use socket Mini DIN8, The mode selector switch can be set to ON, TM or
OFF.

1.1.3 Outline Of MC100 Series Basic Module


The outline and structure of the MC100 series basic module are shown in the following figure (example:
MC100-1614BRA):

1-1 Figure Outline and structure of MC100 series basic module

As shown in Figure 2-1, PORT0 and PORT1 are for communication. PORT0 is RS232, and use socket Mini DIN8,
while PORT1 is RS485 or RS232. The bus socket is for connecting extension modules. The mode selector switch can
be set to ON, TM or OFF.

1.1.4 Outline of MC200 Series Basic Module


The outline and structure of MC200 series basic module is shown in the following figure (example: 64-point basic
module):
1-2 Figure Outline and structure of MC200 series basic module

The battery socket is designed for the CR2032 button lithium battery. The bus socket is for connecting extension
modules. The communication port PORT0 is RS-232 and uses socket Mini DIN8, while the communication port
PORT1 is RS-485 or RS-232. The mode selector switch can be set to ON, TM or OFF.

1.1.5 Outline of MC280 Series Basic Module


The outline and structure of MC280 series basic module is shown in the following figure (example: 32-point basic
module):

The battery socket is designed for the CR2032 button lithium battery. The bus socket is for connecting extension
modules. The communication port PORT1 and PORT2 uses socket Mini DIN8, while the communication port PORT0
is RS-232. The mode selector switch can be set to ON, TM or OFF.
12 Chapter 1 Product Overview

1.2 X-builder Programming Software


X-builder is a programming software specialized for MC100 and MC200 series PLCs. You can download it at
www.megmeet-ia.com.
The X-builder software is a Windows-based diagram programming-tool, operated through the mouse and keyboard.
Three programming languages are available: ladder diagram (LAD), instruction list (IL) and Sequential Function Chart
(SFC).
To connect the X-builder programming platform to your PLC, you can use directly the serial port programming cable, or
the Modbus network through serial port conversion, or the Internet through a modem.
Refer to the X-builder Programming Software User Manual for the Modbus programming and remote monitoring.

1.2.1 Basic Configuration


X-builder programming software requires an IBM PC and Microsoft Windows series OS. The compatible OSs include
Windows 98, Windows Me, NT 4.0, Windows 2000 and Windows XP.
The minimum and recommended configuration for the PC is listed below:
Table 1-2 Computer requirements
Item Minimum Recommended
CPU Intel Pentium 233 equivalent or above Intel Pentium 1G equivalent or above
Memory 64M 128M
Display card Supportive of 640 × 480 resolution and 256 colors Supportive of 800 × 600 resolution and 65535 colors
Communication port A RS-232 serial port with DB9 socket (or a USB port and a USB-RS232 converter)
Others Megmeet dedicated PLC programming cable

1.2.2 X-builder Installation


The X-builder installation package issued by Shenzhen Megmeet Control Technology Co., Ltd. (for short, Megmeet) is
an executable program. Double click it to start the installation, and follow the prompts step by step. You can select an
installation path according to your actual need.
After the installation, the Megmeet program group will be added to the start menu. A X-builder shortcut icon will also be
added to the desktop.
You can uninstall the X-builder software through the Windows Control Panel. To install a new version X-builder, you
have to uninstall the present version first.

1.2.3 X-builder Operation Interface


The main interfaces include 7 sections: Menu, Tool bar, Project Manager window, Instruction Tree window,
Information window, Status bar and Operation area.
Menu
Tool bar

Project manager

Operation area

Instruction tree

Information
window

Status bar

Figure 1-1 X-builder main interface

For the usage of X-builder programming software, refer to the X-builder Programming Software User Manual.

1.2.4 Programming Cable


You can use the Megmeet dedicated programming cable to program and debug the PLC. Note that there are two kinds
of cables, one being optically isolated and hot swappable; the other being non-isolated and not hot swappable. Neither
of them requires setting jumpers.

1.3 Operation Box


MC Serial operation box supports the product of MC100, MC200 and MC280. It can realize the functions of the
program copy, program download, monitor and change element values.

1.3.1 Connecting between Operation Box and Computer


(1) The operation box can be connected to the computer by MCA200-UDM01SL2 cable. Set up a port below.

Figure 1-2 Operation Box Port Setting

(2) Download the program to the PLC. Choose the menu: PLC->>Set hand-held Box->>Download.
14 Chapter 1 Product Overview

Figure 1-3 Operation Box Download

(3) The download number can be set by X-builder. When download program begins between operation box and PLC,
to reach the times of download, the download will stop.
(4) Set password. Choose the menu: PLC->>Set Password->>Download Password/Upload Password/Monitor
Password. After setting password, the program of operation box can be protected. When the program is downloaded
to PLC, the program of PLC can be set corresponding password as well.

Figure 1-4 Operation Box Password Setting

1.3.2 Operation Box Program Copy


(1)The operation box can be connected to the MC series PLC by MCA200-UDM01SL2 cable. The power indicator
light.
(2)Program copy: press the UPLOAD button, then press ENT button, the work indicator light; when the error comes,
the ERR indicator light.
(3)Program download: press the DOWNLOAD button, the WORK indicator light in the process of downloading. When
the download completes, the WORK indicator goes out. When the error comes, the ERR indicator light.

1.3.3 Element Display and Setting of Operation Box


(1)Display and setting function description
Press the MON button, enter the monitor status.
(2)PLC element setting
Operating panel has three level menu, easy to operate: press the ∧ button and ∨ button to increase or
decrease value, press the SHIFT button to switch, press the ENT button to confirm. Decimal point is used as an
indication of bit operation.
(3)Function parameters and setup instruction: When entering the monitor status of function code, press ENTER key to
enter setup mode.

1.4 Communication Function


Each MC series PLC basic module has two integrated serial ports: PORT 0 and Port 1 . The Profibus and Canbus
extension modules are also available for the communication in a fieldbus network.
The two serial ports of the basic module are compatible with Modbus, MCbus and user-defined free port protocols.

1.4.1 Modbus Protocol Network


The basic module can set up a RS-485 Modbus network with multiple inverters, PLCs and other intelligent devices
through the RS-485 on Port 1, or through Port 0 and a RS-232/485 converter. The maximum communication distance
is 1200 meters, and maximum baud rate is 38400bit/s. RTU and ASCII transmission modes are optional.
The basic module can communicate one-to-one with inverters, PLCs, touch screens and meters through the RS-232
port on PORT 0 or Port 1 . The maximum communication distance is 15 meters; and maximum baud rate is 38400bit/s.
For details about the Modbus network, see Chapter 10 Using Communication Function and 0Modbus
Communication Protocol (MC series).

1.4.2 MCbus Protocol Network


The MC100 series PLC is embedded with Megmeet-developed MCbus communication protocol, capable of setting up
an N : N communication network through the Port 1 RS-485 port, or through PORT 0 and a RS-232/485 converter.
The MCbus communication protocol allows single/double-layer networking and data exchange among 2~32 PLCs with
the maximum baud rate of 115200bps.
For details about the MCbus network, see Chapter 10 Using Communication Function.

1.4.3 Free Port Protocol Network


The free port protocol allows communication with customized data format. It supports ASCII and binary system. In this
communication mode, the PLC can communicate with various equipment with customized formats, such as inverter,
bar-code scanner, instrument, and other intelligent devices. PLC can communicate with a single device in the RS-232
or RS-485 mode, or form a RS-485 network when there are multiple devices.
For details about the free port protocol communication, see Chapter 10 Using Communication Function.

1.5 Model Of MC Series PLCs


You can download the documents of MC series small PLC at www.megmeet-ia.com. If you need the paper copy of the
document, please contact your agent.

1.5.1 Basic Module Series

MC80 Series
MC80-1006BRA 10-point input, 6-point relay output
MC80-1006BTA 10-point input, 6-point transistor output
MC80-1410BRA 14-point input, 10-point relay output
MC80-1410BTA 14-point input, 10-point transistor output
MC80-1614BRA 16-point input, 14-point relay output
MC80-1614BTA 16-point input, 14-point transistor output
MC80-2416BRA 24-point input, 16-point relay output
16 Chapter 1 Product Overview

MC80-2416BTA 24-point input, 16-point transistor output


MC80-3624BRA 36-point input, 24-point relay output
MC80-3624BTA 36-point input, 24-point transistor output
MC100 Series
MC100-1006BRA 10-point input, 6-point relay output
MC100-1006BTA 10-point input, 6-point transistor output
MC100-1410BRA 14-point input, 10-point relay output
MC100-1410BTA 14-point input, 10-point transistor output
MC100-1614BRA 16-point input, 14-point relay output
MC100-1614BTA 16-point input, 14-point transistor output
MC100-1614BA1 16-point input, 14-point relay output, 2-point analog signal input, 1-point analog signal
output
MC100-1614BT1 16-point input, 14-point transistor output, 2-point analog signal input, 1-point analog signal
output
MC100-2416BRA 24-point input, 16-point relay output
MC100-2416BTA 24-point input, 16-point transistor output
MC100-3624BRA 36-point input, 24-point relay output
MC100-3624BTA 36-point input, 24-point transistor output
MC200 Series
MC200-2012BRA 20-point input, 16-point relay output
MC200-2012BTA 20-point input, 16-point transistor output
MC200-3232BRA 32-point input, 32-point relay output
MC200-3232BTA 32-point input, 32-point transistor output
MC200-4040BRA 40-point input, 40-point relay output
MC200-4040BTA 40-point input, 40-point transistor output
MC280 Series
MC280-1616BTA8 16-point input, 16-point transistor output, 8-axis pulse output
MC280-1616BTA6 16-point input, 16-point transistor output, 6-axis pulse output
MC280-1616BTA4 16-point input, 16-point transistor output, 4-axis pulse output
MC200E-1616BTA8 16-point input, 16-point transistor output, 8-axis pulse output
MC200E-1616BTA6 16-point input, 16-point transistor output, 6-axis pulse output
MC200E-1616BTA4 16-point input, 16-point transistor output, 4-axis pulse output
MC100 Series (AC Power)
MC100-1006BRA2 10-point input, 6-point relay output
MC100-1006BTA2 10-point input, 6-point transistor output
MC100-1410BRA2 14-point input, 10-point relay output
MC100-1410BTA2 14-point input, 10-point transistor output
MC100-1614BRA2 16-point input, 14-point relay output
MC100-1614BTA2 16-point input, 14-point transistor output
MC100-2416BRA2 24-point input, 16-point relay output
MC100-2416BTA2 24-point input, 16-point transistor output
MC100-3624BRA2 36-point input, 24-point relay output
MC100-3624BTA2 36-point input, 24-point transistor output
MC100-3624BRA3 36-point input, 24-point relay output
MC100 Series (DC Power)
MC100-1006BRD 10-point input, 6-point relay output
MC100-1006BTD 10-point input, 6-point transistor output
MC100-1410BRD 14-point input, 10-point relay output
MC100-1410BTD 14-point input, 10-point transistor output
MC100-1614BRD 16-point input, 14-point relay output
MC100-1614BTD 16-point input, 14-point transistor output
MC100-2416BRD 24-point input, 16-point relay output
MC100-2416BTD 24-point input, 16-point transistor output
MC100-3624BRD 36-point input, 24-point relay output

1.5.2 IO Expansion Module

MC100 Series
MC100-0008ERN 0-point input, 8-point relay output
MC100-0008ETN 0-point input, 8-point transistor output
MC100-0016ERN 0-point input, 16-point relay output
MC100-0016ETN 0-point input, 16-point transistor output
MC100-0800ENN 8-point input, 0-point output
MC100-0808ERN 8-point input, 8-point relay output
MC100-0808ETN 8-point input, 8-point transistor output
MC100-1600ENN 16-point input, 0-point output
MC200 Series
MC200-0008ERN 0-point input, 8-point relay output
MC200-0008ETN 0-point input, 8-point transistor output
MC200-0016ERN 0-point input, 16-point relay output
MC200-0016ETN 0-point input, 16-point transistor output
MC200-0800ENN 8-point input, 0-point output
MC200-0808ERN 8-point input, 8-point relay output
MC200-0808ETN 8-point input, 8-point transistor output
MC200-1600ENN 16-point input, 0-point output
MC200-1616ERA 16-point input, 16-point relay output with independent power
MC200-1616ETA 16-point input, 16-point transistor output with independent power
MC200-1616ERN 16-point input, 16-point relay output without independent power
MC200-1616ETN 16-point input, 16-point transistor output without independent power

1.5.3 Special Function Module

MC100 Series
MC100-2AD 2-point analog signal input
MC100-4AD 4-point analog signal input
MC100-2DA 2-point analog signal output
18 Chapter 1 Product Overview

MC100-4DA 4-point analog signal output


MC100-5AM 4-point analog signal input, 1-point analog signal output
MC100-2PT 2-point thermal resistance
MC100-4PT 4-point thermal resistance
MC100-2TC 2-point thermocouple
MC100-4TC 4-point thermocouple
MC200 Series
MC200-2AD 2-point analog signal input
MC200-4AD 4-point analog signal input
MC200-8AD 8-point analog signal input
MC200-2DA 2-point analog signal output
MC200-4DA 4-point analog signal output
MC200-4AM 2-point analog signal input, 2-point analog signal output
MC200-5AM 4-point analog signal input, 1-point analog signal output
MC200-2TC 2-point thermocouple
MC200-4TC 4-point thermocouple
MC200-8TC 8-point thermocouple
MC200-2PT 2-point thermal resistance
MC200-4PT 4-point thermal resistance
MC200-2HC 2-channel high-speed counting module
MHA-04-NT 4-point high-precision analog signal input

1.5.4 Communication Module

MC200 Series
MC200-CPM CANopen master station communication module
MC200-RS485 RS485 communication module
MC200-CGP Wireless communication and positioning module

1.5.5 Fault Recording Modul

MC200 Series
MC200-ESM MC200-ESM fault recording module
Chapter 2 PLC Function Description 19

Chapter 2 PLC Function Description

This chapter introduces the programming resources, theories and system configuration of MC series PLC, as well as
how to set PLC running and operation modes. The system commissioning functions and commissioning software are
also introduced.
2.1 Programming Resources And Theories.....................................................................................................................................20
2.1.1 Programming Resources................................................................................................................................................. 20
2.1.2 System Running Mechanism (Scan Cycle Model)...................................................................................................... 24
2.1.3 Watchdog Function For User Program Execution....................................................................................................... 25
2.1.4 Constant Scan Mode........................................................................................................................................................25
2.1.5 User File Download And Storage................................................................................................................................... 25
2.1.6 Initialization Of Elements................................................................................................................................................. 25
2.1.7 Saving Data On Power Loss........................................................................................................................................... 25
2.1.8 Permanent Storage Of D Device Data.......................................................................................................................... 26
2.1.9 Digital Filtering Of Input Terminals.................................................................................................................................26
2.1.10 No Battery Mode............................................................................................................................................................. 27
2.1.11 User Program Protection............................................................................................................................................... 27
2.2 System Configuration....................................................................................................................................................................27
2.2.1 System Block..................................................................................................................................................................... 27
2.2.2 Datablock........................................................................................................................................................................... 34
2.2.3 Global Variable Table.......................................................................................................................................................34
2.2.4 Setting BFM For MC200 Serie Special Module........................................................................................................... 35
2.3 Running Mode And State Control............................................................................................................................................... 35
2.3.1 System RUN And System STOP States....................................................................................................................... 36
2.3.2 RUN & STOP State Change........................................................................................................................................... 36
2.3.3 Setting Output In STOP State.........................................................................................................................................36
2.4 System Debugging........................................................................................................................................................................ 37
2.4.1 Uploading & Downloading Program...............................................................................................................................37
2.4.2 Error Reporting Mechanism............................................................................................................................................ 37
2.4.3 Editing User Program Online.......................................................................................................................................... 39
2.4.4 Clearing And Formatting..................................................................................................................................................39
2.4.5 Checking PLC Information Online..................................................................................................................................40
2.4.6 Write, Force And Element Monitoring Table.................................................................................................................41
2.4.7 Generating Datablock From RAM.................................................................................................................................. 42
20 Chapter 2 PLC Function Description

2.1 Programming Resources And Theories

2.1.1 Programming Resources


Table 2-1 MC100 Programming resources
Item Specification and remarks
Max. I/O points 128 (theoretical)
I/O
Externsion module
configuration <4 (sum of I/O extension modules and special modules)
number
User file Program capacity 16k steps
capacity Data block capacity 8000 D elements
Instruction Basic instruction 0.3µs/instruction
speed Application instruction Several µs per instruction ~ several hundred µs per instruction
Instruction Basic instruction 32
number Application instruction 226
I/O points 128 I/128 O (Input: X0 ~ X177. Output Y0 ~ Y177) Note 1
Auxiliary relay 2048 (M0 ~ M2047)
Local auxiliary relay 64 (LM0 ~ LM63)
Special auxiliary relay 256 (SM0 ~ SM255)
Device State relay 1024 (S0 ~ S1023)
configuration Timer 256 (T0 ~ T255) Note 2
Note 7
Counter 256 (C0 ~ C255) Note 3
Data register 8000 (D0 ~ D7999)
Local data register 64 (V0 ~ V63)
Offset addressing register 16 (Z0 ~ Z15)
Special data register 256 (SD0 ~ SD255)
16 (triggering edge is user configurable, corresponding to the rising and falling edge s of
External input interrupt
terminals X0 ~ X7)
High speed counter
6
interrupt
Interrupt
Internal timer interrupt 3
configuration
Serial port interrupt 8
PTO output complete
2
interrupt
Power failure interrupt 1
Port 2 asynchronous serial communication ports. Port 0: RS-232. Port 1: RS-232 or RS-485
Communicatio
Modbus, Freeport, MCbus (Megmeet dedicated protocol). 1 to N or N to N communication
n function Protocol
enabled
X0, X1 Single input: 50kHz. Total frequency (X0 ~ X5): < 80kHz
High speed counter
X2 ~ X5 Single input: 10kHz
100kHz (2 independent outputs, and only for transistor
High speed pulse output Y0, Y1
outputs)
Digital filtering terminals X0 ~ X7 (all the other terminals use hardware filtering)
Analog potentiometerNote 4 2
Maximum number: 64. Maximum nesting levels: 6. Local variables and variable alias are
Subprogram
supported. Each subprogram can provide up to 16 parameter transfer
Upload password
Special 3 kinds of password. Not longer than 8 letters or
Download password
function numbers. Case sensitive
User program protection Monitor password
Subprogram password Not longer than 16 letters or numbers. Case sensitive.
Other protections Formatting and uploading ban enabled
X-builder programming
IBM PC or compatible computer is required
software Note 6
Programming mode Note 5
It can be used to program and download program to
Operation box
PLC
Built-in, 100h of working time after power failure (the basic module must have worked for
Real time clock
more than 2mins before the power failure)
Chapter 2 PLC Function Description 21

Table 2-2 MC80 Programming resources


Item Specification and remarks
Max. I/O points 80
I/O
Externsion module
configuration /
number
User file Program capacity 6k steps
capacity Data block capacity 8000 D elements
Instruction Basic instruction 0.3µs/instruction
speed Application instruction Several µs per instruction ~ several hundred µs per instruction
Instruction Basic instruction 32
number Application instruction 200
I/O points 128 I/128 O (Input: X0 ~ X177. Output Y0 ~ Y177) Note 1
Auxiliary relay 1024(M0 ~ M1023)
Local auxiliary relay 64 (LM0 ~ LM63)
Special auxiliary relay 256 (SM0 ~ SM255)
Device State relay 1024 (S0 ~ S1023)
configuration Timer 256 (T0 ~ T255) Note 2
Note 7 Counter 256 (C0 ~ C255) Note 3
Data register 4000 (D0 ~ D3999)
Local data register 64 (V0 ~ V63)
Offset addressing register 16 (Z0 ~ Z15)
Special data register 256 (SD0 ~ SD255)
16 (triggering edge is user configurable, corresponding to the rising and falling edge s of
External input interrupt
terminals X0 ~ X7)
High speed counter
6
interrupt
Interrupt
Internal timer interrupt 3
configuration
Serial port interrupt 4
PTO output complete
2
interrupt
Power failure interrupt 1
Communicatio Port 1 asynchronous serial communication ports. Port 0: RS-232.
n function Protocol Modbus, Freeport.
X0, X1 Single input: 50kHz. Total frequency (X0 ~ X5): < 80kHz
High speed counter
X2 ~ X5 Single input: 10kHz
50kHz (2 independent outputs, and only for transistor
High speed pulse output Y0, Y1
outputs)
Digital filtering terminals X0 ~ X7 (all the other terminals use hardware filtering)
Analog potentiometerNote 4 2
Maximum number: 64. Maximum nesting levels: 6. Local variables and variable alias are
Subprogram
supported. Each subprogram can provide up to 16 parameter transfer
Special
Upload password
function 3 kinds of password. Not longer than 8 letters or
Download password
numbers. Case sensitive
User program protection Monitor password
Subprogram password Not longer than 16 letters or numbers. Case sensitive.
Other protections Formatting and uploading ban enabled
X-builder programming
IBM PC or compatible computer is required
software Note 6
Programming mode Note 5
It can be used to program and download program to
Operation box
PLC
22 Chapter 2 PLC Function Description

Table 2-3 MC200 programming resources


Name Specification and remarks
Max. I/O points 512 (256 I/256 O)
I/O
Externsion module
configuration <8 (sum of I/O extension modules and special modules)
number
User file Program capacity 12k steps
capacity Data block capacity 8000 D elements
Instruction Basic instruction 0.09µs/instruction
speed Application instruction 5µs/instruction ~ 280µs/instruction
Instruction Basic instruction 32
number Application instruction 221
I/O points 256 I/256 O (Input: X0 ~ X377. Output: Y0 ~ Y377) Note 1
Auxiliary relay 2000 (M0 ~ M1999)
Local auxiliary relay 64 (LM0 ~ LM63)
Special auxiliary relay 256 (SM0 ~ SM255)
State relay 992 (S0 ~ S991)
Device
Timer 256 (T0 ~ T255) Note 2
configuration
Note 7 Counter 256 (C0 ~ C255) Note 3
Data register 8000 (D0 ~ D7999)
Local data register 64 (V0 ~ V63)
Offset addressing
16 (Z0 ~ Z15)
register
Special data register 256 (SD0 ~ SD255)
16 (triggering edge is user configurable, corresponding to the rising & falling edge s of
External input interrupt
terminals X0 ~ X7)
High speed counter
6
interrupt
Interrupt Internal timer interrupt 3
configuration
Internal timer interrupt 3
Serial port interrupt 12
PTO output complete
2
interrupt
2 asynchronous serial communication ports. Port 0: RS-232. Port 1: RS-232 or RS-485
Communication Port
Port 2(external 485 module): RS-422 or RS-485
function
Protocol Modbus, Freeport. 1 to N communication enabled
X0, X1 Single input: 50kHz. Total frequency (X0 ~ X5): < 80kHz
High speed counter
X2 ~ X5 Single input: 10kHz
100kHz (2 independent outputs, and only for transistor
High speed pulse output Y0, Y1
outputs)
Digital filtering terminals X0 ~ X17 (all the other terminals use hardware filtering)
Analog potentiometerNote
4
2

Special Maximum number: 64. Maximum nesting levels: 6. Local variables and variable alias
Calling of subprograms
function are supported. Each subprogram can provide up to 16 parameter transfer
Upload password
3 kinds of password. Not longer than 8 letters or
User program protection Download password
numbers. Case sensitive
Monitor password
X-builder programming
IBM PC or compatible computer is required
Programming mode Note 5 software Note 6
Operation box It can be used to program and download program to PLC
Real time clock Built-in, powered by backup battery
Chapter 2 PLC Function Description 23

Table 2-4 MC280 programming resources


Name Specification and remarks
Max. I/O points 512 (256 I/256 O)
I/O
Externsion module
configuration <8 (sum of I/O extension modules and special modules)
number
User file Program capacity 32k steps
capacity Data block capacity 8000 D elements,32K R element
Instruction Basic instruction 0.065µs/instruction
speed Application instruction Several µs/instruction ~ several µs/instruction
Instruction Basic instruction 32
number Application instruction 256
I/O points 256 I/256 O (Input: X0 ~ X377. Output: Y0 ~ Y377) Note 1
Auxiliary relay 10240 (M0 ~ M1999)
Local auxiliary relay 64 (LM0 ~ LM63)
Special auxiliary relay 512 (SM0 ~ SM511)
State relay 4096(S0 ~ S4095)
Device
Timer 512 (T0 ~ T511) Note 2
configuration
Note 7 Counter 262 (C0 ~ C306) Note 3
Data register 40768 (D0 ~ D7999,R0~R32767)
Local data register 64 (V0 ~ V63)
Offset addressing
16 (Z0 ~ Z15)
register
Special data register 512 (SD0 ~ SD511)
16 (triggering edge is user configurable, corresponding to the rising & falling edge s of
External input interrupt
terminals X0 ~ X7)
High speed counter
8
interrupt
Internal timer interrupt 3
Interrupt Serial port interrupt 12
configuration PTO output complete
8
interrupt
Power failure interrupt 1
Interpolation complete
3
interrupt
Position interrupt 6
3 asynchronous serial communication ports. Port 0: RS-232. Port 1: RS-485
Communication Port
Port 2 or external 485 communication module.
function
Protocol Modbus, Freeport. 1 to N communication enabled.MCbus(Megmeet protocol)
X0~ X7, 8×100 kHz
High speed counter

High speed pulse output Y0~Y7 4×200 kHz, 4×100 kHz


Digital filtering terminals X0 ~ X17 (all the other terminals use hardware filtering)
Analog potentiometerNote
4
2

Special Maximum number: 64. Maximum nesting levels: 6. Local variables and variable alias
Calling of subprograms
function are supported. Each subprogram can provide up to 16 parameter transfer
Upload password
3 kinds of password. Not longer than 8 letters or
User program protection Download password
numbers. Case sensitive
Monitor password
X-builder programming
IBM PC or compatible computer is required
Programming mode Note 5 software Note 6
Operation box It can be used to program and download program to PLC
Real time clock Built-in, powered by backup battery

Notes:
Note 1: The X and Y elements are addressed in octal system. For example, X10 stands for the eighth input point.
Note 2: Based on the timing precision, the T device addresses fall into three categories:
24 Chapter 2 PLC Function Description

MC100/MC80/MC200
1) 100ms: T0 ~ T209
2) 10ms: T210 ~ T251
3) 1ms: T252 ~ T255
MC280
1) 100ms: T0 ~ T209
2) 10ms: T210 ~ T479
3) 1ms: T480 ~ T511
Note 3: Based on the width and function of count value, the C device addresses fall into three categories:
MC100/MC80/MC200
1) 16 bit up counter: C0 ~ C199
2) 32 bit up and down counter: C200 ~ C235
3) 32 bit high speed counter: C236 ~ C259
MC280
1) 16 bit up counter: C0 ~ C199
2) 32 bit up and down counter: C200 ~ C235
3) 32 bit high speed counter: C236 ~ C259,C301~C307,C260~C300 retain
Note 4: The analog potentiometer is an instrument that you can use to set the PLC device value. You can use a Philips
screwdriver to turn the potentiometer clockwise to the maximum angle of 270°, and the device value will be set from 0
to 255. Note that the potentiometer could be damaged if you wind it clockwise more than 270°.
Note 5: The element values can be forcedly set to facilitate commissioning and analyzing user program and streamline
the commissioning. You can force up to 128 bit elements and 16 word elements at the same time.
Note 6: The user program can be modified online.
Note 7: Partial PLC elements are reserved. Avoid using those elements in the user program. For details, see
0Reserved Elements

2.1.2 System Running Mechanism (Scan Cycle Model)


MC series PLC basic module runs according to the scan cycle model.
The system cyclically executes the following four tasks one by one: user program execution, communication, internal
tasks and I/O update. Each round is called a scan cycle.

Execute user
program

Refresh I/O Communication

Internal tasks

Figure 2-1 PLC operation mechanism

User program execution


The system will execute user program instructions one by one from the beginning till the main program ending
instruction.
Communication
Communicate with the programming software to receive and respond to the instructions such as download, run and
stop.
Internal tasks
Processing various system internal tasks, such as refreshing panel indicators, updating software timer, refreshing
special auxiliary relays and special data registers.
Chapter 2 PLC Function Description 25

I/O update
The I/O update includes two stages: input update and output update.
Output update: open or close the output terminal based on the value of the corresponding Y device (ON or OFF).
Input update: convert the ON or OFF state of input terminals to the value of the corresponding X device (ON or OFF).

2.1.3 Watchdog Function For User Program Execution


The watchdog function enables the system to monitor the user program execution time during every scan cycle, and
stop the user program if the running time exceeds the preset limit. You can set the watchdog time in the Set Time tab
after double clicking the System block in X-builder main interface.

2.1.4 Constant Scan Mode


In the constant scan mode, every scan cycle takes the same time. You can set the constant scanning time in the Set
Time tab after double clicking the System block in X-builder main interface. By default, the Constant scanning time
setting is zero, which means no constant scan. The actual scan cycle will prevail when the actual scan cycle is bigger
than the constant scan cycle.

 Note
The Constant scanning time setting must not be set bigger than the Watchdog time setting.

2.1.5 User File Download And Storage


You can download a user file to the basic module to control the basic module.
The user file include user program, data block, system block and auxiliary user information. The auxiliary user
information include the user program variable list and the source file of user data.
You can select to download the user program, data block or system block. Whatever you select, the corresponding
auxiliary user information will always be downloaded.
For MC200 series PLC, the downloaded user program, data block and system block will be stored permanently in the
basic module EEPROM area, while the downloaded auxiliary user information will be stored in the battery backed
RAM area.
For MC100 series PLC, all user files will be stored permanently in the basic module FLASH area.

 Note
1. To embed the downloaded files into the basic module, the basic module power supply must be maintained for more than 30s
after the download.
2. If the backup battery fails in MC200 series PLC, the auxiliary user information will be lost, the annotation for the user program
will not be uploaded, and system will report “User information file error”. But the user program will be executed after all.

2.1.6 Initialization Of Elements


When the PLC changes from STOP to RUN, it will initialize its elements according to battery backed data, EEPROM
data, data block and device value. The priorities of various data are listed in the following table.
Table 2-5 PLC data initialization priorities
Data type Power OFF → ON STOP → RUN
Battery backed data Highest Highest
EEPROM data High High
Data block (precondition: the Datablock enabled is checked in the
Mid Mid
Advanced Settings tab of System block)
Device value (Precondition: the Element value retained is checked in
- Low
the Advanced Settings tab of System block)

2.1.7 Saving Data On Power Loss


Preconditions
Upon power loss, the system will stop the user program and save the device in the specified saving range to the
battery backed files.
26 Chapter 2 PLC Function Description

Device restoration after power on


If the battery backed files are correct, the PLC elements will restore their saved values after power on.
The elements outside of the saving range will be set to zero.
If the battery backed files are lost or incorrect, the system will set all elements to zero.
Setting saving range
You can set the device range in the Saving Range tab of System block. See Figure 2-2 and the following example.
MC100 series PLC supports only one group of saving range.
MC200 series PLC supports two saving groups that form a union.
Example (MC200):
Set M100 ~ M200 as the saving range in Group 1.
Set M300 ~ M400 as the saving range in Group 2.
In effect, both M100 ~ M200 and M300 ~ M400 are set as the saving range.

Help

Figure 2-2 Setting saving range

 Note
The power loss data saving function in MC200 series PLC relies on the support of the backup battery. If batteries fail, all the
saved elements will have uncertain values after power loss.
For MC100 series PLC, the values of its saved elements are stored in the permanent memory.

2.1.8 Permanent Storage Of D Device Data


You can use the EROMWR instruction in the user program to write the D device values (D6000 ~ D6999) to the
permanent memory EEPROM in MC100 series PLC. The EEPROM operation will make the scan cycle 2ms ~ 5ms
longer. The written data will overwrite the existing data in EEPROM.

 Note
The EEPROM can be over-written for a limited number of times (usually one million). Do not overwrite EEPROM unless it is
necessary, otherwise EEPROM could fail soon and lead to CPU fault.

2.1.9 Digital Filtering Of Input Terminals


The input terminals X0 ~ X17 of MC200 series PLC and X0 ~ X7 of MC200 series PLC use digital filtering to filter the
noise at the terminal. You can set the filter constant in the Input Filter tab of System block.
Chapter 2 PLC Function Description 27

2.1.10 No Battery Mode


The MC200,MC280 series basic module can work without battery. When you select the No battery mode in the
Advanced Settings tab of System block, the system will not report system errors caused by lack of battery
(Battery-backed data lost, Forced-table lost and User information file error).
See the notice for the No battery mode in the Advanced Settings tab of Data block.

 Note
MC100 series PLC has no battery, therefore it does not support no battery mode.

2.1.11 User Program Protection


The MC100,MC200 and MC280 series PLCs provide mutiple levels of passwords and other protection measures.
Table 2-6 User program protection
Protection measures Description
After downloading system block to the PLC and checking the Formatting is prohibited option in the
Advanced Settings tab in System block, the PLC internal user program, system block and data block are
Formatting ban protected against formatting.
To lift the formatting ban, you need to re-download the system block and uncheck the Formatting is
prohibited option
Download password Download limit
If you select to disable the upload function during downloading process, it will be prohibited to upload the
Upload ban program from PLC to PC. To enable the upload function, you must re-download the program and check to
enable the upload function during the downloading process.
Upload password Upload limit
Monitor password Monitor limit
The programmer can set passwords to protect the program, subprogram and interrupt subprogram against
aunthrorized accessing and editing in X-builder.
Program password Password setting method: Right click the program and select Encrypt/Decrypt in the popped out shortcut
menu, insert the password and confirm it. To cancel the password, just go through the same process and
input the correct password.

 Note
If you fail to input the correct password for continuously ten times, you will be banned from inputting password for the next 5
minutes.

2.2 System Configuration

2.2.1 System Block


The PLC configuration information, or system block file, is configured through the system block and is an important
part of the PLC user file. Before using the PLC, you need to compile and download the system block file.
The system block configuration includes configuring the following items:
 Saving Range (element saving range)  Input Point (Startup mode of the input point)
 Communication Port (Communication port and protocol  Priority Level Of Interruption
setting)  Special Module Configuration
 Input Filter  Advanced Settings (data block, element
 Output Table value retain, no battery mode and formatting
 Set Time (set watchdog time and constant scanning time) ban)
 Inverter configuration  Communication module

After setting the system block, you can select PLC-> Compile All to compile the system block file and be ready for
download.
28 Chapter 2 PLC Function Description

Saving Range
Upon power loss, the MC100,MC200 and MC280 series PLCs can save the data of elements in the preset saving
range to SRAM, so as to use them after the power on.
You can set the saving range in the Saving Range tab, as shown in Figure 2-3.

Help

Figure 2-3 Setting element saving range

 Note
The element range and group number of the saving range are different for different PLC models.

By default, the D, M, S, T and C elements in a certain range will be saved.


You can change the defaults as you need. By clicking the Clear button on the right will set the corresponding number
to zero.
For MC200 and MC280 series PLC, you can set two groups that form a union.
For MC100 series PLC, you can set only one group.

 Note
The T elements cannot be set in the saving range for MC100 series PLC.

System operation upon power loss: PLC will save the elements in the saving range to the battery backed files.
System operation upon power on: PLC will check the data in SRAM. If the data saved in SRAM is correct, it will remain
unchanged. If the data is incorrect, PLC will clear all the elements in SRAM.
Communication Port
You can set the two PLC communication ports in the Communication Port tab of the System block, as shown in
Figure 2-4. The items include protocol selection and setting the specific protocol parameters.
Chapter 2 PLC Function Description 29

Help

Figure 2-4 Setting communication ports

By default, the communication port 0 uses program port protocol, while the communication port 1 uses no protocol.
You can set as you need.
1. Program port protocol
By default, the communication port 0 uses the program port protocol, the dedicated protocol for the communication of
MC series PLC programming software. Under this protocol, you can set the communication baud rate between PC and
port 0 through the serial port configuration tool of X-builder. In the TM state, port 0 can only be used for programming
communication.
2. Free port protocol
The free port protocol supports customized data file format, either ASCII or binary code. Only in the RUN state can a
PLC use the free port communication, which cannot be used to communicate with the programming device. In the
STOP state, port 0 can only be used for programming communication.
The configurable parameters include Baud rate, Data bit, Valid bit, Parity, Stop bit, Allow start character
detection, Allow end character detection, Intercharacter timeout and Interframe timeout.
3. Modbus protocol
The Modbus communication equipment include a master and a slave. The master can communicate with the slave
(including inverters) and send control frames to the slave, and the slave will respond to the master’s requests.
Communication port 0 can be set as a slave, while communication port 1 can be set as a slave or a master.
The configurable parameters include Baud rate, Data bit, Parity check, Stop bit, master/slave mode, Station no.,
Transmission mode, Timeout time of the main mode and Retry times.
4. MCbus protocol
MCbus is a Megmeet-developed communication protocol that supports N to N communication in a small PLC network.
The PLCs in a MCbus network can automatically exchange part of their D and M elements.
Both port 0 and port 1 can use MCbus protocol.

 Note
For the detailed information of communication protocols, see Chapter 10 Using Communication Function.

Input Filter
In the Input Filter tab, you can set the filter constant for a PLC input terminal. The digital filter can eliminate the noise at
the input terminal. Only input terminals X0 ~ X17 (for MC100 series: X0 ~ X7) use digital filter, while other digital input
terminal use hardware filter. See Figure 2-5.
30 Chapter 2 PLC Function Description

Help

Figure 2-5 Setting input filter

MC200 setting range: 0ms ~ 60ms. Default: 10ms.


MC100 setting range: 0ms, 8ms, 16ms, 32ms, 64ms. Default: 8ms.
Output Table
In the Output Table tab, you can set the state of output points when the PLC is in STOP state. See Figure 2-6.

Help

Figure 2-6 Setting output table

The output table is used to set the PLC output state when the PLC is stopped. The output states include:
Disable: When the PLC is stopped, all the outputs will be disabled.
Freeze: When the PLC is stopped, all the outputs will be frozen at the last status.
Configure: When the PLC is stopped, the marked outputs will be set as ON.
Set Time
See Figure 2-7.
Chapter 2 PLC Function Description 31

Help

Figure 2-7 Setting time

1. Watchdog time setting


The watchdog time is the maximum user program execution time. When the actual program execution time exceeds
the watchdog time, PLC will stop the execution, the ERR indicator (red) will turn on, and the system will output
according to the system configuration. The watchdog time setting range is 0ms ~ 1000ms. Default: 200 ms.
2. Constant scanning time setting
With the constant scanning time set, system will scan the registers within a constant duration. Setting range: 0ms ~
1000ms. Default: 0ms.
3. Power loss detection time setting (for MC200 only)
When the duration of power loss exceeds the power loss detection time, the PLC will change to STOP. The system will
save the values of elements in the Saving Range. Setting range: 0ms ~ 100ms. Default: 0ms
Input Point
The Input Point setting tab is shown in Figure 2-8.
In this tab, you can set the following parameters:
1. Disable input point
Check the Disable input point to disable the input point startup function.
2. Input point
When the Disable input point is not checked, you can designate an input terminal (among X0 ~ X17) as a means of
external RUN control. When the designated input terminal is ON, the PLC will be turned from STOP state to RUN
state.
32 Chapter 2 PLC Function Description

Help

Figure 2-8 Setting input point

Priority Level Of Interruption


The Priority Level Of Interruption is shown in Figure 2-9.
The PLC built-in interrupts can be set as high priority or low priority.

Help

Figure 2-9 Setting interrupt priority


Chapter 2 PLC Function Description 33

Special Module Configuration


You can set the Module Type and Module Property in the Special Module Configuration tab, as shown in Figure
2-10.

Help

Figure 2-10 Setting special module

1. Module Type
As shown in Figure 2-10, you can set the module type for No.0 ~ No.3 special modules.
Module Property
After selecting the Module Type, the corresponding Module Property will be activated. Open the dialogue box as
shown below.

Figure 2-11 Setting special module property

In the dialogue box as shown in Figure 2-11, you can configure the channel for the special module, including Mode
(signal features), Digital value at zero, Upper limit of digital value, and Average sampling value. Refer to the user
manual of the specific special module for the meanings and configuration methods of the various parameters.
34 Chapter 2 PLC Function Description

Advanced Settings
The advanced settings include Datablock enabled, Element value retained, No battery mode and Formatting is
prohibited.

Help

Figure 2-12 Advanced settings

Datablock enabled
Check the Datablock enabled, and the datablock will be used to initialize the D elements when the PLC changes from
STOP to RUN.
Element value retained
Check the Element value retained, and the elements will not be initialized, but saved when the PLC changes from
STOP to RUN.

 Note
When the Datablock enabled and Element value retained are both checked, the Datablock enabled prevails. See 2.1.6
Initialization Of Elements.

No battery mode
Check this option, and the system will not report the battery backup data lost error and forced table lost error upon
battery failure.

2.2.2 Datablock
The datablock is used to set the defaults for D elements. If you download the compiled datablock settings to the PLC,
the PLC will use the datablock to initialize the related D elements upon PLC startup.
The datablock editor enables you to assign initial data to the D register (data memory). You can assign data to words
or double words, but not to bytes. You can also add comments by inputting “//” to the front of a character string.
See X-builder Programming Software User Manual for detailed datablock instruction.

2.2.3 Global Variable Table


The global variables table enables you to give meaningful names for certain PLC addresses. The names are
accessible anywhere in the project, and using them is in effect using the corresponding device.
The global variable
The global variable table includes three columns: Variable Name, Variable addr. and Comments.
Chapter 2 PLC Function Description 35

The variable name can be made up of letters (case insensitive), numbers, underline or their mixture, but no spaces.
The name cannot start with a number, nor be completely made up of numbers. Length: not longer than 8 bytes. The
format of “device type + number” is illegal. No keywords shall be used. The keywords include: basic data type,
instructions and the operators in the IL programming language.
The number of global variables shall not exceed 500. See Figure 2-13.

Figure 2-13 Global variable table

2.2.4 Setting BFM For MC200 Serie Special Module


There is no need to set the addresses for MC200 series special modules, for the basic module can detect and address
them automatically upon power on.
Among the special modules, the analog extension module includes the analog input module and analog output
module.
The parameters of these two special modules, such as the channel characteristics, zero point and maximum digital
signal are by default applicable directly. However, when necessary, you can change the parameters in order to cater
for your actual needs.
MC200 analog input module
MC200 analog input module exchanges information with its basic module through the BFM area.
When a user program runs on the basic module, the TO instruction will write data to the related registers in the BFM
area of MC200 special module, and change the default settings. The configuration data that can be changed includes
zero digital signal, maximum digital signal, input channel signal characteristic, input channel ready flag, and so on.
The basic module uses the FROM instruction to read the data from the BFM area of MC200 analog input module. The
data may include the analog-digital conversion result and other information.
MC200 analog output module
MC200 analog output module exchanges information with its basic module through the BFM area.
When a user program runs on the basic module, the TO instruction will write data to the related registers in the BFM
area of MC200 special module, and change the default settings. The configuration data that can be changed includes
zero digital signal, maximum digital signal, output channel signal characteristic, output channel ready flag, and so on.
The basic module uses the FROM instruction to read the data from, and uses the TO instruction to write the digital
signal to be convertered to, the BFM area of MC200 analog output module.
For details about the TO/FROM instruction, refer to Chapter 6 Application Instructions. As for the information about
various special modules, as well as their BFM areas, see the quick start manuals of the special module.

2.3 Running Mode And State Control


You can start or stop the PLC in any of the following three ways.
1. Using the mode selection switch
2. Feeding power to the designated input terminal (see Input Point in 2.2.1 System Block)
3. Programming software (by clicking PLC -> Stop in the main interface if the mode selection switch is set as TM or
ON)
36 Chapter 2 PLC Function Description

2.3.1 System RUN And System STOP States


The basic module states include RUN state and stop state.
RUN
When the basic module is in the RUN state, the PLC will execute the user program. That is to say, all the four tasks in
a scan cycle, namely the user program execution, communication, internal tasks and I/O update, will be executed.
STOP
When the basic module is in the STOP state, the PLC will not execute the user program, but will still execute the other
three tasks in every scan cycle, namely the communication, internal tasks and I/O update.

2.3.2 RUN & STOP State Change


How to change from STOP to RUN
1. Resetting the PLC
If the mode selection switch is set to ON, reset the PLC (including power-on reset), and the system will enter the RUN
state automatically.

 Note
If the Disable input point is not checked in the basic module system block, the corresponding input terminal must be ON, or the
system will not enter the RUN state after reset.

2. Setting mode selection switch


When the PLC is in STOP state, setting the mode selection switch to ON will change the PLC to RUN state.
3. Powering the designated input terminal
If the Disable input point is not checked in the basic module system block, feeding power to the designated input
terminal will change the PLC from STOP state to RUN state.

 Note
The mode selection switch must be set to ON for the input terminal startup mode to be valid.

How to change from RUN to STOP


1. Resetting the PLC
If the mode selection switch is set to OFF or TM, resetting the system (including power-on reset) will change the PLC
to STOP state.

 Note
Even when the mode selection switch is ON, the system will also enter the STOP state after reset if the Disable input point is not
checked in the basic module system block and the designated input point is OFF.

2. Setting mode selection switch


The system will change from RUN to STOP when you set the mode selection switch from ON or TM to OFF.
3. Using the STOP command
The system will enter the STOP state after executing the STOP command in the user program.
4. Auto-stop upon faults
The system will stop executing the user program when a serious fault (like user program error, or user program
execution overtime) is detected.

2.3.3 Setting Output In STOP State


You can set the state of output terminals (Y) when the PLC is stopped. The three optional settings include:
1. Disable: When the PLC is stopped, all output terminals will be OFF.
2. Freeze: When the PLC is stopped, all the output terminals will be frozen at the last status.
3. Configure: You can decide which output will be ON and which will be OFF when the PLS is stopped according to the
actual need.
Chapter 2 PLC Function Description 37

You can find the above settings in the Output Table tab of the System block. See the Output Table in 2.2.1 System
Block.

2.4 System Debugging

2.4.1 Uploading & Downloading Program


Downloading
The system block, data block and user program edited in X-builder can be downloaded to the PLC through a serial port.
Note that the PLC should be in the STOP state when downloading.
If you change a compiled program and want to download it, the system will ask you to compile it again, as shown in
Figure 2-14.

Yes No

Figure 2-14 Re-compile prompt

 Note
If you select No, the program compiled last time will be downloaded to the PLC, which means the changes are invalid.

If you have set a download password and have not entered it after starting the X-builder this time, a window asking
you to enter the password will pop up before the download can start.
Uploading
You can upload the system block, data block and user program from a PLC to your PC, and save them in a new project.
If the battery backed data are valid, the user auxiliary information files will be uploaded together. See Figure 2-15.

Figure 2-15 Upload dialogue box

If you have set a upload password and have not entered it after starting the X-builder this time, a window asking you to
enter the password will pop up before the upload can start.
During the download, you can select to disable the upload function, which means no PC can upload the program from
the PLC. To enable the upload function, you must re-download the program and check to enable the upload function
during the downloading process.

2.4.2 Error Reporting Mechanism


The system can detect and report two types of errors: system error and user program execution error.
A system error is caused by abnormal system operation. While a user program execution error is caused by the
abnormal execution of the user program.
Every error is assigned with a code. See 0System Error Code.
System error
When system error occurs, the system will set the special relay SM3, and write the error code into the special data
register SD3. You can obtain the system error information by accessing the error code stored in SD3.
38 Chapter 2 PLC Function Description

If multiple system errors occur at the same time, the system will only write the code of the worst error into SD3.
When serious system errors occur, the user program will halt, and the ERR indicator on the basic module will turn on.
User program execution error
When user program execution error occurs, the system will set the special relay SM20, and write the error code into
the special data register SD20.
If the next application instruction is correctly executed, the SM20 will be reset, while SD20 will still keep the error code.
The system keeps the codes of the lastest five errors in special data registers SD20 ~ SD24 and form a stack.
If the code of the current error is different from the code in SD20, the error stack will be pushed down, as shown in
Figure 2-16.

New
Newuser
userprogram
programerror
新发生的用户程序错误 error

错误记录
SD20 Error
Error record
record 00
0

错误记录
SD21 Error
Error record
record 11
1

错误记录 2
SD22 Error
Error record
record 2
2

错误记录
SD23 Error
Errorrecord
record33
3

错误记录
SD24 Error record
Error record 44
4

Discard

Figure 2-16 Push operation of the error


stack

Only when serious user program execution error occurs will the user program halt and the ERR indicator on the basic
module turn on. In less serious cases, the ERR indicator on the basic module will not turn on.
Checing the error information on-line
Connect the PLC with your PC through the serial port, and you can read various PLC state information through the
X-builder, including the system error and user program execution error.
In the main interface of X-builder, click PLC -> PLC Info… to check the PLC information, as shown below:

Figure 2-17 PLC information


Chapter 2 PLC Function Description 39

The System error no. is the No. of the system errors stored in SD3, and Execution error no. is the No. of the
execution error stored in SD20. The error description is for your reference.

2.4.3 Editing User Program Online


You can use the online edit function when you want to change the user program without stopping the PLC.

 Warning
On occasions when casualties or property loss may occur, the online program editing function should be used by professionals
with sufficient protection measures.

Method
After making sure that the PC-PLC communication has been setup and the PLC is in RUN state, click Debug ->
Online Edit in the X-builder main interface to enter the online edit state.
In the online edit state, you can edit the main program, subprograms and interrupts as usual. After the edit, click PLC
-> Download… and the edited program will be compiled and downloaded to the PLC automatically. When the
download completes, the PLC will execute the new program.
Limits
1. In the online edit state, you cannot change the global variable table or any local variable table, nor add or delete any
subprogram and interrupt.
2. X-builder will quit the online edit state if the PLC is stopped.

2.4.4 Clearing And Formatting


You can use the clearing operation to clear PLC element value, PLC program and PLC datablock. While through
formatting, you can clear all PLC internal data and program.
PLC Element Value Clear
The PLC Element Value Clear function can clear all element values when the PLC is in STOP state.
Think it twice before using the clearing function, because clearing PLC element values may cause PLC operation error
or loss of working data.
PLC Program Clear
The PLC Program Clear function can clear the PLC user program when the PLC is in STOP state.
Think it twice before using the clearing function, because after the PLC user program is cleared, the PLC will have no
program to execute.
PLC Datablock Clear
The PLC Datablock Clear function can clear all the PLC datablocks when the PLC is in STOP state.
Think it twice before using the clearing function, because after the PLC datablock is cleared, the PLC will not initialize
element D according to the presetting of the datablock.
PLC Format
The PLC Format function can format all PLC data, including clearing the user program, restoring the defaults, and
clearing the datablock (when PLC is in STOP state).
Think it twice before using the formatting function, because this operation will clear all the downloads and settings in
the PLC.
40 Chapter 2 PLC Function Description

2.4.5 Checking PLC Information Online


PLC Info…
The PLC Info… function can obtain and display various PLC running information, as shown in Figure 2-18.

Figure 2-18 PLC current operation


information

PLC Clock
The PLC Clock function can be used to display and set PLC present time, as shown in Figure 2-19.

Figure 2-19 Setting PLC clock

Displayed in the PLC Clock window is the present date and time of PLC. You can adjust the time setting and click the
Set time button to validate it.
Chapter 2 PLC Function Description 41

2.4.6 Write, Force And Element Monitoring Table


Write and force
During the debugging, some element values may need to be changed manually. You can use the write or force
function. Difference between write and force is that written element values are one-off and may change with the
program operation, but forced element values will be permanently recorded in the PLC hardware until being unforced.
To use the write or force function, just select the element that needs changing, right click and select Write Selected
Element or Force…. All the element addresses used by the selected element will be listed in the dialog box. Modify
the address value to be written or forced, click the OK button, and the value will be downloaded to the PLC. If these
values are effective in the hardware, you will see the change in later debugging process.
The Write element value dialogue box is shown in Figure 2-20:

Figure 2-20 Write element value

The Force element dialogue box is shown in Figure 2-21:

Figure 2-21 Force element

You can see a lock under the forced elements in the LAD, as shown in Figure 2-22:

Figure 2-22 Lock signs under forced


elements
42 Chapter 2 PLC Function Description

Unforce
You can unforce any forced elements when forcing them becomes unnecessary. To unforce an element, select the
target element, right click and select Unforce to pop up a dialog box as shown in Figure 2-23. All the forced elements
among the selected elements are listed in the dialog box. You can select to unforce any elements, and click the OK
button to confirm. The forced value will be deleted from the PLC, so is the lock mark.

Figure 2-23 Unforce

Element monitoring table


The element monitoring table (EMT) is responsible for monitoring the element value during the debugging. the
program input and output elements can be added to the EMT so that they can be tracked after the program is
downloaded to the PLC.
The EMT monitors the element value during the debugging. You can input the input & output elements, registers and
word elements into the EMT during the debugging so that those elements can be monitored after the program is
downloaded to PLC.
The EMT works in two modes: editing mode and monitoring mode. In the editing mode, no monitoring function can be
carried out. In the monitoring mode, both the monitoring and editing functions are available.
In the monitoring mode, the displayed elements’ values are updated automatically.
The EMT provides functions including editing, sequencing, searching, auto-updating of the current value, written value,
forced value of the specified element or variant, and unforce.
See Figure 2-24 for the illustration of an EMT:

Figure 2-24 Element monitoring table

2.4.7 Generating Datablock From RAM


This function can continuously read and display the value of up to 500 D registers in the PLC. The results can merge
into the datablock or overwrite the original datablock.
Select PLC -> Generate Datablock From RAM… to pop up a window as shown in Figure 2-25.
Chapter 2 PLC Function Description 43

Figure 2-25 Reading data register value

Enter the range of the datablock to be read, click the Read from RAM button, and the data will be read into the list
after the instruction is correctly executed.
You can select hex, decimal or octal or binary system in the field of Display type to display the data.
After reading the data successfully, the buttons of Merge to datablock and Overwrite datablock are enabled.
Clicking Merge to datablock will add the results after the current datablock. Clicking Overwrite datablock will replace
the contents in the datablock with the generated results. After exiting the register value reading window, the software
will prompt that the datablock has changed and the datablock window will be opened automatically.
44 Chapter 3 Element And Data

Chapter 3 Element And Data

This chapter details the description, classification and functions of the elements of MC series small PLC.
3.1 Element Type And Function.........................................................................................................................................................45
3.1.1 What Is A PLC Element................................................................................................................................................... 45
3.1.2 Element List....................................................................................................................................................................... 46
3.1.3 Input And Output Points...................................................................................................................................................47
3.1.4 Auxiliary Relays.................................................................................................................................................................48
3.1.5 State Relays.......................................................................................................................................................................48
3.1.6 Timer................................................................................................................................................................................... 49
3.1.7 Counter............................................................................................................................................................................... 50
3.1.8 Data Register.....................................................................................................................................................................51
3.1.9 Special Auxiliary Relay.....................................................................................................................................................52
3.1.10 Special Data Register.................................................................................................................................................... 52
3.1.11 Offset Addressing Register........................................................................................................................................... 53
3.1.12 Local Auxiliary Relay......................................................................................................................................................53
3.1.13 Local Data Register........................................................................................................................................................53
3.2 Elements Addressing Mode......................................................................................................................................................... 54
3.2.1 Kn Addressing Mode (Combined Bit-string Addressing Mode)................................................................................. 54
3.2.2 Z Addressing Mode (Offset Addressing Mode)............................................................................................................54
3.2.3 Kn Addressing In Combination With Z Addressing..................................................................................................... 56
3.2.4 Storing & Addressing 32-Bit Data In D & V Elements.................................................................................................56
3.3 Data................................................................................................................................................................................................. 57
3.3.1 Data Type...........................................................................................................................................................................57
3.3.2 Correlation Between Elements And Data Types......................................................................................................... 57
3.3.3 Constant............................................................................................................................................................................. 58
Chapter 3 Element And Data 45

3.1 Element Type And Function

3.1.1 What Is A PLC Element


The PLC elements are virtual elements configured in PLC system design in order to replace the actual relays in the
relay control circuits. PLC uses the elements to calculate and configure system function. Due to their virtual nature, the
elements can be used repeatedly in the program, their number is in theory unlimited (only related to program capacity),
and have no mechanical or electric problems like their actual counterparts. Such features make the PLC much more
reliable than relay control circuits. In addition, it is easier to program and modify the logic.
The types and functions of MC series PLC elements are shown in the following figure.
Buttons, contacts, etc.

X discrete input point hardware


circuit

Input image registers


PLC system functions, system states, time square

Input point X

Auxiliary relay M
wave, interrupts and communication, etc.

State relay S
Data register D
Timer T
Elements

User program
Counter C
Local auxiliary relay LM
Offset addressing register Z
Local data register V

Special auxiliary relay SM


Special data register SD

Output point Y

Output image registers

Y discrete output point hardware


circuit

Executing & displaying devices

Figure 3-1 Types and functions of PLC


elements

In this manual, the elements are named according to their types. For example:
 Input point X, or “X element” for short
 Output point Y, or “Y element” for short
 Auxiliary relay M, or “M element” for short
 Data register D, or “D element” for short
 State relay S, or “S element” for short
46 Chapter 3 Element And Data

3.1.2 Element List


The elements of MC series PLC are classified according to their functions, and are easily accessible.
The elements are listed in the following table.
Table 3-2 MC series PLC elements
MC100 series MC200 series MC280 series Numbered in
256I/256O (Input: X0
128I/128O (Input: X0 ~ 256 I/256 O (Input: X0 ~
~ X377.
I/O X177. Output: Y0 ~ Y177) X377. Output: Y0 ~ Y377) Octal
Note 1
Output: Y0 ~ Y377) Note 1
Note 1

Auxiliary relay 2048 (M0 ~ M2047) 2000 (M0 ~ M1999) 10240 (M0 ~ M1999) Decimal
Local auxiliary relay Note 5 64 (LM0 ~ LM63) 64 (LM0 ~ LM63) 64 (LM0 ~ LM63) Decimal

Element Special auxiliary relay 256 (SM0 ~ SM255) 256 (SM0 ~ SM255) 512 (SM0 ~ SM511) Decimal
resources State relay 1024 (S0 ~ S1023) 992 (S0 ~ S991) 4096(S0 ~ S4095) Decimal
Note 4 Timer 256 (T0 ~ T255) Note2 256 (T0 ~ T255) Note 2 512 (T0 ~ T511) Note 2 Decimal
Counter 256 (C0 ~ C255) Note 3
256 (C0 ~ C255) Note 3
262 (C0 ~ C306) Note 3
Decimal
Data register 8000 (D0 ~ D7999) 8000 (D0 ~ D7999) 8000 (D0 ~ D7999) Decimal
Data register R 32768(R0~R32767) Decimal
Local data register Note 5 64 (V0 ~ V63) 64 (V0 ~ V63) 64 (V0 ~ V63) Decimal
Offset addressing register 16 (Z0 ~ Z15) 16 (Z0 ~ Z15) 16 (Z0 ~ Z15) Decimal
Special data register 256 个 (SD0 ~ SD255) 256 个 (SD0 ~ SD255) 512 (SD0 ~ SD511) Decimal
Notes:
1: The X and Y elements are addressed in octal system, and X10 represents the 8th input point. The I/O point number here is the
system capacity, while the actual system I/O point number is determined by the actual system configuration (including extension
modules and power supply).
2: The T elements are addressed according to the timing precision:
 100ms: T0 ~ T209
 10ms: T210 ~ T251
 1ms: T252 ~ T255
3: The C elements are addressed according to the counter types and functions:
 16bit up counter: C0 ~ C199
 32bit bi-directional counter: C200 ~ C235
 32bit high speed counter: C236 ~ C259
4: Part of PLC elements are reserved for internal tasks. Avoid using those elements in the user program. See 0Reserved Elements .
5: These two elements are local variants that cannot be defined in the global variant table. When the user program calls
subprograms or returns to the main program, they will be cleared, or be set through interface parameter transfer
Chapter 3 Element And Data 47

3.1.3 Input And Output Points


Element mnemonic
X (discrete input point)
Y (discrete output point)
Function
The X and Y elements represent respectively the input
state of hardware X terminal and output state of
hardware Y terminal.
The state of X elements is obtained through the input
image register, while the state of Y elements is output
through the output circuit driven by the output image
register. The two operations are carried out in the I/O
Update stage of PLC scan cycle, as shown in Figure Classification
3-2. For details, see 2.1.2 System Running X0 ~ X17 have digital filters whose filtering time can be
Mechanism (Scan Cycle Model) It is obvious that there set at the system block. Others use hardware filter. X0
is a brief delay in PLC’s response to the I/O. The delay ~ X5 can be used as the counting input point for high
is related to the input filter, communication, internal speed counters. Besides, X0 ~ X7 can also be used for
tasks and scan cycle. inputting external interrupts, pulse tracking and SPD
frequency detecting instruction.
Y0 and Y1 can be used for high speed output. Others
Execution of user
program are ordinary output points.
Elements numbered in
Input filtering
Communication Octal, starting with 0. The X and Y elements of both
Executing & displaying
Buttons, contacts, etc.

the basic module and the I/O modules are numbered


continuously like 0 ~ 7, 10 ~ 17, 20 ~ 27, and so on.
devices

Internal tasks
Data type
Boolean (both X and Y)
Update I/O Output relay delay Available forms
NO and NC contacts (dependent on which instruction
uses it)
Figure 3-2
The NO and NC contacts have opposite state values.
S
They are sometimes referred to as “a” contact and “b”
c
contact. h
You can use
e NO and NC contacts of the Y element
during programming.
m
a
Value assignment
t
1. The X elements
i accepts only hardware input state
c
value and forced operation state value. In the user
program, they cannot be changed through output or
d
instructions, nor be set during system debugging.
i
2. You can aassign values to Y elements with the OUT
instruction,gor set the state value of Y elements, or
even force ror write Y element values during system
debugging.a
3. Throughmthe system block, you can set the output
states of Y elements in the STOP state.
48 Chapter 3 Element And Data

3.1.4 Auxiliary Relays


Element mnemonic Value assignment
M 1. Through instructions. 2. Write or force during
Function system debugging.

The M state elements of discrete type are similar to the Battery backed features
transfer relays in the actual electrical control circuits. M elements in the M elements outside
State
You can use them to save various transit states in the saving range the saving range
Power loss Remain unchanged Cleared
user program.
RUN → STOP Remain unchanged Remain unchanged
Elements numbered in STOP → RUN Remain unchanged Cleared
Decimal, starting with 0. Note: The saving range is set through the system block. See
2.2.1 System Block.
Data type
Boolean  Note
Available forms When using the MCbus protocol, some M elements will be
used by the system.
NO and NC contacts.

3.1.5 State Relays


Elemenet mnemonic Available forms
S 1. Representation of steps (when used in STL
Alias instruction)
2. NO and NC contacts (when not used in STL
Step flag
instruction). Similar to M elements, the NO and NC
Function contacts of S elements are available during
As the step flag, the S elements are used in the programming.
Sequential Function Chart (SFC). See Chapter 7 Value assignment
SFC Tutor.
1. Through instructions. 2. Write or force during
Classification system debugging.
S0 ~ S19: initial step flag Battery backed features
Others: normal step flag S elements in the S elements outside
State
Elements numbered in saving range the saving range
Power loss Remain unchanged Cleared
Decimal, starting with 0
RUN → STOP Remain unchanged Remain unchanged
Data type STOP → RUN Remain unchanged Cleared
Note: The saving range is set through the system block.
Boolean
See 2.2.1 System Block
Chapter 3 Element And Data 49

3.1.6 Timer
Element mnemonic cycle. Their action time is the most precise. The
T update and action time of other T elements are related
to PLC scan cycles.
Function
Elements numbered in
The T element contains a word element (2 bytes) and
a bit element. The T word element can record a 16-bit Decimal, starting with 0
value. The T bit element represents the timer coil state Data type
and is applicable to logic control. Boolean, word
1 state bit Available forms
T bit element
The timing and action mode of T elements are
determined by the timing instruction that uses them.
MSB
Sign bit There are four timing instructions: TON, TOF, TONR
T word element LSB
and TMON. See Chapter 5 Basic Instructions for
16 bits
details.
Value assignment
Figure 3-3
T
1. Through instructions. 2. Write or force during
system debugging.
e
l
Battery backed features
e
T elements in the
m T elements outside
State saving range
e the saving range
(for MC200 only)
n
Power loss Remain unchanged Cleared
t
RUN → STOP Remain unchanged Remain unchanged
STOP → RUN Remain unchanged Cleared
Classification Note: The saving range is set through the system block. See
According to the timing precision, the T elements are 2.2.1 System Block

classified into three types:


T element Timing precision  Note
T0 ~ T209 100ms The maximum timing value of T element is 32767. The
T210 ~ T251 10ms preset value is -32768 ~ 32767. Because T elements act
only when the counted value reaches or exceeds the preset
T252 ~ T255 1ms
value, it is pointless setting the preset value as a negative
number.
The T elements with the timing precision of 1ms are
activated by interrupts, unrelated to the PLC scan
56 第五章 基本指令说明

saving range the saving range


3.1.7 Counter Power loss Remain unchanged Cleared
RUN → STOP Remain unchanged Remain unchanged
Element mnemonic
STOP → RUN Remain unchanged Cleared
C Note: The saving range is set through the system block. See
Function 2.2.1 System Block

The C element contains a bit element and a word (or a


double word) element. The word elements can record
16-bit or 32-bit counted numbers, and is used as a
value in the program. The bit element represents the
state of the counter coil and is applied to logic control.
1 state bit
C bit element

MSB
Sign bit
16-bit counter LSB
16 bits

MSB
Sign bit
32-bit counter LSB
16 bits 16 bits

Figure 3-4
C

e
l
e
m
e
n
t

Classification
Two types: 16-bit counter and 32-bit counter
Elements numbered in
Decimal, starting with 0
Data type
Boolean, word or double word.
Available forms
The instructions that may use the C elements are
classified into 4 types: CTU, CTR, DCNT and the high
speed counter instructions. See Chapter 5 Basic
Instructions and Chapter 6 Application Instructions
for details.
The classification of C elements is shown below:
C elements Type Applicable to
C0 ~ C199 16-bit up counter CTU, CTR
32-bit bi-directional
C200 ~ C235 DCNT
counter
32-bit high speed High speed I/O
C236 ~ C259
counter instructions

Value assignment
1. Through instructions. 2. Write or force during
system debugging.
Battery backed features
State C elements in the C elements outside

EC 系列小型可编程控制器 编程手册
Chapter 3 Element And Data 55

3.1.8 Data Register


Element mnemonic
D
Function
As a data element, the D elements are used in many  Note
calculation and control instructions as the operands. In a double word D element, the higher 16-bit is in the first
Elements numbered in D element; and the lower 16-bit is in the second D element.
Available forms
Decimal, starting with 0
The D elements are used in many calculation and
Data type
control instructions as the operands.
Every D element is a 16-bit register that can store data,
Value assignment
like an 16-bit integer.
Two D elements can form a double word and store a 1. Through initialization. 2. Through instructions.
32-bit data, such as the long integer data or 3. Write or force during system debugging.
floating-point data. Battery backed features
Sign bit MSB Dn element (n: 0 ~ 7999)
Single word D LSB
element 16 bits D elements in the D elements outside
State
MSB Dn + 1 element
LSB saving range the saving range
Sign bit
Dn element (n: 0 ~ 7998)
Double word
(n: 0 ~ 7998) Power loss Remain unchanged Cleared
D element
16 bits 16 bits RUN → STOP Remain unchanged Remain unchanged
The data range of single word D element: -32, 168 ~ 32, 767 STOP → RUN Remain unchanged Cleared
The data range of double word D element: -2, 147, 483, 648 ~ 2, 147, 483, 647
Note: The saving range is set through the system block.
See 2.2.1 System
Figure 3-5
Block
D

 Note
e
Some D elements
l may be reserved for internal tasks when
the MDI instructions
e or MCbus protocol is used.

MC Series Small PLC Programming Manual


56 Chapter 3 Element And Data

3.1.9 Special Auxiliary Relay


Element mnemonic SM40 ~ SM68: interrupt control flag bit. Setting these
SM SM elements will enable the corresponding interrupts.
SM80/81: Y0/Y1 high speed pulse output stop
Function
instruction.
The SM elements are closely related to the PLC SM110 ~ SM114: monitor bit of free port 0
system function. They reflect PLC system function and
SM135/136: Modbus communication flag bit.
system state. For details, see 0Special Auxiliary Relay.
SM172 ~ SM178: integrated analog channel enabling
Classification flag (valid only for MC100-1614BRA1)
The frequently used SM elements include: Elements numbered in
 SM0: PLC operation monitor bit. It is ON when
Decimal, starting with 0
the PLC is in RUN state.
Data type
 SM1: initial operation pulse bit. It is ON in the first
scan cycle of PLC operation. Boolean
 SM3: system error. It is ON if any system error is Available forms
detected after PLC is powered on or when PLC
NO and NC contacts
changes from STOP to RUN.
Value assignment
 SM10 ~ SM12: respectively the clock
square-wave cycled at 10ms, 100ms and 1s 1. Through instructions. 2. Write or force during
(flipping-over twice in a cycle). system debugging.
In addition, you can use, control or change the PLC
system function by adjusting certain SM elements.
Such elements include:

3.1.10 Special Data Register


Element mnemonic SD80 ~ SD89: Position instruction parameters.
SD SD100 ~ SD106: real time clock data.

Function Elements numbered in

The SD elements are closely related to the PLC Decimal, starting with 0
system function. They reflect PLC system function Data type
parameters, state code and instruction execution data.
Word (integer)
See 0Special Data Register for details.
Available forms
Classification
Storage and calculation of integers
 The frequently used SD elements include:
Value assignment
 SD3: system error code.
 SD50 ~ SD57: high speed pulse output monitor. 1. Through instructions. 2. Write or force during
 SD100 ~ SD106: real time clock data. system debugging.

In addition, you can change PLC system function  Note


parameters by changing certain SD elements. Such You cannot assign values to the read only SD elements.
elements include:
SD66 ~ SD68: cycle of timed interrupt.
Chapter 3 Element And Data 55

3.1.11 Offset Addressing Register


Element mnemonic Data type
Z Word
Function Available forms
The Z elements are 16-bit registers that can store The Z elements are used for offset addressing. You
signed integers. For detailed offset addressing need to write the addressing offset to the Z elements
information, see 3.2.2 Z Addressing Mode (Offset before you can use them.
Addressing Mode). Value assignment
Elements numbered in 1. Through instructions. 2, Write or force during
Decimal, starting with 0 system debugging.

3.1.12 Local Auxiliary Relay


Element mnemonic The LM elements can be used to define the interface
LM parameters of subprograms to realize interface
parameter transfer. For details, see 4.4 Subprogram.
Function
Elements numbered in
The LM elements are local variants and can be used in
the main program and subprograms. But being local Decimal, starting with 0
variants, they are valid only in a certain program. Data type
Different programs cannot share the same LM element Boolean
directly. When the system jumps from one program to
Available forms
another, the system will redefine the LM element.
When the system returns to the main program or calls NO and NC contact
a subprogram, the redefined LM element will be Value assignment
cleared, or be set by the interface parameter transfer.
1. Through instructions. 2. Write or force during
system debugging.

3.1.13 Local Data Register


Element mnemonic The V elements can be used to define the interface
V parameters of subprograms to realize interface
parameter transfer. For details, see 4.4 Subprogram.
Function
Elements numbered in
The V elements are local variants and can be used in
the main program and subprograms. But being local Decimal, starting with 0
variants, they are valid only in a certain program. Data type
Different programs cannot share the same V element Boolean
directly. When the system jumps from one program to
Available forms
another, the system will redefine the V element. When
the system returns to the main program or calls a Word, for numeric information
subprogram, the redefined V element will be cleared, Value assignment
or be set by the interface parameter transfer.
1. Through instructions. 2. Write or force during
system debugging

MC Series Small PLC Programming Manual


56 Chapter 3 Element And Data

3.2 Elements Addressing Mode

3.2.1 Kn Addressing Mode (Combined Bit-string Addressing Mode)


Concept
The Kn addressing mode, or combined bit-string addressing mode, realizes addressing by combining bit elements into
words or double words.
Kn addressing method
The format is: “K (n) (U)”, where the “n” is an integer from one to eight, standing for the length of the bit string: n × 4.
The “U” stands for the address of the starting element.
For example:
1. K1X0 stands for a word made up of (X0, X1, X2, X3).
2. K3Y0 stands for a word made up of (Y0, Y01, Y02, Y03), (Y04, Y05, Y06, Y07), (Y10, Y11, Y12, Y13).
3. K4M0 stands for a word made up of M0, M1, M2, M3…, M15.
4. K8M0 stands for a word made up of M0, M1, M2, M3…, M31.
Data storage using Kn addressing mode
The following is an example of how a specific data can be stored using the Kn addressing mode:
MOV 2#10001001 K2M0 (which is equal to MOV 16#89 K2M0, or MOV 137 K2M0). After executing the instruction, the
result is:
Data Highest bit Middle bit Lowest bit
K2M0 M7 M6 M5 M4 M3 M2 M1 M0
16#89 1 0 0 0 1 0 0 1

Points to note
If the destination operand uses the Kn addressing mode, while the data to be stored is longer than the length of the
destination operand, the system will keep the lower bits and discard the higher bits.
For example:
Execute instruction DBITS 16# FFFFFFF0 K1M0. After executing the instruction, the operand 2 (K1M0) should store
the calculation result 16# 1c (28). However, the K1M0 is only 4 bits wide, which is not enough for 16# 1c. By discarding
the higher bits, the actual operand 2 is K1M0 = 16# c (12).

3.2.2 Z Addressing Mode (Offset Addressing Mode)


Concept
The MC200 series PLC provides the Z addressing mode, or offset addressing mode. You can use the Z elements
(offset addressing register) to get indirect access to the target elements.
Z addressing method
Target address = Basic element address + Address offset stored in Z element
For example:
In the offset addressing mode, for D0Z0 (Z0 = 3), the target address is D3, because D0 is the basic address, and the
offset address is stored in element Z0, which in this case, is 3.
Therefore when Z0 = 3, the instruction “MOV 45 D0Z0” is equal to “MOV 45 D3” in effect, because in both cases
the D3 is set as 45 by the instruction.
Chapter 3 Element And Data 55

Offset addressing example


1. Bit element offset addressing example 2. Word element offset addressing example
LD M01 LD M0 1
MOV 6 Z1 MOV 30 Z20
SFTR X0Z1 M0 8 2 MOV D100Z20 D0
The preceding instructions are in effect equal to: The preceding instructions are in effect equal to:
LD M0 1 LD M0 1
SFTR X6 M0 8 2 MOV D130 D0
The addressing process is as follows: The addressing process is as follows:
Z1=6 Z20=30
X0Z1 = X (0+Z1) = X6 D100 Z20 = D (100+Z20) = D130
Points to note
1. The Z elements store the offset for the offset addressing. They support signed integers, which means minus offset is
supported.
For example:
MOV -30 Z20
MOV D100Z20 D0
The preceding instructions are equal to the following one in effect:
MOV D70 D0
2. The SM elements and SD elements do not support the Z addressing mode.
3. Pay attention to the address range when using the Z addressing mode. For example, D7999Z0 (Z0 = 9) is outside
the address range of the D elements, which is not bigger than D7999.

3.2.3 Kn Addressing In Combination With Z Addressing


The Kn addressing mode can be used in combination with the Z addressing mode. For example: K1X0Z10.
In this mode, the starting element address is found through the Z addressing mode, then the Kn addressing mode is
used to determine the length of the bit string.
For example:
LD M1
MOV 3 Z10
MOV K1X0Z10 D0
The preceding instructions are in effect equal to:
LD M1
MOV K1X3 D0
The addressing process is as follows:
Z10 = 3
K1X0Z10=K1X (0+Z10) = K1X3

3.2.4 Storing & Addressing 32-Bit Data In D & V Elements


Storing 32-bit data in D and V elements
The DINT, DWORD and REAL data are all 32-bit, while the D and V elements are both 16-bit. Two consecutive D or V
elements are needed to store the 32-bit data.
The MC200 series PLC stores the 32-bit data in the Big Endian mode, which means the elements with smaller
addresses are used to store the higher bits, while the elements with bigger addresses are used to store the lower bits.
For example, the unsigned integer “16# FEA8_67DA” is stored in the element (D0, D1). The actual storing format is:
D0 0xFEA8
D1 0x 67DA

MC Series Small PLC Programming Manual


56 Chapter 3 Element And Data

Addressing 32-bit data in D and V elements


You can use a D or V element to locate a 16-bit data, such as an INT or WORD data, or a 32-bit data, such as a DINT
or DWORD data.
If a D or V element address is used in an instruction, the operand data type determines whethther the data is 16-bit or
32-bit.
For example:
In the instruction “MOV 16#34 D0”, the address D0 stands for a single D0 element, because operand 2 of the MOV
instruction is of the WORD data type.
In the instruction “DMOV 16# FEA867DA D0”, the address D0 stands for two consecutive words: D0 and D1,
because operand 2 of the DMOV instruction is of the DWORD data type.

3.3 Data

3.3.1 Data Type


All instruction operands are of a certain data type. There are altogether six data types, as listed in the following table:
Table 3-3 Operand data types
Data type Type description Data width Range
BOOL Bit 1 ON, OFF (1, 0)
INT Signed integer 16 -32768 ~ 32767
Signed double
DINT 32 -2147483648 ~ 2147483647
integer
WORD Word 16 0 ~ 65535 (16#0 ~ 16#FFFF)
DWORD Double word 32 0 ~ 4294967295 (16#0 ~ 16#FFFFFFFF)
REAL Floating point 32 ±1.175494E-38 ~ ±3.402823E+38

3.3.2 Correlation Between Elements And Data Types


The elements used as instruction operands must have suitable data types. The correlations are listed in the following
table.
Table 3-4 Elements and data type correlations
Data type Elements
C T
BOOL
X Y M S LM SM
Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z
INT

Constant KnX KnY KnM KnS KnLM KnSM D SD C V


DINT

Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z


WORD

Constant KnX KnY KnM KnS KnLM KnSM D SD C T V


DWORD

Constant D V
REAL

If an instruction uses an operand with unsuitable data type, the instruction will be deemed illegal. For example,
instruction “MOV 10 X0” is illegal because operand 2 of the MOV instruction is of signed integer data type, while
the X0 element can store only Boolean data.

 Note
1. When the operand is of INT or WORD type, the applicable elements include KnX, KnY, KnM, KnS, KnLM and KnSM, where
1≤n≤4
2. When the operand is of DINT or DWORD type, the applicable elements include KnX, KnY, KnM, KnS, KnLM and KnSM,
where 5 ≤ n ≤ 8
3. When the operand is of INT or WORD type, the applicable C elements are C0 ~ C199.
4. When the operand is of DINT or DWORD type, the applicable C elements are C200 ~ C255.
Chapter 3 Element And Data 55

3.3.3 Constant
You can use constants as the instruction operands. MC200 series PLC supports input of multiple types of constants.
The usual constant types are listed in the following table:
Table 3-5 Constant types
Constant type Example Valid range Remarks
Decimal constant (16-bit signed
-8949 -32768 ~ 32767
integer)
Decimal constant (16-bit unsigned
65326 0 ~ 65535
integer)
Decimal constant (32-bit signed
-2147483646 -2147483648 ~ 2147483647
integer)
Decimal constant(32-bit unsigned
4294967295 0 ~ 4294967295
integer)
Hex constant (16-bit) 16#1FE9 16#0 ~ 16#FFFF
The hex, octal or binary constants are
Hex constant (32-bit) 16#FD1EAFE9 16#0 ~ 16#FFFFFFFF
neither positive nor negative by
Octal constant (16-bit) 8#7173 8#0 ~ 8#177777
themselves. When used as operands, the
Octal constant (32-bit) 8#71732 8#0 ~ 8#37777777777
positive and negative nature of these
Binary constant (16-bit) 2#10111001 2#0 ~ 2#1111111111111111
constants are determined by the data
2#1011100111 2#0 ~ 2#1111111111111111
Binary constant (32-bit) type of the operand.
11 1111111111111111
Compliant with IEEE-754.
-3.1415E-16
The programming software can display
Single-precision floating point 3.1415E+3 ±1.175494E-38 ~ ±3.402823E+38
and input floating point constants with
0.016
7-bit of operational accuracy

MC Series Small PLC Programming Manual


56 Chapter 4 Programming Concepts

Chapter 4 Programming Concepts

This chapter details the programming of MC series small PLC, including the programming language, program
components, data type, addressing mode and annotating function. The programming and usage of subprograms are
also introduced, and finally, the general explanation of instructions.
4.1 Programming Language............................................................................................................................................................... 59
4.1.1 LAD..................................................................................................................................................................................... 59
4.1.2 IL..........................................................................................................................................................................................60
4.1.3 SFC..................................................................................................................................................................................... 60
4.2 Program Components...................................................................................................................................................................61
4.2.1 User Program.................................................................................................................................................................... 61
4.2.2 System Block..................................................................................................................................................................... 61
4.2.3 Data Block..........................................................................................................................................................................61
4.3 Block Comment And Variable Comment................................................................................................................................... 61
4.3.1 Block Comment................................................................................................................................................................. 61
4.3.2 Variable Comment............................................................................................................................................................ 62
4.4 Subprogram....................................................................................................................................................................................64
4.4.1 Concept.............................................................................................................................................................................. 64
4.4.2 Points To Note For Using SBRs..................................................................................................................................... 64
4.4.3 SBR Local Variable Table............................................................................................................................................... 64
4.4.4 SBR Parameter Transfer................................................................................................................................................. 65
4.4.5 Example..............................................................................................................................................................................65
4.5 General Information Of Instructions............................................................................................................................................66
4.5.1 Instruction Operands........................................................................................................................................................ 66
4.5.2 Flag Bit................................................................................................................................................................................66
4.5.3 Limits To Instruction Usage.............................................................................................................................................67
Chapter 4 Programming Concepts 59

4.1 Programming Language


Three programming languages are provided: ladder diagram (LAD), instruction list (IL) and Sequential Function Chart
(SFC).

4.1.1 LAD
Concepts
The LAD is a widely-used diagram programming-language, similar to the electric (relay) control diagram. It features:
1. Left bus, with right bus omitted.
2. All control output elements (coils) and functional blocks (application instructions) share the same power flow inlet.
The electric control diagram and LAD are equivalent to a certain degree, as shown in the following figure.

Figure 4-1 The equivalence between


electric control diagram and LAD

LAD basic programming components


According to the principles in electric control diagram, several basic programming components are abstracted for the
LAD:
1. Left bus: Corresponding to the control bus in electric control diagram, it provides power for the control circuit.
2. Connecting line ( ): Corresponding to the electric connection in electric control diagram, it connects different
components.
3. Contact ( ): Corresponding to the input contact in electric diagram, it controls the ON/OFF and direction of control
currents. The parallel and serial connection of contacts stands for the logic calculation of inputs, determining the
transfer of power flow.
4. Coil ( ): It corresponds to the relay output in electric control diagram.
5. Function block ( ): Or application instruction. Corresponding to the execution unit or functional device that
provides special functions in electric control diagram, it can accomplish specific control function or control calculation
function (like data transmission, data calculation, timer and counter).
Power flow
Being an important concept in LAD, the power flow is used to drive coils and application instructions, which is similar to
the control current output by the driving coil, and executed by the execution unit in electric control diagram.
In LAD, the coils or application instructions must be preceded with power flow, because the coils can output and
instructions can be executed only when the power flow is ON.
The following figure demonstrates the power flow in LAD and the how the power flow drives coils or function blocks.

Power flow No.1

Power flow No.1

Power flow No.2

Power flow No.3


Three power flows

MC Series Small PLC Programming Manual


60 Chapter 4 Programming Concepts

Figure 4-2 Power flow and its driving


function

4.1.2 IL
The IL, or the instruction list composed by users, is a text programming language.
The user program stored in the PLC basic module is actually the instruction list recognizable to the basic module. The
system realizes the control function by executing the instructions in the list one by one.
The following is an example of equivalent LAD and IL.
LAD IL
LD X0
OR X1
AND X14
MPS
OUT Y0
AND X1
OUT Y1
MPP
AND X2
MPS
OUT Y2
AND X3
AND X4
OUT Y3
MRD
LD X5
AND X6
LD X7
AND X10
ORB
ANB
OUT Y4
MPP
OUT Y5

4.1.3 SFC
The SFC is a diagram programming-language usually used to realize sequence control, which is a control process that
can be divided into multiple procedures and proceed according to certain working sequence.
The user program designed with SFC is direct and clear because it has a structure similar to the actual sequence
control process.
See the following figure for a simple example of SFC.

Figure 4-3 Example of SFC

EC Series Small PLC Programming Manual


Chapter 4 Programming Concepts 61

4.2 Program Components


The program components include user program, system block and data block. You can change these components by
programming.

4.2.1 User Program


A user program is the program code composed by users. It must be compiled into executable instruction list,
downloaded to the PLC and executed to realize the control function.
The user program comprises three Program Organization Units (POU): main program (MAIN), subprogram (SBR) and
interrupt (INT).
Main program
The main program is the main body and framework of the user program. When the system is in RUN state, the main
program will be executed cyclically.
One user program has only one main program.
Subprogram
A subprogram is a program independent in structure and function. It can be called by other POUs. Subprograms
generally have call operand interface and are executed only when being called.
A user program can have random number of subprograms, or no subprogram at all.
Interrupt
An interrupt is a program section handling a specific interrupt event. A specific interrupt event always corresponds to a
specific interrupt.
Upon the occurrence of an interrupt event, an ordinary scan cycle will be interrupted. The system will run the
corresponding interrupt until the interrupt is finished, when the system will return to the ordinary scan cycle.
A user program can have random number of interrupts, or no interrupts at all.

4.2.2 System Block


The system block contains multiple system configuration parameters. You can modify, compile and download the
system block to configure the operation mode of the basic module.
For details, see 2.2.1 System Block or the related description in X-builder Programming Software User Manual.

4.2.3 Data Block


The data block contains the values of D elements. By downloading the data block to the PLC, you can set a batch of
designated D elements.
If the Data block enabled is checked in the Advanced Settings tab of System block, the D elements will be
initialized by the data block before the PLC executes the user program.

4.3 Block Comment And Variable Comment

4.3.1 Block Comment


You can add comments to the program. Occupying a whole row, each piece of comment can be used to explain the
function of the following program block.
In the program, right click and select Insert Row to insert a row above the current row. You can use a empty row to
separate two program sections.
To make a block comment, just select an empty row, right click and select Insert Block Comment.

MC Series Small PLC Programming Manual


62 Chapter 4 Programming Concepts

Figure 4-4 Adding block comment

Input your comment into the Block Comment dialogue box that pops out and click the OK button

Figure 4-5 Block comment dialogue box

The comment will appear in the empty row, as shown below:

Figure 4-6 The block comment

A block comment occupies a whole row. You cannot add a block comment to an occupied row, nor can a row occupied
by a comment be used for other purposes.

4.3.2 Variable Comment


You can define variables in the Local variable table and Global variable table. (See 2.2.3 Global Variable Table
and 4.4.3 SBR Local Variable Table) , and use them in the LAD programming language. A variable can stand for a
certain address to make the program more sensible. Figure 4-7 shows some variables defined in a global variable
table.

EC Series Small PLC Programming Manual


Chapter 4 Programming Concepts 63

Figure 4-7 Variables defined in the global


variable table

Symbol Addressing
When the defined variables are used, you can select View -> Symbole Addressing to display their names instead of
their addresses in the LAD or IL program.
The following figure shows the LAD program when the Symbol Addressing is not checked.

Figure 4-8 When symbole addressing is


unchecked

The following figure shows the LAD program when the Symbol Addressing is checked.

Figure 4-9 When symbole addressing is


checked

Element comment
You can select View -> Element Comment to display the element comments in the LAD program, as shown in Figure
4-10.

Figure 4-10 The LAD program displaying


element comments

MC Series Small PLC Programming Manual


64 Chapter 4 Programming Concepts

 Note
The block comment, global variable table and local variable table can be compiled and downloaded to the MC200 series PLC. To
store such information, battery backup is needed. However, although battery failure may cause information loss, comment upload
failure and user information file error report, the user program can still run normally.

4.4 Subprogram

4.4.1 Concept
Being an optional part of the user program, a subprogram (SBR) is an independent Program Organization Unit (POU)
that can be called by the main program or other SBRs.
You can use SBRs in your user program to:
1. Reduce the size of the user program. You can write a repeated program section as a SBR and call it whenever
necessary.
2. Clarify the program structure, particularly the structure of the main program.
3. Make the user program more transplantable.

4.4.2 Points To Note For Using SBRs


Note the following when writing or calling a SBR:
1. The PLC supports up to 6 levels of SBR nesting.
The following is an fine example of 6-level of SBR nesting:
MAIN  SBR1  SBR2  SBR3  SBR4  SBR5  SBR6 (where the “” represents calling with the CALL
instruction)
2. The PLC does not support recursive calling and cyclic calling of SBRs.
The following two examples show two illegal SBR callings.
 MAIN→SBR0→SBR0 (recursive calling, illegal)
 MAIN→SBR0→SBR1→SBR0 (cyclic calling, illegal)
3. You can define up to 64 SBRs in a user program.
4. You can define up to 16 bit variables and 16 word variables in the local variable table of a SBR.
5. When calling a SBR, the operand type of the CALL instruction must match the variable type defined in the SBR local
variable table. The compiler will check the match.
6. The interrupts are not allowed to call SBRs.

4.4.3 SBR Local Variable Table


Concept
The SBR local variable table displays all SBR interface parameters and local variables (both are called variables) and
stipulates their properties.
SBR variable properties
The SBR variables (including interface parameters and local variables) have the following properties:
1. Variable address
Based on the variable data type, the software will automatically assign a fixed LM or V element address to each SBR
variable in sequence.
2. Variable name
You can give each SBR variable a name (alias). You can use a variable in the program by quoting its name.
3. Variable type
The SBR variables are classified into the following four types:
 IN: The IN type variables can transfer the inputs of SBR when the SBR is being called.
 OUT: The OUT type variables can transfer the SBR execution result to the main program when a SBR calling
ends.

EC Series Small PLC Programming Manual


Chapter 4 Programming Concepts 65

 IN_OUT: The IN type variables can transfer the inputs of SBR when the SBR is being called, or transfer the the
SBR execution result to the main program when a SBR calling ends.
 TEMP: The TEMP variables are local variables that are valid only within the SBR.
4. Data type
The variable data type specifies the range of the data. The variable data types are listed in the following table.
Table 4-2 Variable data types
Data type Description Occupied LM/V element address
BOOL Bit type One LM element address
INT Signed integer type One V element address
DINT Signed double integer type Two consecutive V element addresses
WORD Word type One V element address
DWORD Double word type Two consecutive V element addresses
REAL Floating point type Two consecutive V element addresses

4.4.4 SBR Parameter Transfer


If local input or output variables are defined in a SBR, when the main program calls the SBR, you should input the
corresponding variable values, global variables or temporary variables into the SBR interface parameters. Note that
the global variable should be of the same data type with the local variable.

4.4.5 Example
What follows is an example of how to write and call a SBR.
Function of this example SBR
Call SBR_1 in the main program to complete a adding calculation of two integer constants 3 and 2, and assign the
result 5 to D0.
Operation procedures
Step 1: Insert a SBR into the project and name it as SBR_1.
Step 2: Write SBR_1.
1. Set the SBR calling interface through the SBR_1 variable table.
1) Variable 1: Name it as IN1 (variable type: IN). Set the data type as INT. The software will assign it with a V element
address of V0.
2) Variable 2: Name it as IN2 (variable type: IN). Set the data type as INT. The software will assign it with a V element
address of V1.
3) Variable 3: Name it as OUT1 (variable type: OUT). Set the data type as INT. The software will assign it with a V
element address of V2.
2. Write the SBR_1 as:
LD SM0
ADD #IN1 #IN2 #OUT1
The above program is shown in the following figure.

Figure 4-11 Writing SBR_1

MC Series Small PLC Programming Manual


66 Chapter 4 Programming Concepts

Step 3: Write the main program and call the SBR


Use the CALL instruction in the main program to call SBR_1.
The corresponding main program is as shown below:
LD M0
CALL SBR_1 3 2 D0
You can use the parameter transfer relationship table as shown in the following figure to set the parameters
transferred to the subprogram and specify the element for storing the result of the subprogram.
 Parameter IN1 is used to transfer constant integer 3
 Parameter IN2 is used to transfer constant integer 2
 The result OUT1 is stored in D0

Figure 4-12 Calling subprogram

Step 4: Compile, download and run the user program and check the correctness of the SBR logic.
Execution result
When M0 is ON, SBR_1 will be called. Values 2 and 3 are transferred to the operands IN1 and IN2 to carry out the
calculation operation. The result 5 is then returned to the main program, and in the end, D0 is 5.

4.5 General Information Of Instructions

4.5.1 Instruction Operands


The instruction operands can be classified into the following two types:
 Source operands: or S (or S1, S2, S3 … when there are more than one of them in the same instruction). The
instruction reads values from source operands for calculation.
 Destination operands: or D (or D1, D2, D3 … when there are more than one of them in the same instruction). The
instruction controls or outputs values to the destination operands.
The operands could be bit elements, word elements, double-word elements, or constants. See the specific instruction
description in Chapter 5 or Chapter 6 for details.

4.5.2 Flag Bit


The instruction result may affect three kinds of flag.
Zero flag SM180
The zero flag is set when the instruction operation result is zero.
Carry flag SM181
The carry flag is set when the instruction operation result is a carry.

EC Series Small PLC Programming Manual


Chapter 4 Programming Concepts 67

Borrow flag SM182


The borrow flag is set when the instruction operation result is a borrow.

4.5.3 Limits To Instruction Usage


There are some limits to the usage of certain instructions. For details, see the description of the specific instruction.
Exclusive hardware resources
Some instructions requires hardware resources. When a specific hardware is being used by a certain instruction, the
access to the hardware will be denied to other instructions, because the occupation of the resource is exclusive.
Take the high speed I/O instructions and SPD instruction for example. Any of these instructions occupies a input point
among X0 ~ X7. The limited resources will make it impossible to execute these instructions at the same time.
Exclusive time
The execution of certain instructions may take some time. During such period, the system will be too busy to execute
other instructions.
Take the XMT instruction for example. Because of the time limit in communication, only one XMT instruction can be
executed once. In the same way, the free port can execute only one RCV instruction once. Every time when a Modbus
instruction is being executed, the communication channel will be unavailable to other instructions for a while. The
same is true to other instructions such as high speed output instruction, Position instructions and MDI instructions.
Application limit
Some instructions cannot be used in certain situations due to their limited application scope.
For example, instruction pair MC/MCR cannot be used in the steps of SFC.

MC Series Small PLC Programming Manual


68 Chapter 5 Basic Instructions

Chapter 5 Basic Instructions

This chapter details the basic instruction of MC100 and MC200, including the instruction format (form), operand,
influenced flag bit, function, example and sequence chart.
5.1 Contact Logic Instructions............................................................................................................................................................69
5.1.1 LD: NO Contact Power-Flow Loading........................................................................................................................... 69
5.1.2 LDI: NC Contact Power-Flow Loading...........................................................................................................................69
5.1.3 AND: NO Contact Power-Flow And............................................................................................................................... 70
5.1.4 ANI: NC Contact Power-Flow And................................................................................................................................. 70
5.1.5 OR: NO Contact Power-Flow Or.................................................................................................................................... 71
5.1.6 ORI: NC Contact Power-Flow Or................................................................................................................................... 71
5.1.7 OUT: Power-Flow Output................................................................................................................................................ 72
5.1.8 ANB: Power-Flow Block And...........................................................................................................................................72
5.1.9 ORB: Power-Flow Block Or.............................................................................................................................................73
5.1.10 MPS: Output Power-Flow Input Stack.........................................................................................................................73
5.1.11 MRD: Read Output Power-Flow Stack Top Value.................................................................................................... 74
5.1.12 MPP: Output Power-Flow Stack Pop Off.................................................................................................................... 74
5.1.13 EU: Power flow Rising Edge Detection....................................................................................................................... 74
5.1.14 ED: Power flow Falling edge Detection.......................................................................................................................75
5.1.15 INV: Power-Flow Block Inverse....................................................................................................................................75
5.1.16 SET: Set........................................................................................................................................................................... 76
5.1.17 RST: Reset...................................................................................................................................................................... 76
5.1.18 NOP: No Operation........................................................................................................................................................ 76
5.2 Main Control Instruction................................................................................................................................................................76
5.2.1 MC: Main Contorl.............................................................................................................................................................. 76
5.2.2 MCR: Main Control Remove........................................................................................................................................... 77
5.3 SFC Instructions............................................................................................................................................................................ 78
5.3.1 STL: SFC State Load Instruction....................................................................................................................................78
5.3.2 SET Sxx: SFC State Shift................................................................................................................................................78
5.3.3 OUT Sxx: SFC State Jump............................................................................................................................................. 78
5.3.4 RST Sxx: SFC State Reset............................................................................................................................................. 79
5.3.5 RET: SFC Program End.................................................................................................................................................. 79
5.4 Timer Instruction............................................................................................................................................................................ 79
5.4.1 TON: On-Delay Timing Instruction................................................................................................................................. 79
5.4.2 TONR: On-Delay Remember Timing Instruction......................................................................................................... 80
5.4.3 TOF: Off-Delay Timing Instruction................................................................................................................................. 80
5.4.4 TMON: Monostable Timing Instruction..........................................................................................................................81
5.5 Counter Instruction........................................................................................................................................................................ 81
5.5.1 CTU: 16-Bit Counter Counting Up Instruction.............................................................................................................. 81
5.5.2 CTR: 16-Bit Counter Loop Cycle Counting Instruction............................................................................................... 82
5.5.3 DCNT: 32-Bit Counting Instruction.................................................................................................................................83

EC Series Small PLC Programming Manual


Chapter 5 Basic Instructions 69

5.1 Contact Logic Instructions

5.1.1 LD: NO Contact Power-Flow Loading

LAD:
Applicable to MC280 MC200 MC100 MC80
LD

Influenced flag bit

IL: LD (S) Program steps 1


Offset
Operand Type Applicable elements
addressing
S BOOL X Y M S LM SM Dx.y* C T
* only MC280 support

Operand description Example


S: Source operand LD M0
Function description OUT Y0
When M0 is ON, Y0 is ON.
Connected to the left bus to connect
(status: ON) or disconnect (status: Note:
OFF) the power flow. For the contact logic instructions of MC100 series, when the
operands are M1536 ~ M2047, the actual program steps will be
the instruction program steps plus 1.
*In MC280,when operand is M1536~M10240,C256~
C511,T256~T511,S0~S4096,program step adds1.when it is
Dx.y 时,program step is 4。

5.1.2 LDI: NC Contact Power-Flow Loading


LAD:
Applicable to MC280 MC200 MC100 MC80
LDI

Influenced flag bit

IL: LDI (S) Program steps 1


Offset
Operand Type Applicable elements
addressing
S BOOL X Y M S LM SM Dx.y* C T
* only MC280 support

Operand description Example


S: Source operand
LDI M0
Function description OUT Y0
Connected to the left bus to connect When M0 is OFF, Y0 is ON.
(status: OFF) or disconnect (status: Note:
ON) the power flow.
For the contact logic instructions of MC100 series, when the
operands are M1536 ~ M2047, the actual program steps will be
the instruction program steps plus 1.
*In MC280,when operand is M1536~M10240,C256~
C511,T256~T511,S0~S4096,program step adds1.when it is
Dx.y 时,program step is 4。

MC Series Small PLC Programming Manual


70 Chapter 5 Basic Instructions

5.1.3 AND: NO Contact Power-Flow And


LAD: Applicable to MC280 MC200 MC100 MC80
AND
Influenced flag bit

IL: AND (S) Program steps 1


Offset
Operand Type Applicable elements
addressing
S BOOL X Y M S LM SM Dx.y* C T
* only MC280 support

Operand description Example


S: Source operand LD M0
AND M1
Function description
OUT Y0
After conducting the “and” operation on the
ON/OFF status of the designated contact (S) and
the current power flow, assign the value to the When M0 is ON and M1 is ON, Y0 is ON.
current power flow.

5.1.4 ANI: NC Contact Power-Flow And


LAD: Applicable to MC280 MC200 MC100 MC80
ANI
Influenced flag bit

IL: ANI (S) Program steps 1


Offset
Operand Type Applicable elements
addressing
S BOOL X Y M S LM SM Dx.y* C T
* only MC280 support

Operand description Example


S: Source operand LD M0
ANI M1
Function description
OUT Y0
After reversing the ON/OFF status of the
When M0 is ON and M1 is OFF, Y0 outputs ON.
designated contact (S), conduct “and” operation
on the reversed result and the current power flow,
and then assign the value to the current power
flow.

EC Series Small PLC Programming Manual


Chapter 5 Basic Instructions 71

5.1.5 OR: NO Contact Power-Flow Or


LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

OR

IL: OR (S) Program steps 1


Offset
Operand Type Applicable elements
addressing
S BOOL X Y M S LM SM Dx.y* C T
* only MC280 support

Operand description Example


S: Source operand
Function description LD M0
OR M1
After conducting “OR” operation on the ON/OFF OUT Y0
status of the designated contact (S) and the
When M0 or M1 is ON, Y0 is ON.
current power flow, assign the value to the
current power flow.

5.1.6 ORI: NC Contact Power-Flow Or


LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

ORI

IL: ORI (S) Program steps 1


Offset
Operand Type Applicable elements
addressing
S BOOL X Y M S LM SM Dx.y* C T
* only MC280 support

Operand description Example


S: Source operand
LD M0
Function description ORI M2
After reversing the ON/OFF status of the OUT Y0
designated contact (S), conduct “OR” operation on
the reversed result and the current power flow, and When M1 is ON or M2 is OFF, Y0 is ON.
then assign the value to the current power flow.

MC Series Small PLC Programming Manual


72 Chapter 5 Basic Instructions

5.1.7 OUT: Power-Flow Output


LAD: Applicable to MC280 MC200 MC100 MC80
OUT
Influenced flag bit

IL: OUT (S) Program steps 1


Offset
Operand Type Applicable elements
addressing
S BOOL X Y M S LM SM Dx.y* C T

Operand description Example


S: Source operand
LD M1
Function description
OUT Y0
Assign the value of the current power flow to the
When M1 is ON, Y0 is ON.
designated coil (D)

5.1.8 ANB: Power-Flow Block And


LAD: Applicable to MC280 MC200 MC100 MC80
ANB

Influenced flag bit

Power flow
1 Power flow
2
能流块
block 1 block 2

IL: ANB (S) Program steps 1


Offset
Operand Type Applicable elements
addressing
S BOOL X Y M S LM SM C T

Operand description Example


S: Source operand LD M0
OR M1
Function description
LD M2
Conduct “and” OR M3
operation on the power ANB
flow values of two OUT Y0

power flow blocks, and When M0 or M1 is on, and M2 or M3 is ON, Y0 is ON.


then assign the value to
the current power flow.

EC Series Small PLC Programming Manual


Chapter 5 Basic Instructions 73

5.1.9 ORB: Power-Flow Block Or

LAD:
Power flow block 1 Applicable to MC280 MC200 MC100 MC80

ORB Influenced flag bit


Power flow block 2

IL: ORB (S) Program steps 1


Offset
Operand Type Applicable elements
addressing
S BOOL X Y M S LM SM C T

Operand description Example


S: Source operand LD M1
Function description AND M2
LD M3
Conduct “or” operation on the AND M4
power flow values of two power ORB
flow blocks, and then assign the OUT Y0
value to the current power flow. When both M1 and M2 are ON, or both M3 and M4 are ON, Y0
outputs ON.

5.1.10 MPS: Output Power-Flow Input Stack


LAD: Applicable to MC280 MC200 MC100 MC80
MPS

Influenced flag bit

IL: MPS Program steps 1

Function description Note:


Push the current power flow value It is prohibited to use the MPS instruction consecutively for over 8
into the stack for storage, so that it times in a LAD program (with no MPP instruction in between),
otherwise the power flow output stack may overflow.
can be used in the power flow
calculation for the subsequent
output branches.

MC Series Small PLC Programming Manual


74 Chapter 5 Basic Instructions

5.1.11 MRD: Read Output Power-Flow Stack Top Value


LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

MRD

IL: MRD Program steps 1

Function description
Assign the top value of the power flow output stack to the current power flow.

5.1.12 MPP: Output Power-Flow Stack Pop Off


LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

MPP
IL: MPP Program steps 1

Function description Example


Pop the power flow output stack, and LD M0
assign the popped value to the current MPS
AND M1
power flow.
OUT Y0
MRD
AND M2
OUT Y1
MPP
AND M3
OUT Y2

5.1.13 EU: Power flow Rising Edge Detection


LAD: Applicable to MC280 MC200 MC100 MC80
EU
Influenced flag bit

IL: EU Program steps 2

Function description Example


Compare the current power flow status
LD M0
with its previous status. If the power flow
EU
rises (OFF→ON), the output is valid in the
SET Y0
current scan cycle.

EC Series Small PLC Programming Manual


Chapter 5 Basic Instructions 75

5.1.14 ED: Power flow Falling edge Detection


LAD: Applicable to MC280 MC200 MC100 MC80
ED
Influenced flag bit
IL: ED Program steps 2

Function description Sequence chart of example


Compare the current power flow status
with its previous status. If the power flow ON
OFF
falls (OFF→ON), the output is valid in the M2
current scan cycle. ON
OFF
Y2
Example
ON
LD M2
MPS Y3 OFF

EU
OUT Y2
Note
MPP
ED In LAD program, the rising edge contact or falling edge contact
OUT Y3 instruction shall be used in series rather than in parallel
connection with other contact elements.
In LAD program, the rising edge contact and falling edge
1. In two consecutive scan cycles, the
contact instruction cannot directly connect to the left power
status of M2 contact is OFF and ON
flow bus.
respectively. When the EU instruction
The examples of improper use of EU/ED instructions in LAD
detects a rising edge, Y2 will output ON
program are shown as follows:
status with the width of a scan cycle.
2. In two consecutive scan cycles, the
status of M2 contact is ON and OFF X X
respectively, when the ED instruction
detects a trailing edge, Y3 will output ON
status with the width of a scan cycle. X

5.1.15 INV: Power-Flow Block Inverse


LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


INV

IL: INV Program steps 1

Function description
Reverse the current power flow value and then assign to the current power flow.
Note:
In LAD program, the INV instruction shall be used in series rather than in parallel connection with contacts.
INV cannot be used as the first instruction in the input parallel branch.
In LAD program, the INV instruction cannot directly connect to the left power flow bus.
The examples of improper use of INV instructions in LAD program are shown as follows:

X
X X

MC Series Small PLC Programming Manual


76 Chapter 5 Basic Instructions

5.1.16 SET: Set


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: SET (S) Program steps 1
Offset
Operand Type Applicable elements
addressing
S BOOL Y M S LM SM C T

Operand description Example


S: Source operand LD M0
SET M1
Function description
When the power flow is valid, the bit
element designated by D will be set.

5.1.17 RST: Reset


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: RST (S) Program steps 1
Offset
Operand Type Applicable elements
addressing
S BOOL Y M S LM SM C T

Operand description Example


S: Source operand LD M0
Function description RST M1

When the power flow is valid, the Note


designated bit element (D) will be reset
If D is C element, the corresponding count value will be reset; if
D is T element, the corresponding timing value will be reset.

5.1.18 NOP: No Operation


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: NOP Program steps 1

Function description Note


This instruction does not enable any action. In LAD program, this instruction cannot directly conn
t to the left power flow bus.

5.2 Main Control Instruction

5.2.1 MC: Main Contorl


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: MC (S) Program steps 3
Offset
Operand Type Applicable elements
addressing
S INT Constant

Operand description
S: Source operand

EC Series Small PLC Programming Manual


Chapter 5 Basic Instructions 77

5.2.2 MCR: Main Control Remove


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: MCR (S) Program steps 1
Offset
Operand Type Applicable elements
addressing
S INT Constant

Operand description Note


S: Source operand 1. In LAD program, the MCR instruction must
Function description directly connect to the left power flow bus.
2. In LAD program, the MCR instruction cannot
1. MC and MCR form a MC-MCR structure. The MC instruction
connect to other instructions.
indicates the beginning a MC-MCR structure, and its operand S
3. Several MC-MCR structures of different SNs
is the SN of the MC-MCR structure. The value of S is a constant
can be used through the nest structure, but the
ranging from 0 to 7. MCR indicates the end of the MC-MCR
number of nest levels cannot exceed 7. The
structure.
MC-MCR structures with the same SN cannot
2. When the power flow before the MC instruction is valid, the
be used in the nest structure.
instructions in the MC-MCR structure will be executed.
4. Crossing of two MC-MCR structures is not
3. When the power flow before the MC instruction is invalid, the
allowed. The following is an illegal example.
program will skip over the instructions in the MC-MCR structure
and execute the instructions after the structure. Besides, the
destination operands of instructions OUT, TON, TOF, PWM,
HCNT, PLSY,PLSR, DHSCS, SPD, DHSCI, DHSCR, DHSZ,
DHST, DHSP and BOUT in the structure will be cleared.
Example

LD M0
MC 0
LD SM0
OUT Y0
MCR 0

When M0 = ON, the instructions in the MC 0 - MCR 0 structure


will be executed, and Y0 = ON. When M0 = OFF, the
instructions in the MC 0 - MCR 0 structure will not be executed, Note: It cannot be used in SFC programming.
and the bit element Y0 designated by the designation operand
of the OUT instruction in the structure will be cleared, Y0 = OFF.

MC Series Small PLC Programming Manual


78 Chapter 5 Basic Instructions

5.3 SFC Instructions

5.3.1 STL: SFC State Load Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: STL (S) Program steps 3
Offset
Operand Type Applicable elements
addressing
S BOOL S

Operand description instructions such as OUT, TON, TOF, PWM, HCNT,


PLSY, PLSR, DHSCS, SPD, DHSCI, DHSCR,
S : Source operand
DHSZ, DHST, DHSP and BOUT will be cleared.
Function description 4. If a step is invalid (OFF), the embedded
1. It indicates the beginning of a step (S). instructions will not be executed.
2. If a step is valid (ON), its embedded instructions 5. Consecutive STL instructions (serial connection
will be executed. of S elements) define a parallel merge structure.
3. If a step changes from ON to OFF (trailing edge), The STL instructions can be used up to 16 times in
the embedded instructions will not be executed, and a row (the maximum number of branches of a
the destination operands of the embedded parallel branch structure is 16).

5.3.2 SET Sxx: SFC State Shift


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: SET (D) Program steps 3
Offset
Operand Type Applicable elements
addressing
D BOOL S

Operand description Function description


D: Destination operand When the power flow is valid, the designated step (D) will
be set valid, and the current valid step will be set invalid, to
complete the step transition.

5.3.3 OUT Sxx: SFC State Jump


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: OUT (D) Program steps 3
Offset
Operand Type Applicable elements
addressing
D BOOL S

Operand description Function description


D: Destination operand When the power flow is valid, the designated step (D) will
be set valid, and the current valid step will be set invalid, to
complete the step jump.

EC Series Small PLC Programming Manual


Chapter 5 Basic Instructions 79

5.3.4 RST Sxx: SFC State Reset


LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: RST (D) Program steps 3


Offset
Operand Type Applicable elements
addressing
D BOOL S

Operand description Function description


D: Destination operand When the current power flow is valid, the designated step
(D) will be set invalid.

5.3.5 RET: SFC Program End


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: RET Program steps 1

Function description Note


It indicates the end of a SFC program section. It can only be used in the main program.

5.4 Timer Instruction


5.4.1 TON: On-Delay Timing Instruction
LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: TON (D) (S) Program steps 5
Offset
Operand Type Applicable elements
addressing
D INT T
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description Example


D: Destination operand LD M0
TON T1 4
S: Source operand
LD T1
Function description OUT Y0

1. When the power flow is valid, and the timing Time sequence chart
value < 32,767, the designated T element (D)
will start timing (the value will increase with the
lapse of time). When the timing value reaches
ON ON
32,767, it will maintain at 32,767.
OFF
2. When the timing value  the preset value (S), M0
the timing coil output of the designated T 0.3s 0.4s ON
element will be ON. OFF T1 = 32767 (max.)
T1 timing coil
3. When the power flow is OFF, the timing will
stop, the timing value will be cleared, and the T1=3 T1=4
timing coil output will be OFF. T1 timing value
T1=0
4. When the system executes the instruction for
the first time, it will reset the timing coil of the
designated T element, and clear the timing
value.

MC Series Small PLC Programming Manual


80 Chapter 5 Basic Instructions

5.4.2 TONR: On-Delay Remember Timing Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: TONR (D) (S) Program steps 5
Offset
Operand Type Applicable elements
addressing
D INT T
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description Example


D: Destination operand LD M0
TONR T1 5
S: Source operand
LD T1
Function description OUT Y0

1. When the power flow is valid, and the timing value Time sequence chart
<32,767, the designated T element (D) start timing (the
value will increase with the lapse of time). When the ON ON
timing value reaches 32,767, it will maintain at 32,767. OFF
M0
2. When the timing value ≥ the preset value (S), the 0.3s 0.2s ON
timing coil output of the designated T element will be OFF T1 = 32767 (max.)
T1 timing coil
ON.
3. When the power flow is OFF, the timing will stop, the T1=3 T1=5
timing coil and the timing value will maintain the current T1 timing value
T1=0
value.

5.4.3 TOF: Off-Delay Timing Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: TOF (D) (S) Program steps 5
Offset
Operand Type Applicable elements
addressing
D INT T
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description Example


D: destination operand LD M0
TOF T1 5
S: Source operand
LD T1
Function description OUT Y0

1. When the power flow changes from ON to OFF Sequence chart of example
(trailing edge), the designated timer T (D) will start timing.
2. When the power flow is OFF, if the designated timer T
ON ON
has started timing, it will keep timing until the timing value
reaches the preset value (S). The timing coil output of the OFF OFF
M0
T element will be OFF, and the timing value will maintain ON ON
at the present value.
OFF OFF
3. When the power flow input is OFF, if the timing has not T1 timing coil 0.5s
started, the timing will not start. T1=5
4. When the power flow is ON, the timing will stop, the T1 timing value
T1=0 T1=0
timing value will be cleared, and the timing coil output is
ON.

EC Series Small PLC Programming Manual


Chapter 5 Basic Instructions 81

5.4.4 TMON: Monostable Timing Instruction


Applicable to MC280 MC200 MC100 MC80
LAD:
Influenced flag bit

IL: TMON (D) (S) Program steps 5


Offset
Operand Type Applicable elements
addressing
D INT T
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description Example


D: Destination operand LD M0
S: Source operand TMON T1 5
LD T1
Function description OUT Y0
1. When the input power flow changes from OFF to ON Sequence chart of example
(rising edge), and the timing has not started, the
designated timer T (D) will start timing based on the current ON ON
value. In the timing status (whose length is determined by
OFF
S), the timing coil output will maintain ON. M0
ON
2. In the timing status (whose length is determined by S),
no matter how the power flow changes, the timing will keep OFF OFF
T1 timing coil
going, and the timing coil output will keep ON. 0.5s 0.5s
T1=5 T1=5
3. When the timing value reaches the preset point, the
T1 timing value
timing will stop, the timing value will be cleared, and the T1=0 T1=0
timing coil output will be set OFF.

5.5 Counter Instruction

5.5.1 CTU: 16-Bit Counter Counting Up Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: CTU (D) (S) Program steps 5
Offset
Operand Type Applicable elements
addressing
D INT C
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description Example


D: destination operand LD M0
CTU C0 3
S: Source operand
LD C0
Function description OUT Y0

1. When the power flow changes from OFF to ON (rising Time sequence chart
edge), the 16-bit counter C (D) will count 1.
ON ON
2. When the counting value reaches 32,767, it will maintain
OFF
that value. M0
3. When the counting value is larger than or equal to the ON
preset point (S), the counting coil will be set ON. OFF
C0 counting coil
Note
C0=3
C0=1 C0=2
The address range of the 16-bit counter C (D): C0 ~ C199. C0 counting value C0=0

MC Series Small PLC Programming Manual


82 Chapter 5 Basic Instructions

5.5.2 CTR: 16-Bit Counter Loop Cycle Counting Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: CTR (D) (S) Program steps 5
Offset
Operand Type Applicable elements
addressing
D INT C
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description Example


D: destination operand
S: Source operand
Function description LD M0
CTR C0 3
1. When the power flow changes from OFF to ON (rising
edge), the 16-bit counter C (D) will count 1. Time sequence chart

2. When the counting value is equal to the preset point


(S), the counting coil will be set ON.
3. After the counting value reaches the preset point (S), if ON ON ON ON ON ON
the power flow changes from OFF to ON again (rising OFF
OFF
edge), the counting value will be set to 1, and the M0
ON ON
counting coil will be set OFF.
OFF OFF
C0 counting coil
Note
C0=3
1. When the preset counting value (S) is less than or C0=1 C0=2 C0=2
C0=3
C0=0 C0=1
C0 counting value
equal to 0, there will be no counting.
2. The address of the 16-bit counter C (D) shall be within
C0 ~ C199.

EC Series Small PLC Programming Manual


Chapter 5 Basic Instructions 83

5.5.3 DCNT: 32-Bit Counting Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: DCNT (D) (S) Program steps 7
Offset
Operand Type Applicable elements
addressing
D DINT C
S DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description Example


D: destination operand LD M0
DCNT C235 D0
S: Source operand
Function description Time sequence chart

1. When the input power flow changes from OFF to


ON (rising edge), the 32-bit counter C (D) will count
up or down 1 (depending on the corresponding SM
flag bit).
D0=3
2. For a up counter, when the counting value is larger D0
than or equal to the preset point (S), the counting coil ON
will be set ON. Switch to down counting
OFF
SM235
3. For a down counter, when the counting value is
ON ON ON ON ON ON ON
less than or equal to the preset point (S), the
OFF OFF
counting coil will be set OFF. M0
4. When the counting value is 2147483647, it will ON
change to –2147483648 if the counter counts up OFF OFF
C235
once more. counting coil
5. When the counting value is -2147483648, it will C235=1
C235=2
C235=3
C235 counting C235=0 C235=2
change to 2147483647 if the counter counts down value C235=1
C235=0 C235=-1
once more.
Note
The address of the C element (D) shall be within
C200 ~ C235.

MC Series Small PLC Programming Manual


84 Chapter 6 Application Instructions

Chapter 6 Application Instructions

This chapter introduces the application instructions of MC series small PLC, including the formats, operands,
influenced flag bit, functions, examples and time sequence charts of the instructions.
Chapter 6 Application Instructions.............................................................................................................................................................. 84
6.1 Program Flow Control Instruction............................................................................................................................................... 89
6.1.1 FOR: Cycle Instruction..................................................................................................................................................... 89
6.1.2 NEXT: Return From Cycle...............................................................................................................................................89
6.1.3 LBL: Jump Label Definition............................................................................................................................................. 91
6.1.4 CJ: Conditional Jump....................................................................................................................................................... 91
6.1.5 CFEND: Conditional End From User Main Program...................................................................................................92
6.1.6 WDT: User Program Watchdog Reset.......................................................................................................................... 92
6.1.7 EI: Enable Interrupt Instruction....................................................................................................................................... 93
6.1.8 DI: Disable Interrupt Instruction...................................................................................................................................... 93
6.1.9 CIRET: Conditional Return From User Interrupt Subprogram...................................................................................93
6.1.10 STOP: User Program Stop............................................................................................................................................93
6.1.11 CALL: Calling A Subprogram........................................................................................................................................94
6.1.12 CSRET: Conditional Return From User Subprogram............................................................................................... 94
6.2 Data Transmission Instruction..................................................................................................................................................... 95
6.2.1 MOV: Move Word Data Transmission Instruction....................................................................................................... 95
6.2.2 DMOV: Move Double Word Data Transmission Instruction.......................................................................................95
6.2.3 RMOV: Move Floating Point Number Data Transmission..........................................................................................96
6.2.4 BMOV: Move Data Block Transmission Instruction.....................................................................................................96
6.2.5 FMOV: Fill Data Block Instruction.................................................................................................................................. 97
6.2.6 DFMOV: Fill Data Block Double Word Instruction....................................................................................................... 97
6.2.7 SWAP: Swap Bytes.......................................................................................................................................................... 98
6.2.8 XCH: Exchange Word...................................................................................................................................................... 98
6.2.9 DXCH: Exchange Double Word Instruction..................................................................................................................99
6.2.10 PUSH: Push Instruction................................................................................................................................................. 99
6.2.11 FIFO: First-In-First-Out Instruction...............................................................................................................................99
6.2.12 LIFO: Last-In-First-Out Instruction............................................................................................................................. 101
6.2.13 WSFR: Shift Right Word Instruction.......................................................................................................................... 102
6.2.14 WSFL: Shift Left Word Instruction............................................................................................................................. 103
6.3 Integer Math Instructions............................................................................................................................................................104
6.3.1 ADD: Add Integer Instruction........................................................................................................................................ 104
6.3.2 SUB: Subtract Integer Instruction.................................................................................................................................104
6.3.3 MUL: Multiply Integer Instruction..................................................................................................................................105
6.3.4 DIV: Divide Integer Instruction......................................................................................................................................105
6.3.5 SQT: Square Root Integer Instructions....................................................................................................................... 106
6.3.6 INC: Increment Integer Instruction............................................................................................................................... 106
6.3.7 DEC: Decrement Integer Instruction............................................................................................................................107
6.3.8 VABS: Integer Absolute Value Instruction.................................................................................................................. 107
6.3.9 NEG: Negative Integer Instruction............................................................................................................................... 108
6.3.10 DADD: Add Double Integer Instruction..................................................................................................................... 108
6.3.11 DSUB: Subtract Double Integer Instruction..............................................................................................................109
6.3.12 DMUL: Multiply Double Integer Instruction...............................................................................................................109
6.3.13 DDIV: Divide Double Integer Instruction................................................................................................................... 110

EC Series Small PLC Programming Manual


Chapter 6 Application Instructions 85

6.3.14 DSQT: Square Root Double Integer Instruction...................................................................................................... 110


6.3.15 DINC: Increment Double Integer Instruction............................................................................................................ 111
6.3.16 DDEC: Decrement Double Integer Instruction.........................................................................................................111
6.3.17 DVABS: Double Integer Absolute Value Instruction............................................................................................... 112
6.3.18 DNEG: Negative Double Integer Instruction............................................................................................................ 112
6.3.19 SUM: Sum Integer Instruction.................................................................................................................................... 113
6.3.20 DSUM: Sum Double Integer Instruction....................................................................................................................114
6.4 Floating-Point Number Math Instruction.................................................................................................................................. 114
6.4.1 RADD: Add Floating Point Number Instruction..........................................................................................................114
6.4.2 RSUB: Subtract Floating Point Number Instruction.................................................................................................. 114
6.4.3 RMUL: Multiply Floating Point Number Instruction................................................................................................... 115
6.4.4 RDIV: Divide Floating Point Number Instruction........................................................................................................116
6.4.5 RSQT: Square Root Floating Point Number Instruction...........................................................................................116
6.4.6 RVABS: Floating Point Number Absolute Value Instruction....................................................................................117
6.4.7 RNEG: Negative Floating Point Number Instruction................................................................................................. 117
6.4.8 SIN: Floating Point Number Sin Instruction................................................................................................................118
6.4.9 COS: Floating Point Number COS Instruction........................................................................................................... 118
6.4.10 TAN: Floating Point Number TAN Instruction.......................................................................................................... 119
6.4.11 POWER: Floating Point Number Exponentiation Instruction.................................................................................119
6.4.12 LN: Floating Point Number LN Instruction................................................................................................................120
6.4.13 EXP: Floating Point Number EXP Instruction.......................................................................................................... 120
6.4.14 RSUM: Sum Floating Point Number Instruction...................................................................................................... 121
6.4.15 ASIN: Arc Sine Instruction...........................................................................................................................................121
6.4.16 ACOS: Arc Cosine Instruction.................................................................................................................................... 122
6.4.17 ATAN: Arc Tangent Instruction...................................................................................................................................122
6.4.18 LOG: Floating Point Common Logarithm................................................................................................................. 122
6.4.19 RAD: Floating Point Degrees to Radians Conversion............................................................................................123
6.4.20 DEG: Floating Point Radians to Degrees Conversion............................................................................................123
6.5 Data Converting Instruction....................................................................................................................................................... 124
6.5.1 DTI: Double Integer To Integer Instruction................................................................................................................. 124
6.5.2 ITD: Integer To Double Integer Instruction................................................................................................................. 125
6.5.3 FLT: Integer To Floating Point Number Instruction................................................................................................... 125
6.5.4 DFLT: Double Integer To Floating Point Number Instruction.................................................................................. 125
6.5.5 INT: Floating Point Number To Integer Instruction....................................................................................................126
6.5.6 DINT: Floating Point Number To Double Integer Instruction................................................................................... 126
6.5.7 BCD: Word To 16-Bit BCD Instruction........................................................................................................................ 128
6.5.8 DBCD: Double Word To 32-Bit BCD Instruction........................................................................................................128
6.5.9 BIN: 16-Bit BCD To Word Instruction.......................................................................................................................... 130
6.5.10 DBIN: 32-Bit BCD To Double Word Instruction....................................................................................................... 130
6.5.11 GRY: Word To 16-bit Gray Code Instruction........................................................................................................... 132
6.5.12 DGRY: Double Word To 32-Bit Gray Code Instruction.......................................................................................... 132
6.5.13 GBIN: 16-Bit Gray Code To Word Instruction..........................................................................................................133
6.5.14 DGBIN: 32-Bit Gray Code To Double Word Instruction......................................................................................... 133
6.5.15 SEGl: Word To 7-Segment Encode...........................................................................................................................134
6.5.16 ASC: ASCII Code Conversion Instruction................................................................................................................ 134
6.5.17 ITA: Hexadecimal Integer-ASCII Conversion Instruction....................................................................................... 135
6.5.18 ATI: ASCII-Hexadecimal Integer Conversion Instruction....................................................................................... 136
6.5.19 LCNV: Engineering value Conversion Instruction.................................................................................................. 137
6.5.20 RLCNV: Foat Engineering value Conversion Instruction...................................................................................... 139
6.6 Word Logic Operation.................................................................................................................................................................139

MC Series Small PLC Programming Manual


86 Chapter 6 Application Instructions

6.6.1 WAND: AND Word Instruction......................................................................................................................................139


6.6.2 WOR: OR Word Instruction...........................................................................................................................................140
6.6.3 WXOR: Exclusive-OR Word Instruction......................................................................................................................140
6.6.4 WINV: NOT Word Instruction........................................................................................................................................142
6.6.5 DWAND: AND Double Word Instruction..................................................................................................................... 142
6.6.6 DWOR: OR Double Word Instruction.......................................................................................................................... 143
6.6.7 DWXOR: Exclusive-OR Double Word Instruction..................................................................................................... 143
6.6.8 DWINV: NOT Double Word Instruction....................................................................................................................... 144
6.7 Shift / Rotate Instruction............................................................................................................................................................. 144
6.7.1 ROR: 16-Bit Circular Shift Right Instruction............................................................................................................... 144
6.7.2 ROL: 16-Bit Circular Shift Left Instruction...................................................................................................................146
6.7.3 RCR: 16-Bit Carry Circular Shift Right Instruction.....................................................................................................147
6.7.4 RCL: 16-Bit Carry Circular Shift Left Instruction........................................................................................................ 148
6.7.5 DROR: 32-Bit Circular Shift Right Instruction.............................................................................................................148
6.7.6 DROL: 32-Bit Circular Shift Left Instruction................................................................................................................148
6.7.7 DRCR: 32-Bit Carry Circular Shift Right Instruction..................................................................................................149
6.7.8 DRCL: 32-Bit Carry Circular Shift Left Instruction..................................................................................................... 151
6.7.9 SHR: 16-Bit Shift Right Word Instruction.................................................................................................................... 151
6.7.10 SHL: 16-Bit Shift Left Instruction................................................................................................................................153
6.7.11 DSHR: 32-Bit Shift Right Instruction..........................................................................................................................153
6.7.12 DSHL: 32-Bit Shift Left Instruction............................................................................................................................. 155
6.7.13 SFTR: Shift Right Byte Instruction............................................................................................................................. 156
6.7.14 SFTL: Shift Left Byte Instruction................................................................................................................................ 157
6.8 External Equipment Instruction................................................................................................................................................. 158
6.8.1 FROM: Read Word Form Special Module Buffer Register Instruction...................................................................158
6.8.2 DFROM: Read Double Word Form Special Module Buffer Register Instruction..................................................159
6.8.3 TO: Write Word To Special Module Buffer Register Instruction..............................................................................160
6.8.4 DTO: Write Double Word To Special Module Buffer Register Instruction............................................................. 161
6.8.5 VRRD: Read Analog Potentiometer Value Instruction............................................................................................. 161
6.8.6 REFF: Set Input Filtering Constant Instruction.......................................................................................................... 161
6.8.7 REF: Instant Refresh I/O Instruction............................................................................................................................162
6.8.8 EROMWR: EEPROM Write Instruction.......................................................................................................................163
6.8.9 PR: Print Instruction....................................................................................................................................................... 164
6.8.10 TKY: Ten Key Input Instruction.................................................................................................................................. 166
6.9 Real-Time Clock Instruction.......................................................................................................................................................168
6.9.1 TRD: Read Real-Time Clock Instruction.....................................................................................................................168
6.9.2 TWR: Write Real-Time Clock Instruction.................................................................................................................... 169
6.9.3 TADD: Add Clock Instruction........................................................................................................................................ 170
6.9.4 TSUB: Subtract Clock Instruction.................................................................................................................................171
6.9.5 HOUR: Timing List Instruction...................................................................................................................................... 172
6.9.6 DCMP: Compare Date (=, <, >, <>, >=, <=) Instruction............................................................................................173
6.9.7 TCMP: Compare Time (=, <, >, <>, >=, <=) Instruction............................................................................................174
6.9.8 HTOS: Hour To Second Conversion Instruction........................................................................................................175
6.9.9 STOH: Second To Hour Conversion Instruction........................................................................................................176
6.10 High-speed I/O Instruction....................................................................................................................................................... 177
6.10.1 HCNT: High-speed Counter Drive Instruction..........................................................................................................177
6.10.2 DHSCS: High-speed Counting Compare Set Instruction.......................................................................................178
6.10.3 DHSCI: High-speed Counting Compare Interrupt Trigger Instruction..................................................................179
6.10.4 DHSPI: High-speed Output Passing Position Compare Interrupt Trigger Instruction....................................... 180
6.10.5 DHSCR: High-speed Counting Compare Reset Instruction.................................................................................. 181

EC Series Small PLC Programming Manual


Chapter 6 Application Instructions 87

6.10.6 DHSZ: High-speed Counting Zone Compare Instruction.......................................................................................182


6.10.7 DHST: High-speed Counting Table Compare Instruction......................................................................................183
6.10.8 DHSP: High-speed Counting Table Compare Pulse Output Instruction............................................................. 185
6.10.9 SPD: Pulse Detection Instruction...............................................................................................................................187
6.10.10 PLSY: Count Pulse Output Instruction....................................................................................................................188
6.10.11 PLSR: Count Pulse With Acceleration/Deceleration Output Instruction............................................................189
6.10.12 PLS: Pulse Output Instruction of Envelope............................................................................................................190
6.10.13 PWM: Pulse Output Instruction................................................................................................................................191
6.11 Control Calculation Instruction................................................................................................................................................ 192
6.11.1 PID: PID Instruction......................................................................................................................................................192
6.11.2 RAMP: Ramp Wave Signal Output Instruction........................................................................................................ 196
6.11.3 HACKLE: Hackle Wave Signal Output Instruction.................................................................................................. 197
6.11.4 TRIANGLE: Triangle Wave Signal Output Instruction............................................................................................198
6.11.5 ABSD: Absolute Drum Sequencer Instruction......................................................................................................... 200
6.11.6 DABSD: Double Absolute Drum Sequencer Instruction.........................................................................................201
6.11.7 ALT: Alternate State Instruction................................................................................................................................. 203
6.12 Communication Instruction...................................................................................................................................................... 204
6.12.1 Modbus: Modbus Master Station Communication Instruction...............................................................................204
6.12.2 MODRW: Mdodbus and Write Instruction................................................................................................................ 205
6.12.3 Modlink: Modbus Form Instruction.............................................................................................................................207
6.12.4 XMT: Free-Port Sending (XMT) Instruction..............................................................................................................209
6.12.5 RCV: Free-Port Receiving (RCV) Instruction...........................................................................................................210
6.13 Data Check Instruction............................................................................................................................................................. 211
6.13.1 CCITT: Check Instruction............................................................................................................................................211
6.13.2 CRC16: Check Instruction...........................................................................................................................................212
6.13.3 LRC: Check Instruction................................................................................................................................................213
6.14 Enhanced Bit Processing Instruction..................................................................................................................................... 214
6.14.1 ZRST: Batch Bit Reset Instruction............................................................................................................................. 214
6.14.2 ZSET: Set Batch Bit Instruction..................................................................................................................................214
6.14.3 DECO: Decode Instruction..........................................................................................................................................215
6.14.4 ENCO: Encode Instruction..........................................................................................................................................215
6.14.5 BITS: Counting ON Bit In Word Instruction.............................................................................................................. 216
6.14.6 DBITS: Counting ON Bit In Double Word Instruction............................................................................................. 216
6.14.7 BON: Check Specified Bit Status Instruction........................................................................................................... 216
6.15 Word Contactor Instruction......................................................................................................................................................218
6.15.1 BLD: Word Bit Contactor LD Instruction................................................................................................................... 218
6.15.2 BLDI: Word Bit Contactor LDI Instruction................................................................................................................. 218
6.15.3 BAND: Word Bit Contactor AND Instruction.............................................................................................................219
6.15.4 BANI: Word Bit Contactor AND Instruction.............................................................................................................. 219
6.15.5 BOR: Word Bit Contactor OR Instruction................................................................................................................. 220
6.15.6 BORI: Word Bit Contactor ORI Instruction............................................................................................................... 220
6.15.7 BOUT: Word Bit Coil Output Instruction................................................................................................................... 222
6.15.8 BSET: Word Bit Coil Set Instruction.......................................................................................................................... 222
6.15.9 BRST: Word Bit Coil Reset Instruction..................................................................................................................... 223
6.16 Compare Contactor Instrucitons............................................................................................................................................. 224
6.16.1 Compare Integer LD (=,<,>,<>,>=,<=) Instrucitons.................................................................................. 224
6.16.2 Compare Integer AND (=,<,>,<>,>=,<=) Instruction.................................................................................225
6.16.3 Compare Integer OR (=,<,>,<>,>=,<=) Instruction................................................................................... 226
6.16.4 Compare Double Integer LDD (=,<,>,<>,>=,<=) Instruction................................................................... 226

MC Series Small PLC Programming Manual


88 Chapter 6 Application Instructions

6.16.5 Compare Double Integer ANDD (=,<,>,<>,>=,<=) Instruction................................................................ 228


6.16.6 Compare Double Integer ORD (=,<,>,<>,>=,<=) Instruction...................................................................229
6.16.7 LDR: Compare Floating Point Number Instruction..................................................................................................230
6.16.8 ANDR: Compare Floating Point Number Instruction.............................................................................................. 232
6.16.9 ORR: Compare Floating Point Number Instruction.................................................................................................233
6.16.10 CMP: Compare Integer Set Instruction...................................................................................................................234
6.16.11 LCMP: Compare Double Integer Set Instruction...................................................................................................234
6.16.12 RCMP: Compare Floating Point Number Set Instruction.....................................................................................235
6.17 Batch Data Processing Instructions....................................................................................................................................... 235
6.17.1 BKADD: ADD Batch Integer Data..............................................................................................................................235
6.17.2 BKSUB: SUB Batch Integer Data.............................................................................................................................. 236
6.17.3 BKCMP=,>,<,<>,<=,>=: Compare Batch Integer Data...........................................................................................237
6.18 Data Table Instruction:.......................................................................................................................................................... 238
6.18.1 LIMIT: Limit Control......................................................................................................................................................238
6.18.2 DBAND: Dead Band Control.......................................................................................................................................239

EC Series Small PLC Programming Manual


Chapter 6 Application Instructions 89

6.1 Program Flow Control Instruction

6.1.1 FOR: Cycle Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: FOR (S) Program steps 3
Offset
Operand Type Applicable elements
addressing
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description
S: Source operand

6.1.2 NEXT: Return From Cycle


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: NEXT Program steps 1

Function description Note

1. Instructions FOR and NEXT form a FOR-NEXT 1. The FOR-NEXT instruction must be used in pairs in
structure. a POU, or the program cannot pass the compiling.
2. When the power flow before FOR is valid, and the 2. Nesting of several FOR-NEXT structures is
cycle times (S) is larger than 0, the instructions in the supported. MC200 series PLC supports up to 8 levels
FOR-NEXT structure will be cyclically executed S of nesting. (The figure below shows a 3-level nesting
times. After that, the instructions after the FOR-NEXT of FOR-NEXT structure)
structure will be executed.
3. If the power flow before FOR is invalid, or the cycle
times (S) is less than or equal to 0, the program will
skip over the instructions in the FOR-NEXT structure
and execute the following instructions.
Example
LD SM1
MOV 0 D0
LD M2
EU 3. You can use the Conditional Jump (CJ) instruction to
FOR 100
jump out of the structure and end the loop in advance,
LD SM0
as shown in the following ladder diagram:
INC D100
NEXT
The initial conditions for the operation are: D0=0,
M2=OFF. When M2 changes from OFF to ON, the
instructions in the FOR-NEXT structure will be
consecutively executed for 100 times. D0 will increase
one for each cycle. When the cycle is over, D0 reaches
100.
90 Chapter 6 Application Instructions

4. It is prohibited to use the CJ instruction to jump into


a loop. The LAD program shown in the following figure
cannot pass the compiling.

5. The crossing of the structures MC-MCR and


FOR-NEXT is prohibited. LAD program shown in the
following figure cannot pass the compiling.

MC Series Small PLC Programming Manual


第六章 应用指令说明 91

 Note
The execution of the FOR-NEXT structure is time consuming. The bigger the cycle times is, or the more instructions are
contained in the loop, the longer it will take. To prevent the operation overtime error, use the WDT instruction in a
time-consuming loop.

6.1.3 LBL: Jump Label Definition


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: LBL (S) Program steps 3
Offset
Operand Type Applicable elements
addressing
S INT Constant

Operand description Example of error program

S: label number. Range: 0 ≤ S ≤ 127


Function description
1. A label numbered S is defined.
2. It is used to mark a specific jumping position for
Repeated
the CJ instruction. label No.
Note
Take care not to mark two labels with the same No.
in one POU, or the program cannot pass the
compiling. However, you can do so in different
POUs (for example, different sub-programs).

6.1.4 CJ: Conditional Jump


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: CJ (S) Program steps 3
Offset
Operand Type Applicable elements
addressing
S INT Constant

Operand description Example


92 Chapter 6 Application Instructions

S: label SN LD M0
CJ 0
Function description LD SM0
1. When the power flow is valid, the program MOV 100 D0
will jump to execute the instruction numbered Jump to LBL 0 CFEND
LBL 0
S.
LD M1
2. If the power flow is invalid, the program will MOV 200 D0
not jump, but execute the instruction following
1. Initial conditions: M0=OFF, M1=ON. The CJ instruction is not
CJ.
be executed, and D0 is 100. After executing CFEND, the current
Note cycle of the main program ends in advance, and the following LD
1. The jumping label S (0 ≤ S ≤ 127) for the CJ and MOV instructions are not executed.
instruction shall be a legal and defined label. 2. When M0 is ON, M1=ON, the program will execute the CJ
Otherwise, the user program cannot pass the instruction, skip over the “MOV 100 200” and CFEND
compiling. instructions, and jump to LBL 0 and execute “MOV 200 D0”
2. It is not allowed to use the CJ instruction to instruction. D0 is 200 then.
jump into a FOR-NEXT structure.
3. It is allowable to use the CJ instruction to
jump out of or into the MC-MCR structure or
SFC status. However, such operation will
damage the logic of the MC-MCR structure or
SFC status and make the program complex. It
is not recommended to do this.

6.1.5 CFEND: Conditional End From User Main Program


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: CFEND Program steps 1

Function description Example


1. When the power flow of the instruction is The current scan cycle ends
LD M0
valid, the current scan cycle of the main
CFEND
program ends immediately and the following
LD SM12
instructions in the main program will not be OUT Y0
executed.
2. When the power flow of the instruction is When the program is running, if M0=OFF, the CFEND instruction
invalid, the instruction enables no action, and will not enable any action. The following instructions LD and
the instruction after it will be executed in order. OUT will be executed. When M0 is ON, the CFEND instruction
will be executed, the main program will end the current scan
Note
cycle immediately, and the following instructions will not be
The CFEND must be used in the main executed.
program, or the program cannot pass the
compiling.

6.1.6 WDT: User Program Watchdog Reset


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: WDT Program steps 1

Function description
When the power flow is valid, the instruction will clear the user program watchdog, and the watchdog will restart timing.

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 93

6.1.7 EI: Enable Interrupt Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: EI Program steps 1

Function description
1. When the power flow of the EI instruction is valid, the interrupts in the current scan cycle will be enabled.
2. When the EI instruction is valid, the interrupt requests will be allowed to join the interrupt request queue to wait for
system response.

6.1.8 DI: Disable Interrupt Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: DI Program steps 1

Function description
1. When the power flow is valid, the global interrupt enable flag is inactive, that is, the global interrupt will be off.
2. When the global interrupt enable flag is inactive, the interrupt events will not generate any interrupt request.
Note
When the DI instruction is valid, the system will still respond to the unprocessed interrupt requests in the request
queue, but new interrupt events cannot generate interrupt requests.

6.1.9 CIRET: Conditional Return From User Interrupt Subprogram

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: CIRET Program steps 1

Function description
When the power flow is valid, the system will quit the current interrupt program immediately.

6.1.10 STOP: User Program Stop


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: STOP Program steps 1

Function description
When the power flow is valid, the system will immediately stop the execution of the user program.
94 Chapter 6 Application Instructions

6.1.11 CALL: Calling A Subprogram

LAD: MC280 MC200 MC100


Applicable to
MC80
Influenced flag bit
Determined by the
IL: CALL (SBR name) (PARAM1) (PARAM2) … Program steps
subprogram parameters

Function description
When the power flow is valid, the system will call the designated subprogram, execute it, and then return to the main
program to execute the instructions following the CALL instruction.
Note
1. The subprogram called by the CALL instruction must be defined in advance in the user program, or the program
cannot pass the compiling.
2. The operand element type in the CALL instruction must match the Data Type defined in the local variable table of
the subprogram, or the program cannot pass the compiling.
The following examples demonstrates some illegal matches.
Example 1: In the local variable table of subprogram SBR1, the data type of Operand 1 is DINT/DWORD.
The following usages are illegal:
 CALL SBR1 Z0 (The data type of Z element cannot be DINT/DWORD)
 CALL SBR1 C199 (The data type of elements C0 to C199 cannot be DINT/DWORD)
 CALL SBR1 K2X0 (Kn addressing 1 ≤ n ≤ 3, the data type cannot be DINT/DWORD)
Example 2: In the local variable table of the SBR1 subprogram, the data type of Operand 1 is INT/WORD, the
following usages are illegal:
 CALL SBR1 C200 (The data type of element C200 to C255 cannot be INT/WORD)
 CALL SBR1 K2X0 (Kn addressing 4 ≤ n ≤ 8, the data type cannot be INT/WORD)
3. The operand element type in the CALL instruction must match the Variable Type defined in the local variable table
in the subprogram, or the program will not pass the compiling.
The following examples demonstrates some illegal matches.
Example: In the local variable table of subprogram SBR1, the operand type of Operand 1 is OUT or IN_OUT,
the following usages are illegal:
 CALL SBR1 321 (constants cannot be changed, therefore it does not match OUT or IN_OUT)
 CALL SBR1 K4X0 (K4X0 is read-only, therefore it does not match OUT or IN_OUT)
 CALL SBR1 SD0 (SD0 is read-only, therefore it does not match OUT or IN_OUT)
4. The number of the operands in the CALL instruction must match the local variable table of the subprogram, or the
program will not pass the compiling.

6.1.12 CSRET: Conditional Return From User Subprogram

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: CSRET Program steps 1

Function description
When the power flow is valid, the program will quit the current subprogram and return to the upper level subprogram.

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 95

6.2 Data Transmission Instruction

6.2.1 MOV: Move Word Data Transmission Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: MOV (S) (D) Program steps 5
Offset
Operand Type Applicable elements
addressing
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D INT KnY KnM KnS KnLM D SD C T V Z R √

Operand description Note


S: Source operand 1. The MOV instruction supports signed and unsigned integers. If the two
D: Destination operand operands are both elements, the data type is signed integer. If the source
operand is a signed integer (for example, -10, +100), the destination operand is
Function description
also a signed integer. If the source operand is an unsigned double integer (for
When the power flow is valid, example, 100, or 45535), the destination operand will also be an unsigned
the content of S is assigned to integer.
D, and the value of S remains
2. The corresponding element C only supports C0 to C199.
unchanged.
Example
LD X0
MOV D0 D10
When X0 is ON, the content of D0 is assigned to D10, D10 = 500.

6.2.2 DMOV: Move Double Word Data Transmission Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: DMOV (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D DINT KnY KnM KnS KnLM D SD C V R √

Operand description Note

S: Source operand 1. The DMOV instruction supports signed and unsigned double integers. If the
D: Destination operand two operands of the instruction are elements, the data types are signed integers.
If the source operand of the instruction is a signed double integer (for example,
Function description
-10, +100), the destination operand will also be signed integer. If the source
When the power flow is valid, operand is the unsigned double integer (for example, 100, 45535), the
the content of S is assigned to destination operand will also be unsigned integer.
D, and the value of S remains 2. The corresponding element C only supports C200 to C255.
unchanged.
Example
LD X0
DMOV D0 D10

When X0 is ON, the content of (D0, D1) is assigned to (D10, D11). (D10, D11)
is 50000.
96 Chapter 6 Application Instructions

6.2.3 RMOV: Move Floating Point Number Data Transmission


Applicable to MC280 MC200 MC100 MC80
LAD:
Influenced flag bit

IL: RMOV (S) (D) Program steps 7


Offset
Operand Type Applicable elements
addressing
S REAL Constant D V R √
D REAL D V R √

Operand description Example

S: Source operand LD X0

D: Destination operand RMOV D0


D10
Function description
When X0 is ON, the content of (D0, D1) is assigned to (D10, D11). (D10, D11)
When the power flow is valid, is 50000.5.
the content of S is assigned to
D, and the value of S remains
unchanged.
6.2.4 BMOV: Move Data Block Transmission Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: BMOV (S1) (D) (S2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 INT KnX KnY KnM KnS KnLM D SD C T V R √
D INT KnY KnM KnS KnLM D C T V R √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description Example


LD X0
S: Source operand, starting
BMOV D0 D100 10
element of data block;
D: Destination operand, When X0 is ON, the contents of 10 elements starting with D0 are assigned to
starting element of data block; 10 elements starting with D100. D100 = D0, D101 = D1, ..., D109 = D9.
S2: size of data block
Function description
When the power flow is valid,
the contents of S2 elements
starting with S1 are assigned
to the S2 elements starting
with D, and the contents of S2
elements starting with S1
remain unchanged.

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 97

6.2.5 FMOV: Fill Data Block Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


Influenced flag bit
IL: FMOV (S1) (D) (S2) Program steps 7
Offset
Operand Type Applicable elements
addressing
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D INT KnY KnM KnS KnLM D C T V R √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description content of S1 remains unchanged.

S1: Source operand, starting Note


element of data block; 1. When S1, D and S2 use C element, the legal range is C0 to C199.
D: Destination operand, 2. S2 is larger than or equal to 0.
starting element of data block; 3. When S1 and D both use Kn addressing, Kn shall be the same.
S2: size of data block
Example
Function description LD X0
When the power flow is valid, FMOV D0 D100 10
the contents of S1 will be When X0 is ON, the content of D0 will be filled into 10 elements starting with
filled into S2 elements starting D100. D100 = D101 = ... = D109 = D0 = 500.
with D element, and the

6.2.6 DFMOV: Fill Data Block Double Word Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


Influenced flag bit
IL: DFMOV (S1) (D) (S2) Program steps 9
Offset
Operand Type Applicable elements
addressing
S1 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
D DINT KnY KnM KnS KnLM D C V R √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description Note


S1: Source operand 1. When S1, D and S2 use C element, the legal range is C200 to C255.
D: Destination operand, 2. S2 is larger than or equal to 0.
starting element of data block 3. When S1 and D are both Kn addressing, Kn shall be the same.
S2: size of data block Example
Function description LD X0
When the power flow is valid, DFMOV D0 D10 10
the contents of S1 will be When X0 is ON, the content of (D0, D1) will be filled into 10 × 2 units starting
filled into S2 elements starting with D10. (D10, D11) = (D12, D13) =...= (D28, D29) = (D0, D1) = 100000.
with D, and the content of S1
remains unchanged.
98 Chapter 6 Application Instructions

6.2.7 SWAP: Swap Bytes

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: SWAP (D) Program steps 3


Offset
Operand Type Applicable elements
addressing
D INT KnY KnM KnS KnLM D C T V Z R √

Operand description bytes has been swapped will be saved.

D: Destination operand, the Example


word element whose high/low LD X0
bytes are swapped. SWAP D0
When X0 is ON, the high/low bytes in D0 = 0x1027 (4135) will be swapped
Function description
and saved. D0 is then 0x2710 (10000).
When the power flow is valid,
the D element whose high/low

6.2.8 XCH: Exchange Word


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: XCH (D1) (D2) Program steps 5
Offset
Operand Type Applicable elements
addressing
D1 INT KnY KnM KnS KnLM D C T V Z R √
D2 INT KnY KnM KnS KnLM D C T V Z R √

Operand description Note

D1: destination operand 1 When using the Kn addressing mode, the Kn in D1 and D2 shall be the same.
D2: destination operand 2 Example
Function description LD X0
XCH D0 D10
When the power flow is valid,
D1 and D2 will exchange their When X0 is ON, D0 and D10 will exchange their values. Before the execution,
values. D0 is 5000 and D10 is 1000. After the execution, D0 is 1000 and D10 is 5000.

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 99

6.2.9 DXCH: Exchange Double Word Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: DXCH (D1) (D2) Program steps 7
Offset
Operand Type Applicable elements
addressing
D1 DINT KnY KnM KnS KnLM D C T V Z R √
D2 DINT KnY KnM KnS KnLM D C T V Z R √

Operand description Note

D1: destination operand 1 When using the Kn addressing mode, the Kn in D1 and D2 shall be the
D2: destination operand 2 same.

Function description Example


LD X0
When the power flow is valid,
DXCH D0 D10
D1 and D2 will exchange their
values. When X0 is ON, D0 and D10 will exchange their values. Before the
execution and (D0, D1) is 5000000, (D10, D11) is 1000000. After the
execution, (D0, D1) is 1000000 and (D10, D11) is 5000000.

6.2.10 PUSH: Push Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit
IL: PUSH (S1) (D) (S2) Program steps 7
Offset
Operand Type Applicable elements
addressing
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D INT D V R √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description to 1, and the push operation will not be executed.

S1: push value Note


D: the number of elements in 1. When the stack is illegal (for example, when the stack size ≤ 0, the
the stack. It is also the number of elements in the stack < 0, or when the stack size is beyond the
element at the stack bottom. limit), the system will report “Definition error of stack operated”.
S2: stack size 2. The stack size does not include the stack bottom element (the element
Function description designated by D).
3. S2 indicates the stack size. Range: ≥ 0.
1. When the power flow is
valid, the value of S1 will be Example
pushed onto the top of the LD M0
stack with D element as the PUSH D0 D100 10
bottom, and D will increase by
1. At this time, the address of
Stack
the stack top unit is the pointer
address of D plus the value of D0 D110 D109 D108 D107 D106 D105 D104 D103 D102 D101 D100
D.
2. When the value of D
1. When M0 is ON, push D0 into the stack with D100 as the stack bottom.
reaches S2, one more push
2. Before the execution, D0 is 1000, D100 is 8 and D109 is 0.
instruction will set the
operation carry flag (SM181) 3. After the execution, D0 is 1000, D100 is 9 and D109 is 1000.

6.2.11 FIFO: First-In-First-Out Instruction


100 Chapter 6 Application Instructions

LAD: Applicable to MC280 MC200 MC100 MC80


FIFO (D1) (D2) (S) Influenced flag bit
FIFO (D1) (D2) (S)
IL: FIFO (D1) (D2) (S) Program steps 7
Offset
Operand Type Applicable elements
addressing
D1 INT D V R √
D2 INT KnY KnM KnS KnLM D C T V Z R √
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description 3. S indicates the stack size. Range: ≥ 0.

D1: the number of elements in the stack. Example


Its element address plus 1 is the address
of the stack head.
D2: storage register for popped value
LD M0
S: queue size
FIFO D100 D0 10
Function description Stack
pointer
1. When the power flow is valid, the value
0 D110 D109 D108 D107 D106 D105 D104 D103 D102 D101 D100 D0
of the stack head (the element
immediately following D1) with D1 as the
1. When M0 is ON, the content of D101 is filled into D0, and at the
queue head is assigned to D2. At the
same time the contents of D101 ~ D110 move forward, and the
same time, the value of D1 subtracts 1,
D110 is filled with 0.
the contents of the S units after D1 will
move forward, and the last unit is filled 2. Before the execution: D0 = 0, D100 = 10, D101 = 1000, D102 =
with 0. 2000, ..., D109 = 9000, D110 = 10000.
2. When D1 is 0, it indicates that the 3. After the execution: D0 = 1000, D100 = 9, D101 = 2000, D102 =
stack is empty, the zero flag (SM180) will 3000,..., D109 = 10000, D110 = 0.
be set 1.
Note
1. When the stack is illegal (for example,
when the stack size ≤ 0, the number of
elements in the stack < 0, or when the
stack size is beyond the limit), the system
will report “Definition error of stack
operated”.
2. The stack size does not include the
stack bottom element (the element
designated by D1)

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 101

6.2.12 LIFO: Last-In-First-Out Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: LIFO (D1) (D2) (S) Program steps 7


Offset
Operand Type Applicable elements
addressing
D1 INT D V R √
D2 INT KnY KnM KnS KnLM D C T V Z R √
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description 3. S indicates the stack size. Range: ≥ 0.

D1: the number of elements in the queue. Its element Example


address plus 1 is the address of the queue’s head.
D2: storage register for popped value
S: queue size LD M0
LIFO D100 D0 10
Function description
Stack
1. When the power flow is valid, the value of the stack pointer
D0 D110 D109 D108 D107 D106 D105 D104 D103 D102 D101 D100
head with D1 as the stack bottom is assigned to D2,
and at the same time the value of D1 subtracts 1.
1. When M0 is ON, the content of D110 is assigned to
2. When D1 is 0, it indicates that the stack is empty,
D0, the content of units D101 ~ D110 remain
the zero flag (SM180) will be set 1.
unchanged.
Note 2. Before the execution: D0 = 0, D100 = 10, D101 =
1. When the stack is illegal (for example, when the 1000, D102 = 2000, ..., D109 = 9000, D110 = 10000.
stack size ≤ 0, the number of elements in the stack < 0, 3. After the execution: D0 = 10000, D100 = 9, D101 =
or when the stack size is beyond the limit), the system 1000, D102 = 2000, ..., D109 = 9000, D110 = 10000.
will report “Definition error of stack operated”.
2. The stack size does not include the stack bottom
element (the element designated by D1)
102 Chapter 6 Application Instructions

6.2.13 WSFR: Shift Right Word Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


Influenced flag bit Zero, carry, borrow
IL: WSFR (S1) (D) (S2) (S3) Program steps 9
Offset
Operand Type Applicable elements
addressing
S1 INT KnX KnY KnM KnS KnLM D SD C T V R √
D INT KnY KnM KnS KnLM D C T V R √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
S3 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description Example

S1: Source operand


D: Destination operand, starting unit of word string
LD X0
S2: size of destination word queue
WSFR D0 D100 10 3
S3: number of words filled rightward
D2 D1 D0
Function description
When the power flow is valid, the contents of S2 units D109 D108 D107 D106 D105 D104 D103 D102 D101 D100

starting with D unit will move rightward S3 words. The


rightmost S3 units will be discarded. At the same time, 1. When M0 is ON, the contents of 10 units starting
the contents of S3 units starting with S1 will be filled with D100 unit will move rightward 3 words. The
into the left end of the word string. rightmost units D102 ~ D100 will be discarded. At the
Note same time, the contents of the 3 units starting with D0
1. The elements with smaller SN are at the right, and will be filled into the left end of the word string.
the elements with larger SN are at the left. 2. Before the execution: D2=300, D1=200, D0=100.
2. S2 ≥ 0, S3 ≥ 0, S2 ≥ S3. D109=10000, D108=9000, D107=8000, D106=7000,
D105=6000, D104=5000, D103=4000, D102=3000,
3. When S1 and D both use Kn addressing, Kn shall
D101=2000, D100=1000.
be the same.
3. After the execution: D0 ~ D2 remain unchanged,
D2=300, D1=200, D0=100. D109=300, D108=200,
D107=100, D106=10000, D105=9000, D104=8000,
D103=7000, D102=6000, D101=5000, D100=4000.
..

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 103

6.2.14 WSFL: Shift Left Word Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


Influenced flag bit Zero, carry, borrow
IL: WSFL (S1) (D) (S2) (S3) Program steps 9
Offset
Operand Type Applicable elements
addressing
S1 INT KnX KnY KnM KnS KnLM D SD C T V R √
D INT KnY KnM KnS KnLM D C T V R √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
S3 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description Example


S1: source operand LD X0
D: destination operand, WSFL D0 D100 10 3
starting unit of word string
S2: size of destination word D2 D1 D0
queue
S3: number of words filled for D109 D108 D107 D106 D105 D104 D103 D102 D101 D100
right forward
Function description
1. When X0 is ON, the contents of 10 units starting with D100 will move leftward
When the power flow is valid, 3 words. The leftmost units D109 ~ D107 will be discarded. At the same time,
the contents of S2 units the contents of the 3 units starting with D0 will be filled into the right end of the
starting with D unit will move word string.
leftward S3 words. The 2. Before the execution: D0=100, D1=200, D2=300. D109=10000, D108=9000,
leftmost S3 units will be D107=8000, D106=7000, D105=6000, D104=5000, D103=4000, D102=3000,
discarded. At the same time, D101=2000, D100=1000
the contents of S3 units
3. After the execution: D0 ~ D2 remain unchanged: D2=300, D1=200, D0=100.
starting with S1 will be filled
D109=7000, D108=6000, D107=5000, D106=4000, D105=3000, D104=2000,
into the right end of the word
D103=1000, D102=300, D101=200, D100=100.
string.
Note
1. The elements with smaller
SN are at the right, and the
elements with larger SN are
at the left.
2. S2 ≥ 0, S3 ≥ 0, S2 ≥ S3.
3. When S1 and D both use
Kn addressing, Kn shall be
the same.
104 Chapter 6 Application Instructions

6.3 Integer Math Instructions

6.3.1 ADD: Add Integer Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


Influenced flag bit Zero, carry, borrow
IL: ADD (S1) (S2) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D INT KnY KnM KnS KnLM D C T V Z R √

Operand description will be set. When the operation result is less than
–32768, the borrow flag bit (SM182) will be set.
S1: Source operand 1
S2: Source operand 2 Example

D: Destination operand
Function description
LD X0
1. When the power flow is valid, add S1 and S2, and
ADD D0 D1 D10
assign the operation result to D.
When X0 is ON, add D0 (1000) and D1 (2000), and
2. When the operation result (D) is larger than
assign the result to D10, D10 = 3000.
32767, the carry flag bit (SM181) will be set. When
the operation result is 0, the zero flag bit (SM180)

6.3.2 SUB: Subtract Integer Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit Zero, carry, borrow
IL: SUB (S1) (S2) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D INT KnY KnM KnS KnLM D C T V Z R √

Operand description Example

S1: Source operand 1


S2: Source operand 2
D: Destination operand LD X0
SUB D0 D1 D10
Function description
When X0 is ON, D0 (1000) subtracts D1 (2000),
1. When the power flow is valid, S1 subtracts S2, and the result –1000 is assigned to D10.
and the operation result is assigned to D.
2. When the operation result (D) is larger than
32767, the carry flag bit (SM181) will be set. When
the operation result is 0, the zero flag bit (SM180)
will be set. When the operation result is less than
–32768, the borrow flag will be set bit (SM182).

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 105

6.3.3 MUL: Multiply Integer Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


Influenced flag bit Zero, carry, borrow
IL: MUL (S1) (S2) (D) Program steps 8
Offset
Operand Type Applicable elements
addressing
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D DINT KnY KnM KnS KnLM D C V R √

Operand description Note


S1: Source operand 1 The operation result of MUL instruction is a 32-bit
S2: Source operand 2 data.
D: Destination operand Example
Function description
When the power flow is valid, S1 multiplies S2, and
the operation result is assigned to D. LD X0
MUL D0 D1 D10
When X0 is ON, D0 (1000) multiplies D1 (2000),
and the result 2000000 is assigned to (D10, D11).

6.3.4 DIV: Divide Integer Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit Zero, carry, borrow
IL: DIV (S1) (S2) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D INT KnY KnM KnS KnLM D C T V Z R √

Operand description Note


S1: Source operand 1 S2 ≠ 0, otherwise, the system will report “Divided by 0
S2: Source operand 2 error”, and the instruction will not be executed.
D: Destination operand Example
Function description
When the power flow is valid, S1 is divided by S2, and
the operation result is assigned to D (D includes 2 LD X0
units, one storing the quotient, the other storing the DIV D0 D1 D10
remainder). When X0 is ON, D0 (2500) is divided by D1 (1000), the
result is assigned to (D10, D11). D10=2, D11=500.
106 Chapter 6 Application Instructions

6.3.5 SQT: Square Root Integer Instructions

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit Zero, carry, borrow

IL: SQT (S) (D) Program steps 5


Offset
Operand Type Applicable elements
addressing
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D INT KnY KnM KnS KnLM D C T V Z R √

Operand description decimal fraction, the borrow flag bit (SM182) will be set.

S: Source operand Note


D: Destination operand S ≥ 0, otherwise, the system will report operand error, and the instruction
Function description will not be executed.

1. When the power flow is Example


valid, S is extracted, and the LD X0
operation result is assigned to SQT D0 D10
D.
When X0 is ON, extract D0 (1000), and assign the result to D10, D10=31.
2. When the operation result
(D) is 0, the zero flag bit
(SM180) will be set. When the
operation result rounds off the

6.3.6 INC: Increment Integer Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit Zero, carry, borrow

IL: INC (D) Program steps 3


Offset
Operand Type Applicable elements
addressing
D INT KnY KnM KnS KnLM D C T V Z R √

Operand description Note


D: Destination operand 1. This instruction is a cyclic increase instruction. Range: –32768 ~ 32767.
Function description 2. The supported range of C element: C0 ~ C199.

When the power flow is valid, Example


D increases by 1. LD X0
INC D0
When X0 is ON, D0 (1000) is increased by 1. After the execution, D0 is
1001.

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 107

6.3.7 DEC: Decrement Integer Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


Influenced flag bit Zero, carry, borrow
IL: DEC (D) Program steps 3
Offset
Operand Type Applicable elements
addressing
D INT KnY KnM KnS KnLM D C T V Z R √
Operand description Note

D: Destination operand This instruction is a cyclic decrease instruction, with the range of –32768 ~
32767.
Function description
Example
When the power flow is valid,
D decreases 1. LD X0
DEC D0
When X0 is ON, D0 (1000) decreases 1. After the execution, D0=999.

6.3.8 VABS: Integer Absolute Value Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


Influenced flag bit Zero, carry, borrow
IL: VABS (S) (D) Program steps 5
Offset
Operand Type Applicable elements
addressing
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D INT KnY KnM KnS KnLM D C T V Z R √

Operand description Example

S: Source operand LD X0
D: Destination operand VABS D0 D10

Function description When X0 is ON, get the absolute value of D0 (-1000), and assign the result
to D10. D10=1000.
When the power flow is valid,
get the absolute value of S
and assign it to D.
Note
The range of S shall be
-32767 ~ 32767. When S is
-32768, the system will report
operand error, and the
instruction will not be
executed.
108 Chapter 6 Application Instructions

6.3.9 NEG: Negative Integer Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


Influenced flag bit Zero, carry, borrow

IL: NEG (S) (D) Program steps 5


Offset
Operand Type Applicable elements
addressing
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D INT KnY KnM KnS KnLM D C T V Z R √

Operand description Example

S: Source operand LD X0
D: Destination operand NEG D0 D10

Function description When X0 is ON, get the negative value of D0 (1000) and assign the result to
D10. D10=-1000.
When the power flow is valid, get
the negative value of S and
assign the result to D.
Note
The range of S shall be –32767 ~
32767. When S is –32768, the
system will report operand error,
and the instruction will not be
executed.
6.3.10 DADD: Add Double Integer Instruction
LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit Zero, carry, borrow
IL: DADD (S1) (S2) (D) Program steps 10
Offset
Operand Type Applicable elements
addressing
S1 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
S2 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
D DINT KnY KnM KnS KnLM D C V R √

Operand description the borrow flag bit (SM182) will be set.


Example
S1: Source operand 1
LD X0
S2: Source operand 2
DADD D0 D2 D10
D: destination operand When X0 I ON, add the value (100000) of (D0, D1) and the value (200000)
of (D2, D3), and assign the result to (D10, D11). (D10, D11) = 300000.
Function description
1. When the power flow is valid,
add S1 and S2, and assign the
operation result to D.
2. When the operation result
(D) > 2147483647, the carry flag
bit (SM181) will be set. When the
operation result is 0, the zero flag
bit (SM180) will be set. When the
operation result < -2147483648,

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 109

6.3.11 DSUB: Subtract Double Integer Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


Influenced flag bit Zero, carry, borrow
IL: DSUB (S1) (S2) (D) Program steps 10
Offset
Operand Type Applicable elements
addressing
S1 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
S2 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
D DINT KnY KnM KnS KnLM D C V R √

Operand description the operation result < -2147483648, the borrow flag bit
(SM182) will be set.
S1: Source operand 1
S2: Source operand 2 Example

D: Destination operand
Function description
LD X0
1. When the power flow is valid, S1 subtracts S2, and
DSUB D0 D2 D10
the operation result is assigned to D.
When X0 is ON, the value (100000) of (D0, D1)
2. When the operation result (D) > 2147483647, the
subtracts the value (200000) of (D2,D3), and the result
carry flag bit (SM181) will be set. When the operation
–100000 is assigned to (D10, D11).
result is 0, the zero flag bit (SM180) will be set. When

6.3.12 DMUL: Multiply Double Integer Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


Influenced flag bit Zero, carry, borrow
IL: DMUL (S1) (S2) (D) Program steps 10
Offset
Operand Type Applicable elements
addressing
S1 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
S2 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
D DINT KnY KnM KnS KnLM D C V R √

Operand description Example

S1: Source operand 1


S2: Source operand 2
D: Destination operand LD X0

Function description DMUL D0 D2 D10


When X0 is ON, the value (83000) of (D0, D1)
When the power flow is valid, S1 multiplies S2, and the
multiplies the value (2000) of (D2,D3), and the result
result is assigned to D.
1660000000 is assigned to (D10, D11).
Note
The result of the DMUL instruction is a 32-bit data, and
overflow may occur.
110 Chapter 6 Application Instructions

6.3.13 DDIV: Divide Double Integer Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


Influenced flag bit Zero, carry, borrow
IL: DDIV (S1) (S2) (D) Program steps 10
Offset
Operand Type Applicable elements
addressing
S1 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
S2 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
D DINT KnY KnM KnS KnLM D C V R √

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 111

Operand description Note


S1: Source operand 1 S2 ≠ 0, otherwise, the system will report “Divided by 0 error”, and the
S2: Source operand 2 instruction will not be executed.
D: Destination operand Example
Function description LD X0
When the power flow is valid, S1 DDIV D0 D2 D10
is divided by S2, and the When X0 is ON, the value (83000) of (D0, D1) is divided by the value (2000)
operation result is assigned to D of (D2, D3), and the result is assigned to (D10, D11) and (D12,D13). (D10,
(D includes 4 units, with the first D11) = 41, (D12, D13) = 1000.
two storing the quotient, the
other two storing the remainder)

6.3.14 DSQT: Square Root Double Integer Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit Zero, carry, borrow

IL: DSQT (S) (D) Program steps 7


Offset
Operand Type Applicable elements
addressing
S DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
D DINT KnY KnM KnS KnLM D C V R √

Operand description Note


S: Source operand S ≥ 0, otherwise, the system will report operand error, and the instruction
D: Destination operand will not be executed.

Function description Example

1. When the power flow is LD X0


valid, S is extracted, and the DSQT D0 D10
operation result is assigned to
When X0 is ON, extract the value (83000) of (D0, D1), and assign the
D.
result to (D10, D11). (D10, D11) = 288.
2. When the operation result
(D) is 0, the zero flag bit
(SM180) will be set. When the
operation result rounds off the
decimal fraction, the borrow
flag bit (SM182) will be set.
112 Chapter 6 Application Instructions

6.3.15 DINC: Increment Double Integer Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit Zero, carry, borrow
IL: DINC (D) Program steps 4
Offset
Operand Type Applicable elements
addressing
D DINT KnY KnM KnS KnLM D C V R √

Operand description Note


D: Destination operand 1. This instruction is a cyclic increase instruction. Range: -2147483648 ~
Function description 2147483647.
2. The supported range of C element: C200 ~ C255.
When the power flow is valid,
D increases 1. Example
LD X0
DINC D0
When X0 is ON, the value (100000) of (D0, D1) increases 1. After the
execution, (D0, D1) = 100001.

6.3.16 DDEC: Decrement Double Integer Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit Zero, carry, borrow
IL: DDEC (D) Program steps 4
Offset
Operand Type Applicable elements
addressing
D DINT KnY KnM KnS KnLM D C V R √

Operand description Note


D: Destination operand This instruction is a cyclic decrease instruction. Range: -2147483648 ~
Function description 2147483647

When the power flow is valid, Example


D decreases 1. LD X0
DDEC D0

When X0 is ON, the value (100000) of (D0, D1) decreases 1. After the
execution, (D0, D1) = 99999.

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 113

6.3.17 DVABS: Double Integer Absolute Value Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


Influenced flag bit Zero, carry, borrow
IL: DVABS (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
D DINT KnY KnM KnS KnLM D C V R √

Operand description Example

S: Source operand LD X0
D: Destination operand DVABS D0 D10

Function description When X0 is ON, get the absolute value (100000) of (D0, D1) and assign
When the power flow is valid, the result to (D10, D11). (D10, D11) = 100000.
get the absolute value of S
and assign the result to D.
Note
The range of S shall be
-2147483647 ~ 2147483647.
When S is -2147483648, the
system will report operand
error, and the instruction will
not be executed.
6.3.18 DNEG: Negative Double Integer Instruction
LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit Zero, carry, borrow
IL: DNEG (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
D DINT KnY KnM KnS KnLM D C V R √

Operand description instruction will not be executed.

S: Source operand Example


D: Destination operand LD X0
Function description DNEG D0 D10

When the power flow is valid, When X0 is ON, get the negative value (-100000) of (D0, D1), and assign
get the negative value of S the result to (D10, D11). (D10, D11) = -100000.
and assign the result to D.
Note
The range of S shall be
-2147483647 ~ 2147483647.
When the value of S is
-2147483648, the system will
report operand error, and the
114 Chapter 6 Application Instructions

6.3.19 SUM: Sum Integer Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit Zero, carry, borrow
IL: SUM (S1) (S2) (D) Program steps 8
Offset
Operand Type Applicable elements
addressing
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D DINT KnY KnM KnS KnLM D C V R √

Operand description Example

S1: Source operand, starting


unit of summing LD SM0
MOV 1000 D0
S2 : Source operand, number
MOV 2000 D1
of units to be summed up
MOV 3000 D2
D: Destination operand, MOV 4000 D3
summing result MOV 5000 D4
LD X0
Function description
SUM D0 5 D100
When the power flow is valid,
the contents of S2 units
When X0 is ON, the integers of 5 elements starting form D0 will be
starting with the starting unit
summed up, and the result is assigned to (D100, D101), (D100, D101) =
(S1) will be summed up, and
D0+...+D4 = 15000.
the summing result is
assigned to the D unit.
Note
1. The operation result of the
SUM instruction is a 32-bit
data.
2. 0 ≤ S2 ≤ 255, or system will
report operand error..
3. Since D is a 32-bit data, the
carry and borrow flags are
constantly 0, and the zero flag
is determined by the final
summing result.

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 115

6.3.20 DSUM: Sum Double Integer Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit Zero, carry, borrow
IL: DSUM (S1) (S2) (D) Program steps 9
Offset
Operand Type Applicable elements
addressing
S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D DINT KnY KnM KnS KnLM D C V R √

Operand description Note

S1: Source operand, starting 0 ≤ S2 ≤ 255, or the system will report operand error.
unit of summing Example
S2: Source operand, number LD SM0
of data to be summed up
DMOV 100000 D0
D: destination operand,
DMOV 200000 D2
summing result
DMOV 300000 D4
Function description DMOV 400000 D6
When the power flow is valid, DMOV 500000 D8
the contents of S2 × 2 units LD X0
starting with the starting unit
DSUM D0 5 D100
(S1) will be summed up, and
When X0 is ON, the double integers of 5 × 2 units starting with D0 will be
the summing result is
summed up, and the result is assigned to (D100, D101).
assigned to the D unit.

6.4 Floating-Point Number Math Instruction

6.4.1 RADD: Add Floating Point Number Instruction


MC280 MC200
LAD: Applicable to
MC100
Influenced flag bit Zero, carry, borrow
IL: RADD (S1) (S2) (D) Program steps 10
Offset
Operand Type Applicable elements
addressing
S1 REAL Constant D V R √
S2 REAL Constant D V R √
D REAL D V R √

Operand description + 038) ~ (1.701412e + 038), the carry flag bit (SM181) will be set. When
the operation result is 0, the zero flag bit (SM180) will be set.
S1: Source operand 1
S2: Source operand 2 Example

D: Destination operand LD X0

Function description RADD D0 D2 D10

1. When the power flow is When X0 is ON, add the value (-10000.2) of (D0, D1) and the value
valid, add S1 and S2, and (2000.5) of (D2, D3), and the result -7999.7 is assigned to (D10, D11).
assign the operation result to
D.
2. When the operation result
(D) is not within (-1.701412e

6.4.2 RSUB: Subtract Floating Point Number Instruction


116 Chapter 6 Application Instructions

MC280 MC200
LAD: Applicable to
MC100
Influenced flag bit Zero, carry, borrow
IL: RSUB (S1) (S2) (D) Program steps 10
Offset
Operand Type Applicable elements
addressing
S1 REAL Constant D V R √
S2 REAL Constant D V R √
D REAL D V R √

Operand description Example

S1: Source operand 1


S2: Source operand 2
LD X0
D: Destination operand
RSUB D0 D2 D10
Function description
When X0 is ON, the value (2000.5) of (D2, D3) is
1. When the power flow is valid, S2 is subtracted subtracted from the value (-10000.2) of (D0, D1),
from S1, and the operation result is assigned to D. and the result -12000.7 is assigned to (D10, D11).
2. When the operation result (D) is not within
(-1.701412e + 038) ~ (1.701412e + 038), the carry
flag bit (SM181) will be set. When the operation
result is 0, the zero flag bit (SM180) will be set.
6.4.3 RMUL: Multiply Floating Point Number Instruction

LAD: Applicable to MC200 MC100


Influenced flag bit Zero, carry, borrow
IL: RMUL (S1) (S2) (D) Program steps 10
Offset
Operand Type Applicable elements
addressing
S1 REAL Constant D V R √
S2 REAL Constant D V R √
D REAL D V R √

Operand description Example

S1: Source operand 1


S2: Source operand 2
LD X0
D: Destination operand
RMUL D0 D2 D10
Function description When X0 is ON, the value (-10000.2) of (D0, D1),
1. When the power flow is valid, S1 multiplies S2, multiplies the value (2000.5) of (D2, D3), and the
and the operation result is assigned to D. result -20005400.0 is assigned to (D10, D11)
2. When the operation result (D) is not within (actually the product is -20005400.1, but is rounded
(-1.701412e + 038) ~ (1.701412e + 038), the carry off to the calculation precision).
flag bit (SM181) will be set. When the operation
result is 0, the zero flag bit (SM180) will be set.

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 117

6.4.4 RDIV: Divide Floating Point Number Instruction


LAD: Applicable to MC280 MC200 MC100
Influenced flag bit Zero, carry, borrow
IL: RDIV (S1) (S2) (D) Program steps 10
Offset
Operand Type Applicable elements
addressing
S1 REAL Constant D V R √
S2 REAL Constant D V R √
D REAL D V R √
Operand description Note
S1: Source operand 1 S2 ≠ 0, or the system will report “Divided by 0 error”,
S2: Source operand 2 and the RDIV instruction will not be executed.
D: Destination operand Example
Function description
1. When the power flow is valid, S1 is divided by S2,
LD X0
and the operation result is assigned to D (which
includes 4 units, with the first two storing the RDIV D0 D2 D10
quotient, the other two storing the remainder) When X0 is ON, the value -10000.2 of (D0, D1) is
2. When the operation result (D) is not within divided by the value 2000.5 of (D2, D3), and the
(-1.701412e + 038) ~ (1.701412e + 038), the carry result -4.998850 is assigned to (D10, D11).
flag bit (SM181) will be set. When the operation
result is 0, the zero flag bit (SM180) will be set.

6.4.5 RSQT: Square Root Floating Point Number Instruction


LAD: Applicable to MC280 MC200 MC100
Influenced flag bit Zero, carry, borrow
IL: RSQT (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S REAL Constant D V R √
D REAL D V R √

Operand description Note

S: Source operand S ≥ 0, or the system will report operand error, and


D: Destination operand the instruction will not be executed.

Function description Example

1. When the power flow is valid, S is extracted, and


the operation result is assigned to D.
LD X0
2. When the operation result (D) is 0, the zero flag
RSQT D0 D10
bit (SM180) will be set.
When X0 is ON, extract the value (10000.2) of (D0,
D1), and assign the result 100.000999 to (D10,
D11).
118 Chapter 6 Application Instructions

6.4.6 RVABS: Floating Point Number Absolute Value Instruction


LAD: Applicable to MC280 MC200 MC100
Influenced flag bit Zero, carry, borrow
IL: RVABS (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S REAL Constant D V R √
D REAL D V R √

Operand description Example

S: Source operand
D: Destination operand
LD X0
Function description RVABS D0 D10
When the power flow is valid, get the absolute value When X0 is ON, get the absolute value (10000.2) of
of S and assign the value to D. (D0, D1), and assign the result to (D10, D11).
6.4.7 RNEG: Negative Floating Point Number Instruction
LAD: Applicable to MC280 MC200 MC100
Influenced flag bit Zero, carry, borrow
IL: RNEG (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S REAL Constant D V R √
D REAL D V R √

Operand description Example

S: Source operand
D: Destination operand
Function description LD X0
RNEG D0 D10
When the power flow is valid, get the negative value
of S and assign the result to D. When X0 is ON, get the negative value -10000.2 of
(D0, D1) and assign the result to (D10, D11).

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 119

6.4.8 SIN: Floating Point Number Sin Instruction


LAD: Applicable to MC280 MC200 MC100
Influenced flag bit Zero, carry, borrow
IL: SIN (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S REAL Constant D V R √
D REAL D V R √

Operand description Example

S: Source operand
D: Destination operand
Function description LD X0

1. When the power flow is valid, get the SIN value of S SIN D0 D10
(unit: radian), and assign the result to D. When X0 is ON, get the SIN value of (D0, D1) =1.57,
2. When the operation result (D) is 0, the zero flag bit and assign the value 1 to (D10, D11).
(SM180) will be set.
6.4.9 COS: Floating Point Number COS Instruction
LAD: Applicable to MC280 MC200 MC100
Influenced flag bit Zero, carry, borrow
IL: COS (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S REAL Constant D V R √
D REAL D V R √

Operand description Example

S: Source operand
D: Destination operand
LD X0
Function description
COS D0 D10
1. When the power flow is valid, get the COS value of When X0 is ON, get the COS value of (D0, D1) 3.14,
S (unit: radian), and assign the result to D. and assign the result -0.999999 to (D10, D11).
2. When the operation result (D) is 0, the zero flag bit
(SM180) will be set.
120 Chapter 6 Application Instructions

6.4.10 TAN: Floating Point Number TAN Instruction


LAD: Applicable to MC280 MC200 MC100
Influenced flag bit Zero, carry, borrow
IL: TAN (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S REAL Constant D V R √
D REAL D V R √

Operand description result is 0, the zero flag bit (SM180) will be set.

S: Source operand Example


D: Destination operand LD X0
TAN D0 D10
Function description
When X0 is ON, get the TAN value of (D0, D1) 1.57, and assign the result
1. When the power flow is 1255.848398 to (D10, D11).
valid, get the TAN value of S
(unit: radian), and assign the
result to D.
2. When the operation result
(D) is not within (-1.701412e
+ 038) ~ (1.701412e + 038),
the carry flag bit (SM181) will
be set. When the operation

6.4.11 POWER: Floating Point Number Exponentiation Instruction


LAD: Applicable to MC280 MC200 MC100
Influenced flag bit Zero, carry, borrow
IL: POWER (S1) (S2) (D) Program steps 10
Offset
Operand Type Applicable elements
addressing
S1 REAL Constant D V R √
S2 REAL Constant D V R √
D REAL D V R √

Operand description 3. When the operation result is 0, the zero flag bit (SM180) will be set.

S1: Source operand 1 Example


S2: Source operand 2 LD X0
D: Destination operand POWER D0 D2 D10
Function description When X0 is ON, get the (D2, D3)th power of (D0, D1) (i.e. 55.03.0), and
assign the result 166375.0 to (D10, D11).
1. When the power flow is
valid, get the S2th power of Note
S1, and assign the result to D. 1. When S1 = 0 and S2 ≤ 0, the system will report operand error, and the
2. When the operation result instruction will not be executed.
(D) is not within 2. When S1 < 0 and the mantissa of S2 is not 0, the system will report
(-1.701412e+038) ~ operand error, and the instruction will not be executed.
(1.701412e+038), the carry
flag bit (SM181) will be set.

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 121

6.4.12 LN: Floating Point Number LN Instruction


LAD: Applicable to MC280 MC200 MC100
Influenced flag bit Zero, carry, borrow
IL: LN (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S REAL Constant D V R √
D REAL D V R √

Operand description Example


LD X0
S: Source operand
LN D0 D10
D: Destination operand
When X0 is ON, get the LN value of (D0, D1) 1000.0, and assign the result
Function description
6.907755 to (D10, D11).
1. When the power flow is
valid, get the LN value of S1,
and assign the result to D.
2. When the operation result
(D) is not within
(-1.701412e+038) ~
(1.701412e+038), the carry
flag bit (SM181) will be set.
When the operation result is 0,
the zero flag bit (SM180) will
be set.
6.4.13 EXP: Floating Point Number EXP Instruction
LAD: Applicable to MC280 MC200 MC100
Influenced flag bit Zero, carry, borrow
IL: EXP (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S REAL Constant D V R √
D REAL D V R √

Operand description the zero flag bit (SM180) will be set.

S: Source operand Example


D: Destination operand LD X0
EXP D0 D10
Function description
When X0 is ON, get the EXP value of (D0, D1) “10.0”, and assign the
1. When the power flow is
result 22026.464844 to (D10, D11).
valid, get the EXP value of S,
and assign the result to D.
2. When the operation result
(D) is not within
(-1.701412e+038) ~
(1.701412e+038), the carry
flag bit (SM181) will be set.
When the operation result is 0,
122 Chapter 6 Application Instructions

6.4.14 RSUM: Sum Floating Point Number Instruction

LAD: Applicable to MC280 MC200 MC100


Influenced flag bit Zero, carry, borrow
IL: RSUM (S1) (S2) (D) Program steps 9
Offset
Operand Type Applicable elements
addressing
S1 REAL D V R √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D V R √
D REAL D V R √

Operand description Example

S1: Source operand, starting LD SM0


unit of summing RMOV 10000.1 D0
S2: Source operand, number RMOV 20000.2 D2
of units to be summed up RMOV 30000.3 D4
D: Destination operand, RMOV 40000.4 D6
summing result RMOV 50000.5 D8
Function description LD X0
When the power flow is valid, RSUM D0 5
the contents of S2 × 2 units D100
starting with S1 will be When X0 is ON, the floating point numbers of the 5 × 2 units starting with
summed up, and the floating D0 will be summed up, and the result is assigned to (D100, D101). (D100,
point number summing result D101) = (D0, D1) + ... + (D8, D9) = 150001.5.
is assigned to the D unit.
Note
1. 0 ≤ S2 ≤ 255, or the system
will report operand error.
2. When overflow occurs, the
summing operation will stop.

6.4.15 ASIN: Arc Sine Instruction

LAD: Applicable to MC280


Influenced flag bit Zero, carry, borrow
IL: ASIN (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S REAL Constant D V R √
D REAL D V R √

Operand description 2. When the operation result (D) is zero, set SM180
zero.
S: Source operand
D: Destination operand
Function description
1. When the power flow is valid, get the Arc SIN
value of S, and assign the result to D.

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 123

Note ASIN D0 D10


When S > 1 or S < -1, the system will report operand When SM0 is ON, get the Arc SIN value of (D0, D1)
(0.500000), and assign the result to (D10, D11),
error, and the instruction will not be executed. (D10, D11) = 0.523599.
Example

LD SM0

6.4.16 ACOS: Arc Cosine Instruction

LAD: Applicable to MC280


Influenced flag bit Zero, carry, borrow
IL: ACOS (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S REAL Constant D V R √
D REAL D V R √

Operand description Example

S: Source operand
D: Destination operand
Function description LD SM0
1. When the power flow is valid, get the Arc COS ACOS D0 D10
value of S, and assign the result to D. When SM0 is ON, get the Arc SIN value of (D0, D1)
2. When the operation result (D) is zero, set SM180 (0.500000), and assign the result to (D10, D11),
to zero. (D10, D11) = 1.047198.
Note
When S > 1 or S < -1, the system will report operand
error, and the instruction will not be executed.

6.4.17 ATAN: Arc Tangent Instruction

LAD: Applicable to MC280


Influenced flag bit Zero, carry, borrow
IL: ATAN (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S REAL Constant D V R √
D REAL D V R √

Operand description Example

S: Source operand
D: Destination operand
Function description
LD SM0
1. When the power flow is valid, get the Arc TAN ATAN D0 D10
value of S, and assign the result to D.
2. When the operation result (D) is zero, set SM180 When SM0 is ON, get the Arc TAN value of (D0, D1)
to zero. (3.140), and assign the result to (D10, D11), (D10,
D11) = 1.262481.

6.4.18 LOG: Floating Point Common Logarithm


LAD: Applicable to MC280
124 Chapter 6 Application Instructions

Influenced flag bit Zero, carry, borrow


IL: LOG (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S REAL Constant D V R √
D REAL D V R √

Operand description Example

S: Source operand
D: Destination operand
Function description LD SM0
1. When the power flow is valid, common LOG D0 D10
logarithm [l(ogarithm whose base is "10"] ") of S When SM0 is ON, common logarithm [(logarithm
is calculated, and assign the result to D. whose base is "10"] ")of D0 (3) is calculated, and
2. When the operation result (D) is zero, set SM180 assign the result to D10 (D11), D10 (D11) =
to zero. 0.477121.

6.4.19 RAD: Floating Point Degrees to Radians Conversion

LAD: Applicable to MC280


Influenced flag bit Zero, carry, borrow
IL: RAD (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S REAL Constant D V R √
D REAL D V R √

Operand description Example

S: Source operand
D: Destination operand
Function description LD SM0
1. When the power flow is valid, the unit of S is RAD D0 D10
converted from degrees into radians, and the When SM0 is ON, get the radians value of D0 (D1),
operation result is stored to D. and assign the result to D10 (D11), D10 (D11) =
2. When the operation result (D) is zero, set SM180 3.141593.
to zero.

6.4.20 DEG: Floating Point Radians to Degrees Conversion

LAD: Applicable to MC280


Influenced flag bit Zero, carry, borrow
IL: DEG (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S REAL Constant D V R √
D REAL D V R √

Operand description Function description

S: Source operand 1. When the power flow is valid, the unit of S is


converted from radians into degrees, and the
D: Destination operand operation result is stored to D.
2. When the operation result (D) is zero, set SM180

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 125

to zero.
Example

LD SM0
DEG D0 D10
When SM0 is ON, get the degrees value of D0 (D1),
and assign the result to D10 (D11), D10 (D11) =
171.8873.

6.5 Data Converting Instruction

6.5.1 DTI: Double Integer To Integer Instruction


LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit Zero, carry, borrow


IL: DTI (S) (D) Program steps 6
Offset
Operand Type Applicable elements
addressing
S DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
D INT KnY KnM KnS KnLM D C T V Z R √

Operand description Note

S: Source operand When S is not within –32768 ~ 32767, the system will report operand error
D: Destination operand and will not execute the conversion. D will not change.

Function description Example

When the power flow is valid, LD X0


S will be converted from DTI D0 D10
double integer to integer, and When X0 is ON, (D0, D1) 10000 will be converted from double integer to
the result is assigned to D. integer and the result 10000 is assigned to D10.
126 Chapter 6 Application Instructions

6.5.2 ITD: Integer To Double Integer Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit Zero, carry, borrow
IL: ITD (S) (D) Program steps 6
Offset
Operand Type Applicable elements
addressing
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D DINT KnY KnM KnS KnLM D C V R √

Operand description integer to double integer, and the result is assigned to D.

S: Source operand Example


D: Destination operand LD X0
Function description ITD D0 D10

When the power flow is valid, When X0 is ON, D0 (1000) will be converted from integer to double integer,
S will be converted from and the result 1000 is assigned to (D10, D11).

6.5.3 FLT: Integer To Floating Point Number Instruction


LAD: Applicable to MC280 MC200 MC100
Influenced flag bit Zero, carry, borrow
IL: FLT (S) (D) Program steps 6
Offset
Operand Type Applicable elements
addressing
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D REAL D V R √

Operand description number, and the result is assigned to D.

S: Source operand Example

D: Destination operand LD
X0
Function description
FLT
When the power flow is valid,
D0
S will be converted from
D10
integer to floating point
When X0 is ON, D0 (10005) will be converted from integer to floating point
number, and the result 10005.0 is assigned to (D10, D11).
6.5.4 DFLT: Double Integer To Floating Point Number Instruction
LAD: Applicable to MC280 MC200 MC100
Influenced flag bit Zero, carry, borrow
IL: DFLT (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
D REAL D V R √

Operand description double integer to floating point number, and the result is assigned to D.

S: Source operand Example


D: Destination operand LD X0
Function description DFLT D0 D10

When the power flow is valid, When X0 is ON, (D0, D1) 100000 will be converted from integer to floating
S will be converted from point number, and the result 100000.0 is assigned to (D10, D11).

6.5.5 INT: Floating Point Number To Integer Instruction

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 127

LAD: Applicable to MC280 MC200 MC100

Influenced flag bit Zero, carry, borrow

IL: INT (S) (D) Program steps 6


Offset
Operand Type Applicable elements
addressing
S REAL Constant D V R √
D INT KnY KnM KnS KnLM D C T V Z R √

Operand description Note

S: Source operand When S > 32767, D=32767. When S<-32768, D = -32768, and at the
D: Destination operand same time the carry (overflow) flag bit will be set.

Function description Example


LD X0
1. When the power flow is
INT D0 D10
valid, S will be converted from
floating point number to When X0 is ON, (D0, D1) 10000.5 will be converted from floating point
integer, and the result is number to integer and the result 10000 is assigned to D10.
assigned to D.
2. This instruction affects the
zero flag and borrow flag.
When the conversion result is
0, the zero flag will be set.
When the result rounds off
the decimal fraction, the
borrow flag will be set. the
carry (overflow) flag will be
set.
6.5.6 DINT: Floating Point Number To Double Integer Instruction
LAD: Applicable to MC280 MC200 MC100
Influenced flag bit Zero, carry, borrow
IL: DINT (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S REAL Constant D V R √
D DINT KnY KnM KnS KnLM D C V R √

Operand description borrow flag will be set. When the result exceeds the range of the double
integer, the carry (overflow) flag will be set.
S: Source operand
D: Destination operand Note

Function description When S > 2147483647, D = 2147483647. When S < -2147483648, D =


-2147483648, and at the same time the carry (overflow) flag will be set.
1. When the power flow is
valid, S will be converted from Example
floating point number to LD X0
double integer, and the result DINT D0 D10

is assigned to D.
When X0 is ON, (D0, D1) 100000.5 will be converted from floating point
2. When the conversion result number to double integer, and the result 100000 is assigned to (D10,
is 0, the zero flag will be set. D11).
When the result rounds off
the decimal fraction, the
128 Chapter 6 Application Instructions

6.5.7 BCD: Word To 16-Bit BCD Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit Zero, carry, borrow
IL: BCD (S) (D) Program steps 5
Offset
Operand Type Applicable elements
addressing
S WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D WORD KnY KnM KnS KnLM D C T V Z R √

Operand description Note

S: Source operand. S ≤ 9999 When S > 9999, the system will report operand error and will not execute
D: Destination operand the instruction, and D will not change.

Function description Example

When the power flow is valid, LD X0


S will be converted from BCD D0 D10
integer to 16-bit BCD code, When X0 is ON, D0 0x0D05 (3333) will be converted from integer to 16-bit
and the result is assigned to BCD code, and the result 0x3333 (13107) is assigned to D10.
D.

6.5.8 DBCD: Double Word To 32-Bit BCD Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


Influenced flag bit Zero, carry, borrow
IL: DBCD (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
D DWORD KnY KnM KnS KnLM D C V R √

Operand description Note

S: Source operand, S ≤ When S > 99999999, the system will report operand error and will not
99999999 execute the instruction, and D will not change.
D: Destination operand Example
Function description LD X0
When the power flow is valid, DBCD D0 D10
S will be converted from When X0 is ON, (D0, D1) 0x3F940AA (66666666) will be converted from
integer to 32-bit BCD code, double integer to 32-bit BCD code, and the result 0x66666666
and the result is assigned to (1717986918) is assigned to (D10, D11).
D.

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 129

6.5.9 BIN: 16-Bit BCD To Word Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


Influenced flag bit Zero, carry, borrow
IL: BIN (S) (D) Program steps 5
Offset
Operand Type Applicable elements
addressing
S WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D WORD KnY KnM KnS KnLM D C T V Z R √

Operand description Note

S: Source operand, the data When the data format of S does not match the BCD code format, the
format of S must match the system will reports illegal operand and will not execute the instruction, and
BCD code format D will not change.
D: Destination operand Example
Function description LD X0
BIN D0 D10
When the power flow is valid,
S will be converted from When X0 is ON, D0 0x5555 (21845) will be converted from 16-bit BCD
16-bit BCD code to integer, code to integer, and the result 0x15B3 (5555) is assigned to D10.
and the result is assigned to
D.
6.5.10 DBIN: 32-Bit BCD To Double Word Instruction
LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit Zero, carry, borrow
IL: DBIN (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
D DWORD KnY KnM KnS KnLM D C V R √

Operand description Note

S: Source operand When the data format of S does not match the BCD code format, the
D: Destination operand system will report operand error and will not execute the instruction, and D
will not change.
Function description
Example
1. When the power flow is
LD X0
valid, S will be converted from
DBIN D0 D10
16-bit BCD code to double
integer, and the result is When X0 is ON, (D0, D1) 0x99999999 (2576980377) will be converted
assigned to D. from 32-bit BCD code to double integer, and the result 0x5F5E0FF
2. The data format of S must (99999999) is assigned to (D10, D11).
match the BCD code format.
130 Chapter 6 Application Instructions

6.5.11 GRY: Word To 16-bit Gray Code Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit Zero, carry, borrow
IL: GRY (S) (D) Program steps 5
Offset
Operand Type Applicable elements
addressing
S WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D WORD KnY KnM KnS KnLM D C T V Z R √

Operand description Example


LD X0
S: Source operand
GRY D0 D10
D: Destination operand
When X0 is ON, D0 0xAAAA (43690) will be converted form integer to
Function description
16-bit Gray code, and the result 0xFFFF (65535) is assigned to D10.
When the power flow is valid,
S will be converted from
integer to 16-bit Gray code,
and the result is assigned to
D.
6.5.12 DGRY: Double Word To 32-Bit Gray Code Instruction
LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit Zero, carry, borrow
IL: DGRY (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
D DWORD KnY KnM KnS KnLM D C V R √

Operand description and the result is assigned to D.

S: Source operand Example


D: Destination operand LD X0
Function description DGRY D0 D10

When the power flow is valid, When X0 is ON, (D0, D1) 0x88888888 (2290649224) will be converted
S will be converted from from double integer to 32-bit Gray code, and the result 0xCCCCCCCC
integer to 32-bit Gray code, (3435973836) is assigned to (D10, D11).

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 131

6.5.13 GBIN: 16-Bit Gray Code To Word Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit Zero, carry, borrow
IL: GBIN (S) (D) Program steps 5
Offset
Operand Type Applicable elements
addressing
S WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D WORD KnY KnM KnS KnLM D C T V Z R √

Operand description Example


S: Source operand LD X0
GBIN D0 D10
D: Destination operand
Function description When X0 is ON, D0 0xFFFF (65535) will be converted from 16-bit Gray
code to integer, and the result 0xAAAA (43690) is assigned to D10.
When the power flow is valid,
S will be converted from
16-bit Gray code to integer,
and the result is assigned to
D.

6.5.14 DGBIN: 32-Bit Gray Code To Double Word Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


Influenced flag bit Zero, carry, borrow
IL: DGBIN (S) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V R √
D DWORD KnY KnM KnS KnLM D C V R √

Operand description Example


LD X0
S: Source operand
DGBIN D0 D10
D: Destination operand
When X0 is ON, (D0, D1) 0xCCCCCCCC (3435973836) will be converted
Function description
from 32-bit Gray code to double integer, and the result 0x88888888
When the power flow is valid, (2290649224) is assigned to (D10, D11).
S will be converted from
32-bit Gray code to double
integer, and the result is
assigned to D.
132 Chapter 6 Application Instructions

6.5.15 SEG: Word To 7-Segment Encode


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit Zero, carry, borrow
IL: SEG (S) (D) Program steps 5
Offset
Operand Type Applicable elements
addressing
S WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D WORD KnY KnM KnS KnLM D C T V Z R √

Operand description Note

S: Source operand, S ≤ 15 When S>15, the system reports illegal operand and will not execute the
D: Destination operand instruction, and D will not change.

Function description Example


LD X0
When the power flow is valid,
SEG D0 D10
S will be converted from
integer to 7-segment code, When X0 is ON, D0 0x0F (15) will be converted from integer to 7-segment
and the result is assigned to code, and the result 0x71 (113) is assigned to D10.
D.
6.5.16 ASC: ASCII Code Conversion Instruction
LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit Zero, carry, borrow
IL: ASC (S1~ S8) (D) Program steps 19
Offset
Operand Type Applicable elements
addressing
S1 WORD Constant
S2 WORD Constant
S3 WORD Constant
S4 WORD Constant
S5 WORD Constant
S6 WORD Constant
S7 WORD Constant
S8 WORD Constant
D WORD D C T V Z R √

Operand description Example

S1 ~ S8 : Source operand (If the number is less than 8,


the remaining elements shall be filled with 0)
LD M0
Only characters with ASCII code of 0x21 ~ 0x7E are
supported (input through keyboard, if the number is ASC 12345678 D0
less than 8, fill in with 0X00) When M0 is ON, execute the ASCII conversion, and
D: destination operand the data will be stored in two modes:
 When SM186 is OFF, the execution result is:
Function description
D0=0x3231, D1=0x3433, D2=0x3635,
When the power flow is valid, the string S1 ~ S8 will be D3=0x3837.
converted to ASCII code, and the result is assigned to  When SM186 is ON, the execution result is:
the elements starting with D. When SM186 isOFF, the D0=0x31, D1=0x32, D2=0x33, D3=0x34,
high/low byte of each D element will store two ASCII D4=0x35, D5=0x36, D6=0x37, D7=0x38.
code data. When SM186 is ON, the low byte of each D
element will store 1 ASCII code data.

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 133

6.5.17 ITA: Hexadecimal Integer-ASCII Conversion Instruction


LAD: Applicable to MC280 MC200 MC100 MC80
Influenced flag bit Zero, carry, borrow
IL: ITA (S1) (D) (S2) Program steps 7
Offset
Operand Type Applicable elements
addressing
S1 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D WORD KnY KnM KnS KnLM D C T V Z R √
S2 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description Example

S1: Conversion source, hexadecimal data


D: destination operand. Source data: 0x9876
S2: number of ASCII codes, 1 ≤ S2 ≤ 256 LD M0
Function description ITA 16#9876 D20 6
When the power flow is valid, the hexadecimal data When M0 is ON, execute ITA conversion, the data will
starting with S1 element will be converted to S2 ASCII be stored in two modes:
codes, and the result is assigned to the elements  If SM186=OFF, the execution result is: D20 =
starting with D. When SM186 is OFF, the high/low byte 0x3839, D21 = 0x3637.
of each D element will store two ASCII code data.  If SM186=ON, the execution result is D20 =
When SM186 is ON, the low byte of each D element 0x39, D21 = 0x38, D22 = 0x37, D23 = 0x36.
will store 1 ASCII code data.
Note
1. When S1 and D use Kn addressing, Kn=4.
2. When S2 is not within 1 ~ 256, the system will report
operand error and will not execute the instruction, and
D will not change.
3. If S1 is a constant, S2 will be regarded as 4 by
default when S2 ≥ 4, and the system will not report
operand error.
134 Chapter 6 Application Instructions

6.5.18 ATI: ASCII-Hexadecimal Integer Conversion Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


Influenced flag bit Zero, carry, borrow
IL: ATI (S1) (D) (S2) Program steps 7
Offset
Operand Type Applicable elements
addressing
S1 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
D WORD KnY KnM KnS KnLM D C T V Z R √
S2 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √

Operand description report operand error and will not execute the
instruction, and D will not change.
S1: conversion source, ASCII code data 0x30 ≤ S1
3. If S1 is a constant, S2 will be regarded as 2 by
≤ 0x39 or 0x41 ≤ S1 ≤ 0x46 (when SM186 is OFF,
default when SM186 is OFF and S2 ≥ 2, or as when
the high byte and low byte of S1 shall both be within
SM186 is ON and S2 ≥ 1, and the system will not
this range)
report operand error.
D: destination operand.
S2: Number of ASCII codes; 1 ≤ S2 ≤ 256 Example

Function description
When the power flow is valid, the S2 ASCII code LD M0
data starting with S1 element will be converted to ATI D10 D30 4
hexadecimal data, and the result will be stored in
Source data: D10 = 0x3938, D11 = 0x3736, D12 =
the elements starting with D in every 4 bits. When
0x3534, D13 = 0x3332
SM186 is OFF, the high/low byte of each D element
When M0 is ON, the ATI conversion will be
will store two ASCII code data. When SM186 is ON,
executed. According to the data storing mode, the
the low byte of each D element will store 1 ASCII
results are as follows:
code data.
If SM186 is OFF, the result is: D30 = 0x8967.
Note
If SM186 is ON, the result is: D30=0x8642.
1. When S1 is not within 0x30 ~ 0x39 or 0x41 ~
0x46, or S2 is not within 1 ~ 256, the system will

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 135

6.5.19 LCNV: Engineering value Conversion Instruction


LAD: Applicable to MC280 MC200
Influenced flag bit Zero, carry, borrow
IL: LCNV (S1) (S2) (D) (S3) Program steps 9
Offset
Operand Type Applicable elements
addressing
S1 INT D V R
S2 INT D V R
D INT D V R
S3 WORD Constant D V R

Operand description
S1: the operand starting address of converting the source
D: The starting address conversion form
S2: The starting address for conversion results
S3:The data number to transform(1≤S3≤64)
Function description
When using analog input module reads the external analog signal, this instruction can convert the original analog value
to a corresponding reading the engineering value.
When using the temperature or analog module to measure, if there is deviation between measured value and value by
PLC temperature thermometer or related standard instrument measured results, we can use this instruction for linear
correction with correction in the actual measurement.

In the form, we fill in the low value


VML , high measurement values VMH and the corresponding low standard values
VSL VSH
and high standard values .When performing a linear transformation, source data by the following formula for
Sn Dn
computing produce corresponding target values. for the original input data, for data conversion results.
A  (VSL  VSH ) /(VML  VMH ) *10000

B  VSL  (VML * A / 10000)

Dn  ( S n * A / 10000)  B
Note
Four data in conversion form is of practical significance, such as low value should be less than high measurement
Dn
values. Conversion results such as beyond the integer result will not be accurate. will be is 32767,if greater than
Dn
32767. will be is -32768 if less than – 32768.
136 Chapter 6 Application Instructions

Example

When power on, it will perform LCNV conversion. Results are as follows
D300 = -10
D301 = 50
D302 = 150

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 137

6.5.20 RLCNV: Foat Engineering value Conversion Instruction


LAD: Applicable to MC280 MC200
Influenced flag bit Zero, carry, borrow
IL:R LCNV (S1) (S2) (D) (S3) Program steps 12
Offset
Operand Type Applicable elements
addressing
S1 REAL D V R
S2 REAL D V R
D REAL D V R
S3 WORD Constant D V R

Operand description Dn Dn
will be is 32767,if greater than 32767.
S1: the operand starting address of converting the will be is -32768 if less than – 32768.
source
Example
D: The starting address conversion form
S2: The starting address for conversion results
S3:The data number to transform(1≤S3≤64)
Function description
When using analog input module reads the external
analog signal, this instruction can convert the original
analog value to a corresponding reading the
engineering value.
When using the temperature or analog module to
measure, if there is deviation between measured
value and value by PLC temperature thermometer or
related standard instrument measured results, we
can use this instruction for linear correction with
correction in the actual measurement.

In the form, we fill in the low value


VML , high

measurement values
VMH and the corresponding
When M2 is on, it will perform LCNV conversion.
Results are as follows
VSL D200 (D201) = 260
low standard values and high standard
V D202 (D203) = 3650
values SH .When performing a linear transformation,
D204 (D205) = 1955
source data by the following formula for computing
D206 (D207) = -34.3288
Sn
produce corresponding target values. for the D208 (D209) = 5184.267
Dn D210 (D211) = -154.357
original input data, for data conversion results.
A  (VSL  VSH ) /(VML  VMH ) *10000

B  VSL  (VML * A / 10000)

Dn  ( S n * A / 10000)  B
Note
Four data in conversion form is of practical
significance, such as low value should be less than
high measurement values. Conversion results such
as beyond the integer result will not be accurate.

6.6 Word Logic Operation

6.6.1 WAND: AND Word Instruction


138 Chapter 6 Application Instructions

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: WAND (S1) (S2) (D) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S2 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D WORD KnY KnM KnS KnLM D C T V Z √

Operand description AND operation, and the result is assigned to D.

S1: Source operand 1 Example

S2: Source operand 2 LD X0


WAND
D: destination operand
D0 D1 D10
Function description When X0 is ON, D0 2#1011011010010011 (46739) and D1
When the power flow is valid, 2#1001001100101110 (37678) will conduct logic AND operation, and the result
S1 and S2 will conduct logic 2#1001001000000010 (37378) is assigned to D10.

6.6.2 WOR: OR Word Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: WOR (S1) (S2) (D) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S2 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D WORD KnY KnM KnS KnLM D C T V Z √

Operand description Example


LD X0
S1: Source operand 1
WOR D0 D1
S2: Source operand 2 D10
D: destination operand When X0 is ON, D0 2#1011011010010011 (46739) and D1
Function description 2#1001001100101110 (37678) will conduct logic OR operation, and the result
2#1011011110111111 (47039) is assigned to D10.
When the power flow is valid,
S1 and S2 will conduct logic
OR operation, and the result
is assigned to D. .

6.6.3 WXOR: Exclusive-OR Word Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: WXOR (S1) (S2) (D) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S2 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D WORD KnY KnM KnS KnLM D C T V Z √

Operand description S1: Source operand 1


S2: Source operand 2

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 139

D: destination operand Example


Function description LD X0
WXOR D0 D1 D10
When the power flow is valid,
When X0 is ON, D0 2#1011011010010011 (46739) and D1
S1 and S2 will conduct logic
2#1001001100101110 (37678) will conduct logic exclusive OR operation, and
exclusive OR operation, and
the result 2#0010010110111101 (9661) is assigned to D10.
the result is assigned to D.
140 Chapter 6 Application Instructions

6.6.4 WINV: NOT Word Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: WINV (S) (D) Program steps 5


Offset
Operand Type Applicable elements
addressing
S WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D WORD KnY KnM KnS KnLM D C T V Z √

Operand description Example

S: Source operand LD X0
WINV D0 D1 D10
D: destination operand
Function description When X0 is ON, conduct logic NOT operation on D0 (46739), and assign the
result 18796 to D10.
When the power flow is valid,
conduct logic NOT operation
on S, and assign the result to
D.

6.6.5 DWAND: AND Double Word Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: DWAND (S1) (S1) (D) Program steps 10


Offset
Operand Type Applicable elements
addressing
S1 DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
S2 DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
D DWORD KnY KnM KnS KnLM D C V √

Operand description AND operation, and the result is assigned to D.

S1: Source operand 1 Example

S2: Source operand 2 LD X0


DWAND D0 D2 D10
D: destination operand
When X0 is ON, (D0, D1) 2#10110010101001101110011001010010
Function description (2997282386) and (D2, D3) 2#00111010001110110011000100110011
When the power flow is valid, (976957747) will conduct the logic AND operation, and the result
S1 and S2 will conduct logic 2#00110010001000100010000000010010 (841097234) is assigned to (D10,
D11).

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 141

6.6.6 DWOR: OR Double Word Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: DWOR (S1) (S2) (D) Program steps 10


Offset
Operand Type Applicable elements
addressing
S1 DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
S2 DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
D DWORD KnY KnM KnS KnLM D C V √

Operand description operation, and the result is assigned to D.

S1: Source operand 1 Example

S2: Source operand 2 LD X0


DWOR D0 D2 D10
D: destination operand
When X0 is ON, (D0, D1) 2#10110010101001101110011001010010 (2997282386)
Function description and (D2, D3) 2#00111010001110110011000100110011 (976957747) will conduct
When the power flow is logic OR operation, and the result 2#10111010101111111111011101110011
valid, S1 and S2 will (3133142899) is assigned to (D10, D11).
conduct logic OR

6.6.7 DWXOR: Exclusive-OR Double Word Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: DWXOR (S1) (S2) (D) Program steps 10


Offset
Operand Type Applicable elements
addressing
S1 DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
S2 DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
D DWORD KnY KnM KnS KnLM D C V √

Operand description Example


LD X0
S1: Source operand 1
DWXOR D0 D2
S2: Source operand 2 D10
D: destination operand When X0 is ON, (D0, D1) 2#10110010101001101110011001010010
Function description (2997282386) and (D2, D3) 2#00111010001110110011000100110011
(976957747) will conduct logic exclusive OR operation, and the result
When the power flow is valid,
2#10001000100111011101011101100001 (2292045665) is assigned to (D10,
S1 and S2 will conduct logic
D11).
exclusive OR operation, and
the result is assigned to D.
142 Chapter 6 Application Instructions

6.6.8 DWINV: NOT Double Word Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: DWINV (S) (D) Program steps 7


Offset
Operand Type Applicable elements
addressing
S DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
D DWORD KnY KnM KnS KnLM D C V √

Operand description conducted on S, and the result is assigned to D.

S: Source operand Example

D: destination operand LD X0
DWINV D0 D10
Function description
When X0 is ON, logic NOT operation will be conducted on (D0, D1)
When the power flow is valid, 2#10110010101001101110011001010010 (2997282386), and the result
logic NOT operation will be 2#01001101010110010001100110101101 (1297684909) is assigned to (D10,
D11).

6.7 Shift / Rotate Instruction

6.7.1 ROR: 16-Bit Circular Shift Right Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit Carry flag SM181

IL: ROR (S1) (D) (S2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D WORD KnY KnM KnS KnLM D C T V Z √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example


LD M0
S1: Source operand 1
ROR D0 D10 3
D: destination operand
Before Rotate rightward 3 bits
S2: Source operand 2 MSB LSB
1 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1
Function description
When the power flow is SM181
valid, the data of S1 will After
MSB LSB
rotate rightward for S2 bits, 1 0 1 1 1 0 0 1 1 0 1 1 0 0 1 0
and the result is assigned
to D. At the same time the
SM181 1
highest bit of the S2 bits will
be stored into the carry flag When M0 is ON, D0 2#1100110110010101 (52629) rotates rightward for 3 bits,
(SM181). and the result 2#1011100110110010 (47538) is assigned to D10. The highest bit
of the 3 bits is stored into the carry flag. SM181 is ON.
Note
1. S2 ≥ 0.
2. When S1 uses Kn
addressing, Kn must be
equal to 4.

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 143

6.7.2 ROL: 16-Bit Circular Shift Left Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit Carry SM181

IL: ROL (S1) (D) (S2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D WORD KnY KnM KnS KnLM D C T V Z √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example


LD M0
S1: Source operand 1
ROL D0 D10 15
D: destination operand
Before Rotate leftward 15 bits
S2: Source operand 2 MSB LSB
1 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1
Function description
When the power flow is valid, SM181

the data of S1 will rotate After


leftward for S2 bits, and the MSB LSB
1 1 1 0 0 1 1 0 1 1 0 0 1 0 1 0
result is assigned to D. At the
same time the lowest bit of
0 SM181
the S2 bits will be stored into
the carry flag SM181. When M0 is ON, D0 2#1100110110010101 (52629) rotates leftward for 15 bits,
and the result 2#1110011011001010 (59082) is assigned to D10. The final bit
Note
will be stored in the carry flag bit. SM181 is OFF.
1. S2 ≥ 0.
2. When S1 uses Kn
addressing, Kn must be equal
to 4.
144 Chapter 6 Application Instructions

6.7.3 RCR: 16-Bit Carry Circular Shift Right Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit Carry SM181

IL: RCR (S1) (D) (S2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D WORD KnY KnM KnS KnLM D C T V Z √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example


LD M0
S1: Source operand 1
RCR D0 D10 5
D: destination operand
Rotate with the carry
S2: Source operand 2 flag 5 bits leftward
Before
Function description MSB LSB
1 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1
When the power flow is valid,
S1 data and the carry flag SM181 (0)
(SM181) will together rotate
After
rightward for S2 bits, and the MSB LSB
result is assigned to D. 0 1 0 1 0 1 1 0 0 1 1 0 1 0 1 0
Note
SM181 1
1. S2 ≥0.
2. When S1 uses Kn When M0 is ON, D0 2#1100110110010101 (52629) and the carry SM181 (OFF)
addressing, Kn must be equal will rotate rightward for 5 bits, and the result 2#0101011001101100 (22124) is
to 4. assigned to D10. SM181 = ON.

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 145

6.7.4 RCL: 16-Bit Carry Circular Shift Left Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit Carry SM181

IL: RCL (S1) (D) (S2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D WORD KnY KnM KnS KnLM D C T V Z √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example

S1: Source operand 1 LD M0


D: destination operand RCL D0 D10 16
S2: Source operand 2
Rotate with the carry
Function description Before flag leftward 16 bits
MSB LSB
When the power flow is valid, 1 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1
S1 data and the carry (SM181)
SM181 (1)
will together rotate leftward
for S2 bits, and the result is
After
assigned to D.
MSB LSB
Note 1 1 1 0 0 1 1 0 1 1 0 0 1 0 1 0

1. S2 ≥ 0. 1 SM181

2. When S1 uses Kn
When M0 is ON, D0 2#1100110110010101 (52629) and the carry SM181 (ON)
addressing, Kn must be equal
will rotate leftward for 16-bits, and the result 2#1110011011001010 (59082) is
to 4.
assigned to D10. SM181=ON.
6.7.5 DROR: 32-Bit Circular Shift Right Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit Carry SM181

IL: DROR (S1) (D) (S2) Program steps 9


Offset
Operand Type Applicable elements
addressing
S1 DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
D DWORD KnY KnM KnS KnLM D C V √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
Operand description the S2 bits will be stored into the carry flag bit SM181.

S1: Source operand 1 Note

D: destination operand 1. S2 ≥ 0.
S2: Source operand 2 2. When S1 uses Kn addressing, Kn must be equal to 8.

Function description Example

When the power flow is valid, LD M0


DROR D0 D10 7
the data of S1 will rotate
rightward for S2 bits, and the 1. When M0 is ON, D0 (D1) 2#10110011100110001001110010101100
result is assigned to D. At the (3013123244) will rotate rightward for 7 bits, and the result
same time the highest bit of 2#01011001011001110011000100111001 (1499935033) is assigned to
(D10, D11). The final bit is stored into the carry flag bit. SM181 = OFF.
2. Please refer to the ROR instruction illustration.
6.7.6 DROL: 32-Bit Circular Shift Left Instruction
146 Chapter 6 Application Instructions

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit Carry SM181

IL: DROL (S1) (D) (S2) Program steps 9


Offset
Operand Type Applicable elements
addressing
S1 DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
D DWORD KnY KnM KnS KnLM D C V √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Note

S1: Source operand 1 1. S2 ≥ 0.

D: destination operand 2. When S1 uses Kn addressing, Kn must be equal to 8.

S2: Source operand 2 Example

Function description LD M0
DROL D0 D10 30
When the power flow is valid,
the data of S1 will rotate 1. When M0 is ON, (D0, D1) 2#10110011100110001001110010101100
leftward for S2 bits, and the (3013123244) will rotate leftward for 30 bits, and the result
result is assigned to D. At the 2#00101100111001100010011100101011 (753280811) is assigned to (D10,
same time the lowest bit of D11). The final bit is stored into the carry flag bit. SM181=ON.
the S2 bits will be stored into 2. Please refer to the ROL instruction illustration.
the carry flag bit SM181.
6.7.7 DRCR: 32-Bit Carry Circular Shift Right Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit Carry SM181

IL: DRCR (S1) (D) (S2) Program steps 9


Offset
Operand Type Applicable elements
addressing
S1 DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
D DWORD KnY KnM KnS KnLM D C V √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Note

S1: Source operand 1 1. S2 ≥ 0.

D: destination operand 2. When S1 uses Kn addressing, Kn must be equal to 8.

S2: Source operand 2 Example

Function description LD M0
DRCR D0
When the power flow is valid, D10 11
S1 data and the carry SM181 1. When M0 is ON, (D0, D1) 2#10110011100110001001110010101100
will together rotate rightward (3013123244) and the carry SM181 (OFF) will rotate rightward for 11 bits, and
for S2 bits, and the result is the result 2#00101011000101100111001100010011 (722891539) is assigned
assigned to D. to (D10, D11). SM181=ON.
2. Please refer to the RCR instruction illustration.

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 147

6.7.8 DRCL: 32-Bit Carry Circular Shift Left Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit Carry SM181

IL: DRCL (S1) (D) (S2) Program steps 9


Offset
Operand Type Applicable elements
addressing
S1 DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
D DWORD KnY KnM KnS KnLM D C V √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Note

S1: Source operand 1 1. S2 ≥ 0.

D: destination operand 2. When S1 uses Kn addressing, Kn must be equal to 8.

S2: Source operand 2 Example

Function description LD M0
DRCL D0 D10 25
When the power flow is valid,
the S1 data and the carry 1. When M0 is ON, (D0, D1) 2#10110011100110001001110010101100
SM181 will together rotate (3013123244) and the carry SM181 (OFF) will rotate leftward for 25 bits, and
leftward for S2 bits, and the the result 2#001011000101100111001100010011100 (1488165020) is
result is assigned to D. assigned to (D10, D11). SM181 = ON.
2. Please refer to the RCL instruction illustration.
6.7.9 SHR: 16-Bit Shift Right Word Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: SHR (S1) (D) (S2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D WORD KnY KnM KnS KnLM D C T V Z √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description 2. When S1 uses Kn addressing, Kn must be equal to 4.

S1: Source operand 1 Example

D: destination operand LD M0
SHR D0 D10 5
S2: Source operand 2
Before Rotate rightward 5 bits
Function description MSB LSB
0 1 1 1 1 0 1 0 1 1 0 1 1 1 0 0
When the power flow is valid,
the data of S1 will shift After
rightward for S2 bits, and the MSB LSB
result is assigned to D. 0 0 0 0 0 0 1 1 1 1 0 1 0 1 1 0

Note When M0 is ON, D0 2#0111101011011100 (31452) shifts rightward for 5


bits, and the result 2#0000001111010110 (982) is assigned to D10.
1. S2 ≥ 0.
148 Chapter 6 Application Instructions

6.7.10 SHL: 16-Bit Shift Left Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: SHL (S1) (D) (S2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D WORD KnY KnM KnS KnLM D C T V Z √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example


LD M0
S1: Source operand 1
SHL D0 D10 7
D: destination operand
S2: Source operand 2
Before Rotate leftward 7 bits
MSB LSB
Function description 0 1 1 1 1 0 1 0 1 1 0 1 1 1 0 0
When the power flow is valid, After
the data of S1 will shift MSB LSB
leftward for S2 bits, and the 0 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0
result is assigned to D. When M0 is ON, D0 2#0111101011011100 (31452) shifts leftward for 7
Note bits, and the result 2#0110111000000000 (28160) is assigned to D10.
1. S2 ≥0.
2. When S1 uses Kn
addressing, Kn must be equal
to 4.
6.7.11 DSHR: 32-Bit Shift Right Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: DSHR (S1) (D) (S2) Program steps 9


Offset
Operand Type Applicable elements
addressing
S1 DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
D DWORD KnY KnM KnS KnLM D C V √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Note

S1: Source operand 1 1. S2 ≥0.

D: destination operand 2. When S1 uses Kn addressing, Kn must be equal to 8.

S2: Source operand 2 Example

Function description LD M0
DSHR D0 D10 10
When the power flow is valid,
1. When M0 is ON, (D0, D1) 2#01110011100110001001110010101100
the data of S1 will shift
(1939381420) shifts rightward for 10 bits, and the result
rightward for S2 bits, and the
2#00000000000111001110011000100111 (1893927) is assigned to (D10,
result is assigned to D.
D11).
2. Please refer to the SHR instruction illustration.

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 149

6.7.12 DSHL: 32-Bit Shift Left Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: DSHL (S1) (D) (S2) Program steps 9


Offset
Operand Type Applicable elements
addressing
S1 DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
D DWORD KnY KnM KnS KnLM D C V √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example

S1: Source operand 1 LD M0


DSHL D0 D10 15
D: destination operand
1. When M0 is ON, (D0, D1) 2#01110011100110001001110010101100
S2: Source operand 2
(1939381420) shifts leftward for 15 bits, and the result
Function description 2#01001110010101100000000000000000 (1314258944) is assigned to (D10,
When the power flow is valid, D11).
the data of S1 will shift 2. Please refer to SHL instruction illustration.
leftward for S2 bits, and the
result is assigned to D.
Note
1. S2 ≥ 0.
2. When S1 uses Kn
addressing, Kn must be equal
to 8.
150 Chapter 6 Application Instructions

6.7.13 SFTR: Shift Right Byte Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: SFTR (S1) (D) (S2) (S3) Program steps 9


Offset
Operand Type Applicable elements
addressing
S1 BOOL X Y M S LM SM C T √
D BOOL Y M S LM C T √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S3 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example

S1: Source operand 1 LD M0


D: destination operand SFTR X0 M10 10 3

S2: Source operand 2


S3: Source operand 3
X2 X1 X0
Function description
When the power flow is valid, M19 M18 M17 M16 M15 M14 M13 M12 M11 M10

S2 elements starting with D


will move rightward for S3
1. When M0 is ON, the contents of 10 elements starting with M10 will move
units, and the S3 elements at
rightward for 3 bits, and rightmost three elements M10 ~ M12 will be discarded.
the rightmost side will be
At the same time, the contents of the 3 elements starting with X0 will be filled
discarded. At the same time,
into the left end of the string.
the contents of S3 elements
starting with S1 will be filled 2. Before the execution: X0 = 1, X1 = 0, X2 = 1, M10 = 0, M11 = 1, M12 = 1, M13
into the left end of the string. = 0, M14 = 0, M15 = 1, M16 = 0, M17 = 0, M18 = 0, M19 = 1.
3. After the execution: the contents of X0 to X2 remain unchanged, M10 = 0,
Note
M11 = 0, M12 = 1, M13 = 0, M14 = 0, m15 = 0, m16 = 0, m17 = 1, m18 = 0, m19
1. The elements with smaller = 1.
SN are at the right, and the
elements with larger SN are
at the left.
2. S2 ≥ 0.
3. S3 ≥ 0.

MC Series Small PLC Programming Manual


Chapter 6 Application Instructions 151

6.7.14 SFTL: Shift Left Byte Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: SFTL (S1) (D) (S2) (S3) Program steps 9


Offset
Operand Type Applicable elements
addressing
S1 BOOL X Y M S LM SM C T √
D BOOL Y M S LM C T √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S3 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example

S1: Source operand 1 LD M0


D: destination operand SFTL X0 M10 10 3

S2: Source operand 2


X2 X1 X0
S3: Source operand 3
Function description
M19 M18 M17 M16 M15 M14 M13 M12 M11 M10
When the power flow is valid,
S2 elements starting with D
will more leftward for S3 1. When M0 is ON, the contents of 10 elements starting with M10 will move
units, and the S3 elements at leftward for 3 bits, and the leftmost elements M17 ~ M19 will be discarded. At
the leftmost side will be the same time, the contents of the 3 elements starting with X0 will be filled into
discarded. At the same time, the right end of the string.
the contents of S3 elements 2. Before the execution: X0 = 1, X1 = 0, X2 = 1, M10 = 0, M11 = 1, M12 = 1, M13
starting with S1 will be filled = 0, M14 = 0, M15 = 1, M16 = 0, M17 = 0, M18 = 0, M19 = 1.
into the right end of the 3. After the execution: the contents of X0 ~ X2 remain unchanged, M10 = 1, M11
string. = 0, M12 = 1, M13 = 0, M14 = 1, M15 = 1, M16 = 0, M17 = 0, M18 = 1, M19 = 0.
Note
1. The elements with smaller
SN are at the right, and the
elements with larger SN are
at the left.
2. S2 ≥ 0.
3. S3 ≥ 0.
152 Chapter 6 Application Instructions

6.8 External Equipment Instruction

6.8.1 FROM: Read Word Form Special Module Buffer Register Instruction

LAD: Applicable to MC200 MC280


Influenced flag bit
Program steps 9
IL: FROM (S1) (S2) (D) (S3)
Offset
Operand Type Applicable elements
addressing
S1 INT Constant
S2 INT Constant
D INT D V √
S3 INT Constant

Operand description D: The D element where the data read from the target module will be stored.
S3: The number of consecutive buffer registers (single word) to be read.
S1: SN of the special module
Range: 1 ~ 32767. If the target register does not exist, the system will report
to be read, or the target
“BFM unit of accessed special module exceeds range”.
module.
Range: 0 ~ 7. If the target Function description
module does not exist, the Read consecutively S3 registers, starting with S2 register, in the BFM of the
system will report target target module (SN: S1) and put them into the S3 word elements starting with D.
module address invalid.
Note
S2: The starting address in
The execution time of the FROM instruction is relatively long, and closely
the BFM of the target module.
related to S3.
Range: 0 ~ 32767. If the BFM
address is invalid, the system Example
will report “BFM unit of LD M0
accessed special module FROM 0 3 D100 2
exceeds range”. When M0 is ON, read consecutively 2 registers, starting with register 3, in the
BFM of the target module number 0, and put them into the word elements D100
and D101.
Chapter 6 Application Instructions 153

6.8.2 DFROM: Read Double Word Form Special Module Buffer Register Instruction

LAD: Applicable to
MC200 MC280
Influenced flag bit

Program steps
IL: DFROM (S1) (S2) (D) (S3) 10
Offset
Operand Type Applicable elements
addressing
S1 INT Constant
S2 INT Constant
D DINT D V √
S3 INT Constant
154 Chapter 6 Application Instructions

Operand description D: The D element where the data read from the target module will be stored.
S3: The number of consecutive buffer registers (double word) to be read.
S1: SN of the special module
Range: 1 ~ 32767. If the target register does not exist, the system will report
to be read, or the target
“BFM unit of accessed special module exceeds range”
module.
Range: 0 ~ 7. If the target Function description
module does not exist, the Read consecutively S3 registers, starting with S2 register, in the BFM of the
system will report target target module (SN: S1) and put them into the S3 double-word elements starting
module address invalid. with D.
S2: The starting address in Note
the BFM of the target
The execution time of the DFROM instruction is relatively long, and closely
module.
related to S3.
Range: 0 ~ 32767. If the BFM
address is invalid, the system Example
will report “BFM unit of LD M0
accessed special module DFROM 0 3 D200 1
exceeds range”. When M0 is ON, read 1 double word from register 3, in the BFM of the target
module number 0, and put it into the double word element (D200, D201).
Chapter 6 Application Instructions 155

6.8.3 TO: Write Word To Special Module Buffer Register Instruction

LAD: Applicable to MC200 MC280

Influenced flag bit

IL: TO (S1) (S2) (S3) (S4) Program steps 9


Offset
Operand Type Applicable elements
addressing
S1 INT Constant
S2 INT Constant
S3 INT D V √
S4 INT Constant
156 Chapter 6 Application Instructions

Operand description S4: The number of consecutive buffer registers (single word) to be written.
Range: 1 ~ 32767. If the target register does not exist, the system will report
S1: The SN of the special
“BFM unit of accessed special module exceeds range”.
module to be written, or the
target module. Function description
Range: 0 ~ 7. If the target 1. Write data from consecutive S4 registers starting with S3 to the consecutive
module does not exist, the S4 buffer registers starting with S2 in the BFM of the target module (SN: S1).
system will report “Using 2. If S3 is a constant, write it consecutively into the S4 word elements starting
FROM/TO instruciton to with S2 in the BFM of special module S1.
access module not existing”.
Note
S2: The starting register
The execution time of the TO instruction is relatively long, and closely related to
address in the BFM of the
S4.
target module.
Range: 0 ~ 32767. If the Example
BFM address is invalid, the LD SM0
system will report “BFM unit TO 0 8 1000 2
of accessed special module When PLC runs, write 1000 respectively to buffer registers 8 and 9 in the BFM of
exceeds range”. target module number 0.
S3: The data to be written
into the target module.
Chapter 6 Application Instructions 157

6.8.4 DTO: Write Double Word To Special Module Buffer Register Instruction

LAD: Applicable to MC200 MC280

Influenced flag bit

IL: DTO (S1) (S2) (S3) (S4) Program steps 10


Offset
Operand Type Applicable elements
addressing
S1 INT Constant
S2 INT Constant
S3 DINT D V √
S4 INT Constant
158 Chapter 6 Application Instructions

Operand description S4: The number of consecutive buffer registers (double word) to be written.
Range: 1 ~ 32767. If the target register does not exist, the system will report
S1: The SN of the special
“BFM unit of accessed special module exceeds range”.
module to be written, or the
target module. Function description
Range: 0 ~ 7. If the target 1. Write data from consecutive S4 registers starting with S3 to the
module does not exist, the consecutive S4 buffer registers starting with S2 in the BFM of the target
system will report “Using module (SN: S1).
FROM/TO instruciton to access 2. If S3 is a constant, write it consecutively into the S4 double-word elements
module not existing”. starting with S2 in the BFM of special module S1.
S2: The starting register Note
address in the BFM of the target
The execution time of the DTO instruction is relatively long, and closely
module.
related to S4.
Range: 0 ~ 32767. If the BFM
address is invalid, the system Example
will “BFM unit of accessed LD SM0
special module exceeds range”. DTO 0 8 16711935 1

S3: The data to be written into When PLC runs, write a double word data 16711935 to buffer registers 8 and
the target module. 9 (which forms a double-word element) in the BFM of target module number
0.

6.8.5 VRRD: Read Analog Potentiometer Value Instruction

LAD: Applicable to MC200 MC100

Influenced flag bit

IL: VRRD (S) (D) Program steps 5


Offset
Operand Type Applicable elements
addressing
S WORD Constant
D WORD D V √

Operand description Function description

S: The specified potentiometer SN. Range: 0 Read the value of the specified analog potentiometer and store
~ 255. If S is set outside this range, the it into the specified element.
system will report operand error. Example
D: The element where the read analog LD M0
potentiometer value will be stored. Range: 0 ~ VRRD 0 D10
255. When M0 is ON, read the value of analog potentiometer 0 and
put the reading into D10.
6.8.6 REFF: Set Input Filtering Constant Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: REFF (S) Program steps 3


Offset
Operand Type Applicable elements
addressing
S WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description  MC100


Range: 0, 8, 16, 32, 64. Any setting between any two
S: Input filtering constant
values will be regarded as the smaller value. For
 MC200
example, a setting between 8 and 16 will be regarded
Range: 0 ~ 64ms. Any setting bigger than 64 will be as 8. Any setting bigger than 64 will be regarded as 64.
regarded as 64.
Chapter 6 Application Instructions 159

Function description Example


Set the input filtering constant of X0 ~ X17. LD M0
REFF 30
Note
When X10 is ON, set the input filtering constant to
The input filtering constant is valid only for 30ms.
non-high-speed input points.
6.8.7 REF: Instant Refresh I/O Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: REF (D) (S) Program steps 5


Offset
Operand Type Applicable elements
addressing
D BOOL X Y
S INT Constant

Operand description Note

D: the starting X or Y element to be refreshed. The Generally, the REF instruction is used to refresh I/O
specified starting element address should always be a immediately between the FOR-NEXT instruction and
multiple of 8 (in octal system). For example, X0, X10, the CJ instruction.
X20… or Y0, Y10, Y20…. You can also use the REF instruction to obtain the
S: the number of inputs and outputs to be refreshed. It latest input and output the operation result without
should always be a multiple of 8, for example, 8, 16, ..., delay during the execution of the interrupts with I/Os.
256, and so on. To refresh a relay output, you need to consider the
Function description response time.

Generally, the PLC will not refresh its inputs or outputs Example
before the user program ends. However, if you want to LD M0
refresh the inputs or outputs when the user program is REF Y0 8
still running, you can use this instruction. When M0 is ON, the stats at Y0 ~ Y7 will be output
immediately regardless of the scan cycle.
160 Chapter 6 Application Instructions

6.8.8 EROMWR: EEPROM Write Instruction

LAD: Applicable to MC280 MC200 MC100

Influenced flag bit

IL: EROMWR (S1) (S2) Program steps 6


Offset
Operand Type Applicable elements
addressing
S1 WORD D
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
Chapter 6 Application Instructions 161

Operand description Example


LD M1
S1: starting address of the elements to be stored.
SET M1000
Range: D6000 ~ D6999 RST M1
S2: number of the elements to be stored. S2<16 MOV 16 D6016
S1 + S2 < D7000 MOV 32 D6032
LD SM1
Function description SET M1
1. Partial PLC data are battery backed. However, LD M1000
during the calculation, you can save the AND SM196
EROMWR D6016 2
intermediate data into EEPROM with the EROMWR
RST M1000
instruction.
SET M1001
2. This instruction is executed upon the rising edge. LD M1001
3. Two EROMWR instructions cannot be executed AND SM196
at the same time. When SM196, the EEPROM write EROMWR D6032 16
OK flag, is ON, it indicates that EEPROM is okay for RST M1001

write operation. When SM196 is OFF, it indicates In the preceding example, two sets of D elements
that an EROMWR instruction is being executed. are stored in the EEPROM:
1. SM1 and M1 makes M1000 generate a rising
Note
edge during the second scan cycle and triggers the
An EROMWR instruction will make the scan cycle 2 execution of the first EROMWR instruction.
~ 5ms longer. It is recommended to set the S1 to
2. M1001 and SM196 makes the second rising edge,
6000 plus an integer multiple of 16, like D6000,
triggering the execution of the second EROMWR
D6016 and D6032.
instruction.
162 Chapter 6 Application Instructions

6.8.9 PR: Print Instruction

LAD: Applicable to MC280 MC200

Influenced flag bit

IL: PR (S) (D) Program steps 5


Offset
Operand Type Applicable elements
addressing
S WORD D C T R √
D BOOL Y

Operand description
S: Head device number storing data
D: Head output (Y) number to which data is output
Function description
1. Data stored in low-order 8 bits (1 byte) of S to S+7 are output to D to D+7 in turn by one character at a time in the
time division method.
2. SM71 is an execution flag of print instruction. In printing, SM71 is ON. After printing, SM71 is OFF.
Timing chart:

3. While SM70 is OFF, 8-byte serial output (fixed to 8 characters) is executed. While SM70 is ON, 16-byte serial output
(1 to 16 characters) is executed. If "H00 (NUL code)" is contained in the data (16 characters), the character just before
"H00 (NUL code)" is handled as the last character.
When SM70 is ON, timing chart:

When the power flow is invalid, the execution flag of print instruction is OFF.
1. When the power flow is valid, print only once.
2. The execution flag of print instruction can be used to control ON or OFF of the power flow.
Example
Wiring Diagram:
Chapter 6 Application Instructions 163

LD SM1
MOV 0 Z0
LD SM1
FOR 8
LD SM0
WINV D0Z0 D0Z0
INC Z0
NEXT
LD M0
PR D0 Y1

Note
1. Use a transistor output type PLC.
2. This instruction is executed in synchronization with the scan time.
3. Even if the command input is continuously ON or if the pulse operation type instruction is used, execution is
completed after a series of outputs.
164 Chapter 6 Application Instructions

6.8.10 TKY: Ten Key Input Instruction

LAD: Applicable to MC280

Influenced flag bit

IL: TKY (S) (D1) (D2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S BOOL X Y M S SM LM
D1 INT KnY KnM KnLM D SD C T V Z R √
D2 BOOL Y M S SM LM

Operand description
S: Head bit device number from which one of the ten
keys is input [10 devices are occupied]
D1: Word device number storing the data
D2: Head bit device number storing the key pressing
information [11 devices are occupied]
Function description
1. D1 stores a numeric value input from S to S+9
connected to the ten keys. Output information for key
pressing and key sensing are output to D2 to D2+10.
1) Input numeric value D1
When the ten keys are pressed in the order "[1] → [2]
→ [3] → [4]" in the figure shown on the next page,
"2130" is stored in D1.
2) Key pressing information [D2 to D2+10]
For the key pressing information, D2 to D2+9 turn ON
or OFF according to the pressed keys.
For the key sensing output, D2+10 turns ON when any
key is pressed.

Example
LD M0
TKY X0 D7999 M1000
When the ten keys are pressed in the order "[X2] →
[X1] →[X3] → [X0]", "2130" is stored in (D7999).
When X2 is pressed, M102 turns ON and remains ON
until another key is pressed. Other keys work in the
same way. When pressing a key, the key sensing
output M1010 is ON only while it is pressed.
Note

1. When two or more keys are pressed at the same


time, in such a case, only the first key pressed is valid.

2. When the power flow is OFF, the contents of D1 do


not change, all of D2 to D2+10 turn OFF.
3. When an input value is larger than "9999", it
overflows from the most significant digit.
Chapter 6 Application Instructions 165

4. When a key is pressed, the key sensing output D2 is ON and5. TKY instruction can be used only once in a program. When
remains ON until another key is pressed. TKY instruction should be used two or more times, you
must use the indexing (V, Z) function.
166 Chapter 6 Application Instructions

6.9 Real-Time Clock Instruction

6.9.1 TRD: Read Real-Time Clock Instruction

LAD: Applicable to MC280 MC200 MC100

Influenced flag bit

IL: TRD (D) Program steps 3


Offset
Operand Type Applicable elements
addressing
D WORD D V √

Operand description Note

D: the starting storage element for the system time, The TRD instruction will fail upon system clock
which occupies the 7 consecutive elements starting setting error.
with D Example
Function description LD M0
TRD D10
Read the system time and store the value in the
storage elements designated by D. When M0 is ON, send the system time to the 7
elements starting with D10.

The execution result of the instruction is as follows:


Element Item Clock data Element Item
SD100 Year 2000 to 2099 ————— D10 Year
SD101 Month 1 to 12 D11 Month
—————
SD102 Day 1 to 31 D12 Day
Special data register SD103 Hour 0 to 23 ————— D13 Hour
for real time clock SD104 Minute 0 to 59 ————— D14 Minute
SD105 Second 0 to 59 ————— D15 Second

—————
SD106 Week 0 to 6 D16 Week
—————
Chapter 6 Application Instructions 167

6.9.2 TWR: Write Real-Time Clock Instruction

LAD: Applicable to MC280 MC200 MC100

Influenced flag bit

IL: TWR (S) Program steps 3


Offset
Operand Type Applicable elements
addressing
S WORD D V √

Operand description
S: the element where the system time is to be written
Element Item Clock data ————— Element Item
D10 Year 2000 to 2099 SD100 Year
—————
D11 Month 1 to 12 SD101 Month
D12 Day 1 to 31 ————— SD102 Day
Data for clock setting D13 Hour 0 to 23 ————— SD103 Hour
D14 Minute 0 to 59 ————— SD104 Minute
D15 Second 0 to 59 SD105 Second
—————
D16 Week 0 to 6 SD106 Week
—————

Function description Example

When the system time is Changing the system time with the TWR instruction is shown in the following
different from the real time, figure:
you can use the TWR
LD X10
instruction to correct the
EU
system time.
MOV 2004 D10
Note MOV 12 D11
MOV 7 D12
1. The time must use the
MOV 9 D13
solar calendar, or the
MOV 53 D14
instruction will not be MOV 30 D15
executed. MOV 2 D16
2. It is recommended to use LD X11
the edge to trigger the EU
execution of the instruction. TWR D10
LD M0
TRD D20

1. Upon the rising edge of X10, write the time setting into the 7 consecutive
units starting with D10 (D10 ~ D16).
2. Upon the rising edge of X11, write the values of elements D10 ~ D16 into the
system time.
3. When M0 is On, read the system time and save it into D20 ~ D26.
168 Chapter 6 Application Instructions

6.9.3 TADD: Add Clock Instruction

LAD: Applicable to MC280 MC200 MC100

Influenced flag bit Zero SM180, carry SM181

IL: TADD (S1) (S2) (D) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 WORD D SD V √
S2 WORD D SD V √
D WORD D V √
Chapter 6 Application Instructions 169

Operand description Example


S1: clock data1. The 3 storage S1 S2 D
elements designated by S1 are D10 23 (hour) D20 23 (hour) D30 23 (hour)
+ =
used to store the time data. If D11 59 (minute) D21 58 (minute) D31 58 (minute)
the data is not compliant with D12 59 (second) D22 58 (second) D32 57 (second)

the time format, the system will


report “Illegal instruction
LD X10
operand value”.
MOV 23 D10
S2: clock data2. The 3 storage MOV 59 D11
elements designated by S2 are MOV 59 D12
used to store another time data. MOV 23 D20
If the data is not compliant with MOV 58 D21
the time format, the system will MOV 58 D22
LD M0
report “Illegal instruction
TADD D0 D20 D30
operand value”.
LD SM181
D: time result storage unit. The OUT Y10
result of the time adding LD SM180
operation is stored in the 3 OUT Y11
storage elements designated
by D. The result will affect the 1. When X10 is ON, send the time data to the 3 storage elements starting with
carry flag SM181 and the zero D10 (D10 ~ D12) and the 3 storage elements starting with D20 (D20 ~ D22).
flag SM180. 2. When M0 is ON, add the data in D10 ~ D12 and the data in D20 ~ D22, and
Function description store the result in the 3 storage elements starting with D30.

Add two time-format data. The 3. The carry flag (SM181) will be set to ON, and the zero flag (SM180) will be
operation rules follow the time set to OFF.
format.
Note
The time data for the operation
must meet the time setting
range requirements.
 Hour: 0 ~ 23
 Minute: 0 ~ 59
 Second: 0 ~ 59
170 Chapter 6 Application Instructions

6.9.4 TSUB: Subtract Clock Instruction

LAD: Applicable to MC280 MC200 MC100

Influenced flag bit Zero SM180, borrow SM181

IL: TSUB (S1) (S2) (D) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 WORD D SD V √
S2 WORD D SD V √
D WORD D V √

Operand description Example


S1 S2 D
S1: clock data1. The 3
D10 23 (hour) D20 23 (hour) D30 23 (hour)
storage elements designated - =
D11 59 (minute) D21 59 (minute) D31 59 (minute)
by S1 are used to store the D12 58 (second) D22 59 (second) D32 59 (second)
time data. If the data is not
compliant with the time format,
the system will report “Illegal
LD X10
instruction operand value”. MOV 23 D10
S2: clock data2. The 3 MOV 59 D11
storage elements designated MOV 58 D12
by S2 are used to store MOV 23 D20
MOV 59 D21
another time data. If the data
MOV 59 D22
is not compliant with the time
LD M0
format, the system will report TSUB D10 D20 D30
“Illegal instruction operand LD SM182
value”. OUT Y10
D: time result storage unit. LD SM180
The result of the time OUT Y11
subtracting operation is
stored in the 3 storage 1. When X10 is ON, send the time data to the 3 storage elements starting with
elements designated by D. D10 (D10 ~ D12) and the 3 storage elements starting with D20 (D20 ~ D22).
The result will affect the carry 2. When M0 is ON, subtract the data in (D20 ~ D22) from the data in (D10 ~
flag SM181 and the zero flag D12), and store the result in the 3 storage elements starting with D30.
SM180.
3. The carry flag (SM182) will be set to ON, and the zero flag (SM180) will be
Function description set to OFF.
Conduct subtract operation
on the time format data, with
the operation rules following
the time format.
Note
The time data for the
operation must meet the time
setting range requirements.
 Hour: 0 ~ 23
 Minute: 0 ~ 59
 Second: 0 ~ 59
Chapter 6 Application Instructions 171

6.9.5 HOUR: Timing List Instruction

LAD: Applicable to MC280 MC200 MC100

Influenced flag bit

IL: HOUR (S) (D1) (D2) Program steps 8


Offset
Operand Type Applicable elements
addressing
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D1 INT D V √
D2 BOOL Y M S LM

Operand description Note

S: the hour comparison data. 1. To sustain the current data after power off, set D1 within the element Saving
Range: 0 ~ 32767. Range (see 2.2.1 System Block). Otherwise, the current data will be cleared
D1: time storage starting upon PLC power off or when PLC changes from RUN to STOP.
element. D1: hour. D1+1: 2. The timing still continues even when the alarm output D2 is ON.
second. 3. The hour data in this instruction is a 16-bit integer. It will restart from 0 after
D2: alarm output address. 32767.
When D1 ≥ S, the alarm point Example
changes to ON, and generates
LD M0
output.
MOV 1000 D100
Function description LD M1
HOUR D100 D200 M10
Make judgment on the time
LD M10
when the input contact is ON
OUT Y10
(unit: hour).
1. When M0 is ON, set the comparison data of HOUR instruction.
2. When M1 is ON, accumulate the time for the input contact.
3. M10 will be ON when the accumulated time ≥ 1000.
172 Chapter 6 Application Instructions

6.9.6 DCMP: Compare Date (=, <, >, <>, >=, <=) Instruction

LAD:
Applicable to MC280 MC200 MC100

Influenced flag bit

IL:
DCMP= (S1) (S2) (D)
DCMP< (S1) (S2) (D)
DCMP> (S1) (S2) (D)
Program steps 7
DCMP<> (S1) (S2) (D)
DCMP>= (S1) (S2) (D)
DCMP<= (S1) (S2) (D)
Offset
Operand Type Applicable elements
addressing
S1 INT D SD V √
S2 INT D SD V √
D BOOL Y M S LM C T

Operand description S2, and assign the comparison result to D.

S1: starting word element for Note


date comparison data 1, The date data stored in the elements starting with S1 and S2 must comply with
which occupies the 3 word the solar calendar format, or the system will report operand error. For example,
elements following S1. The “2004, 9, 31” and “2003, 2, 29” are both illegal.
data must comply with the Example
solar calendar format, or the
system will report operand
error.
LD SM0
S2: starting word element for MOV 2004 D0
date comparison data 2, MOV 10 D1
which occupies the 3 word MOV 25 D2
elements following S2. The MOV 2004 D10
MOV 10 D11
data must comply with the
MOV 24 D12
solar calendar format, or the
LD X0
system will report operand
DCMP= D0 D10 M0
error. DCMP< D0 D10 M1
D: Comparison status output. DCMP> D0 D10 M2
When the data meet the DCMP<> D0 D10 M3
comparison condition, D is set DCMP>= D0 D10 M4
DCMP<= D0 D10 M5
ON; otherwise, it is set OFF.
Function description
Conduct BIN comparison on Conduct BIN comparison on the date data stored in the elements starting with
the date data stored in the D0 and D10, and assign the comparison result to M0.
elements starting with S1 and
Chapter 6 Application Instructions 173

6.9.7 TCMP: Compare Time (=, <, >, <>, >=, <=) Instruction

LAD: Applicable to MC280 MC200 MC100

Influenced flag bit

IL:
TCMP= (S1) (S2) (D)
TCMP< (S1) (S2) (D)
TCMP> (S1) (S2) (D)
Program steps 7
TCMP<> (S1) (S2) (D)
TCMP>= (S1) (S2) (D)
TCMP<= (S1) (S2) (D)
Offset
Operand Type Applicable elements
addressing
S1 INT D SD V √
S2 INT D SD V √
D BOOL Y M S LM C T

Operand description S2, and assign the comparison result to D.

S1: starting word element for Note


date comparison data 1, The time data stored in the elements starting with S1 and S2 must comply
which occupies the 3 word with the 24-hour system, or the system will report operand error. For
elements following S1. The example, “24, 10, 31” and “13, 59, 60” are both illegal.
data must comply with the Example
24-hour time format, or the
system will report operand
error.
S2: starting word element for LD SM0
date comparison data 2, MOV 20 D0
MOV 31 D1
which occupies the 3 word
MOV 1 D2
elements following S2. The
MOV 20 D10
data must comply with the MOV 30 D11
24-hour time format, or the MOV 59 D12
system will report operand LD X0
error. TCMP= D0 D10 M0
D: comparison status output. TCMP< D0 D10 M1
TCMP> D0 D10 M2
When the data meet the
TCMP<> D0 D10 M3
comparison condition, D is set
TCMP>= D0 D10 M4
ON; otherwise, it is set OFF. TCMP<= D0 D10 M5
Function description
Conduct BIN comparison on
the time data stored in the
Conduct BIN comparison on the time data stored in the elements starting
elements starting with S1 and
with D0 and D10, and assign the comparison result to M0.
174 Chapter 6 Application Instructions

6.9.8 HTOS: Hour To Second Conversion Instruction

LAD: Applicable to MC280

Influenced flag bit

IL: HOTS (S) (D) Program steps 5


Offset
Operand Type Applicable elements
addressing
S WORD KnX KnY KnM KnS D SD C T R √
D WORD KnY KnM KnS D SD C T R √

Operand description and S+2 is converted into data in units of "second", and stored to D.

S: Head device number Example


storing the time data (hour,
minute and second) before
LD M1
conversion HTOS D0 D10
D: Device number storing the
time data (second) after
conversion
1. When M1 is ON, the time data read from D0, D1 and D2 is converted
Function description into data in units of "second", and stored to D10. When D0=3, D1=10,
The time data (hour, minute, D2=15, then D10=11415.
and second) stored in S, S+1,
Chapter 6 Application Instructions 175

6.9.9 STOH: Second To Hour Conversion Instruction

LAD: Applicable to MC280

Influenced flag bit

IL: STOH (S) (D) Program steps 5


Offset
Operand Type Applicable elements
addressing
S WORD KnX KnY KnM KnS D SD C T R √
D WORD KnY KnM KnS D SD C T R √

Operand description and stored to D, D+1, and D+2 (hour, minute, and second).

S: Device number storing the Example


time data (second) before
conversion
LD M0
D: Head device number STOH D0 D10
storing the time data (hour,
minute and second) after
conversion
1. When M1 is ON, the time data in units of "second" stored in D0 is converted
Function description into data in units of "hour, minute, and second", and stored to D10, D11 and
The time data in units of D12. When D0=1000, then D10=0, D11=16, D12=40.
"second" stored in S is
converted into data in units of
"hour, minute, and second",
176 Chapter 6 Application Instructions

6.10 High-speed I/O Instruction

6.10.1 HCNT: High-speed Counter Drive Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: HCNT (D) (S) Program steps 7
Offset
Operand Type Applicable elements
addressing
D DINT C
S DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √

Operand description Example

D: Counter SN. Range: C236 LD X10


~ C255. OUT SM236
LD X11
S: Comparison constant, a
RST C236
signed 32-bit data. Range:
LD X12
-2147483648 ~ 2147483647. HCNT C236 -5
Function description X010 Rising Rising
Falling
Drive the specified hardware Reset input
X011
high speed counter. All high
X012 Startup input
speed counter must be driven
to perform high speed X000
Counting input
counting. Meanwhile, the NO 5
4 4
contact action of the counter 3 3
2 2
will be judged based on the S 1 1
Current value 0 0 1
value. -
1 -
Output situation 2 - -
- -
Note 3
4 -
- -
- 4 3
5 5
6 - -
- 6
The HCNT instruction, SPD 7
8
7
C235 output contact
instruction, external input
interrupt and pulse capture
1. When X12 changes from OFF to ON, the hardware counter C236 will be
may have contradictory
initialized. X0 is the pulse input point for C236, which counts the pulse input
hardware demands. Pay
through X0. When X12 is OFF, X0 is a common input point, and C236 cannot
attention to the preconditions
count the external pulse of X0.
of all system high speed I/Os,
2. Contact actions: when the current value of the counter C236 increases from
and refer to the instruction
-6 to -5, the contact of C236 will be set. When the counter C236 decreases from
description in actual practice.
-5 to -6, the contact of C236 will be reset.
3. When X11 is ON, the RST instruction will be executed, C236 will be cleared,
and the C236 contact will be disconnected.
4. When PLC is powered off, the data of the high-speed counter and the contact
status is set by the user in the system block through the X-builder software.
Chapter 6 Application Instructions 177

6.10.2 DHSCS: High-speed Counting Compare Set Instruction

MC280 MC200 MC100


LAD: Applicable to
MC80

Influenced flag bit


IL: DHSCS (S1) (S2 ) (D) Program steps 10
Offset
Operand Type Applicable elements
addressing
S1 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
S2 DINT C
D BOOL Y M S

Operand description Note

S1: a 32-bit DINT data, the 1. The DHSCS instruction must work together with the HCNT instruction,
one with which the high because DHSCS is only applicable to the high speed counters that is driven by
speed counter will compare. HCNT.
Range: -2147483648 ~ 2. The DHSCS instruction will be validated only by pulse input. You cannot
2147483647. validate the instruction by changing the counter value with instructions such as
S2: high speed counter. DMOV or MOV.
Range: C236 ~ C255. 3. DHSCS (DHSCI, DHSCR, DHSZ, DHSP, DHST) can be used repeatedly.
D: target bit element, However, at most the first six such instructions can be driven at the same time.
including Y, M and S elements. 4. The maximum frequency supported by the PLC high speed counters will be
They will be set or output seriously affected by instructions like DHSCS, DHSCI, DHSCR, DHSZ, DHSP
immediately regardless of the and DHST. For details, see Chapter 8 Using High Speed I/O.
scan cycle. Example
Function description LD M1
1. A high-speed counter will OUT SM236
LD M0
count in the interrupt mode
HCNT C236 1000
only when it is driven by the
LD M2
HCNT instruction and the DHSCS 2000 C236 Y10
counting input changes from LD C236
OFF to ON. When high-speed OUT Y11
counter counts to S1 in the 1. When M1 is ON, C236 will count in the interrupt mode when X0 changes
DHSCS instruction, the bit from OFF to ON (see Chapter 8 Using High Speed I/O for the description of
element D will be set the X0 input frequency). When C236 changes from 999 to 1000, the C236
immediately, or, in the case of contact will be set. When C236 changes from 1001 to 1000, the C236 contact
a Y element, the Y element will be reset. When the C236 contact drives Y11, the execution of Y11 is
will output immediately. determined by the user program scan cycle.
2. This instruction can be 2. When M2 is ON, and the DHSCS instruction meets the requirements stated
used when you want to set in the preceding “Note”, Y10 will output immediately if C236 reaches 2000,
(and output, for Y elements) a regardless of the the scan cycle.
certain bit element by 3. When M0 is ON, SM236 is driven, and the C236 counter counts down. When
comparing the counter value M0 is OFF, SM236 is not driven, and the C236 counter counts up.
with a preset value.
178 Chapter 6 Application Instructions

6.10.3 DHSCI: High-speed Counting Compare Interrupt Trigger Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: DHSCI (S1) (S2) (S3) Program steps 10
Offset
Operand Type Applicable elements
addressing
S1 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V R 
S2 DINT C
S3 WORD Constant

Operand description 3. DHSCI (DHSCS, DHSCR, DHSZ, DHSP, DHST) can be used repeatedly.
However, at most the first six such instructions can be driven at the same time.
S1: a 32-bit DINT data, the
4. The maximum frequency supported by the PLC high speed counters will be
one with which the high
seriously affected by instructions like DHSCS, DHSCI, DHSCR, DHSZ, DHSP
speed counter will compare.
and DHST. For details, see Chapter 8 Using High Speed I/O.
Range: -2147483648 ~
2147483647. Example
S2: high speed counter. Main user program:
Range: C236 ~ C255.
S3: interrupt SN. Range: 20 ~ LD M1
OUT SM236
25.
LD M0
Function description DHSCI 2000 C236 20
A high-speed counter will LD C236
OUT Y11
count in the interrupt mode
only when it is driven by the Interrupt No.20:
HCNT instruction and the
counting input changes from LD M10
OFF to ON. When the counter OUT Y20
counts to S1, the S3 interrupt LD>= D0 100
OUT Y12
will start. You can write the
MOV 0 D0
interrupt according to your
actual needs. 1. When M1 is ON, C236 will count in the interrupt mode when X0 changes
from OFF to ON (see Chapter 8 Using High Speed I/O for the description of the
Note
X0 input frequency). When C236 changes from 999 to 1000, the C236 contact
1. The DHSCI instruction will be set. When C236 changes from 1001 to 1000, the C236 contact will be
must work together with the reset. When C236 contact drives Y11, the execution of Y11 will be determined
HCNT instruction, because by the user program scan cycle.
DHSCI is only applicable to
2. When M2 is ON, and the DHSCI instruction meets the requirements stated in
the high speed counters
the preceding “Note”, interrupt No.20 will be executed immediately when C236
which is driven by HCNT.
reaches 2000, regardless of the scan cycle.
2. The DHSCI instruction will
3. When M0 is ON, SM236 is driven, and the C236 counter counts down. When
be validated only by pulse
M0 is OFF, SM236 is not driven, and the C236 counter counts up.
input. You cannot validate the
4. With pulse input, interrupt No.20 will be executed when C236 reaches 2000,
instruction by changing the
and Y20 will be driven when M10 is ON. But, the output of Y20 is related to the
counter value with
scan cycle. Meanwhile, Y12 will be driven and D0 will be cleared when D0 is
instructions such as DMOV or
detected to be larger than 100.
MOV.
Chapter 6 Application Instructions 179

6.10.4 DHSPI: High-speed Output Passing Position Compare Interrupt Trigger Instruction

LAD: Applicable to MC280

Influenced flag bit


IL: DHSPI (S1) (S2) (S3) Program steps 10
Offset
Operand Type Applicable elements
addressing
S1 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V R 
S2 DINT SD
S3 WORD Constant

Operand description Example

S1: a 32-bit DINT data, the Main user program:


one with which the high
speed counter will compare.
Range: -2147483648 ~
2147483647.
S2: high speed output
position element. Range:
SD200, SD320, SD340,
SD350, SD360, SD370.
S3: interrupt SN. Range: 53 ~
58.
Function description
When the value of high-speed 1. You can choose the interrupt SN 53 for the interrupt program or other
output position element interrupt resource of high speed output passing position, then write the
counts to S1, the S3 interrupt interrupt program according to your actual needs.
will start. You can write the
interrupt according to your
actual needs.
180 Chapter 6 Application Instructions

6.10.5 DHSCR: High-speed Counting Compare Reset Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: DHSCR (S1) (S2) (D) Program steps 10
Offset
Operand Type Applicable elements
addressing
S1 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V 
S2 DINT C
D BOOL Y M S C

Operand description HCNT instruction, because DHSCR is only applicable to the high speed
counters that is driven by HCNT.
S1: a 32-bit DINT data, the
2. The DHSCR instruction will be validated only by pulse input. You cannot
one with which the high
validate the instruction by changing the counter value with instructions such as
speed counter will compare.
DMOV or MOV.
Range: -2147483648 ~
3. DHSCR (DHSCI, DHSCS, DHSZ, DHSP, DHST) can be used repeatedly.
2147483647.
However, at most the first six such instructions can be driven at the same time.
S2: high speed counter.
4. The maximum frequency supported by the PLC high speed counters will be
Range: C236 ~ C255.
seriously affected by instructions like DHSCS, DHSCI, DHSCR, DHSZ, DHSP
D: target bit element. The
and DHST. For details, see Chapter 8 Using High Speed I/O.
action on Y, M, S or C will be
valid immediately regardless Example
of the scan cycle. If D is a C LD SM255
element, it must be S2. OUT Y10
LD M1
Function description HCNT C255 1000
A high-speed counter will LD C255
count in the interrupt mode OUT Y20
LD M2
only when it is driven by the
DHSCR 2000 C255 Y1
HCNT instruction and the
1. When M1 and X7 are both ON, C255 counts the phase difference of X3 and
counting input changes from
X4 in the interrupt mode. When C255 changes from 999 to 1000, C255 contact
OFF to ON. When the counter
will be set, and reset when C255 changes from 1001 to 1000. When C255
counts to S1, the D element
contact drives Y20, the execution of Y20 will be determined by the user
will be reset (and output, for Y
program scan cycle.
elements) immediately. You
can use this instruction when 2. When M2 is ON, and the DHSCR instruction meets the requirements stated
you want to reset (and output, in the preceding “Note”, Y1 will be output immediately when C255 reaches
for Y elements) a certain bit 2000, regardless of the the scan cycle.
element by comparing the 3. When the X3 pulse input is ahead of X4, SM255 is ON. When the X4 pulse
counter value with a preset input is ahead of X3, SM255 is OFF.
value. 4. When X7, the startup signal of C255, is OFF, C255 will not count.
Note 5. When M1 and X7 are all ON, if X5 is ON, C255 will be cleared, and C255
auxiliary contact will be reset.
1. The DHSCR instruction
must work together with the
Chapter 6 Application Instructions 181

6.10.6 DHSZ: High-speed Counting Zone Compare Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: DHSZ (S1) (S2) (S3) (D) Program steps 13
Offset
Operand Type Applicable elements
addressing
S1 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V 
S2 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V 
S3 DINT C
D BOOL Y M S

Operand description Note

S1: a 32-bit DINT data, one of 1. The DHSZ instruction must work together with the HCNT instruction,
the two numbers with which because DHSZ is only applicable to the high speed counters that is driven by
the high speed counter will HCNT.
compare. Range: 2. The DHSZ instruction will be validated only by pulse input. You cannot
-2147483648 ~ 2147483647. validate the instruction by changing the counter value with instructions such as
S2: a 32-bit DINT data, one of DMOV or MOV.
the two numbers with which 3. DHSZ (DHSCI, DHSCS, DHSCR, DHSP, DHST) can be used repeatedly.
the high speed counter will However, at most the first six such instructions can be driven at the same time.
compare. Range: 4. The maximum frequency supported by the PLC high speed counters will be
-2147483648 ~ 2147483647. seriously affected by instructions like DHSCS, DHSCI, DHSCR, DHSZ, DHSP
S3: high speed counter. and DHST. For details, see Chapter 8 Using High Speed I/O.
Range: C236 ~ C255. Example
D: target bit element. The LD M0
action on Y, M or S will be HCNT C249 1000
valid immediately regardless LD M1
of the scan cycle. DHSZ 1500 2000 C249 Y10
LD SM249
Function description OUT Y12
1. A high-speed counter will LD C249
count in the interrupt mode OUT Y6

only when it is driven by the 1. When M0 and X6 are both ON, C249 will count up when X0 changes from
HCNT instruction and the OFF to ON, or count down when X1 changes from OFF to ON. When C249
counting input changes from changes from 999 to 1000, the C249 contact will be set; when C249 changes
OFF to ON. from 1001 to 1000, the C249 contact will be reset. When C249 contact drives
2. When the counter value is Y6, the execution of Y6 will be determined by the user program scan cycle.
smaller than S1, the D 2. When M1 is ON, the DHSZ instruction meets the requirements stated in the
element will be set. In preceding “Note”, the states of elements Y10 ~ Y12 are as follows:
addition, the D+1 and D+2 C249 < 1000: Y10: ON. Y11 & Y12: OFF.
elements will be reset. 1000 ≤ C249 ≤ 2000: Y10, Y12: OFF. Y11: ON.
3. When the counter value is C249 > 2000: Y10, Y11: OFF. Y12: ON.
≥S1 and ≤S2, the D and D+2 The outputs of Y10, Y11 and Y12 are immediate, regardless of the scan cycle.
elements will be reset, while 3. When M0 and X6 are ON at the same time, SM249 will be reset if X0
the D+1 element will be set. changes from OFF to ON and the counter counts up, and SM249 will be set if
4. When the counter value is X1 changes from OFF to ON and the counter counts down.
bigger than S2, the D and 4. When X6 is OFF, C249 stops counting.
D+1 elements will be reset,
5. When M0 and X6 are both ON, if X2 is ON, C249 will be cleared, and C249
while D+2 element will be set.
auxiliary contact will be reset.
5. If D is a Y element, it will be
output immediately
regardless of the scan cycle.
182 Chapter 6 Application Instructions

6.10.7 DHST: High-speed Counting Table Compare Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: DHST (S1) (S2) (S3) Program steps 10
Offset
Operand Type Applicable elements
addressing
S1 DINT D
S2 INT Constant
S3 DINT C

Operand description Note

S1: the starting D element for table comparison. 1. The DHST instruction must work together with
The following three D elements are the comparison the HCNT instruction, because DHST is only
data, SN of Y element and the output state. These applicable to the high speed counters that is driven
four D elements form a record. by HCNT.

S2: the number of records for comparison. Range: 1 2. The DHST instruction will be validated only by
~ 128. pulse input. You cannot validate the instruction by
changing the counter value with instructions such
S3: high speed counter. Range: C236 ~ C255.
as DMOV or MOV.
Function description
3. DHST (DHSCI, DHSCS, DHSCR, DHSP, DHSZ)
1. A high-speed counter will count in the interrupt can be used repeatedly. However, at most six such
mode only when it is driven by the HCNT instruction instructions can be driven at the same time.
and the counting input changes from OFF to ON. 4. In a user program, the DHSP and DHST
2. When the counter value equates the comparison instructions cannot be valid at the same time. That
data of the present record, the corresponding Y means a valid DHST (or DHSP) instruction will
element will be output. make the following DHSP (or DHST) instructions
3. The Y element specified in the present record will invalid.
be output immediately, regardless of the scan cycle. 5. The maximum frequency supported by the PLC
4. You can use the DHST instruction when you want high speed counters will be seriously affected by
to immediately output, according to certain instructions like DHSCS, DHSCI, DHSCR, DHSZ,
comparison data, the Y elements specified in a DHSP and DHST. For details, see Chapter 8
certain table. Using High Speed I/O.
Chapter 6 Application Instructions 183

Example
The table for comparison is shown below:
Comparison data
Y element Set/Reset Operation flow
Most significant bit Least significant bit
D100=0 D101=100 D102=0 D103=1 1
D104=0 D105=200 D106=1 D107=0 2
D108=0 D109=300 D110=2 D111=1 3
4
D112=0 D113=300 D114=3 D115=1
Return to 1

The following is the user program:

LD SM1
DMOV 100 D100
MOV 0 D102
MOV 1 D103
DMOV 200 D104
MOV 1 D106
MOV 0 D107
DMOV 300 D108
MOV 2 D110
MOV 1 D111
DMOV 100 D112
MOV 3 D114
MOV 1 D115
LD M0
HCNT C244 1000
LD M1
DHST D100 4 C244
LD M2
OUT SM244
LD C244
OUT Y10

1. In the first user-program scan cycle, assign elements D100 ~ D115 with values to generate the table for comparison.
2. When M0 and X6 are both ON, the C244 will count when X0 changes from OFF to ON (for the input frequency, see
Chapter 8 Using High Speed I/O). When C244 changes from 999 to 1000, the C244 contact will be set; when C244
changes from 1001 to 1000, the C244 contact will be reset. When the C244 contact drives Y10, the execution of Y10
will be determined by the user program scan cycle.
3. When M1 is ON, and the DHST instruction meets the requirements in the preceding “Note”, the compare will start
with the first record. The compare with the second record will not start until the first compare is over and the
corresponding Y element has been output. After the compare with the last record is over, the compare with the first
record will start again, and SM185 will be set. SD184 is the SN of the present record, and SD182 & SD183 are the
present data for comparison. The corresponding output will be immediate, regardless of the scan cycle.
4. When M2 is ON, SM244 is ON, and C244 will count down. If M2 is OFF, SM244 is OFF, and C244 will count up.
5. When X6 is OFF, C244 is invalid.
6. When M0 and X6 are both ON, if X2 is ON, C244 will be cleared, and C244 auxiliary contact will be reset.
184 Chapter 6 Application Instructions

6.10.8 DHSP: High-speed Counting Table Compare Pulse Output Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: DHSP (S1) (S2) (S3) Program steps 10
Offset
Operand Type Applicable elements
addressing
S1 DINT D
S2 INT Constant
S3 DINT C

Operand description 2. When the DHSP instruction is used together with


the PLSY instruction, the values assigned to SD180
S1: the starting D element for table comparison.
and SD181 must meet the frequency output
The following three D elements are the comparison
requirement of the PLSY instruction. For details,
data, and the data to output to SD180 & SD181.
see the description of the PLSY instruction.
These four D elements form a record.
3. To stop the comparison at the last record, set the
S2: the number of records to be compared. Range:
last output data of the table as 0. Under this
1 ~ 128.
situation, other DHST and DHSP instructions will be
S3: high speed counter. Range: C236 ~ C255. invalid. But at this time, the DHSP instruction is not
Function description regarded as a high speed instruction when it comes
to the number limit of high-speed instructions.
1. A high-speed counter will count in the interrupt
mode only when it is driven by the HCNT instruction 4. The DHSP instruction will be validated only by
and the counting input changes from OFF to ON. pulse input. You cannot validate the instruction by
changing the counter value with instructions such
2. When the counter value equates the comparison
as DMOV or MOV.
data of the present record, the output data of the
present record will become the values of SD180 & 5. DHSP (DHSCI, DHSCS, DHSCR, DHST, DHSZ)
SD181. can be used repeatedly. However, at most the first
six such instructions can be driven at the same
3. You can use the DHSP instruction when you want
time.
to control the high speed output or assign values to
certain parameters according to a table. For 6. In a user program, the DHSP and DHST
example, you can set the SD180 & SD181 (double instructions cannot be valid at the same time. That
word) as the output frequency of the PLSY means a valid DHSP (or DHST) instruction will
instruction, and the PLSY output frequency will be make the following DHST (or DHSP) instructions
adjusted by the table compare result. invalid.
7. The maximum frequency supported by the PLC
Note
high speed counters will be seriously affected by
1. The DHSP instruction must be used together with instructions like DHSCS, DHSCI, DHSCR, DHSZ,
the HCNT instruction, because the DHST DHSP and DHST. For details, see Chapter 8
instruction cannot be executed unless the related Using High Speed I/O.
high speed counter is driven by the HCNT
instruction.
Chapter 6 Application Instructions 185

Example
The table for comparison is shown below:
Comparison data Output data (to SD180 & SD181)
Operation flow
Most significant bit Least significant bit Most significant bit Least significant bit
D100=0 D101=100 D102=0 D103=1 1
D104=0 D105=200 D106=0 D107=2 2
D108=0 D109=300 D110=0 D111=3 3
4
D112=0 D113=300 D114=0 D115=4
Return to 1

The following is the user program:

LD SM1
DMOV 100 D100
MOV 0 D102
MOV 1 D103
DMOV 200 D104
MOV 0 D106
MOV 2 D107
DMOV 300 D108
MOV 0 D110
MOV 3 D111
DMOV 100 D112
MOV 0 D114
MOV 4 D115
LD M0
HCNT C244 1000
LD M1
DHSP D100 4 C244
LD M2
OUT SM244
LD C244
OUT Y10
LD M3
PLSY SD180 0 Y0

1. In the first user-program scan cycle, assign elements D100 ~ D115 with values to generate the table for comparison.
2. When M0 and X6 are both ON, C244 will count when X0 changes from OFF to ON (for the input frequency, see
Chapter 8 Using High Speed I/O). When C244 changes from 999 to 1000, the C244 contact will be set; when C244
changes from 1001 to 1000, the C244 contact will be reset. When the C244 contact drives Y10, the execution of Y10
will be determined by the user program scan cycle.
3. When M1 is ON, and the DHSP instruction meets the requirements in the preceding “Note”, the compare will start
with the first record. The compare with the second record will not start until the first compare is over and the output
data has been output to SD180 & SD181. After the compare with the last record is over, the compare with the first
record will start again, and SM185 will be set. SD184 is the SN of the present record, and SD182 & SD183 are the
present data for comparison. The output data will be output to SD180 & SD181 immediately, regardless of the scan
cycle. If you want to stop the at the last record, set the output data of the last record to 0.
4. When M2 is ON, and SM244 is ON, C244 will count down. When M2 is OFF, and SM244 is OFF, C244 will count up.
5. When X6 is OFF, C244 is invalid.
6. When M0 and X6 are both ON, if X2 is ON, C244 will be cleared, and the C244 contact will be reset.
186 Chapter 6 Application Instructions

6.10.9 SPD: Pulse Detection Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: SPD (S1) (S2) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S1 BOOL X
S2 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z 
D WORD D V 

Operand description The time sequence chart of the example program is


shown below:
S1: input point. Range: X0 ~ X5.
S2: time unit for input point detection. Unit: ms.
M0
Operand S2 > 0.
D: the storage register for the counted pulse number, X0
which will cause overflow when bigger than 65535.
D10: measured
Function description value
D11: current
To detect the number of pulses input through X0 ~ X5 value

in the specified period of time (ms) and store the result


in the designated storage register.
Note 1000ms 1000ms

1. SPD and HCNT are contradictory in their occupation


of hardware. For details, see Chapter 8 Using High 1000
Speed I/O.
D12: elapsed time
2. The SPD instruction supports only input points X0 ~
X5.
Input X0
3. Maximum pulse input frequency: 10kHz. Detection
may be faulty when frequency is higher than 10kHz.
4. The input frequency of SPD must be subject to the
limit of system total pulse frequency.
N(fpn)
Proximity switch
Example n pulse/round

1. When M0 is ON, count the pulses input through X0


within 1000ms, and store the counting result in D10.
D11 is the present counting value within the 1000ms,
LD SM0 while D12 is the elapsed time within the 1000ms.
PLSY 10000 0 Y0 2. D10 is in positive proportion to the rotary speed of
LD M0 the plate in the preceding figure.

SPD X0 1000 D10 3. D10 counts whenever X0 changes from OFF to ON,
and the counting value within the last 1000ms will be
stored in D10.
Chapter 6 Application Instructions 187

6.10.10 PLSY: Count Pulse Output Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: PLSY (S1) (S2) (D) Program steps 9
Offset
Operand Type Applicable elements
addressing
S1 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V 
S2 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V 
D BOOL Y

Operand description 5. During or after the execution of the high-speed


instruction, no other instructions can use the same
S1: specified frequency (Hz). Range: 1 ~ 100,000 (Hz).
port, unless the high speed pulse output instruction is
When S1 is outside this range, the system will report
invalid.
instruction operand error, and no hardware resources
6. Using two PLSY instructions can output two
will be occupied.
independent pulses at Y0 and Y1. You can also use
Change S1 during the execution of the instruction will
PLSY and the PWM (or PLSR) instructions to get
change the output frequency in real time.
independent pulse outputs at different output ports
S2: output pulse number (PLS). (Y0, Y1).
Range: 0 ~ 2147483647. When S2 is outside this range, 7. When multiple PWM, PLSY or PLSR instructions
the system will report instruction operand error, output work on the same output point, the first valid
no pulse, and no hardware resources will be occupied. instruction will control the state of the output point,
When S2 is 0, the pulse will output so long as the and others will not affect the output point state.
instruction is valid. If you change S2 during the
8. Just like other high speed instructions (DHSCS,
execution of the instruction, the change will be take
DHSCR, DHSZ, DHSP, DHST and HCNT), the PLSY
effect in the next round.
instruction must meet the system’s requests on high
D: high speed pulse output point. Range: Y0, Y1. speed I/O.
Function description Example
To output specified amount of high speed pulses at the
specified frequency. For that purpose, the load current
on the PLC output transistor should be big, but below
the rated load current. LD M1
Note PLSY 1000 10000 Y1
1. The PLC must use the transistor output mode. PLSR 1000 10000 Y0
2. When the PLC outputs high-frequency pulses, the Pulses
Y0
following load current for the PLC output transistor must
Frequency (1000)
be used.
3. The output loop (transistor) for PLSY, PWM and Pulses

PLSR is shown as follows: Y1


Frequency (1000)
resistance

PLC
1. When M1 is ON, 10,000 pulses will output through
Load

External
power supply Y0 and Y1 at the frequency of 1000Hz. Then the
pulse output will stop until M0 changes from OFF to
100m A
ON when the next round of output will start. When
M0 is OFF, there will be no output.
4. With large load, the transistor off time is relatively
2. The duty cycle of the pulses is 50%. The output is
longer. The PWM, PLSY and PLSR instructions require
handled in the interrupt mode, free from the scan
that the transistor output terminal be connected to their
cycle. For high frequency output, the output duty
corresponding loads. When the output waveform does
cycle at Y points is related to the load. The waveform
not conform to the instruction operand, increase the load
at output points (Y0 & Port 0, Y1 & Port 1) is related
current of the transistor (the transistor load current
to the load: so long as the current does not exceed
≤100mA).
188 Chapter 6 Application Instructions

the rated load current, the smaller the load is, the closer SD52: the MSB of the output pulse number at Y1 for
the output wave form is to the set operand. PLSY and PLSR instructions.
3. SM80 & SM81 controls the ON/OFF of the output at SD53: the LSB of the output pulse number at Y1 for
Y0 and Y1 respectively. When SM80 or SM81 is 1, the PLSY and PLSR instructions.
output is ON. SD54: the MSB of the total output pulse number at
4. SM82 & SM83 are the output monitors of Y0 & Y1 Y0 and Y1 for PLSY and PLSR instructions.
respectively. SM82 or SM83 will be OFF after the output SD55: the LSB of the total output pulse number at Y0
is complete. and Y1 for PLSY and PLSR instructions.
5. SD50: the MSB of the output pulse number at Y0 for 6. SD50 ~ SD55 can be changed with the instruction
PLSY and PLSR instructions. DMOV or MOV, or through the ConstrolStar software.
SD51: the LSB of the output pulse number at Y0 for 7. Refer to the DHSP instruction if you want to use
PLSY and PLSR instructions. the input pulse number to control the PLSY output
pulse frequency.

6.10.11 PLSR: Count Pulse With Acceleration/Deceleration Output Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: PLSR (S1) (S2) (S3) (D) Program steps 10
Offset
Operand Type Applicable elements
addressing
S1 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S2 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
S3 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D1 BOOL Y

Operand description operand error, and the acceleration or deceleration


time will be uncertain.
S1: maximum frequency. Range: 10 ~ 20,000 (Hz).
When S1 is specified indirectly, and if the specified  Note
value is outside this setting range, it will be For MC100, the acceleration / deceleration time must not
regarded as 10 or 20,000, depending on which limit be smaller than 50ms.
it breaks. In that case, the system will report
operand illegal, and the high speed pulse output will The speed change is evenly divided into 10 steps
be based on the default 10Hz or 20,000Hz. during the acceration or deceleration, each step
being S1/10.
S2: total output pulse number (PLS). Range: 110 ~
2147483647. When S2 is outside this range, the D: high speed pulse output point. Range: Y0, Y1.
system will report instruction operand error, output Function description
no pulse, and no hardware resources will be The PLSR instruction is a high speed pulse output
occupied. instruction with acceleration / deceleration function.
S3: acceleration or deceleration time (ms). If S1 × It is used for Position. Targeting at the specified
S3 < 100,000, S3 will be regarded as 100000/S1. maximum frequency, the pulse output will
Meanwhile the system will report instruction accelerate evenly. After the output pulse number
operand error, and the acceleration or deceleration reaches the preset value, the pulse output will
time will be uncertain. decelerate evenly.
If S1 × S3 > S2 × 909, S3 will be regarded as S2 ×
909/S1. Meanwhile the system will report instruction
The operation process is shown in the following figure:
Chapter 6 Application Instructions 189

S1 highest frequency: 10 ~ 2000Hz


10 1
9 2
Output: 8 3
Y0 or Y1
7

s
4

ep

Sp
st

ee
6 5

10

d
S1 total output pulse Speed change

ch
in
5

an
6 in one step is at

ge
number: 110 ~

ge
an
4 2,147,483,647pls 7 most 1/10 of S1

in
ch

10
d
3
ee
8

st
Sp

ep
2

s
9
1 10

S9 acceleration time S5 deceleration time


Time (sec)

Note Example

1. The output frequency of this instruction is 10 ~


20,000Hz. When the acceleration / deceleration rate
exceeds that range, it will be automatically adjusted
according to that range.This instruction is free from the LD M0
influence of the scan cycle. PLSR 10 110 1000 Y1
2. Use the transistor output. During the high speed pulse PLSR 10 110 1000 Y0
output, the output current must comply with the related 1. When M0 is ON, Y0 and Y1 output 110 pulses
regulations. The waveform at output points (Y0 & Port 0, respectively at set frequencies. When M0 changes
Y1 & Port 1) is related to the load: so long as the current from OFF to ON, pulses will be output again. When
does not exceed the rated load current, the smaller the M0 is OFF, the output will stop.
load is, the closer the output waveform is to the set 2. The operand change during the execution of the
operand. instruction will not be valid until the next time this
3. During the execution of the high-speed instruction, so instruction is executed.
long as the power flow is not OFF, no other instructions 3. SM80 & SM81 controls the ON/OFF of the output
can use the same port, unless the high speed pulse at Y0 and Y1 respectively. When SM80 or SM81 is 1,
output instruction is invalid. the output is ON.
4. Using two PLSR instructions can output two 4. SM82 & SM83 are the output monitors of Y0 & Y1
independent pulses at Y0 and Y1. You can also use respectively. SM82 & SM83 will be ON when the
PLSR and the PWM (or PLSY) instruction to get output is going on, or OFF when the output is over.
independent pulse outputs at different output ports (Y0, 5. SD50: the MSB of the output pulse number at Y0
Y1). for PLSY and PLSR instructions.
5. When multiple PWM, PLSY or PLSR instructions SD51: the LSB of the output pulse number at Y0 for
work on the same output point, the first valid instruction PLSY and PLSR instructions.
will control the state of the output point, and others will SD52: the MSB of the output pulse number at Y1 for
not affect the output point state. PLSY and PLSR instructions.
6. Just like other high speed instructions (DHSCS, SD53: the LSB of the output pulse number at Y1 for
DHSCR, DHSZ, DHSP, DHST and HCNT), the PLSR PLSY and PLSR instructions.
instruction must meet the system’s requests on high
SD54: the MSB of the total output pulse number at
speed I/O.
Y0 and Y1 for PLSY and PLSR instructions.
SD55: the LSB of the total output pulse number at Y0
and Y1 for PLSY and PLSR instructions.
6. SD50 ~ SD55 can be changed with the instruction
DMOV or MOV, or through the X-builder software.

6.10.12 PLS: Pulse Output Instruction of Envelope

LAD: Applicable to MC280 MC200 MC100

Influenced flag bit


190 Chapter 6 Application Instructions

IL: PLS (S1) (S2) (D1) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S2 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
D1 BOOL Y

Operand description maximum speed; Fmin : the maximum speed; Tup : the
acceleration time; Tdown : the deceleration time.
S1: the starting D element
1) When the speed of step N is bigger than that of
S2: output section number. Range: 0 ~ 255
step N-1, the pulse number of step N must meet
D1: high speed pulse output point. Range: Y0, Y1.
the following condition:
Function description ( FN  FN 1 )  ( FN  FN 1 )  Tup
P
1. Use the ConstrolStar instruction wizzard to generate 2000  ( Fmax  Fmin )
the PLS instruction, which can be called like 2) When the speed of step N is smaller than that of
subprograms. When the power flow is ON, the system step N - 1, the pulse number of step N must meet
will output corresponding pulses according to the the following condition:
configuration. You can control ON or OFF of the PG, ( FN  FN 1 )  ( FN  FN 1 )  Tdown
P
and set frequency & pulse number. 2000  ( Fmax  Fmin )
2. There is no output when the section number is 0. 3. In particular,
3. SM80 and SM81 can be used to stop the high speed 1) when N = 1, the frequency of step N – 1 is used
pulse output. Other flag bits are the same as other instead of Fmin in the above format.
high speed I/O instructions.
2) when all the step number is 1, that is to say, only
4. The subprogram PLS_SET generated by the one section, the pulse number must meet the
X-builder is as follows (n: D element addr. M: total following condition:
section number): ( F1  Fmin )  ( F1  Fmin )  (Tup  Tdown )
LD SM0 P
2000  ( Fmax  Fmin )
DMOV section 1 step frequency Dn 3) The pulse number of the last step must meet the
DMOV section 1 step pulse number Dn + 2 following format:
DMOV section 2 step frequency Dn + 4 ( FM  FM 1 )  ( FM  FM 1 )  (Tup  Tdown )
P
DMOV section 2 step pulse number Dn+ 6 2000  ( Fmax  Fmin )

DMOV section 3 step frequency Dn + 8 4) the frequency set in every step must be within
DMOV section 3 step pulse number Dn + 10 the range of maximum speed and minimum speed.

... 5) The maximum total pulse number of all steps is


999,999.
DMOV section M step frequency Dn + 4M - 4
4. Use the transistor output. During the high speed
DMOV section M step pulse number Dn + 4M - 2
pulse output, the output current must comply with the
DMOV max. speed Dn + 4M
related regulations. The waveform at output points (Y0
MOV min. speed Dn + 4M + 2 & Port 0, Y1 & Port 1) is related to the load: so long as
MOV acceleration time Dn + 4M + 3 the current does not exceed the rated load current, the
MOV deceleration time Dn + 4M + 4 smaller the load is, the closer the output waveform is
Note to the set operand.
5. During the execution of the high-speed instruction,
1. It is recommended to use the PTO instruction wizard
so long as the power flow is not OFF, no other
to generate PLS instruction. If you write the PLS
instructions can use the same port, unless the high
instruction manually, note that the pulse number of the
speed pulse output instruction is invalid.
steps must not be too small. With set acceleration, the
pulse number of each step must be bigger than the 6. The PLSY, PLSR, PLS and Position instructions can
min. pulse number required by frequency transfer. output high speed pulses through Y0 and Y1. Note that
only one instruction can use one output port at one
2. Use P to stand for the pulse number that a certain
time.
step outputs; FN : frequency of section N; F max: the

6.10.13 PWM: Pulse Output Instruction


Chapter 6 Application Instructions 191

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: PWM (S1) (S2) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S1 INT Operand KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S2 INT Operand KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D BOOL Y

Operand description the PLSY and PLSR instructions to get independent


pulse outputs at different output ports (Y0, Y1).
S1: pulse width (ms).
5. When multiple PWM, PLSY or PLSR instructions
Range: 0 ~ 32767 (ms). When S1 is bigger than 32767,
work on the same output point, the first valid
the system will report illegal instruction operand, and
instruction will control the state of the output point, and
no hardware resources will be occupied.
others will not affect the output point state.
You can change the output pulses in real-time by
6. Just like other high speed instructions (DHSCS,
changing S1 during the execution of the instruction.
DHSCR, DHSZ, DHSP, DHST and HCNT), the PWM
S2: pulse cycle (ms). instruction must meet the system’s requests on high
Range: 1 ~ 32767. When S2 is outside the range, the speed I/O.
system will report illegal instruction operand, no pulse
Example
will be output, and no system resources will be
occupied.
You can change the output pulses in real-time by
changing S2 during the execution of the instruction.
S2 must be bigger than S1, or the system will report LD M0
illegal instruction operand, no pulse will be output, and PWM 40 200 Y0
no system resources will be occupied. PWM 40 200 Y1
D: high speed pulse output point (Y0 or Y1) t

Function description Y0
Output PWM pulses with the width of S1 and cycle of
To
S2 at the port designated by D.
t
Note
Y1
1. When S1 is 0, Y0 or Y1 output is OFF. When S1 is
equates S2, Y0 or Y1 output is ON. To

2. The waveform at output points (Y0 & Port 0, Y1 & Where “t” is the pulse width and T0 is the pulse cycle.
Port 1) is related to the load: so long as the current 1. When M0 is ON, Y0 and Y1 output PWM pulses with
does not exceed the rated load current, the smaller the the width of 40ms and cycle of 200ms. When M0 is
load is, the closer the output waveform is to the set OFF, the output will stop. The output state is not
operand. Therefore, in order to output high speed affected by the scan cycle.
pulses, the load current at the PLC output transistor 2. SM80 and SM81 control the output ON/OFF of Y0
must be big, but smaller than the rated load current. and Y1 respectively. When SM80 and SM81 are ON,
3. During the execution of the high-speed instruction, the output will stop.
so long as the power flow is not OFF, no other 3. SM82 and SM83 monitor the output of Y0 and Y1
instructions can use the same port, unless the high respectively. When M0 is OFF, SM82 and SM83 are
speed pulse output instruction is invalid. OFF.
4. Using two PWM instructions can output two
independent pulses at Y0 and Y1. You can also use

6.11 Control Calculation Instruction

6.11.1 PID: PID Instruction

LAD: Applicable to MC280 MC200 MC100 MC80


192 Chapter 6 Application Instructions

Influenced flag bit


IL: PID (S1) (S2) (S3) (D) Program steps 9
Offset
Operand Type Applicable elements
addressing
S1 INT D √
S2 INT D √
S3 INT D √
D INT D √

Operand description Output upper limit: -32768 ~ 32767 (when bit 2 & bit 5
of S3+1 are 0 & 1 respectively).
D: calculation result output after the program is
S3+18: PID output value (negative change) alarm
executed (MV)
point. Range: 0 ~ 32767 (when bit 2 & bit 5 of S3+1 are
S1: preset value (SV)
1 & 0 respectively).
S2: current value (PV)
Output lower limit: -32768 ~ 32767 (when bit 2 & bit 5
S3: sampling time (Ts). Range: 1 ~ 32767 (ms). It must of S3+1 are 0 & 1 respectively).
be set bigger than the calculation time.
S3+19: PID alarm output
S3+1: action, alarm and thresholds setting
Bit 0 process value (positive change) overflows
Value and meaning
Bit Bit 1 process value (negative change) overflows
0 1
0 Forward Reverse
Bit 2 output value (positive change) overflows
Process Value Process Value alarm Bit 3 output value (negative change) overflows
1
alarm disabled enabled Where, S3 ~ S3 + 6 are the mandatory user set
Output value alarm Output value alarm operands, while S3 + 15 ~ S3 + 19 are optional user
2
disabled enabled set operands. You can set the operands through the
3~4 Reserved
PID instruction wizard of the X-builder.
Output threshold Output threshold setting
5 Function description
setting disabled enabled
6 ~ 15 Reserved 1. PID calculation will be carried out when the power
flow is ON and it is the sampling time.
S3+2: input filter constant (α). Range: 0 ~ 99 [%].
2. Multiple PID instructions can be executed
Zero means no input filtering function. simultaneously (no limit on the loop number). However,
S3+3: proportional gain (Kp). Range: 1 ~ 32767 [%]. note that the elements used as S1, S2, S3 or D should
S3+4: integral time constant (TI). Range: 0 ~ 32767 be different.
(×100ms). Zero means limit, or no integral. 3. The PID instruction is applicable to timed interrupt
S3+5: differential gain (KD). Range: 0 ~ 100[%]. Zero subprograms, ordinary subprograms and the main
means no differential gain. program. Note that before using the PID instruction,
S3+6: differential time (TD). Range: 0 ~ 32767 confirm the operand settings and clear the internal
(×10ms). Zero means no differential processing. data registers S3+7 ~ S3 + 14 first.
S3+7 ~ S3+14: internal data register for PID operation 4. The input filtering constant can smooth the change
S3+15: PID process value (positive change) alarm of measured value.
point. Range: 0 ~ 32767 (when bit 1 of S3+1 is 1). 5. The differential gain can smooth the change of
S3+16: PID process value (negative change) alarm output value.
point. 0 ~ 32767 (when bit 1 of S3+1 is 1). 6. Action direction: bit 0 of S3+1 is used to set the
S3+17: PID output value (positive change) alarm point forward (positive reactioin) and reverse (negative
0 ~ 32767 (when bit 2 & bit 5 of S3+1 are 1 & 0 reaction) of the system.
respectively).
Chapter 6 Application Instructions 193

7. Output thresholds: when the output threshold setting is enabled (bit 5 & bit 2 of S3+1 are 1 and 0 respectively), the
integral of PID can be controlled from becoming too big. The output value is shown as below:
Output value
Without
output limits
S3+17
Upper limit No output

S3+18
No output
Lower limit
With output
limits
Time

8. Alarm setting: when the output thresholds are set valid (in S3+1, bit 1 is 1, BIT2 is 1 and bit 5 is 0), the PID
instruction will compare the current value with the preset value in S3+15 ~ S3 + 18. If the current value is bigger than
the preset value, PID will report alarm, and the corresponding bits in S3+19 will be set. In this way you can monitor the
input change and output change. See the following figures.

Input change Output change

Positive change Positive change

0 Sampling times Sampling times


0

Negative change
Negative change
Alarm flag
Alarm flag
S3+19
bit 0 ON OFF S3+19
bit 2 ON OFF
S3+19
bit 1 OFF S3+19
bit 3 OFF ON
ON

9. Basic PID equations:


Direction PID equations

EVn  PVnf  1  SV
Forward TD
Dn  PVnf  PVnf  2  2 PVnf  1  αD TD  Dn  1
TS αD TD TS αD TD
MVn   ΔMV

EVn  SV  PVnf  1
Reverse TD
Dn  2 PVnf  1  PVn f  PVnf  2   αD TD  Dn  1
T S  α D T D T S  α D T D
MVn   ΔMV

Operand description:
Symbol Description Symbol Description
EV n The current Error Value Dn The current Differential Value
EVn  1 The previous Error Value Dn  1 The previous Differential Value
SV The Set Point Value KP The Proportion Constant
PVnf The calculated Process Value TS The Sampling Time
PVnf  1 The previsou Process Value TI The Integral Time Constant
PVnf  2 The second previous Process Value TD The Differential Time
ΔMV The change in the output Manipulation Values αD The Differential gain
MV The current output manipulation value
194 Chapter 6 Application Instructions

Example
// PID initialization. If the control operands are the same, you can initialize the operands only once.
LD SM1 //Initialization, executed only once
MOV 1000 D500 //Setting target value
MOV 500 D510 //Sampling time (Ts) Range: 1 ~ 32767 (ms). It must be bigger than the
// calculation time
MOV 7 D511 //Action direction
MOV 70 D512 //Input filtering constant (α) Range: 0 ~ 99 [%]. Zero means no input filtering
MOV 100 D513 //Proportional gain (Kp) Range:1 ~ 32767 [%]
MOV 25 D514 //Integral time (TI) Range: 0 ~ 32767 (×100ms). Zero means limit, or no integral
MOV 0 D515 //Differential gain (KD) Range: 0 ~ 100[%]. Zero means no differential gain
MOV 63 D516 //Differential time (TD) Range: 0 ~ 32767 (×10ms). Zero means no differential
// processing
FMOV 0 D517 8 //Clearing the memory for the transit data of PID calculation
MOV 2000 D525 //Process value (positive change) alarm setting 0 ~ 32767
MOV 2000 D526 //Process value (negative change) alarm setting 0 ~ 32767
MOV 2000 D527 //Output value (positive change) alarm setting 0 ~ 32767
MOV 2000 D528 //Output value (negative change) alarm setting 0 ~ 32767
//PID instruction execution
LD M0 //User-controlled PID calculation program
FROM 0 5 D501 1 //Input current measured value (users can input measured values
// according to the actual situation)
PID D500 D501 D510 D502 //PID instruction: PID S1 S2 S3 D
TO 0 8 D502 1 //PID calculation result is fed back to the controlled system (users can
// handle the PID calculation result according to the actual situation)

The LAD of the above instructions is shown below: situation could be different), assigned to the
corresponding elements, and the PID calculation will
be carried out. The calculation result will be converted
into analog signals through the external D/A module
(the actual situation could be different) and fed to the
controlled system.
Note
1. The operand D should be a register outside of the
Saving Range. Otherwise, it should be cleared (LD
SM0 MOV 0 D****) in the first operation.
2. The PID instructions occupies 20 consecutive
registers starting with S3.
3. The maximum error of sampling time (TS) is - (scan
cycle + 1ms) ~ + (scan cycle). When TS is small, the
PID effect will be affected. It is recommended to use
PID instruction in the timed interrupt.
4. When setting the PID output thresholds, if the upper
limit is smaller than the lower limit, the system will
report operand error, and no PID calculation will be
carried out.
5. When the process value alarm and output value
alarm are enabled, S3 + 15 ~ S3 + 18 cannot be set
The PLC will initialize the PID operands only in the first
negative, or the system will report operand error, and
scan cycle. When X2 is ON, the current measured
no PID calculation will be carried out.
value will be read from external A/D module (the actual
Chapter 6 Application Instructions 195

6. Setting bit 2 and bit 5 of S3+1 ON at the same time 9. The PID operands must be initialized before the PID
will be regarded as invalid (essentially the same as instruction is executed the first time. If the operands
setting bit 2 and bit 5 OFF), and there will be no limit, remain the same during the operation, and the related
nor output value alarm. operand elements will not be covered by other
7. When the PID control operands (S3 ~ S3 + 6) are programs, you can initialize the PID operands only
set outside their ranges, the system will report operand once. However, if the data in the transit data registers
error, and no PID calculation will be carried out. are changed during the PID calculation, the calculation
8. When the sampling time is smaller than the scan result will be incorrect.
cycle, if there is data overflow or result overflow during
the calculation, there will be no alarm, and the PID
calculation continues.

6.11.2 RAMP: Ramp Wave Signal Output Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: RAMP (S1) (S2) (D1) (S3) (D2) Program steps 12
Offset
Operand Type Applicable elements
addressing
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D1 INT D V √
S3 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D2 BOOL Y M S LM C T

Operand description Analysis of the execution process of the ramp


instruction is shown in the following figure (S3=5):
S1: starting value
S2: end value
D1: output value D1

S3: step number. S3 >0, or system will report operand


error. and do not execute the calculation.
D2
D2: output state 0
Function description
SM15
In each scan cycle, when the power flow is ON, this
S3
instruction can determine the increment and current
output value D1 according to the ramp wave height
Note
and step number. When the output value D1 reaches
S2, it will keep stable, and the output state D2 will be 1. If the result is not divisible when calculating the
set ON. If the power flow falls, the output state D2 will program steps, round off to the nearest whole number.
be set OFF, but the output value D1 will not change, 2. The instruction will generate one ramp data upon
until the power flow rises again, when D1 will be every rising edge.
initialized as S1, and continue to conduct the next 3. When S1 = S2, D1 = S2, D2 = ON.
ramp calculation. 4. The total number of RAMP, HACKLE and
See the following figure: TRIANGLE instructions in a program should not
exceed 100.
pf
Example
S2
//Initialize registers upon the first scan cycle after the
S1
D1
power-on
LD SM1
D2 MOV 0 D0
pf: state of the power flow MOV 2000 D1
//Execute RAMP instruction when X0 is ON
LD X0
196 Chapter 6 Application Instructions

RAMP D0 D1 D10 1000 M0 1. When X0 is ON, D10 (in the first cycle, D10 = D0 = 0)
//Output the ramp function result to external DA will increase by 2 (2000/1000) in every scan cycle.
module when X1 = ON to generate ramp wave form When D10 = D1 = 2000, D10 will increase no more,
LD X1 and M0 will be ON. During the generation of the ramp
function, if the power flow falls, the output state D2 will
TO 0 6 D10 1
be OFF, the output value D1 will keep its current value
The LAD of the preceding instructions is shown below:
until the next rising edge, when D10 = D0 and a new
ramp starts.
2. You can use an external special module to convert
the data into analog waveform.

6.11.3 HACKLE: Hackle Wave Signal Output Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: HACKLE (S1) (S2) (D1) (S3) (D2) Program steps 12
Offset
Operand Type Applicable elements
addressing
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D1 INT D V √
S3 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D2 BOOL Y M S LM C T

Operand description
pf
S1: starting value
S2
S2: end value
D1: output value S1
D1
S3: step number. S3 > 0, or system will report
operand error. and do not execute the calculation
D2
D2: output state
pf: state of the power flow
Function description
In each scan cycle, when the power flow is ON, The analysis of the hackle wave instruction is shown in
this instruction can determine the increment and the following figure (S3=5):
current output value D1 according to the hackle
wave height and step number. When the output
value reaches S2, it will be initialized as S1 and D1
the state output D2 will be set ON. If the power
flow in the next scan cycle is still ON, D2 will be
set OFF to produce the next hackle wave. If the D2
power flow falls, the output state D2 will be OFF,
and the output value D1 will keep its current value
until the next rising edge, when the output value SM15
D1 will be initialized as S1, and the next hackle S3
wave will be created, as shown in the following
figure.
Chapter 6 Application Instructions 197

Note //When X1 is ON, output the result of ramp function to


external DA module to generate hackle waveform
1. If the result is not divisible when calculating the
LD X1
program steps, round off to the nearest whole
TO 0 1 D10 1
number.
The LAD for the preceding instruction is shown in the
2. The instruction will generate a series of
following figure:
continuous hackle wave data so long as the
power flow keep ON
3. When S1 = S2, D1 = S2, D2 = ON (no counting
pulse)
4. The total number of RAMP, HACKLE and
TRIANGLE instructions in a program should not
exceed 100.
1. When X0 is ON, D10 (in the first cycle, D10 = D0 = 0)
Example
will increase by 2 (2000/1000) in every scan cycle. When
//Initialize registers upon the first scan cycle after D10 = D1 = 2000, M0 will be ON. In the next scan cycle, if
power-on X0 keeps ON, D10 = D0 = 0, and M0 is OFF, the next
LD SM1 hackle wave will start. If the power flow falls, the output
MOV 0 D0 state D2 will be OFF, but the output value D1 will keep its
MOV 2000 D1 current value until the next rising edge, when D1 will be
//Execute HACKLE instruction when X0 is ON initialized as S1, and a new hackle wave starts.
LD X0 2. You can use an external special module to convert the
HACKLE D0 D1 D10 1000 M0 data into analog waveform.

6.11.4 TRIANGLE: Triangle Wave Signal Output Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: TRIANGLE (S1) (S2) (D1) (S3) (D2) Program steps 12
Offset
Operand Type Applicable elements
addressing
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D1 INT D V √
S3 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D2 BOOL Y M S LM C T

Operand description again, the state output D2 will be set ON. In the next
scan cycle, if the power flow keeps ON, the state
S1: starting value
output D2 will be set OFF and the next triangle will
S2: end value be generated. If the power flow falls, the output
D1: output value state D2 will be OFF, the output value D1 will keep
S3: step number. S3 > 0, or system will report its current value until the power flow rises again,
operand error, and do not execute the calculation. when D1 will be initialized as S1, and a new triangle
D2: output state wave will start. See the following figure:

Function description
pf
In each scan cycle, when the power flow is ON, this
instruction can determine the increment and current S2
output value D1 according to the triangle wave S1
height and step number. When the output value D1
reaches S2, the rising half of the triangle is
completed, the increment direction of the output D2
value will change and generate the falling half of the pf: state of the power flow
triangle. When the output value D1 reaches S1
198 Chapter 6 Application Instructions

The analysis of the execution of the triangle next triangle wave will start. If the power flow falls,
instruction is shown in the following figure (S3 = 5): the output state D2 will be OFF, but the output value
D1 will keep its current value until the next rising
edge, when D1 will be initialized as S1, and a new
D1 triangle wave starts.
2. You can use an external special module to
convert the data into analog waveform.
D2

SM15

(S3 -1)*2

Note
1. If the result is not divisible when calculating the
program steps, round off to the nearest whole
number.
2. The instruction will generate a series of
continuous triangle wave data so long as the power
flow keeps ON.
3. When S1 = S2, D1 = S2, D2 = ON (no counting
pulse), the cycle of the triangle wave is (S3 - 1) × 2.
4. The total number of RAMP, HACKLE and
TRIANGLE instructions in a program should not
exceed 100.
Example
// Initialize registers upon the first scan cycle after
power-on
LD SM1
MOV 0 D0
MOV 2000 D1
//Execute TRIANGLE instruction when X0 is ON
LD X0
TRIANGLE D0 D1 D10 1000 M0
// When X1 is ON, output the result of ramp function
to external DA module to generate triangle
waveform
LD X1
TO 0 1 D10 1
The LAD of the preceding instruction is shown in the
following figure:

1. When X0 is ON, D10 (in the first cycle, D10 = D0


= 0) will increase by 2 (2000/1000) in every scan
cycle. When D10 = D1 = 2000, the rising half of the
triangle is complete, and D10 will decrease by 2 in
every scan cycle that follows. When D10 = D0 = 0, a
complete triangle is complete, and M0 is ON. In the
next scan cycle, if X0 keeps ON, and M0 is OFF, the
Chapter 6 Application Instructions 199

6.11.5 ABSD: Absolute Drum Sequencer Instruction

LAD: Applicable to MC280 MC200

Influenced flag bit Zero, carry, borrow


IL: ABSD (S1) (S2) (D) (S3) Program steps 9
Offset
Operand Type Applicable elements
addressing
S1 INT KnX KnY KnM KnS D C T R √
S2 INT C √
D BOOL Y M S
S3 WORD Constant

Operand description 3. Write the following data to S1 to [S1+2·S3+1] in


advance by a transfer instruction:
S1: Head device number storing the data table (with
rising and falling point data) Rising Data Falling Data Outpu
S2: Counter number for monitoring the current point examp point example t
value compared with the data table le

D: Head bit device number to be output S1 40 S1+1 140 D


S3: Number of lines in the table and the number of S1+2 100 S1+3 200 D+1
output bit devices S1+4 160 S1+5 60 D+2
[1 ≤ S3 ≤ 64].
S1+6 240 S1+7 280 D+3
Function description …… …… …… …… ……
1. The current value of S2 the counter is compared S1+2S3 S1+2S3 D+S3
with the data table with "S3" lines starting from S1 +1 -1
(which occupies "S3" lines × 2 devices), and
4. When the command input is set to ON, "S3"
consecutive "S3" outputs starting from D are
points starting from D change as shown below.
controlled to ON or OFF.
2. Each rising point/falling point can be changed
respectively by overwriting the data in S1 to [S1+S3
×
2].
200 Chapter 6 Application Instructions

Example Notes
In this example, outputs are controlled to ON or 1. When specifying digits of a bit device as S1, k =
OFF by one rotation (0 to 360° using the rotation 4.
angle signal of 1°/pulse). 2. When specifying numbers of a counter as S2, the
range of S2 is in C0~C199.
3. The instruction is affected by the scan cycle.

M0 is the power flow input, X1 is the rotation angle


signal of 1°/pulse.

6.11.6 DABSD: Double Absolute Drum Sequencer Instruction

LAD: Applicable to MC280 MC200

Influenced flag bit Zero, carry, borrow


IL: DABSD (S1) (S2) (D) (S3) Program steps 11
Offset
Operand Type Applicable elements
addressing
S1 INT KnX KnY KnM KnS D C T R √
S2 INT C √
D BOOL Y M S
S3 WORD Constant

Operand description 3. Write the following data to S1 to [S1+2S3+1] in


advance by a transfer instruction:
S1: Head device number storing the data table (with
rising and falling point data) Rising Data Falling Data Output
point exam point exa
S2: Counter number for monitoring the current
ple mple
value compared with the data table
C200~C255 [S1+1, 40 [S1+3, 140 D
D: Head bit device number to be output S1] S1+2]

S3: Number of lines in the table and the number of [S1+5, 100 [S1+7, 200 D+1
output bit devices S1+4] S1+6]
[1 ≤ S3 ≤ 64]. [S1+9, 160 [S1+11, 60 D+2
S1+8] S1+10]
Function description
[S1+13, 240 [S1+15, 280 D+3
1. The current value of S2 the counter is compared
S1+12] S1+14]
with the data table with "S3" lines starting from S1
(which occupies "S3" lines × 4 devices), and …… …… …… …… ……
consecutive "S3" outputs starting from D are [S1+4S3 [S1+4 D+ S3-1
controlled to ON or OFF. +1, S1+4 S3+3,
2. Each rising point/falling point can be changed S3] S1+4
respectively by overwriting the data in [S1+1, S1] to S3+2]
[S1+ (S3 × 2) +3, S1+ (S3 × 2) +2]. 4. When the command input is set to ON, "S3"
points starting from D change as shown below.
Chapter 6 Application Instructions 201

Notes
1. When specifying digits of a bit device as S1, k =
8.
2. When specifying numbers of a counter as S2, the
range of S2 is in C200~C255.
3. The instruction is affected by the scan cycle.
Example
In this example, outputs are controlled to ON or
OFF by one rotation (0 to 360° using the rotation
angle signal of 1°/pulse).

M0 is the power flow input, X1 is the rotation angle


signal of 1°/pulse.
202 Chapter 6 Application Instructions

6.11.7 ALT: Alternate State Instruction


LAD: Applicable to MC280 MC200

Influenced flag bit Zero, carry, borrow

IL: ALT (D) Program steps 11


Offset
Operand Type Applicable elements
addressing
D BOOL Y M S

Operand description Example

D: Bit device number whose output is alternated


Function description
When the power flow is valid, a specified bit device is
alternated in every operation cycle.
Chapter 6 Application Instructions 203

6.12 Communication Instruction

6.12.1 Modbus: Modbus Master Station Communication Instruction

LAD: Applicable to MC280 MC200 MC100

Influenced flag bit


IL: Modbus (S1) (S2) (S3) Program steps 8
Offset
Operand Type Applicable elements
addressing
S1 INT Constant
S2 INT D V
S3 INT D √

Operand description Example

S1: designated communication channel


S2: starting address of the data to be transmitted
S3: starting address for storing the received data
Function description
1. When being a master station, when the input
conditions are met, the system will transmit the data
stored in the unit starting with S2, and then receive the
data and save it to the unit starting with S3. LD SM1
2. When being a slave station, the system needs no MOV 3 D0
instruction control for transmitting and receiving data. MOV 1 D1
3. This instruction is executed upon the rising edge. MOV 0 D2
Note MOV 10 D3
1. Sending data through Modbus, whether the data is MOV 5 D4
in RTU mode or ASCII mode, you only need to store AND SM124
the RTU-mode data into the unit starting with S2. You Modbus 1 D0 D100
do not need to store the starting character, ending 1. Store the data sent through Modbus into the
character and checksum, because they will be added element starting with D0.
to the data automatically in the sending process. 2. Store the data received in the elements starting with
2. You do not need to set the length for the data to be D100.
sent. The system will set the length automatically 3. After receiving data through Modbus, the system will
based on the instruction. conduct CRC check, address check and instruction
check. If there is any error, the error flag (SM136) will
S2 Slave address
be set, and the error details will be recorded in the
S2+1 Function code
special register SD139.
S2+2 Data 1 The communication error codes are shown below:
... Code Description
Data N 0x01 Illegal instruction
S2+N+1
0x02 Illegal register address
3. The data, when received through Modbus, will be 0x03 Wrong number of data
stored in RTU-mode, regardless of whether you set it Communication timeout. The communication
0x10
exceeds the preset communication time limit
in RTU mode or ASCII mode. That is, when you set the
0x11 Error in receiving data frame
data to ASCII mode, the system will automatically
Operand error. Operand (mode or master/slave)
convert them to hexadecimal, remove the starting 0x12
setting error
character and ending character, and save them in the Error occurs because t he local station SN is the
data area starting with S3. 0x13
same as that set by the instruction
4. The sent and received data are stored in the low For the detailed application methods, see Chapter 10
bytes of the word element. High bytes are not used. Using Communication Function.
204 Chapter 6 Application Instructions

6.12.2 MODRW: Mdodbus and Write Instruction


LAD: Applicable to MC280 MC200 MC100
MODRW (S1)(S2)(S3)(S4)(S5)(D)(S6)
Influenced flag bit
IL: MODRW (S1)(S2)(S3)(S4)(S5)(D) Program steps 14
Offset
Operand Type Applicable elements
addressing
S1 INT Constant R √
S2 WORD Constant D V R √
S3 WORD Constant D V R √
S4 WORD Constant D V R √
S5 WORD Constant D V R √
D WORD D R √

Operand description In MC200 and MC280, reading and writing number is less
than 16. All bits are saved in a word.
S1: specified channel of communication (only support D1: the address to store reading and writing
1). components. The number of components in MC100 is
S2: address (slave address can be set up for 1 ~ 247, referenced in chart above.
the broadcast address is only for the writing
Function description
component).
For MC200 and MC280
S3: function code. MC100 support 01(read coil status), 1. The element number is up to 16.
02 (read discrete input status), 03 (read register 2. Bit component to read is up to 16, and address the
status), 04 (read input register status), 05(write single presence of small is stored in lower bits. A word is
coil status), 06 (write single register status), 15 (write stored in 16 bits.
3. The abnormal return code is same as the modbus
multiple coils status), 16 (write multiple registers commands.
status), 41 (write off electricity keep register).
MC200 and MC280 support 01(read coil status), 03 For MC100 V1.23 or higher version supports this
instruction, and need to cooperate to use V2.39
(read register status), 05(write single coil status), 06
X_Builder or higher version.
(write single register status), 15 (write multiple coils
Example
status), 16 (write multiple registers status), 41 (write off
electricity keep register). The sample below is only for MC100 series PLC.

S4: read/write inverter components starting address. Standard polling


S5: reading and writing components number. In This example is a simple example of polling, after
setting the M1, M2, M3, three MODRW instructions will
MC100, the largest reading and writing number is 256,
run in turn.
the number of each function code is as shown in the At runtime, a M component is reset, the corresponding
table below. MODRW instruction will exit, and other MODRW
instructions still perform in polling way. For example, if
M2 is reset, MODRW instructions which M1 and M3 is
Code Name components number D number
for to access will be in turn.
01 read coil status 1~2000 (S5+15)/16 Similarly, we can also insert a MODRW instruction in
read discrete 1~2000 (S5+15)/16 the operation. For example, if M2 is set, three MODRW
02
input status instructions will run in turn.
read register 1~125 S5
03
status
read input 1~125 S5
04
register status
write single coil 0 1
05
status
write single 0 1
06
register status
write multiple 1~1968 (S5+15)/16
15
coils status
write multiple 1~123 S5
16
registers status
* 05、06,S5 must be 0.
Chapter 6 Application Instructions 205

communication before the previous communication has


been completed. SM135 is the finish flag of
communication, and SM136 is for communication error.

MC100 communicate with MV600 series inverter


The example is MC100 communicate with MV600
series inverter. Frequency is controlled by T0, it is
important to note:
T0 timer time must be greater than the timeout time you
set for the communication, to ensure that the next
206 Chapter 6 Application Instructions

6.12.3 Modlink: Modbus Form Instruction


LAD: Applicable to MC100(3.000) MC200(3.003)

Influenced flag bit


IL: Modlink (S1)(S2)(S3)(S4)(S5) Program steps 12
Offset
Operand Type Applicable elements
addressing
S1 INT Constant
S2 INT D
S3 INT D √
S4 BOOL M S C T
S5 BOOL M S C T
Chapter 6 Application Instructions 207

Operand description
S1: the specified channel of communication, support
only 1
S2: the starting address of the form
S3: the starting address of the fault information is kept
S4: the starting bit address of instructions to complete
S5: stop running control bits
Function description
MODLINK instruction is a MODBUS form one. You can
set multiple forms. A MODLINK form is corresponding
to a MODLINK instruction, and each MODLINK form
can include more communication commands.
MODLINK can launch multiple MODBUS
communication conveniently. Every communication
automatically begin after last communication complete.
You also can suspend a communication. MODLINK
require the system block and instructions.
1. When power-flow is set to1 from 0 and suspending
flag S4 is reset to 0, if the specified communications 2. In each form, we need configure enable flag, slave
port is not occupied by other communication instruction station address, starting address, number of
(SM124 equals 1), this command immediately control
the communication port, and will set SM124 to 0, then component and reading and writing. To start a
immediately begin a data transmission. communication, enable flag must be set.
2. When instruction starts, it reads the data from S2 After setting , data area started from D6000 will be
stared D element area, and sequentially perform .The
contents of D element area which S2 points to is occupied. The specific address is listed below.
generated automatically after the system block is S2 Number of communication
configured.
3. S3, the starting address of to save instruction S2+1 Enable flag of communication ( serial No 0
complete result, from 0 to N ,data is saved from the number of components M) Communication
address started from S3.
4. S4 the starting address of the complete flag bit. The S2+2 salve address
command execute from 0 to N communication, S2+3 Function code
sequentially set S4 started address when the S2+4 The starting address of reading and
instruction complete, and reset again when the
instruction starts. Whether communication task is a writing components
normal completion, or a timeout or error, S4 will always S2+5 components number to read or write
be set. Once setting, during the process of instruction S2+6 stored address to read or write
execution, it will not automatically reset, and need to
S2+7 The reserved
manually remove.
5. In the transport, if the suspension flag S5 in set, this S2+8 Enable flag of communication ( serial No 1
instruction will pause after this data transmission. number of components M) Communication
When this flag reset, this instruction will continue to
complete last transmission. S2+9 salve address
6. When power-flow is off, it immediately stop S2+10 Function code
transmission after completing recent communication. S2+11 The starting address of reading and
writing components
Example
S2+12 components number to read or write
1. Set MODLINK in the system block. Each MODLINK
S2+13 stored address to read or write
form corresponds to a MODLINK communication
S2+14 The reserved
instruction. In the diagram below, two forms need two

MODLINK instructions.

3. Instruction
208 Chapter 6 Application Instructions

In this example, SM124 is used as power-flow input. communication


It can solve the problem of communication conflict.
Supported function code is as follows: When the normal communication is complete, the
address of the corresponding is zero. If there are any
components D number errors, the specific error will saved in the corresponding
Code Name
number S3 began address. It can only record the latest error.
read coil 1~2000 (S5+ Modbus error codes:
01
status 15)/16
Error
1~2000 Description
read discrete (S5+ codes
02
input status 15)/16 0x01 Illegal functional code
read register 1~125 S5 0x02 Illegal register address
03
status 0x03 Data number error
read input 1~125 S5 Communication overtime (longer than the preset
04 0x10
register status maximum communication time)
write single 0 1 0x11 Data frame reception error
05
coil status Parameter error (mode or master/slave parameter
0x12
write single 0 1 setting error)
06
register status Error occurs because the local station number coincides
0x13
write multiple 1~1968 (S5+ with the instruction-set station number
15
coils status 15)/16 Element address overflow (the data received or sent is
0x14
write multiple 1~123 S5 too much for the stroring area)
16 registers 0x15 Command execute failed
status
0x16 The address of receive and transmit do not match
The instruction processing results, according to from 0
0x17 The function code of receive and transmit do not match
to N, is stored in S3 started address, see the table
below: 0x18 Frame error:

The completion of communication sign below:


S3 The last error code of No 0 S4 The completion sign of No 0 communication
communication S4+1 The completion sign of No 1 communication
S3+1 The last error code of No S4+2 The completion sign of No 2 communication
1communication

S3+2 The last error code of No 2 …
communication
S4+N The completion sign of No N communication

S3+N The last error code of No N


Chapter 6 Application Instructions 209

6.12.4 XMT: Free-Port Sending (XMT) Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: XMT (S1) (S2) (S3) Program steps 7
Offset
Operand Type Applicable elements
addressing
S1 INT Constant
S2 WORD D V
S3 INT Constant KnX KnY KnM KnS KnLM D SD C T V Z

Operand description Example

S1: designated communication channel. Range: 0, 1


S2: starting address of the data to be sent
S3: number of bytes to be sent
Function description
When the power flow is valid, and the communication
conditions are met, the designated data will be sent
through the designated channel.
Note
1. Size of communication frame: depending on the
element type (D or V) of the communication frame, the
ending character of the frame does not exceed D7999
or V63.
2. In case of shutdown, the sending will stop. LD SM0
TON T0 100
Special register
LD T0
1. SM110/SM120: Sending enabled flag. It will be set
RST T0
when the XMT instruction is used and cleared when
the sending is completed. When it is reset, the current MOV 16# 1 D0
sending stops. MOV 16#0 D1
2. SM112/SM122: sending completed flag. When it is MOV 16#1 D2
judged that the sending is completed, the sending MOV 16#1 D3
completed flag will be set. MOV 16#2 D4
3. SM114/SM124: Idle flag. When the serial port has RST SM122
no communication task, it will be set, and it can be XMT 1 D0 5
used as the checking bit for communication. LD SM122
4. For detailed examples of the application, please INC D1OO
refer to Chapter 10 Communication Function Use
In this example, one data frame is sent in every 10s.
Instruction.
The following data will be sent through serial port 1.
01 00 01 01 02
1. Set port 1 in the system block as free port, and then
set the baud rate, parity check, data bit and stop bit.
2. Write the data to be sent into the transmission buffer
area. For MC200, only the low bytes of the word
element will be sent.
3. Reset the sending completed flag (SM122) before
sending the data.
4. When the sending is completed, set the sending
completed flag (SM122).
210 Chapter 6 Application Instructions

6.12.5 RCV: Free-Port Receiving (RCV) Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: RCV (S1) (D) (S2) Program steps 7
Offset
Operand Type Applicable elements
addressing
S1 INT Constant
D WORD D V
S2 INT Constant KnX KnY KnM KnS KnLM D SD C T V Z

Operand description Special register

S1: designated communication channel. Range: 0, 1 SM111 (SM121): Receiving enabled flag. It will be set
when the RCV instruction is used and cleared when
D: starting address for storing the received data
the sending is completed. When it is reset, the current
S2: maximum number of received bytes
receiving stops.
Function description SM113 (SM123): receiving completed flag. When the
When the power flow is valid, and the communication receiving is completed, the receiving completed flag
conditions are met, limited amount of data will be will be set.
received through the designated channel to the SM114 (SM124): Idle flag. When the serial port has no
designated registers. communication task, it will be set, and it can be used
Example as the checking bit for communication.
SD111 (SD121): Starting character, which can be set
in the system block
SD112 (SD122): Ending character, which can be set in
the system block
LD SM1
SD113 (SD123): Character time-out time, i.e. the
RCV 1 D20 5
maximum receiving interval between the two
LD SM123
characters, which can be set in the system block
INC D100
SD114 (SD124): Frame time-out time: the time starting
1. The instruction will be valid continuously as long as
with the power flow and stops at the end of the
the power flow is valid. If you want to receive data only
receiving, which can be set in the system block
once, you can use a rising edge or special registers
SD115 (SD125): receiving completion code. The
that are effective only once, such as SM1, to trigger
definition of the data bit is shown as follows:
the instruction.
Designated Maxi.
2. For detailed application examples, refer to Chapter User Inter- (Frame) Parity
ending number of
10 Using Communication Function. end character reception check
word characters Reserved
receiving time-out time-out error
Note received received
flag flag flag flag
flag flag
Size of communication frame: depending on the Bits 6 ~
element type (D or V) of the communication frame, the Bit 0 Bit 1 Bit 2 Bit 3 Bit 4 Bit 5
15
ending character of the frame does not exceed D7999
or V63.
SD116 (SD126): The characters currently received
The receiving stops upon shutdown.
SD117 (SD127): The character received previously
The value range of S1: 0 and 1
Chapter 6 Application Instructions 211

6.13 Data Check Instruction

6.13.1 CCITT: Check Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: CCITT (S1) (S2) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S1 WORD D V √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D WORD D V √

Operand description are taken as 0, and the check result has 16 bits.

S1: the starting element of the data to Example


be checked
S2: the number of the data to be
checked. S2 ≥ 0, or the system will LD SM1
report operand error. MOV 16#00 D0
MOV 16#11 D1
D: check result
MOV 16#22 D2
Function description MOV 16#33 D3
MOV 16#44 D4
1. Conduct CCITT check on the S2
MOV 16#55 D5
data starting with S1, and assign the MOV 16#66 D6
result to D. MOV 16#77 D7
2. The expression for CCITT check LD X0
algorithm is: X^16+X^12+X^5+1 MOV 0 D100
CCITT D0 8 D100
Note
1. For the system will bring value of D
into the operation each time the
When X0 is ON, conduct CCITT check on the 8 data starting with
instruction is executed, make sure to
D0, and the result is assigned to D100.
clear D before executing the CCITT
instruction.
2. The data within the checking data
zone starting with S2 are stored in byte
mode by default. That is, the high bytes
212 Chapter 6 Application Instructions

6.13.2 CRC16: Check Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: CRC16 (S1) (S2) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S1 WORD D V √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D WORD D V √

Operand description Example

S1: the starting element of the


data to be checked
LD SM1
S2: the number of the data to
MOV 16#00 D0
be checked; S2 ≥ 0, or the MOV 16#11 D1
system will report operand MOV 16#22 D2
error MOV 16#33 D3
D: check result MOV 16#44 D4
MOV 16#55 D5
Function description MOV 16#66 D6
1. Conduct CRC16 check on MOV 16#77 D7
the S2 data starting with S1, LD X0
MOV 0 D100
and assign the result to D
CRC16 D0 8 D100
unit.
2. The expression for CRC16
check algorithm is:
When X0 is ON, conduct CRC16 check on the 8 data starting with D0, and
X^16+X^15+X^2+1
the result is assigned to D100.
Note
1. For the system will bring
value of D into the operation
each time the instruction is
executed, make sure to clear
D before executing the
CRC16 instruction.
2. The standard Modbus CRC
check requires that the D
element (checksum) be
initialized as 16#FFFF, and
the high/low byes (8 high, 8
low) shall be swapped.
3. The data within the
checking data zone starting
with S2 are stored in byte
mode by default. That is, the
high bytes will be taken as 0,
and the check result has 16
bits.
Chapter 6 Application Instructions 213

6.13.3 LRC: Check Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: LRC (S1) (S2) (D) Program steps 7
Offset
Operand Type Applicable elements
addressing
S1 WORD D V √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D WORD D V √

Operand description Example

S1: the starting element of the


data to be checked
S2: the number of the data to LD SM1
be checked. S2 ≥ 0, or the MOV 16#00 D0
MOV 16#11 D1
system will report operand
MOV 16#22 D2
error
MOV 16#33 D3
D: check result MOV 16#44 D4
Function description MOV 16#55 D5
MOV 16#66 D6
Conduct LRC check on the MOV 16#77 D7
S2 data starting with the S1, LD M0
and assign the result to D. MOV 0 D100
LRC D0 8 D100
Note
1. For the system will bring
value of D into the operation
each time the instruction is
When X0 is ON, conduct LRC check on the 8 data starting with D0, and
executed, make sure to clear
the result is assigned to D100.
D before executing the LRC
instruction.
2. The data within the
checking data zone starting
with S2 are stored in byte
mode by default. That is, the
high bytes are taken as 0, and
the check result has 8 bits
and is stored in the low bytes
of D.
214 Chapter 6 Application Instructions

6.14 Enhanced Bit Processing Instruction

6.14.1 ZRST: Batch Bit Reset Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: ZRST (D) (S) Program steps 5
Offset
Operand Type Applicable elements
addressing
D BOOL Y M S LM C T √
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Note

D: destination operand 1. When a C element is reset, the counting value in it will also be cleared.
S: source operand 2. When a T element is reset, the timing value in it will also be cleared.

Function description Example

When the power flow is valid, LD SM0


ZRST M10 10
reset S bit-elements starting
with D. When SM0 is ON, the 10 elements M10, M10, M11, M12 ... M19 will be
completely cleared.

6.14.2 ZSET: Set Batch Bit Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: ZSET (D) (S) Program steps 5
Offset
Operand Type Applicable elements
addressing
D BOOL Y M S LM C T √
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Function description

D: destination operand When the power flow is valid, set S bit elements starting with D.

S: source operand Example


LD SM0
ZSET M10 10
When SM0 is ON, the 10 units M10, M10, M11, M12 … M19, will all be set
to 1.
Chapter 6 Application Instructions 215

6.14.3 DECO: Decode Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: DECO (S) (D) Program steps 5
Offset
Operand Type Applicable elements
addressing
S WORD Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D INT KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Note

S: source operand 1. Range of S: 0 to 15.


D: destination operand 2. If S is outside the range of 0 ~ 15, D will not be changed when the
power flow is valid. Instead, the system will report operand error.
Function description
Example
When the power flow is valid,
set bit S in word element D to LD SM0
1, and clear other bits. DECO 2 D9

When the power flow is valid, bit 2 in D9 will be set as 1, other bits will be
cleared.

6.14.4 ENCO: Encode Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: ENCO (S) (D) Program steps 5
Offset
Operand Type Applicable elements
addressing
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D INT KnY KnM KnS KnLM D SD C T V Z √

Operand description Note

S: source operand When the value of multiple bits in S is 1, the smallest bit number will be written
into D, as shown in the following figure:
D: destination operand
Function description
When the power flow is valid,
Example
assign the number of the bit
LD M0
whose value is 1 in word
ENCO 2#0010 D0
element S to D.
When the power flow is valid, operand 1 is 2#0010, bit 1 is 1, hence 1 is written
into D0.
216 Chapter 6 Application Instructions

6.14.5 BITS: Counting ON Bit In Word Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: BITS (S) (D) Program steps 5
Offset
Operand Type Applicable elements
addressing
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example


LD SM0
S: source operand
BITS 16#F0F0 D1
D: destination operand
When the power flow is valid, it is counted that there are 8 bits whose value
Function description is 1 (ON status) in constant 16#F0F0, so 8 is stored into D1.
When the power flow is valid,
count how many bits in operand
S is 1, and store the result into D.
6.14.6 DBITS: Counting ON Bit In Double Word Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: DBITS (S) (D) Program steps 6


Offset
Operand Type Applicable elements
addressing
S DWORD Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
D INT KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description double word S is 1, and store the result into D.

S: source operand Example

D: destination operand LD SM0


DBITS 16#FF0FF D10
Function description
When the power flow is valid, it is counted that there are 16 bits whose
When the power flow is valid, value is 1 (ON status) in constant 16#FF0FF, so 16 is stored into D10.
count how many bits in

6.14.7 BON: Check Specified Bit Status Instruction

LAD: Applicable to MC280

Influenced flag bit

IL: BON (S1) (D) (S2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
D BOOL Y M S
S2 INT D V R

Operand description Function description

S: source operand When the power flow is valid, the status (ON or OFF) of the bit "S2" in S1 is
output to D.
D: destination operand
Chapter 6 Application Instructions 217

Example When the power flow is valid, the status (ON) of the bit "5 in D0 is output to
Y0.

LD M1
BON D0 Y0 5
218 Chapter 6 Application Instructions

6.15 Word Contactor Instruction

6.15.1 BLD: Word Bit Contactor LD Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: BLD (S1) (S2) Program steps 5


Offset
Operand Type Applicable elements
addressing
S1 WORD KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example


BLD D0 5
S1: source operand
OUT Y0
S2: designated bit, 0 ≤ S2 ≤ 15, or system will report
Use the status of BIT5 (ON) in D0 (1000:
operand error
2#0000001111101000) to determine the status of Y0 in
Function description the following operation.
Use the status of bit S2 in element S1 to drive the
following operation.
6.15.2 BLDI: Word Bit Contactor LDI Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: BLDI (S1) (S2) Program steps 5


Offset
Operand Type Applicable elements
addressing
S1 WORD KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example


BLDI D0 5
S1: source operand
OUT Y0
S2: designated bit. 0 ≤ S2 ≤ 15, or system will report
Use the logic NOT of the status of BIT5 (ON) in D0
operand error..
(1000: 2#0000001111101000), which is OFF, to
Function description determine the status of Y0 in the following operation.
Use the logic NOT of the status of bit S2 in element S1
to drive the following operation.
Chapter 6 Application Instructions 219

6.15.3 BAND: Word Bit Contactor AND Instruction

LAD:
Applicable to MC280 MC200 MC100 MC80

Note: because the logic relationship is visualized in the diagram, the


BAND instruction is displayed in LAD as BLD Influenced flag bit

IL: BAND (S1) (S2) Program steps 5


Offset
Operand Type Applicable elements
addressing
S1 WORD KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example


LD X0
S1: source operand BAND D0 5
S2: designated bit. 0 ≤ S2 ≤ OUT Y0
15, or system will report Take the status of BIT5 (ON) in element D0 (1000: 2#0000001111101000)
operand error and use it in serial connection with other nodes (X0: ON) to determine the
Function description status of Y0 in the following operation.

Take the status of bit S2 in


element S1 and use it in serial
connection with other nodes
to drive the operation of the
following operation.
6.15.4 BANI: Word Bit Contactor AND Instruction

LAD:
Applicable to MC280 MC200 MC100 MC80

Note: because the logic relationship is visualized in the diagram, the


BANI instruction is displayed in LAD as BLDI Influenced flag bit

IL: BANI (S1) (S2) Program steps 5


Offset
Operand Type Applicable elements
addressing
S1 WORD KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example


LD X0
S1: source operand
BANI D0 5
S2: designated bit, 0 ≤ S2 ≤ OUT Y0
15, or system will report Take the logic NOT of the status of BIT5 (ON) in element D0 (1000:
operand error 2#0000001111101000), which is OFF, and use it in serial connection with
Function description other nodes (X0: ON) to determine the status of Y0 in the following
operation.
Take the logic NOT of the
status of bit S2 in element S1
and use it in serial connection
with other nodes to drive the
operation of the following
instruction.

6.15.5 BOR: Word Bit Contactor OR Instruction


220 Chapter 6 Application Instructions

LAD:
Applicable to MC280 MC200 MC100 MC80

Note: because the logic relationship is visualized in the diagram, the


Influenced flag bit
BOR instruction is displayed in LAD as BLD

IL: BOR (S1) (S2) Program steps 5


Offset
Operand Type Applicable elements
addressing
S1 WORD KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example


LD X0
S1: source operand
BOR D0 5
S2: designated bit, 0 ≤ S2 ≤ 15, or OUT Y0
system will report operand error
Take the status of BIT5 (ON) in element D0 (1000:
Function description 2#0000001111101000) and use it in parallel connection with other
Take the status of bit S2 in element S1 nodes (X0: ON) to determine the status of Y0 in the following
and use it in parallel connection with operation.
other nodes to drive the operation of the
following instruction.

6.15.6 BORI: Word Bit Contactor ORI Instruction

LAD:
Applicable to MC280 MC200 MC100 MC80

Note: because the logic relationship is visualized in the diagram, the


Influenced flag bit
BORI instruction is displayed in LAD as BLDI

IL: BORI (S1) (S2) Program steps 5


Offset
Operand Type Applicable elements
addressing
S1 WORD KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example


LD X0
S1: source operand
BORI D0 5
S2: designated bit, 0 ≤ S2 ≤ 15, or OUT Y0
system will report operand error
Take the logic NOT of the status of BIT5 (ON) in element D0 (1000:
Function description 2#0000001111101000), which is OFF, and use it in parallel
Take the logic NOT of the status of bit S2 connection with other nodes (X0: ON) to determine the status of Y0
in element S1 and use it in parallel in the following operation.
connection with other nodes to drive the
operation of the following segment.
Chapter 6 Application Instructions 221

6.15.7 BOUT: Word Bit Coil Output Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: BOUT (D) (S) Program steps 5


Offset
Operand Type Applicable elements
addressing
D WORD KnY KnM KnS KnLM D C T V Z √
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example


LD X0
S1: source operand
BOUT D0 4
S2: designated bit. 0 ≤ S2 ≤ 15, or
Assign the current power flow status (X0: ON) to BIT4 ofelement
system will report operand error.
D0 (1000: 2#0000001111101000). After the execution, D0 = 1016
Function description (2#0000001111111000).
Assign the current power flow status to
bit S of element D.
6.15.8 BSET: Word Bit Coil Set Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: BSET (D) (S) Program steps 5


Offset
Operand Type Applicable elements
addressing
D WORD KnY KnM KnS KnLM D C T V Z
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example


LD X0
D: destination operand
BSET D0 8
S2: designated bit. 0 ≤ S2 ≤ 15, or
When the power flow is valid, set BIT15 of element D0 (1000:
system will report operand error.
2#0000001111101000). After the execution, D0 = 33768
Function description (2#1000001111101000).
Set bit S of element D.
6.15.9 BRST: Word Bit Coil Reset Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit


IL: BRST (D) (S) Program steps 5
Offset
Operand Type Applicable elements
addressing
D WORD KnY KnM KnS KnLM D C T V Z √
S INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example


LD X0
D: destination operand
BRST D0 8
S2: designated bit. 0 ≤ S2 ≤ 15, or
When the power flow is valid, reset BIT8 of element D0 (1000:
system will report operand error.
2#0000001111101000). After the execution, D0 = 744
Function description (2#0000001011101000).
Reset bit S of element D.
222 Chapter 6 Application Instructions

6.16 Compare Contactor Instrucitons

6.16.1 Compare Integer LD (=,<,>,<>,>=,<=) Instrucitons

LAD:

Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: LD= (S1) (S2)


LD< (S1) (S2)
LD> (S1) (S2)
LD<> (S1) (S2) Program steps 5
LD>= (S1) (S2)
LD<= (S1) (S2)
Offset
Operand Type Applicable elements
addressing
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example


LD= D0 D1
S1: comparison parameter 1
OUT Y0
S2: comparison parameter 2 LD< D0 D1
Function description OUT Y1
LD> D0 D1
Conduct BIN comparison on OUT 2
elements S1 and S2, and use LD<> D0 D1
the comparison result to drive OUT Y3
the following operation. LD>= D0 D1
OUT Y4
LD<= D0 D1
OUT Y5
Conduct BIN comparison on the data of D0 and D1, and the comparison
result is used to determine the output status of the following element.
Chapter 6 Application Instructions 223

6.16.2 Compare Integer AND (=,<,>,<>,>=,<=) Instruction

LAD:

Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: AND= (S1) (S2)


AND< (S1) (S2)
AND> (S1) (S2)
AND<> (S1) (S2) Program steps 5
AND>= (S1) (S2)
AND<= (S1) (S2)
Offset
Operand Type Applicable elements
addressing
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example

S1: comparison parameter 1 LD X0


AND= D0 D1
S2: comparison parameter 2
OUT Y0
Function description LD X1
AND< D0 D1
Conduct BIN comparison on
OUT Y1
elements S1 and S2, and use LD X2
the comparison result in serial AND> D0 D1
connection with other nodes OUT Y2
to drive the following LD X3
operation. AND<> D0 D1
OUT Y3
LD X4
AND>= D0 D1
OUT Y4
LD X5
AND<= D0 D1
OUT Y5
Conduct BIN comparison on the data of D1 and D2, and use the comparison
result in serial connection with other nodes to determine the output status of the
following element.
224 Chapter 6 Application Instructions

6.16.3 Compare Integer OR (=,<,>,<>,>=,<=) Instruction

LAD:

Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: OR= (S1) (S2)


OR< (S1) (S2)
OR> (S1) (S2)
OR<> (S1) (S2) Program steps 5
OR>= (S1) (S2)
OR<= (S1) (S2)
Offset
Operand Type Applicable elements
addressing
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √

Operand description Example


LD X0
S1: comparison parameter 1
OR= D0 D1
S2: comparison parameter 2 OUT Y0
Function description LD X1
OR< D0 D1
Compare elements S1 and OUT Y1
S2, and use the comparison LD X2
result in parallel connection OR<> D0 D1
with other nodes to drive the OUT Y2
following operation. LD X3
OR>= D0 D2
OUT Y3
LD X4
OR>= D0 D1
OUT Y4
LD X5
OR<= D0 D1
OUT Y5
Compare elements D0 and D1, and use the comparison result in parallel
connection with other nodes to determine the output status of the following
element.

6.16.4 Compare Double Integer LDD (=,<,>,<>,>=,<=) Instruction


Chapter 6 Application Instructions 225

LAD:

Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: LDD= (S1) (S2)


LDD< (S1) (S2)
LDD> (S1) (S2)
LDD<> (S1) (S2) Program steps 7
LDD>= (S1) (S2)
LDD<= (S1) (S2)
Offset
Operand Type Applicable elements
addressing
S1 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
S2 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √

Operand description Example


LD= D0 D2
S1: comparison parameter 1
OUT Y0
S2: comparison parameter 2 LD< D0 D2
Function description OUT Y1
LD<> D0 D2
Compare elements S1 and OUT Y2
S2, and use the comparison LD>= D0 D2
result to drive the following OUT Y3
operation. LD>= D0 D2
OUT Y4
LD<=D0 D2
OUT Y5
Compare (D0, D1) and (D2,D3), and use the comparison result to determine
the output status of the following element.
226 Chapter 6 Application Instructions

6.16.5 Compare Double Integer ANDD (=,<,>,<>,>=,<=) Instruction

LAD:

Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: ANDD= (S1) (S2)


ANDD< (S1) (S2)
ANDD> (S1) (S2)
ANDD<> (S1) (S2) Program steps 7
ANDD>= (S1) (S2)
ANDD<= (S1) (S2)
Offset
Operand Type Applicable elements
addressing
S1 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
S2 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √

Operand description Example


LD X0
S1: comparison parameter 1
LDD= D0 D2
S2: comparison parameter 2 OUT Y0
Function description LD X1
LDD< D0 D2
Compare elements S1 and OUT Y1
S2, and use the comparison LD X2
result in serial connection with LDD<> D0 D2
other nodes to drive the OUT Y2
following operation. LD X3
LDD<> D0 D2
OUT Y3
LD X4
LDD>= D0 D2
OUT Y4
LD X5
LDD<= D0 D2
OUT Y5
Compare (D0, D1) and (D2,D3), and use the comparison result in serial
connection with other nodes to determine the output status of the following
element.
Chapter 6 Application Instructions 227

6.16.6 Compare Double Integer ORD (=,<,>,<>,>=,<=) Instruction

LAD:

Applicable to MC280 MC200 MC100 MC80

Influenced flag bit

IL: ORD= (S1) (S2)


ORD< (S1) (S2)
ORD> (S1) (S2)
ORD<> (S1) (S2) Program steps 7
ORD>= (S1) (S2)
ORD<= (S1) (S2)
Offset
Operand Type Applicable elements
addressing
S1 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
S2 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √

Operand description Example

S1: comparison parameter 1 LD X0


ORD= D0 D2
S2: comparison parameter 2
OUT Y0
Function description LD X1
ORD< D0 D2
Compare elements S1 and
OUT Y1
S2, and use the comparison
LD X2
result in parallel connection
ORD<> D0 D2
with other nodes to drive the OUT Y2
following operation. LD X3
ORD>= D0 D2
OUT Y3
LD X4
ORD>= D0 D2
OUT Y4
LD X5
ORD<= D0 D2
OUT Y5

Compare (D0, D1) and (D2,D3), and use the comparison result in parallel
connection with other nodes to determine the output status of the following
element.
228 Chapter 6 Application Instructions

6.16.7 LDR: Compare Floating Point Number Instruction

LAD:
Applicable to MC280 MC200 MC100

Influenced flag bit

IL: LDR= (S1) (S2)


LDR< (S1) (S2)
LDR> (S1) (S2)
LDR<> (S1) (S2) Program steps 7
LDR>= (S1) (S2)
LDR<= (S1) (S2)
Offset
Operand Type Applicable elements
addressing
S1 REAL Constant D V √
S2 RAEL Constant D V √

Operand description Example


LDR= D0 D2
S1: comparison parameter 1
OUT Y0
S2: comparison parameter 2 LDR< D0 D2
Function description OUT Y1
LDR> D0 D2
Compare elements S1 and OUT Y2
S2, and use the comparison LDR<> D0 D2
result to drive the following OUT Y3
operation. LDR>= D0 D2
OUT Y4
LDR<= D0 D2
OUT Y5
Compare (D0, D1) and (D2,D3), and use the comparison result determine the
output status of the following element.
Chapter 6 Application Instructions 229

6.16.8 ANDR: Compare Floating Point Number Instruction

LAD:
Applicable to MC280 MC200 MC100

Influenced flag bit

IL: ANDR= (S1) (S2)


ANDR< (S1) (S2)
ANDR> (S1) (S2)
ANDR<> (S1) (S2) Program steps 7
ANDR>= (S1) (S2)
ANDR<= (S1) (S2)
Offset
Operand Type Applicable elements
addressing
S1 REAL Constant D V √
S2 REAL Constant D V √

Operand description Example


LD X0
S1: comparison parameter 1
ANDR= D0 D2
S2: comparison parameter 2 OUT Y0
Function description LD X1
ANDR< D0 D2
Compare elements S1 and OUT Y1
S2, and use the comparison LD X2
result in serial connection with ANDR<> D0 D2
other nodes to drive the OUT Y2
following operation. LD X3
ANDR<> Y3
LD X4
ANDR>= D0 D2
OUT Y4
LD X5
ANDR<= D0 D2
OUT Y5
Compare (D0, D1) and (D2,D3), and use the comparison result in serial
connection with other nodes to determine the output status of the following
element.
230 Chapter 6 Application Instructions

6.16.9 ORR: Compare Floating Point Number Instruction

LAD:

Applicable to MC280 MC200 MC100

Influenced flag bit

IL: ORR= (S1) (S2)


ORR< (S1) (S2)
ORR> (S1) (S2)
ORR<> (S1) (S2) Program steps 7
ORR>= (S1) (S2)
ORR<= (S1) (S2)
Offset
Operand Type Applicable elements
addressing
S1 REAL Constant D V √
S2 REAL Constant D V √

Operand description Example

S1: comparison parameter 1 LD X0


S2: comparison parameter 2 ORR= D0 D2
OUT Y0
Function description
LD X1
Compare elements S1 and ORR< D0 D2
S2, and use the comparison OUT Y1
result in parallel connection LD X2
ORR> D0 D2
with other nodes to drive the
OUT Y2
following operation.
LD X3
ORR<> D0 D2
OUT Y3
LD X4
ORR>= D0 D2
OUT Y4
LD X5
ORR<= D0 D2
OUT Y5

Compare (D0, D1) and (D2, D3), and use the comparison result in parallel
connection with other nodes to determine the output status of the following
element.
Chapter 6 Application Instructions 231

6.16.10 CMP: Compare Integer Set Instruction

LAD: Applicable to MC200 MC280


CMP (S1) (S2) (D)
Influenced flag bit
IL: CMP (S1) (S2) (D)
Program steps 7
Offset
Operand Type Applicable elements
addressing
S1 REAL Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
S2 REAL Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z √
D BOOL Y M S

Operand description Function description

S1: comparison parameter 1 When the power flow is valid, execute instruction. Compare elements S1 and
S2. According to the result, one of (D)(D+1)(D+2) is ON.
S2: comparison parameter 2
D: The starting number of the Example
element with the result

6.16.11 LCMP: Compare Double Integer Set Instruction

LAD: Applicable to MC200 MC280

LCMP (S1) (S2) (D)


Influenced flag bit

IL: LCMP (S1) (S2) (D)


Program steps 9
Offset
Operand Type Applicable elements
addressing
S1 REAL Constant KnX KnY KnM KnS KnLM KnSM D SD C V Z √
S2 REAL Constant KnX KnY KnM KnS KnLM KnSM D SD C V Z √
D BOOL Y M S

Operand description Function description

S1: comparison value 1 When the power flow is valid, executing instruction,Compare elements S1 and
S2. According to the result, one of (D)(D+1)(D+2) is ON.
S2: comparison value 2
D: The starting number of the Example
element with the result
232 Chapter 6 Application Instructions

6.16.12 RCMP: Compare Floating Point Number Set Instruction

LAD: Applicable to MC200 MC280

RCMP (S1)(S2)(D)
Influenced flag bit

IL: RCMP (S1) (S2) (D)


Program steps 9
Offset
Operand Type Applicable elements
addressing
S1 REAL Constant D R √
S2 REAL Constant D R √
D BOOL Y M S

Operand description Function description

S1: comparison value 1 When the power flow is valid, execute instruction, compare elements S1 and S2.
According to the result, one of (D)(D+1)(D+2) is ON.
S2: comparison value 2
D: The starting number of the Example
element with the result

6.17 Batch Data Processing Instructions

6.17.1 BKADD: ADD Batch Integer Data

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:BKADD (S1) (S2) (D) (S3) Program steps 9


Offset
Operand Type Applicable elements
addressing
S1 INT D SD C T V R √
S2 INT Constant D SD C T V R √
D INT D SD C T V R √
S3 INT Constant D V R

Operand description
2. When S2 is a 16-bit constant, S3 point 16-bit
S1: The starting number of the element that holds
binary data starting from S1 are added to S2 in turn,
the data for the addition operation
and the operation result is stored in S3 point starting
S2: A constant, or the starting number of the
from D.
element that holds the data for the addition
operation Example
D: The starting number of the element with the
result
S3: Data number LD M1
Function description BKADD D10 D100 D1000 5

1. When the power flow is valid, executing When M1 is ON, add 5 units from D10 and 5 units
instruction, S3 point 16-bit binary data starting from from D100, and assign the result to 5 units from
S2 are added to S3 point 16-bit binary data (BIN) D1000. D1000 = D10+D100,
starting from S1, and the operation result is stored D1001=D11+D101,……, D1004=D14+D104.
in S3 point starting from D.
Chapter 6 Application Instructions 233

6.17.2 BKSUB: SUB Batch Integer Data

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:BKSUB (S1) (S2) (D) (S3) Program steps 9


Offset
Operand Type Applicable elements
addressing
S1 INT D SD C T V R √
S2 INT Constant D SD C T V R √
D INT D SD C T V R √
S3 INT Constant D V R

Operand description
2. When S2 is a 16-bit constant, S2 is subtracted
S1: The starting number of the element that holds
from S3 point 16-bit binary data starting from S1 in
the data for the subtraction operation
turn, and the operation result is stored in S3 point
S2: A constant, or the starting number of the
starting from D.
element that holds the data for the subtraction
operation Example
D: The starting number of the element with the
result
S3: Data number LD M1
Function description BKADD D10 D100 D1000 5

1. When the power flow is valid, executing When M1 is ON, 5 units from D100 are subtracted
instruction, S3 point 16-bit binary data starting from form 5 units from D10, and assign the result to 5
S2 are subtracted from S3 point 16-bit binary data units from D1000. D1000 = D10-D100,
(BIN) starting from S1, and the operation result is D1001=D11-D101,……, D1004=D14-D104.
stored in S3 point starting from D.
234 Chapter 6 Application Instructions

6.17.3 BKCMP=,>,<,<>,<=,>=: Compare Batch Integer Data

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:BKCMP=,>,<,<>,<=,>= (S1) (S2) (D) (S3) Program steps 9


Offset
Operand Type Applicable elements
addressing
S1 INT Constant D SD C T V R √
S2 INT D SD C T V R √
D BOOL Y M S LM SM
S3 INT Constant D V R

Operand description 3. When the comparison result is ON in all of S3


points starting from D, SM188 (block comparison
S1: Comparison value of device number storing
signal) turns ON.
comparison value
S2: Head device number storing comparison source Caution
data When flow occurs in the operation result, the
D: Head device number storing comparison result carry flag does not turn ON.
S3: Number of compared data Example

Function description
1. When the power flow is valid, executing
instruction, S3 point 16-bit binary data starting from
S1 are compared with S3 point 16-bit binary data LD M1
(BIN) starting from S2, and the comparison result is BKCMP= D10 D100 Y0 4
stored in S3 point starting from D. LD SM188
2. When S1 is a 16-bit constant, S1 is compared SET Y10
with S3 point 16-bit binary data starting from S2 in When M1 is ON, four 16-bit binary data starting
turn, and the operation result is stored in S3 point from D10 are compared with four 16-bit binary data
starting from D. starting from D100, and the comparison result is
stored in four points starting from Y0. When the
comparison result is "ON (1)" in all of the four points
starting from Y0, Y10 is set to ON.
Chapter 6 Application Instructions 235

6.18 Data Table Instruction:

6.18.1 LIMIT: Limit Control

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:LIMIT (S1) (S2) (S3) (D) Program steps 9


Offset
Operand Type Applicable elements
addressing
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V R √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V R √
S3 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √

Operand description
S1: Lower limit value
S2: Upper limit value
S3: Input value controlled by the upper and lower limit
values
D: Head device number storing the output value
controlled by the upper and lower limit values Example
Function description
Depending on how the input value specified by S3
compares to the range between S1 and S2, the
output value D is controlled. When S3<S1, D=S1; LD M1
When S3>S2, D=S2;When S1<=S3<=S2, D=S2. LIMIT D0 D10 D100 D1000
When M1 is ON, the data in D100 is controlled by
the limit values D0 to D10, and the controlled
value is output to D1000.
D0(10)<=D100(30)<=D10(100),D1000=30.

6.18.2 DBAND: Dead Band Control

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow


IL:DBAND (S1) (S2) (S3) (D) Program steps 9
Offset
Operand Type Applicable elements
addressing
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V R √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V R √
S3 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √

Operand description Function description

S1: Lower limit value of the dead band Depending on how the input value specified by
S2: Upper limit value of the dead band S3 compares to the dead band range between
S3: Input value controlled by the dead band S1 and S2, the output value D is controlled.
D: Device number storing the output value controlled When S3<S1,D=S3-S1.
by the dead band
236 Chapter 6 Application Instructions

Example

LD M1
DBAND D0 D10 D100 D1000
When M1 is ON, the data in D100 is controlled by
the dead band from D0 to D10, and the controlled
value is output to D1000.
D0 (-100)<D100(30)<D10(100),D1000=0

6.18.3 ZONE: Zone Control

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow


IL:ZONE (S1) (S2) (S3) (D) Program steps 9
Offset
Operand Type Applicable elements
addressing
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V R √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V R √
S3 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √

Operand description ZONE D0 D10 D100 D1000


When M1 is ON, the data in D100 is controlled by
S1: Negative bias value to be added to the input value
the zone from D0 to D10, and the controlled value
S2: Positive bias value to be added to the input value is output to D1000.
S3: Input value controlled by the zone D100(30)>0,D1000=D100(30)+D10(100),
D1000=130.
D: Head device number storing the output value
controlled by the zone
Function description
The bias value specified by S1 or S2 is added to the
input value specified by S3 , and output to the device
specified by D. When S3<0, D=S3+S1; When S3>0,
D=S3+S2; When S3=0, D=0.

Example

LD M1

6.18.4 SCL: Scaling (Coordinate by Point Data)

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:SCL (S1) (S2) (D) Program steps 7


Chapter 6 Application Instructions 237

Offset
Operand Type Applicable elements
addressing
S1 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V R √
S2 INT D V R √
D INT KnY KnM KnS KnLM D SD C T V R √

Operand description SCL D10 D100 D1000


When M1 is ON, the value input to D10 is
S1: Input value used in scaling or device number
processed by scaling based on the conversion table
storing the input value
for scaling set in D100, and output to D1000.
S2: Head device number storing the conversion table
used in scaling Number of coordinate
D100 5
points
D: Device number storing the output value controlled
X
by scaling D101 10
coordinate
Point 1
Function description Y
D102 0
1. The input value specified in S1 is processed by coordinate
X
scaling for the specified conversion characteristics, D103 20
coordinate
and stored to a device number specified in D. Point 2
Y
2. Conversion for scaling is executed based on the D104 20
coordinate
data table stored in a device specified in S2 and X
later. If the output data is not an integer, however, D105 30
coordinate
the number in the first decimal place is rounded. Point 3
y
D106 60
3. Conversion setting data table for scaling: coordinate
Number of coordinate points S2 X
D107 50
X coordinate S2+1 coordinate
Point 1 Point 4
Y coordinate S2+2 y
D108 40
X coordinate S2+3 coordinate
Point 2 X
Y coordinate S2+4 D109 60
… … … coordinate
Point 5
X coordinate S2+2n-1 y
Point n (last) D110 0
y coordinate S2+2n coordinate

Caution
1. The Xn data is set in the ascending order in the
data table. The data table is searched from the
low-order side of device numbers in the data table
in the operation. Accordingly, even if only some Xn
data is not set in the ascending order in the data
table, the instruction is executed without operation
error up to the area of the data table in which the Xn
data is set in the ascending order.
2. S1 must be inside the data table.
Example

LD M1

6.18.5 SER: Search a Data Stack

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow


IL:SER (S1) (S2) (D) (S3) Program steps 9
238 Chapter 6 Application Instructions

Offset
Operand Type Applicable elements
addressing
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
S2 INT Constant KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √
S3 INT Constant D V R

Operand description position, last position, maximum value position and


minimum value position.
S1: Head device number in which same data, 3. When same data was not detected, five devices
maximum value and minimum value are searched starting from store the number of same data, first
position, last position, maximum value position and
S2: Data to be searched for or device number storing
minimum value position.
data In this case, however, "0" is stored in three devices
D: Head device number storing number of same data, starting from (which store the number of same data,
maximum value and minimum value detected by first position and last position).
search Example
S3: Number of data in which same data, maximum
value and minimum value are searched
Function description LD M1
1. In "S3" data starting from S1, same data as S2 is SER D10 D100 D1000 8
searched, and the search result is stored to D to
When M1 is ON, 8 data starting from D10 are
D+4.
searched, and the search result is stored to D1000
2. When same data was detected, five devices
to D1004.
starting from D store the number of same data, first

6.19 Character String Instruction:

6.19.1 STRADD: Link Character Strings

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:STRADD (S1) (S2) (D) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 INT Character string KnX KnY KnM KnS KnLM KnSM D SD C T V R √
S2 INT Character string KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √

Operand description S1: The first character string unit


Chapter 6 Application Instructions 239

S2: The second character string unit Example


D: Head device storing the linked character string
Function description
1. When the power flow is valid, the character string LD M1
data stored in S2 and later is linked to the end of the
STRADD D10 D100 D1000
character string data stored in S1 and later, and the
When M1 is ON, a character string stored in
linked data is stored to devices starting from D.
D10 is linked to the character string stored in
2. In linking, “00H” indicating the end of a character D100, and the result is stored to D1000 and
string specified in S1 is ignored, and a character later.
B15---b8 b7---b0 B15---b8 b7---b0 B15---b8 b7---b0
string specified in S2 is linked to the last character
D10 0x32 0x31 D100 0x38 0x37 D1000 0x32 0x31
specified in S1. D11 0x34 0x33 + D101 0x61 0x39 D1001 0x34 0x33
3. A character string stored in S1 or S2 or later D12 0x36 0x35 D102 0x00 0x62 D1002 0x36 0x35
indicates the data from the specified device to the D13 0x00 0x00 D1003 0x38 0x37
D1004 0x61 0x39
first "00H" in units of byte.
D1005 0x00 0x62
4. When the number of characters after linking is
odd, “00H” is stored in the high-order byte of the
device storing the last character. When the number
of characters after linking is even, “0000H” is stored
in the device after the last character.
Caution
1. When directly specifying a character string by
S1 or S2, up to 32 characters can be specified.
2. When the values in both S1 and S2 start from
"00H" (that is, when the number of characters is
“0”), "0000H" is stored in D.
3. When the same device is specified in S1, S2
and D as a device for storing a character string,
the system will report “Illegal instruction operand
value”.
4. When “00H” is not set within the
corresponding device range after the device
specified by S1 or S2, the system will report
“Outside instruction element range”.

6.19.2 STRLEN: Character String Length Detection

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:STRLEN (S) (D) Program steps 5


Offset
Operand Type Applicable elements
addressing
S INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √

Operand description Caution

S: Device storing a character string When “00H” is not set within the corresponding
D: Character string length device range after a device specified by S, the
system will report “Outside instruction element
Function description
range”.
1. When the power flow is valid, the length of a
character string stored in S is detected, and Example
stored to D.
2. Data starting from S until the first device storing
"00H" is handled as a character string in units of
byte.
LD M1
240 Chapter 6 Application Instructions

STRLEN D10 D100 When M1 is ON, the length of a character string


stored in D10 is detected, and stored to D100.

6.19.3 STRRIGHT: Extracting Character String Data from the Right

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:STRRIGHT (S1) (D) (S2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √
S2 INT Constant D V R

Operand description until "00H" is first detected in byte units.


Caution
S1: Device storing a character string
D: Device storing extracted character string 1. When “00H” is not set within the corresponding
S2: Number of characters to be extracted device range after a device specified by S1, the
system will report “Outside instruction element
Function description
range”.
1. When the power flow is valid, S2 characters are
extracted from the right end (that is, from the end) 2. S2 cannot be a negative value.
of the character string data stored in S1 and later, 3. S2 cannot exceed the number of characters
and stored to D and later.
specified by S1.
2. If the number of characters specified by S2 is
“0”, the NULL code (0000H) is stored to D. Example
3. When the number of extracted characters is odd,
“00H” is stored in the high-order byte of a device
storing the last character.
- When the number of extracted characters is even, LD M1
“0000H” is stored in the device after the last
character. STRRIGHT D10 D100 3
4. A character string stored in S1 and later indicates
data stored in devices from the specified device
Chapter 6 Application Instructions 241

When M1 is ON, 3 characters are extracted from B15---b8 b7---b0 B15---b8 b7---b0
the right end of the character string data stored in D10 0x32 0x31 D100 0x35 0x34
D10 and later, and stored to D100 and later. D11 0x34 0x33 D101 0x00 0x36
D12 0x36 0x35
D13 0x00 0x00

6.19.4 STRLEFT: Extracting Character String Data from the Left

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:STRLEFT (S1) (D) (S2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √
S2 INT Constant D V R √

Operand description system will report “Outside instruction element


range”.
S1: Device storing a character string
D: Device storing extracted character string
2. S2 cannot be a negative value.

S2: Number of characters to be extracted 3. S2 cannot exceed the number of characters


specified by S1.
Function description
Example
1. When the power flow is valid, S2 characters are
extracted from the left end (that is, from the head)
of the character string data stored in S1 and later,
and stored to D and later.
2. If the number of characters specified by S2 is LD M1
“0”, the NULL code (0000H) is stored to D. STRLEFT D10 D100 3
3. When the number of extracted characters is odd,
“00H” is stored in the high-order byte of a device When M1 is ON, 3 characters are extracted from
storing the last character. the left end of the character string data stored in
- When the number of extracted characters is even,
D10 and later, and stored to D100 and later.
“0000H” is stored in the device after the last
character. B15---b8 b7---b0 B15---b8 b7---b0
4. A character string stored in S1 and later indicates D10 0x32 0x31 D100 0x32 0x31
data stored in devices from the specified device
D11 0x34 0x33 D101 0x00 0x33
until "00H" is first detected in byte units.
D12 0x36 0x35
Caution
D13 0x00 0x00
1. When “00H” is not set within the corresponding
device range after a device specified by S1, the
242 Chapter 6 Application Instructions

6.19.5 STRMIDR: Random Selection of Character Strings

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:STRMIDR (S1) (D) (S2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √

Operand description Caution

S1: Device storing a character string 1. S2 cannot exceed the number of characters
D: Device storing extracted character string specified by S1.
S2: Head position to be extracted 2. “n” is more than “-2”.
S2+1: “n”, number of characters to be extracted 3. S2 cannot be less than “1”.
Function description 4. When “00H” is not set within the corresponding
1. When the power flow is valid, " S2+1" characters device range after a device specified by S1, the
are extracted leftward from the position specified by system will report “Outside instruction element
S2 of the character string data stored in S1 and
range”.
later, and stored to D and later.
2. When the number of extracted characters Example
specified by S2+1 is odd, “00H” is stored in the
high-order byte of a device storing the last
character.
- When the number of extracted characters LD M1
specified by S2+1 is even, “0000H” is stored in the
device after the last character. STRMIDR D10 D100 D0
3. A character string stored in S1 and later indicates When M1 is ON, three (D1=3) characters are
data stored in devices from the specified device extracted from the 2nd (D0=2) character of the
until "00H" is first detected in byte units. character string data stored in D10 and later,
4. When the number of characters to be extracted and then stored to D100 and later.
specified by S2+1 is “0”, the extraction processing B15---b8 b7---b0 B15---b8 b7---b0
is not executed. D10 0x32 0x31 D100 0x33 0x32
5. When the number of characters to be extracted
D11 0x34 0x33 D101 0x00 0x34
specified by S2+1 is “-1”, the entire character string
D12 0x36 0x35
stored in S1 and later is stored to D and later.
D13 0x00 0x00
Chapter 6 Application Instructions 243

6.19.6 STRMIDW: Random Replacement of Character Strings

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:STRMIDW (S1) (D) (S2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √

Operand description 3. S2 cannot be less than “1”.


S1: Device storing a character string used in 4. When the number of characters to be
overwriting overwritten specified by S2+1 exceeds the last
D: Device storing character string to be overwritten character of the character string stored in D and
later, data is stored up to the last character.
S2: Head position to be overwritten
S2+1: “n”, number of characters to be overwritten 5. When “00H” is not set within the corresponding
Function description device range after a device specified by S1 or D,
the system will report “Outside instruction
1. When the power flow is valid, " S2+1" characters
are extracted from the left end (that is, the head) of element range”.
the character string data stored in S1 and later, and
Example
stored to the position specified by S2 and later of
the character string data stored in D and later.
2. A character string stored in S1 and later indicates
data stored in devices from the specified device
until "00H" is first detected in byte units. LD M1
3. When the number of characters to be extracted STRMIDW D10 D100 D0
specified by S2+1 is “0”, the extraction processing
is not executed. When M1 turns ON, three (D1=3) characters are
4. When the number of characters to be extracted extracted from the character string data stored in
specified by S2+1 is “-1”, the entire character string D10 and later, and then stored to the 2nd (D0=2)
stored in S1 and later is stored to D and later. character (from the left end) and later for the
character string data stored in D100 and later.
B15---b8 b7---b0 B15---b8 b7---b0
Caution B15---b8 b7---b0
D10 0x32 0x31 D100 0x35 0x34 D100 0x31 0x34
1. S2 cannot exceed the number of characters D11
0x34 0x33 D101 0x37 0x36 D101 0x33 0x32
specified by S1. D12
0x00 0x35 D102 0x39 0x38 D102 0x39 0x38
2. “n” is more than “-2”. D103 0x00 0x61 D103 0x00 0x61
244 Chapter 6 Application Instructions

6.19.7 STRINSTR: Character String Search

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:STRINSTR (S1) (S2) (D) (S3) Program steps 9


Offset
Operand Type Applicable elements
addressing
S1 INT Character strings D SD C T V R √
S2 INT D SD C T V R √
D INT D SD C T V R √
S3 INT Constant D V R

Operand description the system will report “Outside instruction


element range”.
S1: Head device number storing a character string
S2: Head device number storing a character string to
2. The search start position "S3" cannot exceed
be searched the number of characters stored in S2.
D: Head device number storing search result 3. When directly specifying a character string by
S3: Search start position S1, up to 32 characters can be specified.
4. When S2 is “00H”, search result is the position
Function description
of “00H” in S2.
1. When the power flow is valid, the character string
stored in S2 and higher is searched for within the Example
character string S2 and higher. The search begins
at the "S3"th character from the left end (head
character) of S2 and the search result is stored in
D. LD M1
2. When the searched character string is not
detected, "0" is stored in D. STRINSTR “45” D10 D100 2
3. When the search start position "n" is a When M1 is ON, the character string "45" is
negative number or "0", search processing is not searched from the 2nd character from the left end
executed. (head character) of the character string(D10 and
4. A character string stored in S1 and later later). The search result is stored in D100.
indicates data stored in devices from the specified “45”
device until "00H" is first detected in byte units. B15---b8 b7---b0

Caution ASC D10 0x32 0x31


D11 0x34 0x33 D100 = 4
1. When “00H” is not set within the corresponding B15---b8 b7---b0
D12 0x36 0x35
device range after a device specified by S1 or S2, 0x35 0x34
D13 0x00 0x37
Chapter 6 Application Instructions 245

6.19.8 STRMOV: Character String Transfer

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:STRMOV (S) (D) Program steps 5


Offset
Operand Type Applicable elements
addressing
S INT Character string KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √

Operand description “00H” is stored to both the high-order byte and


low-order byte of D.
S: Specified character string or head device number
storing character string which is handled as the transfer 3. When directly specifying a character string by
source S, up to 32 characters can be specified.
D: Head device number storing transferred character
string Example

Function description
1. The character string data stored in the device
specified by S and later is transferred to the device
LD M1
specified by D and later.
2. A character string stored in S and later indicates STRMOV D10 D100
data stored in devices from the specified device When M1 is ON, character string data stored in
until "00H" is first detected in byte units. D10 is transferred to D100.
Caution
1. When “00H” is not set within the corresponding
device range after a device specified by S, the
system will report “Outside instruction element
range”.
2. When the number of characters stored in S is
even, “00H” is stored in the low-order byte, and
246 Chapter 6 Application Instructions

6.20 Position Instructions

6.20.1 ZRN: Regress To Origin Instruction

LAD: Applicable to MC280 MC200 MC100

Influenced flag bit Zero, carry, borrow

IL: ZRN (S1) (S2) (S3) (D) Program steps 11


Offset
Operand Type Applicable elements
addressing
S1 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
S2 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
S3 BOOL X Y M S
D1 BOOL Y

Operand description output respectively through Y2 and Y3. When SM85


is set, the CLR signals will be output to the servo
S1: zero return speed, specifying the zero return
amplifier through Y2 and Y3.
start speed
Note
32-bit instruction: 10 ~ 100,000 (Hz)
S2: crawling speed, specifying the relatively low 1. Because the ZRN instruction is incapable of
speed when the proximity signal is ON searching the proximity signal automatically, the
S3: Proximity signal, specifying the X point for zero return operation must start earlier than where
the proximity sensor is located.
inputting proximity signal
If a non-X element is specified, the position offset of 2. During the return to zero process, the value of the
the zero point will increase due to the influence of current value register will decrease.
the PLC calculation cycle. 3. Pay attention to the configuration of SD84 ~
D: starting address (Y0 or Y1) of the high speed SD87 when using this instruction.
pulse output 4. When the instruction input frequency is smaller
than SD84, there will be no high speed output at Y0
Function description
or Y1. When the instruction input frequency is
When SM85 clearing function is enabled, the CLR bigger than SD85 or SD86, the output will be
signals for high speed pulse outputs Y0 and Y1 are abnormal.
Time sequence chart

S1 Zero return speed


Frequency

S2 Crawling speed
Pulse output
Position
Zero return
starting point
ON

OFF
Position

ON

Note 1 OFF
Clearing signal
Width: 20ms + scan cycle Within 1ms
ON

Note 2
OFF
Monitoring of Position
pulse output
Note 1: When SM85 is set, the clearing function is valid
Note 2: SM82 & SM83 are the monitors of Y0 & Y1 pulse
outputs respectively
Chapter 6 Application Instructions 247

6.20.2 PLSV: Variable Speed Pulse Output Instruction

LAD: Applicable to MC280 MC200 MC100

Influenced flag bit Zero, Carry, Borrow

IL: PLSV (S) (D1) (D2) Program steps 8


Offset
Operand Type Applicable elements
addressing
S DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
D1 BOOL Y
D2 BOOL Y M S

Operand description RAMP instruction to change the value of pulse


frequency S.
S: output pulse frequency (Hz)
3. In the process of high speed pulse output, when the
32-bit instruction: 10 ~ 100,000(Hz), -1 ~ -100,000(Hz)
power flow driven by the instruction turns OFF, the
D1: high speed pulse output starting address (Y0 or output will stop without deceleration.
Y1)
4. If the corresponding high speed pulse output
D2: rotating direction signal output starting address. Its monitor (SM82 or SM83) is ON, the power flow driven
state is determined by S: by the instruction will not be driven by the instruction
When S is positive: D2 is ON again after the power flow turns OFF.
When S is negative: D2 is OFF 5. The direction is determined by the positive or
Function description negative nature of S.

1. You can change the output pulse frequency of S Note


even in the state of output high speed pulses. 1. Pay attention to the instruction driven time.
2. Because there will be no acceleration or 2. The high speed I/O instructions, PLS instruction and
deceleration during the start & stop, if buffer is needed Position instructions can use Y0 or Y1 to output high
during the start or stop, it is recommended to use the speed pulses. However, take care not to use more
than one such instruction on Y0 or Y1 at one time.
6.20.3 DRVI: Relative Position Control Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit Zero, Carry, Borrow

IL: DRVI (S1) (S2) (D1) (D2) Program steps 11


Offset
Operand Type Applicable elements
addressing
S1 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
S2 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
D1 BOOL Y
D2 BOOL Y M S

Operand description Function description

S1: output pulse number (relatively specified) 1. S1 is stored in the following current registers:

32-bit instruction: -999999 ~ +999999 Y0 output: SD80, SD81 (32-bit)

S2: output pulse frequency (Hz) Y1 output: SD82, SD83 (32-bit)

32-bit instruction: 10 ~ 100000 (Hz) 2. When D2 is OFF, the value of the current value
register will decrease.
D1: high speed pulse output starting address (Y0 or
Y1) 3. The rotating direction is determined by the positive
or negative nature of S1.
D2: rotating direction signal output starting address. Its
state is determined by S1: 4. Changing the operands during the execution of the
instruction will not take effect until the next cycle when
When S1 is positive: D2 is ON
the instruction is executed again.
When S1 is negative: D2 is OFF
5. During the execution of the instruction, the output
will decelerate to stop when the driven contact turns
248 Chapter 6 Application Instructions

OFF. The execution completion flag SM will not act Note


then. 1. Pay attention to the configuration of SD84 ~ SD87
6. If the corresponding high speed pulse output control when using this instruction
(SM80 or SM81) is ON, the contact driven by the 2. When the instruction input frequency is smaller than
instruction will not be driven by the instruction again SD84, there will be no high speed output at Y0 or Y1.
after the contact turns OFF. When the instruction input frequency is bigger than
SD85 or SD86, the output will be abnormal.
Chapter 6 Application Instructions 249

6.20.4 DRVA: Control Absolute Position Instruction

LAD: Applicable to MC280 MC200 MC100 MC80

Influenced flag bit Zero, carry, borrow

IL: DRVA (S1) (S2) (D1) (D2) Program steps 11


Offset
Operand Type Applicable elements
addressing
S1 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
S2 DINT Constant KnX KnY KnM KnS KnLM KnSM D SD C V √
D1 BOOL Y
D2 BOOL Y M S

Operand description 4. Changing the operands during the execution of the


instruction will not take effect until the next cycle when
S1: target position (absolutely specified)
the instruction is executed again.
32-bit instruction: -999999 ~ +999999
5. During the execution of the instruction, the output
S2: output pulse frequency (Hz) will decelerate to stop when the driven contact turns
32-bit instruction: 10 ~ 100000 (Hz) OFF. The execution completion flag SM will not act
D1: high speed pulse output starting address (Y0 or then.
Y1). The PLC output must be transistor output 6. If the corresponding high speed pulse output control
D2: rotating direction signal output starting address. (SM80 or SM81) is ON, the contact driven by the
Its state is determined by S1: instruction will not be driven by the instruction again
When S1 is positive: D2 is ON after the contact turns OFF.
When S1 is negative: D2 is OFF Note
Function description 1. Pay attention to the configuration of SD84 ~ SD87
1. S1 is stored in the following registers: when using this instruction.
Y0 output: SD80, SD81 (32-bit) 2. When the instruction input frequency is smaller than
Y1 output: SD82, SD83 (32-bit) SD84, there will be no high speed output at Y0 or Y1.
When the instruction input frequency is higher than
2. When D2 is OFF, the value of the current value
SD85 or SD86, the output will be abnormal.
register will decrease.
3. The rotating direction is determined by the positive
or negative nature of S1.

6.20.5 ABS: Read Current Value Instruction

LAD: Applicable to MC280 MC200 MC100

Influenced flag bit Zero, carry, borrow

IL: ABS (S) (D1) (D2) Program steps 8


Offset
Operand Type Applicable elements
addressing
S BOOL X Y M S
D1 BOOL Y M S
D2 DINT KnY KnM KnS D SD C √

Operand description
S: the input point from servo.
The input points occupies three consecutive Xs (S, S + 1 and S + 2) or other bit elements.
D1: output points to servo.
The output points occupies three consecutive Ys (D1, D1 + 1 and D1 + 2) or other bit elements
D2: the current value (32-bit) read from servo.
The current value occupies two word elements: D2 (MSB) and D2 + 1 (LSB). Because the read current value must be
written into SD80 or SD82 (32-bit signed interger), you can directly specify SD80 or SD82 as D2.
250 Chapter 6 Application Instructions

Function description
1. You should power on the PLC and servo amplifier at the same time or power on the servo amplifier first, in order to
make sure that the servo amplifier is ON before the PLC enters the RUN state.
2. The read current value D2 can be stored in any word element, but the current value must be eventually stored in
SD80 or SD82.
3. The power flow of the ABS instruction should be ON after the current value is read, otherwise the servo amplifier will
turn OFF.
4. SM82 and SM83 are the output monitors of Y0 and Y1. The monitors will turn OFF after the output is complete.
5. When the power flow is valid and the servo is ON, the ABS instruction will send the transmission mode signal.
6. When the data transmission ready signal and the ABS request signal coincide with each other, the (32 + 6) bit data
communication will start.
7. The data are transmitted through the ABS 2-bit (bit0 & bit1) loop.
8. The system error code for ABS Data Read Timeout is 79; for ABS Data Read and Check Error, 80.
9. The wire connection for the I/O signals of the ABS instruction is as shown in the following figure.

PLC Servo amplifier PLC Servo amplifier


EC10 - 1614BRA MR-H -A EC10-1614BRA MR-J2-A
X 0 ABS ( bit 0) PF 24 X 0 ABS (bit 0) D01 4
X 1 ABS ( bit 1) ZSP 23 X 1 ABS (bit 1) ZSP 19
Data transmission Data transmission
X 2 ready
TLC 25 X 2 TLC 6
ready
COM SG 16 COM SG 10

Y 4 Servo ON SON 12 Y 4 Servo ON SON 5


ABS transmission ABS transmission
Y 5 D13 44 Y 5 ABSM 8
mode mode
Y 6 ABS request D14 45 Y 6 ABS request ABSR 9
COM2 COM2

Time sequence chart

ON
Power supply
OFF
Note 4
Servo ON signal ON
(SON)
Note 1 OFF

ABS transmission ON
mode (ABSM).
Note 1 OFF

ABS transmission ON
request (ABSR)
Note 1 OFF
Note 5
Data transmission ON
ready (TLC).
Note 2 OFF
Note 5

Send ABS data ON


DO1/ZSP
OFF
main circuit 80ms 80ms

Ready for
Ready. Note 2
operation.
RD Ready for Note 3
peration.
Note 1: the signal PLC sends to servo amplifier Note 3
Note 2: the signal servo amplifier sends
Note 3: system data transmission over, ready for normal operation. After RD is set, ABSM signal will not be accepted
Note 4: Here the SON signal is set before ABSM signal. Despite that, the main circuit will not be ON until ABSM is set ON. If
transmission mode is interrupted with ABSM being set OFF during the ABS trasmission, the servo amplifier will report overtime alarm
(AL.E5).
Note 5: These signal pins' definitions will change upon ABSM set/reset. See the related Mitsubishi product information.
Chapter 6 Application Instructions 251

Note
The ABS instruction supports the Mitsubishi MR ~ J2 and MR ~ J2S servo amplifiers and use its specialized data
transmission protocol to read the current value of absolute position. The ABS instruction is a dedicated 32-bit
instruction. For the servo amplifiers of other brands, reading the current value of absolute position requires
communication or other designated methods. When the ABS instruction is executed, the related I/O points will be
processed accordingly. Therefore, the ABS instruction is applicable only to Mitsubishi servo amplifiers.
252 Chapter 6 Application Instructions

6.20.6 DSZR: Return to Mechanical Zero Point

LAD: Applicable to MC280 MC200


DSZR (S1) (S2) (D1) (D2) Influenced flag bit Zero, carry, borrow
IL:DSZR (S1) (S2) (D1) (D2) Program steps 9
Offset
Operand Type Applicable elements
addressing
S1 BOOL X Y M S
S2 BOOL X
D1 BOOL Y
D2 BOOL Y M S
Operand Introductions:

S1:Regress speed(32 bit:MC100、MC200:10~100000(Hz),MC280:10~200000(Hz)).

S2:crawl speed: assign crawl speed after near point signal(DOG) arrival.

D1:Near point signal(DOG),Assign near point signal(DOG) input port ( When assign another component but X ,origin
offset will increase due to the influence of the PLC scan cycle).
D2:High-speed pulse output port (For MC100, MC200, only Y0 or Y1. But for MC280, you can specify the Y0 to Y7).

Function description
1. S1 is stored in the following registers:
 Y0 output: SD80, SD81 (32-bit)
 Y1 output: SD82, SD83 (32-bit)
2. When D2 is OFF, the value of the current value register will decrease.
3. The rotating direction is determined by the positive or negative nature of S1.
4. Changing the operands during the execution of the instruction will not take effect until the next cycle when the
instruction is executed again.
5. During the execution of the instruction, the output will decelerate to stop when the driven contact turns OFF. The
execution completion flag SM will not act then.
6. If the corresponding high speed pulse output control (SM80 or SM81) is ON, the contact driven by the instruction will
not be driven by the instruction again after the contact turns OFF.
Note
1. Pay attention to the configuration of SD84 ~ SD87 when using this instruction
2. When the instruction input frequency is smaller than SD84, there will be no high speed output at Y0 or Y1. When the
instruction input frequency is higher than SD85 or SD86, the output will be abnormal.
Chapter 6 Application Instructions 253

6.20.7 STOPDV: Pulse output interrupt Instruction

LAD: Applicable to MC280

STOPDV (S1) (S2) (S3) (D) Influenced flag bit Zero, carry, borrow

IL:STOPDV (S1) (S2) (S3) (D) Program steps 12


Offset
Operand Type Applicable elements
addressing
S1 DINT constant KnX KnY KnM KnS KnLM KnSM D SD C V √

S2 DINT constant KnX KnY KnM KnS KnLM KnSM D SD C V √

S3 BOOL KnX KnY KnM KnS KnLM KnSM D SD C V √

D BOOL Y

operand Introductions:

S1:relative position to the point when instruction execute

S2:basal speed

S3:deceleration time

D:High-speed pulse output port ( For MC100,MC200,only Y0 or Y1. But for MC280, you can specify the Y0 to Y7).

Function description
1. S1 is stored in the following registers:
 Y0 output: SD80, SD81 (32-bit)
 Y1 output: SD82, SD83 (32-bit)
2. When D2 is OFF, the value of the current value register will decrease.
3. The rotating direction is determined by the positive or negative nature of S1.
4. Changing the operands during the execution of the instruction will not take effect until the next cycle when the
instruction is executed again.
5. During the execution of the instruction, the output will decelerate to stop when the driven contact turns OFF. The
execution completion flag SM will not act then.
6. If the corresponding high speed pulse output control (SM80 or SM81) is ON, the contact driven by the instruction will
not be driven by the instruction again after the contact turns OFF.
Note
1. Pay attention to the configuration of SD84 ~ SD87 when using this instruction
2. When the instruction input frequency is smaller than SD84, there will be no high speed output at Y0 or Y1. When the
instruction input frequency is higher than SD85 or SD86, the output will be abnormal.
254 Chapter 6 Application Instructions

6.20.8 LIN: Line Interpolation Instruction

LAD: Applicable to MC280

LIN (S) (D1) (D2) (D3) (D4) Influenced flag bit Zero, carry, borrow

IL:LIN (S) (D1) (D2) (D3) (D4) Program steps 12


Offset
Operand Type Applicable elements
addressing
S DINT D

D1 BOOL Y

D2 BOOL Y

D3 BOOL Y

D4 BOOL Y

operand Introductions:

S:Starting address of the Parameter table storage area

D1:X-axis Pulse (For MC280, you can specify the Y0 to Y7).

D2:X-axis direction (For MC280, you can specify the Y0 to Y7)

D3:Y-axis Pulse (For MC280, you can specify the Y0 to Y7).

D4:Y-axis direction (For MC280, you can specify the Y0 to Y7).

Function description
1. S1 is stored in the following registers:
 Y0 output: SD80, SD81 (32-bit)
 Y1 output: SD82, SD83 (32-bit)
2. When D2 is OFF, the value of the current value register will decrease.
3. The rotating direction is determined by the positive or negative nature of S1.
4. Changing the operands during the execution of the instruction will not take effect until the next cycle when the
instruction is executed again.
5. During the execution of the instruction, the output will decelerate to stop when the driven contact turns OFF. The
execution completion flag SM will not act then.
6. If the corresponding high speed pulse output control (SM80 or SM81) is ON, the contact driven by the instruction will
not be driven by the instruction again after the contact turns OFF.
Note
1. Pay attention to the configuration of SD84 ~ SD87 when using this instruction
2. When the instruction input frequency is smaller than SD84, there will be no high speed output at Y0 or Y1. When the
instruction input frequency is higher than SD85 or SD86, the output will be abnormal.
Chapter 6 Application Instructions 255

6.20.9 CW: Clockwise circular arc interpolation instruction

LAD: Applicable to MC280

CW (S) (D1) (D2) (D3) (D4) Influenced flag bit Zero, carry, borrow

IL:CW (S) (D1) (D2) (D3) (D4) Program steps 12


Offset
Operand Type Applicable elements
addressing
S DINT D

D1 BOOL Y

D2 BOOL Y

D3 BOOL Y

D4 BOOL Y

operand Introductions:

S:Starting address of the Parameter table storage area

D1:X-axis Pulse (For MC280, you can specify the Y0 to Y7).

D2:X-axis direction (For MC280, you can specify the Y0 to Y7).

D3:Y-axis Pulse (For MC280, you can specify the Y0 to Y7).

D4:Y-axis direction (For MC280, you can specify the Y0 to Y7).

Function description
1. S1 is stored in the following registers:
 Y0 output: SD80, SD81 (32-bit)
 Y1 output: SD82, SD83 (32-bit)
2. When D2 is OFF, the value of the current value register will decrease.
3. The rotating direction is determined by the positive or negative nature of S1.
4. Changing the operands during the execution of the instruction will not take effect until the next cycle when the
instruction is executed again.
5. During the execution of the instruction, the output will decelerate to stop when the driven contact turns OFF. The
execution completion flag SM will not act then.
6. If the corresponding high speed pulse output control (SM80 or SM81) is ON, the contact driven by the instruction will
not be driven by the instruction again after the contact turns OFF.
Note
1. Pay attention to the configuration of SD84 ~ SD87 when using this instruction
2. When the instruction input frequency is smaller than SD84, there will be no high speed output at Y0 or Y1. When the
instruction input frequency is higher than SD85 or SD86, the output will be abnormal.
256 Chapter 6 Application Instructions

6.20.10 CCW: Counterclockwise circular arc interpolation instruction

LAD: Applicable to MC280

CCW (S) (D1) (D2) (D3) (D4) Influenced flag bit Zero, carry, borrow

IL:CCW (S) (D1) (D2) (D3) (D4) Program steps 12


Offset
Operand Type Applicable elements
addressing
S DINT D

D1 BOOL Y

D2 BOOL Y

D3 BOOL Y

D4 BOOL Y

operand Introductions:

S:Starting address of the Parameter table storage area

D1:X-axis Pulse (For MC280, you can specify the Y0 to Y7).

D2:X-axis direction (For MC280, you can specify the Y0 to Y7).

D3:Y-axis Pulse (For MC280, you can specify the Y0 to Y7).

D4:Y-axis direction (For MC280, you can specify the Y0 to Y7)

Function description
1. S1 is stored in the following registers:
 Y0 output: SD80, SD81 (32-bit)
 Y1 output: SD82, SD83 (32-bit)
2. When D2 is OFF, the value of the current value register will decrease.
3. The rotating direction is determined by the positive or negative nature of S1.
4. Changing the operands during the execution of the instruction will not take effect until the next cycle when the
instruction is executed again.
5. During the execution of the instruction, the output will decelerate to stop when the driven contact turns OFF. The
execution completion flag SM will not act then.
6. If the corresponding high speed pulse output control (SM80 or SM81) is ON, the contact driven by the instruction will
not be driven by the instruction again after the contact turns OFF.
Note
1. Pay attention to the configuration of SD84 ~ SD87 when using this instruction
2. When the instruction input frequency is smaller than SD84, there will be no high speed output at Y0 or Y1. When the
instruction input frequency is higher than SD85 or SD86, the output will be abnormal.
Chapter 6 Application Instructions 257

6.20.11 GEARBOX: ELECTRONIC GEAR instruction

LAD: Applicable to MC280

GEARBOX (D1) (S1) (D2) (S2) Influenced flag bit Zero, carry, borrow

IL:GEARBOX (D1) (S1) (D2) (S2) Program steps 12


Offset
Operand Type Applicable elements
addressing
D1 BOOL X Y C

S1 INT constant D √

D2 BOOL Y

S2 INT constant D √

Operand Introductions:

D1:principal axis

S1:Gear Ratio Denominator

D2:Driven shaft

S2:Gear Ratio Molecular

Function description
1. S1 is stored in the following registers:
 Y0 output: SD80, SD81 (32-bit)
 Y1 output: SD82, SD83 (32-bit)
2. When D2 is OFF, the value of the current value register will decrease.
3. The rotating direction is determined by the positive or negative nature of S1.
4. Changing the operands during the execution of the instruction will not take effect until the next cycle when the
instruction is executed again.
5. During the execution of the instruction, the output will decelerate to stop when the driven contact turns OFF. The
execution completion flag SM will not act then.
6. If the corresponding high speed pulse output control (SM80 or SM81) is ON, the contact driven by the instruction will
not be driven by the instruction again after the contact turns OFF.
Note
1. Pay attention to the configuration of SD84 ~ SD87 when using this instruction
2. When the instruction input frequency is smaller than SD84, there will be no high speed output at Y0 or Y1. When the
instruction input frequency is higher than SD85 or SD86, the output will be abnormal.
258 Chapter 6 Application Instructions

6.20.12 DRVC:Closed loop relative / absolute position control command

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:DRVC (S1) (D1) (S2) (S3) Program steps 9


Offset
Operand Type Applicable elements
addressing
S1 BOOL C
D1 DINT constant D √
S2 BOOL Y
D2 BOOL constant D √
digits), and if you set a frequency f, then the actual
Operand Introductions:
acceleration and deceleration time t = SD205 *
S1 : Counter (encoder return of physical location) ID: (f-SD204 ) / (SD202-SD204); other axes above.
C236 ~ C239, C251, C252, C254, C256, C257, 2. If Y0-axis output pulse number s not satisfy the following
C258, C259, C301, C302, C304, C305, C306 conditions: (t / 1000) s * (f + SD204), the output triangle
counter supports unidirectional, AB phase counter; prevention, there is acceleration and deceleration but
D1 : Relative / absolute position value range: the output frequency cannot reach the specified speed;
-134 217 727 - 134 217 727; other axes above.
3. If Y0 axis pulse output stop bit SM80 set, the output is
(D1+2): The output frequency value;
stopped immediately. Other Y has a corresponding SM
(D1+4): The maximum pulse output restrictions; when the
element.
output to the maximum limit, even if there is no
4. After the drive power flow, pulse output stop.
counter to expectations, output is stopped.
5. Driven process, you can change the pulse frequency;
S2 : Axis output ports: Y0 ~ Y7;
modified frequency, there is acceleration and deceleration.
S3 : Output direction of the port: Y0 ~ Y17;
6. Y0 ~ Y7 output completion interrupt support.
Function description:
Example
1. Positioning axis Y transmit pulse actuator to action, the
actual position of the axis by the encoder feedback to
the high-speed counting port, when the actual position
and the specified target instruction encoder feedback
position is the same positioning is completed, the
positioning process is completed by the motion control
processor, from the scan cycle.
2. DRVI output shaft with the same characteristics, there is
acceleration or deceleration, but the end position by an
encoder feedback to be judged.

Note
1. Y0 actual acceleration and deceleration time is not the
SD205, SD205 is the SD202 (32-bit) to time SD204 (16
Chapter 6 Application Instructions 259

6.20.13 CAMTABLE:Setting the electronic cam data table instructions

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:CAMTABLE (S1) (S2) (S3) (S4) (S5) Program steps 11


Offset
Operand Type Applicable elements
addressing
S1 INT constant D SD C V

S2 INT constant D SD C V √

S3 INT constant D SD C V

S4 INT constant D SD C V √

S5 INT constant D SD C V
Example
Operand Introductions:

S1: Starting member cam angle table: Table value where


you want continuous, and are arranged in ascending order.
The maximum you can set the 1024 array. Unit: pulses.
S2: The number of data of the cam curve table: 2 to 2048.
S3: Starting execution address
S4: Length of the cam execution if plastic storage places
equal S2 cam table data, if stored cam table S2 twice as
long integer data places.
S5: Cam curve number: 1 to 4, you can set up four
electronic cam curve (Y0 as a counterpart from the shaft in
Table 1, Y1 as a counterpart from the shaft Table 2, Y2 as a
counterpart from the shaft in Table 3, Y3 as a counterpart
from the shaft table 4).

Function description:
Generating an electronic cam curve table, the table
points can be set, maximum 2048.
Note
1. It should be driven by rising energy flow CAMTABLE
form, because the assignment only once.
2. Data tables can be generated four, while there are four
cam data table.
260 Chapter 6 Application Instructions

6.20.14 CAMBOX:Electronic cam instruction

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:CAMBOX (S1) (D1) (D2) (D3) (D4) Program steps 9


Offset
Operand Type Applicable elements
addressing
S1 INT D SD C V √

D1 BOOL X Y C √

D2 BOOL Y
D3 BOOL Y M
D4 BOOL Y
S1+8 Absolute position of Absolute mode
Operand Introductions
setting: double word.
S1 Mode Select (word): S1+10 Absolute mode execution speed
1: Table 1 single execution; setting: double word.
11: Table 1 cycle execution. D1 Cam shaft: Y0 ~ Y7, X0 ~ X7, C251, C252,
21: Table 1 and the absolute position of the
cam combined, single-cycle execution. C254, C256, C257, C258, C259, C304, C305,
2: Table 2 single execution; C306.
12: Table 2 loop execution.
3: Table 3 single execution; D2 Cam slave axis: Y0 ~ Y3 (Y0 as a counterpart
13: Table 3 loop execution. from the shaft Table 1, Y1 as a counterpart
4: Table 4 single execution;
14: Table 4 loop execution. from the shaft Table 2, Y2 as a counterpart
S1+1 Cam stop signal setting: 0 from the shaft Table 3, Y3 as a counterpart
corresponding to no end signal; an input signal
port-digit number (range: 0 to 7, indicating X0 ~ from the shaft Table 4);
X7), the tens digit 1 indicates rising edge, the D3 The direction of the slave axis:Y0~Y17;
tens digit is 2 indicates falling edge; the case of
13, it means the end of the cam rising X3 D4 Synchronization signal:Y10~Y17;
forced execution, such as a single execution
mode of the cam end, as the cycle execution Function description:
mode is started next cam cycle, as described in
conjunction with the absolute position of the In accordance with the existing electronic cam
cam way then enter the absolute positioning curve, operation can continue to run according to
mode.
 S1+2 Synchronization zone lower limit: the data stream cam data table after the effective.
double word, the spindle is set, and the Note
upper limit is determined jointly sync area,
the synchronization area specific port 1、 At the same time there can be only one
output sync signal. electronic cam instruction.
S1+4 The upper limit synchronization area
setting: double word, the spindle is set, and the 2、 If the axis of the electronic cam is C counter,
lower limit is determined jointly sync area, the there must be HCNT instruction to drive the
synchronization area specific port output sync counters.
signal.
S1+6 Circulation mode setting: 1: Limited cycles, Example
0: infinite loop.
S1+7 Cycles settings: the value set cycle times
through the loop finite.
Chapter 6 Application Instructions 261

6.21 Data Processing Instructions

6.21.1 MEAN: Mean Value Instruction

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:MEAN (S1) (D) (S2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 INT constant KnX KnY KnM KnS KnLM KnSM D SD C T R √
D INT KnY KnM KnS KnLM D SD C R √
S2 INT constant D R √

Operand description Example

S1: Head word device number storing data to be


averaged
D: Word device number storing the mean value result LD M1
S2: Number of data to be averaged MEAN D0 D10 4
Function description When M1 is ON, the data of D0, D1, D2 and D3
1. The mean value of "S2" 16-bit data from S1 is are summed, divided by "4", and then stored to
stored to D. D10.

6.21.2 WTOB: Word to Byte Instruction

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:WTOB (S1) (D) (S2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 INT D SD C T R √
D INT D SD C T R √
S2 INT constant D R √

Operand description
S1: Head device number storing data to be separated in byte units
D: Head device number storing result of separation in byte units
S2: Number of byte data to be separated
Function description
1. "S2/2" 16-bit data stored in S1 and later is separated into "S2" bytes, and stored in the low-order byte (8 bits) of "S2"
devices starting from D. And "00H" is stored in the high-order byte (8 bits) of each device (D and later) storing the
separated byte data.
262 Chapter 6 Application Instructions

2. When "S2" is an odd number, only the low-order byte (8 bits) of the final separation source device is regarded as the
target data as shown in the figure below.
For example, when "n" is "5", the data from S to the low-order byte (8 bits) of S+2 is stored in D to D+4.

3. When "S2" is "0", WTOB instruction is not executed.


4. Devices storing the separation source data cannot overlap devices storing the separated data.
Example

LD M1
WTOB D0 D10 6
When M1 turns ON, the data stored in D0 to D2 is separated in six byte units, and stored in D10 to D15. When
D0=0x102, D1=0x304, D2=0x506,then D10=0x01, D11=0x02, D12=0x03, D13=0x04, D14=0x05, D15=0x06.

6.21.3 BTOW: Byte to Word Instruction

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:BTOW (S1) (D) (S2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 INT D SD C T R √
S2 INT D SD C T R √
D INT constant D R √

Operand description
S1: Head device number storing data to be combined in byte units
D: Head device number storing data acquired by combination in byte units
S2: Number of byte data to be combined
Function description
1. The low-order byte (8 bits) of "S2" 16-bit data starting from S1 is combined, and stored in "S2/2" devices starting
from D. And the high-order byte (8 bits) of each combination source 16-bit data (S1 and later) is ignored.
Chapter 6 Application Instructions 263

2. When "S2" is an odd number, "00H" is stored in the low-order byte (8 bits) of the final one among the combination
result destination devices.

3. When "S2" is "0", BTOW instruction is not executed.


4. Devices storing the separation source data cannot overlap devices storing the separated data.
Example

LD M1
BTOW D0 D10 6
When M1 turns ON, the data stored in D0 to D5 is combined in three byte units, and stored in D10 to D12. When
D0=0x01, D1=0x02, D2=0x03, D3=0x04, D4=0x05, D5=0x06,then D10=0x102, D11=0x304, D12=0x506.

6.21.4 UNI: 4-bit Linking of Word Data Instruction

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:UNI (S1) (D) (S2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 INT D SD C T R √
S2 INT D SD C T R √
D INT constant D R √

Operand description
S1: Head device number storing data to be combined
D: Device number storing combined data
S2: Number of data to be combined
Function description
1. The low-order 4 bits of "S2" 16-bit data starting from S1 are combined, and stored in “S2” devices starting from D.
264 Chapter 6 Application Instructions

2. In the case of "1 ≤ n ≤3", the low-order {4 (4-S2)} bits of D are set to "0".

3. Specify a number 1 to 4 in "S2".


In the case of "S2 = 0", UNI instruction is not executed.
4. Devices storing the separation source data cannot overlap devices storing the separated data.
Example

LD M1
UNI D0 D10 4
When M1 turns ON, the low-order 4 bits of D0 to D2 are combined and stored in D10. When D0=0x01, D1=0x02,
D2=0x03m D3=0x04, then D10=0x1234.

6.21.5 DIS: 4-bit Grouping of Word Data Instruction

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:DIS (S1) (D) (S2) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 INT D SD C T R √
S2 INT D SD C T R √
D INT constant D R √

Operand description
S1: Device number storing data to be separated
D: Head device number storing separated data
S2: Number of data to be separated
Chapter 6 Application Instructions 265

Function description
1. 16-bit data stored in S1 is separated in 4-bit units, and stored in D.

2. Specify a number 1 to 4 in "S2".


In the case of "S2 = 0", UNI instruction is not executed.
3. High-order 12 bits of "S2" devices starting from D are set to "0".
4. Devices storing the separation source data cannot overlap devices storing the separated data.
Example

LD M1
DIS D0 D10 4
When M1 turns ON, D0 is separated into 4 bit units and stored in D10 to D13. When D0=0x1234, then D10=0x01,
D11=0x02, D12=0x03,D13=0x04.

6.21.6 ANS: Timed Annunciator Set Instruction

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:ANS (S1) (S2) (D) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 INT T √
S2 INT constant D R √
D BOOL S √

Operand description
S1: Timer number for evaluation time, only for T0~T209 (100ms)
S2: Evaluation time data(1~32767)
D: Annunciator device to be set
Function description
1. When the command input remains ON for equivalent to or longer than the evaluation time [S2 × 100 ms, timer S1],
D is set. When the command input remains ON for less than the evaluation time [m × 100 ms] and then turns OFF, the
current value of the timer for evaluation S1 is reset and D is not set. When the command input turns OFF, the timer for
evaluation S1 is reset.

Device Name Description


When SM400 is set to ON, SM40 and
SM400 Enable annunciator
SD401 are valid.
When one of the state relays S900 to
SM401 Annunciator ON
S999 is ON, SM401 turns ON.
SD401 Smallest state relay Among S900 to S999, the smallest state
266 Chapter 6 Application Instructions

number in ON relay number in the ON status is stored.


status

Example

LD M1
ANS T0 100 S901
When the command input remains ON for equivalent to or longer than 10s, S901 is set.

6.21.7 ANR: Annunciator Reset Instruction

LAD: Applicable to MC280

Influenced flag bit Zero, carry, borrow

IL:ANR Program steps 1


Offset
Operand Type Applicable elements
addressing
There are no applicable devices.

Operand description When one of the state


Annunciator
SM401 relays S900 to S999 is
There is no set data. ON
ON, SM401 turns ON.
Function description Smallest state Among S900 to S999,
1. When the command input turns ON, a state relay relay the smallest state relay
SD401 number in ON
working as annunciator (S900 to S999) in the ON number in the ON status
status is reset. status is stored.
If two or more state relays are ON, the state relay
with the smallest number is reset.
When the command input is set to ON again, the Example
state relay with the next smallest number is reset
among state relays working as annunciators (S900
to S999) in the ON status.
Device Name Description
When SM400 is set to LD M1
Enable
SM400 ON, SM40 and SD401 ANR
annunciator
are valid. When M1 is ON, If two or more state relays are ON,
the state relay with the smallest number is reset.

6.22 Other instructions

6.22.1 RND: Random Number Generation Instruction

LAD: Applicable to MC280

Influenced flag bit Zero

IL:RND (D) Program steps 3


Offset
Operand Type Applicable elements
addressing
D WORD KnX KnY KnM KnS KnLM KnSM D SD C T Z R √
Chapter 6 Application Instructions 267

Operand description Example

D: Head device number storing a random number.


Function description
1. This instruction generates a pseudo-random LD X0
number within the range from 0 to 32767, and
RND D0
stores it as a random number to D.
When M1 is ON, the random number is stored to
D0. D0 = 26406.

6.22.2 DUTY: Timing Pulse Generation Instruction

LAD: Applicable to MC280

Influenced flag bit

IL:DUTY (S1) (S2) (D) Program steps 7


Offset
Operand Type Applicable elements
addressing
S1 WORD constant KnX KnY KnM KnS KnLM KnSM D SD C T Z R √
S2 INT constant KnX KnY KnM KnS KnLM KnSM D SD C T Z R √
D BOOL SM

Operand description Example

S1: Number of scans (operation cycles) to remain ON


[n1 > 0]
S2: Number of scans (operation cycles) to remain OFF LD M1
[n1 > 0] DUTY 10 10 SM430
D: Timing clock output destination When M1 is ON, SM430 is set to ON for 10 scans
and OFF for 10 scans, and the counted number of
Function description
scans is stored in SD430.
1. The timing clock output destination D is set to
ON and OFF with the ON duration for "S1" scans
and OFF duration for "S2" scans.
2. Specify either one among SM430 to SM434 as
the timing clock output destination device.
Timing clock output Scan counting
destination device device
SM430 SD430
SM431 SD431
SM432 SD432
SM433 SD433
SM434 SD434
3. DUTY instruction can be used up to 5 times
(points).
It is not permitted, however, to use the same timing
clock output destination device D for two or more
DUTY instructions.
4. When the command input is set to ON, the
operation is started. Even if the command input is
set to OFF, the operation is not stopped.
In the STOP mode, the operation is suspended.
When the power of the PLC is turned OFF, the
operation is stopped.
268 Chapter 7 SFC Tutor

Chapter 7 SFC Tutor

This chapter introduces the basic concepts and programming methods of Sequential Function Chart (SFC). In addition,
the points to note during the programming is also introduced.
7.1 Introduction To SFC....................................................................................................................................................................262
7.1.1 What Is SFC.................................................................................................................................................................... 262
7.1.2 What Is SFC Of MC series PLC................................................................................................................................... 262
7.1.3 Basic Concepts Of SFC.................................................................................................................................................262
7.1.4 Programming Symbols And Their Usage................................................................................................................... 262
7.1.5 SFC Program Structure................................................................................................................................................. 263
7.1.6 Execution Of SFC Program...........................................................................................................................................267
7.2 Relationship Between SFC Program And LAD Program......................................................................................................267
7.2.1 STL Instruction And Steps.............................................................................................................................................267
7.2.2 SET Instruction................................................................................................................................................................268
7.2.3 RET Instruction And SFC Program Section............................................................................................................... 268
7.2.4 OUT Instruction And RST Instruction.......................................................................................................................... 268
7.2.5 SFC Selection Branch, Parallel Branch And Merge..................................................................................................268
7.3 How To Program With SFC....................................................................................................................................................... 268
7.4 Points To Note In SFC Programming.......................................................................................................................................269
7.4.1 Common Programming Errors......................................................................................................................................269
7.4.2 Programming Tricks....................................................................................................................................................... 271
7.5 Examples Of SFC Programming...............................................................................................................................................273
7.5.1 Simple Sequential Structure......................................................................................................................................... 273
7.5.2 Selection Branch Structure........................................................................................................................................... 275
7.5.3 Parallel Branch Structure...............................................................................................................................................278
Chapter 7 SFC Tutor 269

7.1 Introduction To SFC

7.1.1 What Is SFC


The Sequential Function Chart, or SFC, is a programming language developed and got popular in recent years. SFC
can turn a PLC program into a structured flow chart. By using standard programming symbols and grammar compliant
with IEC61131-3, the SFC can divide a complicated operation process into sequential procedures that are linked
together with conditioned transfers, so as to realize sequence control.
The SFC edited programs are direct and sequential. Each procedure and transfer condition are relatively simple
program sections, ideal for the sequential control application. These advantages explain why it is finding wider
application.

7.1.2 What Is SFC Of MC series PLC


The SFC of MC series PLC is a programming language used by Megmeet MC series PLCs. Besides standard SFC
functions, the SFC of MC series PLC can provide multiple nested LAD program blocks.
The program edited with SFC of MC series PLC can be converted into LAD or IL program.
The SFC of MC series PLC can also support up to 20 independent procedures. The independent procedures can run
independently, that is to say, the steps within different independent procedures are scanned and executed separately.
However, jumping among independent procedures is enabled.

7.1.3 Basic Concepts Of SFC


The SFC has the following two basic concepts: step and transfer. Other concepts, like jump, branch and multiple
independent procedures, all evolve from the two basic concepts.
Steps
1. Definition
A step is actually a program section, representing a work state or move in the sequence control process. Putting
multiple steps together in a organic way can form a complete SFC program.
2. Execution of steps
In a SFC program, each step is represented by a fixed S element.
A step is valid when it is being executed. For a valid step, its corresponding S element is ON, and the PLC will scan
and execute its instructions. While a step not being executed is invalid. For a invalid step, its corresponding S element
is OFF, and the PLC will not scan and execute its instructions.
Transfer
The sequence control process is actually a series of step transfers. A PLC executing a certain step will, if certain logic
conditions are met, leave the current step to enter and execute a new step. That transition is called the step transfer.
The logic condition that triggers the transfer is called the transfer condition.

7.1.4 Programming Symbols And Their Usage


Programming Symbol
The MC series PLC SFC programming language consists of the following programming symbols:
Table 7-1 Programming symbols
Symbol name Symbol Description
A initial step of SFC, numbered as Sn. The “n” must not repeat. The execution of a
Initial step
SFC program must start with an initial step, whose S element range is S0 ~ S19
A normal step, numbered as Sn. The “n” must not repeat. The S element range for
Normal step
the normal step is S20--S991
A transfer. It can be built-in with a transfer condition (a embeded LAD). You can
compile the transfer condition so that the S element connected with this transfer will
Transfer
be set when the condition is met and enter the next step. The transfer must be used
between steps.
270 Chapter 7 SFC Tutor

Symbol name Symbol Description

A jump, used after the transfer. It can set the specified S element to ON when the
Jump
transfer conditions are met. It is used to cycle or jump among steps

A reset, used after the transfer. It can set the specified S element to OFF when the
Reset
transfer conditions are met. It is used to end the SFC program

Multiple independent transfer conditions, used after a step. When the transfer
Selection branch condition of one branch is met, the last step will end and the next step of the
corresponding branch will start. After that, no other parallel branch will be selected

A merge of selection branches. When the transfer condition of one branch is met,
Selection merge
the last step will end and the next step will start

Connected after a step, the parallel branches share the same transfer conditions.
Parallel branch When the transfer conditions are met, the parallel branches are validated and
executed at the same time

A merge of parallel branches. The next step will start only after all the parallel steps
Parallel merge
are finished and the transfer conditions are met

Ladder chart The LAD block presents LAD instructions for operations besides the SFC flow, such
block as starting the initial step and other general operations

Usage Of Programming Symbols


1. The initial step can be used alone. If you connect it with other symbols, you must use it at the start of you SFC
program, and use a transfer condition symbol after it.
2. However, you cannot connect the LAD step with other symbols.
3. You must connect a normal step with transfer condition symbols, for the ordinary steps cannot be used alone.
4. The reset and jump should both be preceded by a transfer and followed by nothing.
5. Neither the transfer nor the jump can exist alone in a program.

7.1.5 SFC Program Structure


The structure of a SFC program is classified into three types: simple sequential structure, selection branch structure
and parallel structure. Besides, the jump structure is also a special form of the selection branch structure.
Simple sequential structure
Figure 7-1 shows a simple structured SFC program and its LAD counterpart.

Figure 7-1 A simple structured SFC


program and its LAD counterpart
Chapter 7 SFC Tutor 271

In a simple structured SFC program, when the step transfer conditions are met, the program will run from the current
step to the next step in a linear flow. At the last step, when the transfer conditions are met, the SFC program section
will either end or transfer to the initial step.

1. Ladder chart block


The ladder chart block is used to start SFC program section. To be specific, to set the S element of the initial step to
ON. In the preceding figure, the program uses the power-on startup mode.
The ladder chart block can also be used as other general program sections besides the SFC program.

2. Initial step
As shown in Figure 7-1, the initial step is started by a ladder chart block. The range of S elements for initial-step is 0 ~
19.

3. Normal step
The normal step is the main component of the program. The range of S elements for normal-step is 20 ~ 991 (for
MC200) or 20 ~ 1023 (for MC100).

4. Transfer or reset
The program shown in Figure 7-1 is ended with a jump, which leads the program to the initial step. This is a cyclic
program.
However, the program can also be ended with a reset, which can reset the status of the last step, end a program, and
wait for the next round of execution.
Selection branch structure
The selection branch structure is shown in the following figure, with LAD on the left and SFC on the right.

1. Selection branch
A branch step is validated when its corresponding transfer conditions are met. You must ensure that the transfer
conditions of different branches are all exclusive, so as to make sure that each time only one branch will be selected.
As shown in the preceding figure, steps S27 and S28 in row N12 of LAD program are transferred from conditions M20
and M21 respectively. The conditions M20 and M21 must not be met at the same time in order to ensure that S27 and
S28 will not be selected at the same time.

2. Selection merge
The selection merge is the structure where all selection branches merge to the same step. The transfer conditions are
set respectively. As shown in the preceding figure, the transfer condition in the branch of S27 is that time is up for T12,
while that for the branch of S28 is that time is up for T13. However, the results are the same: step S29 starts.
272 Chapter 7 SFC Tutor

Parallel branch structure


The parallel branch structure is shown in the following figure, with LAD on the left and SFC on the right.

1. Parallel branch
When the transfer conditions are met for the parallel branches, all branch steps will be validated at the same time. This
enables the PLC to process multiple procedures at the same time, a quite usual sequential control process. As shown
in the preceding figure, in program row N5, the steps S30 and S31 will be validated at the same time when condition
M30 is met.

2. Parallel merge
The parallel merge is the structure where all parallel branches merge to the same step by invalidating all branch steps
at the same time. As shown in the preceding figure, in program row N6, when the program is running both S30 and
S31 at the same time, if condition M31 is met, the program will start S32 and end S30 & S31.
The sequential control behind the parallel merge structure is that no next step can be executed unless all the parallel
steps are finished.
Jump structure
The applications of jumps include: to omit certain steps, to recycle by returning to the initial step or a normal step, and
to jump to another independent procedure.

1. Omitting certain steps


In a procedure, when certain steps are unnecessary under certain conditions, the program can jump directly to the
needed step and omit the unnecessary steps, as shown in the following figure, with LAD on and left and SFC on the
right.

In the SFC program shown in the preceding figure, S21 is used as the jump, while step S20 is omitted. The jump is
actually a selection branch.
While in the LAD counterpart, the second branch in row N0 is the jump instruction, which uses the OUT coil instead of
the SET instruction in the transfer. When step S0 is valid, and if M1 is ON, the program will jump to step S21.

2. Recycling
In a procedure, when it is necessary to recycle a part or all of the steps under certain conditions, you can use the jump
function. you can recycle a part of the steps if you jump to a previous normal step, or all the step if you jump to the
initial step.
Shown in the following figure is a program that can realize the above two recycles, with LAD on the left and SFC on the
right.
Chapter 7 SFC Tutor 273

In the SFC, when step S22 is valid, the program may jump to step S21 to recycle S21 and S22, or jump to the initial
step S0 to recycle all the steps. Which recycle will be selected is determined by a selection branch structure.
While in the LAD, the two kinds of jumps are realized in row N3, where you can see the OUT coil.

3. Jumping to another independent procedure


The SFC of MC series PLC supports multiple independent procedures and jumping among these procedures is
allowed. You can set certain transfer conditions in an independent procedure for jumping to a random step (initial or
normal) of another independent procedure.

 Note
Jumping among multiple independent procedures complicates the program. Use it with prudence.

Shown in the following figure is a jump from one independent procedure to another, with LAD on the left and SFC on
the right.

In the SFC, when the S0 in the first procedure is valid, the program can jump to step S23 in the second procedure
under certain conditions; while in the second procedure, the program can also jump to step S20 in the first procedure
under certain conditions.
As shown in the preceding figure, the jump is based on a selection branch structure. When the program jumps to
another procedure, all the steps in the original procedure will become invalid. As the example shows, if the program
jumps to step S23 in the second procedure from step S20 in the first procedure, step S20 and all the other steps in the
first procedure will become invalid.
274 Chapter 7 SFC Tutor

7.1.6 Execution Of SFC Program


The similarity between the execution of a SFC program and that of a LAD program is that they both carry out cyclic
scanning from up to down and from left to right.
On the other hand, their difference lies in that in a SFC program, the steps’ validity will change according to certain
conditions, and only valid steps can be executed. While in a LAD main program, the whole program will be scanned
and executed in each scan cycle.
As shown in the following figure, the program on the right is the LAD counterpart of the SFC program on the left. When
step S20 is valid, the T2 timer will be scanned and start timing. Steps S21 and S22 will not be executed before T2
counter reaches the preset value, and S23 will not be executed when M13 is OFF.

The S elements state will switch between ON and OFF according to the transfer conditions, thus making the program
transfer from one step to another. When a S element changes from ON to OFF, the output elements of the
corresponding step will be cleared or reset. For details, see 5.3.1 STL: SFC State Load Instruction.

 Note
1. The SFC program of MC series PLC usually contains LAD program blocks that are used to handle operations besides the
flow, including starting the SFC. The LAD program blocks are not controlled by the S elements and will be executed in every
scan cycle.
2. Because the state change of the S element will affect the embedded instructions of the corresponding step, and the
switch-over between two steps takes some time, it is necessary to observe certain rules during the SFC programming. For details,
see 7.4 Points To Note In SFC Programming.

7.2 Relationship Between SFC Program And LAD Program


A SFC program can take the form of a LAD program, which can help understanding the SFC program structure.
In the LAD program, the SFC symbols are replaced with various SFC instructions, while the procedures are
represented by various structures.

7.2.1 STL Instruction And Steps


All SFC steps are represented by S elements. In a LAD program, a step is started by a STL instruction.
Shown in the following left figure is the LAD program of a simple sequential structure, and the right figure is its
corresponding SFC program.
Chapter 7 SFC Tutor 275

As shown in the LAD program, the S2 step starts with a STL instruction, and the following TON instruction is the
internal instruction of S2. A step can be made up of multiple instructions. A SFC step is actually a relatively complete
program section, almost consistent with the LAD counterpart.
The difference between an initial step and a normal step is that they use different S elements.
For detailed information about the STL instruction, see 5.3.1 STL: SFC State Load Instruction. Note that when the
step changes from ON to OFF, the destination operands of its internal instructions will be cleared. Such instructions
include OUT, TON, TOF, PWM, HCNT, PLSY, PLSR, DHSCS, SPD, DHSCI, DHSCR, DHSZ, DHST, DHSP and BOUT.

 Note
Because the PLC runs in continuous scan cycles, after a step transition, the instructions of the original step will not be affected by
the change of ON to OFF until the next scan cycle. See 7.4.1 Common Programming Errors.

7.2.2 SET Instruction


As shown in the preceding figure, the transfer symbols in the SFC program on the right are realized through the SET
instructions in the LAD program on the left.
The transfer conditions consist of the NO contacts before the SET instruction. The NO contacts are controlled by
internal instructions or through external operation.
When the power flow of the SET instruction is valid, the specified step becomes valid, and the current valid step is
invalidated. A step transfer is thus complete.

7.2.3 RET Instruction And SFC Program Section


As shown in the preceding figure, the SFC program on the right starts with a S2 initial step symbol, and returns to S2
after two ordinary steps. While in the LAD program, the SFC program section must end with the RET instruction.
The RET instruction can be only used in a main program.

7.2.4 OUT Instruction And RST Instruction


As shown in the preceding figure, the jump to S2 is realized in LAD program by the N3 row, which uses an OUT
instruction. The destination operand of the OUT instruction (jump) can be in any independent procedure.
If the reset S26 is used, line N3 in the LAD program will be a RST instruction, which can reset the last step S26.

7.2.5 SFC Selection Branch, Parallel Branch And Merge


See Selection branch structure in 7.1.5 SFC Program Structure for the LAD counterpart of SFC selection branches.
See Parallel branch structure in 7.1.5 SFC Program Structure for the LAD counterpart of SFC parallel branches.

7.3 How To Program With SFC


1. Analysis the work flow and determine the program structure
The structure of a SFC program is classified into three types: simple sequential structure, selection branch structure
and parallel branch structure. Besides, the jump structure is also a special form of the selection branch structure.
To program with SFC, the first thing to do is to determine the structure of the flow. For example, a single object passing
through a sequential flow is a simple sequential structure. Multiple objects with different parameters to be processed
asynchronously needs a selection branch structure. While a cooperation of multiple independent mechanical elements
may need a parallel branch structure.
276 Chapter 7 SFC Tutor

2. Determine the major procedures and transfer conditions to draw a draft flow chart
After determining the structure, you need to figure out the major procedures and transfer conditions. By deviding the
work flow into smaller operation stages, you can get the procedures. End each procedure with a transfer condition,
and you can get the draft of the work flow.

3. Make a SFC program according to the draft flow chart


Use the SFC programming language in X-builder to make a SFC program out of the draft flow chart. By now you have
got an executable PLC program, but you still need to refine it.

4. Make a list of input and output points, and determine the objects of each procedure and the transfer conditions
Generally, the input points are transfer conditions, while the output points are the operation objects. In addition, with
the list, you can further modify the SFC.

5. Input the steps and transfer conditions


In the SFC program you just made, right click a SFC symbol and select Embedded Ladder Chart in the shortcut
menu. You are then able to edit the step or transfer condition through the LAD programming language.

6. Add functional program sections to the program


Do remember to add program sections that provide general functions, such as start, stop and alarm functions. Such
program sections should all be put in LAD blocks.

 Note
The start and stop operations are crucial for personal and equipment safety. Considering the special features of SFC program,
make sure that all outputs that should be stopped are shut down when the PLC is stopped.

7.4 Points To Note In SFC Programming


The STL instruction has some special characteristics, and the PLC scans instructions cyclically by their display order.
Because of these reasons, there are some points to note during SFC programming.

7.4.1 Common Programming Errors

1. Reusing steps
In the same PLC program, each step corresponds to a unique S element and cannot be reused.
Note this when editing a SFC program using the LAD editor.

2. Setting branches after a transfer condition


Setting conditioned branches after a transfer condition is prohibited in SFC programming, as shown in the left figure
below. Instead, you should change it into the right figure below.

3. Connecting output coils to internal bus after a NC or NO contact instruction


Connecting output coils to the internal bus after a NO or NC contact instruction in a branch is prohibited, as shown in
the left figure below. In stead, you should change it into the right figure below.
Chapter 7 SFC Tutor 277

4. Reusing the same element in neighboring steps


The PLC scans instructions by their display order. The scanning of the current step and that of the next step are
closely joined together.
Therefore, after a STL instruction is executed, although certain elements of the instruction will be reset (see 5.3.1
STL: SFC State Load Instruction), the reset will not be carried out until the next scan cycle. That means, at the
moment of the transfer, the elements of the last step retains their states and values until the step is scanned in the next
cycle.
As shown in the following figure, the two neighboring steps use the same timer: T2. When the S0-S20 transfer occurs,
the T2 will retain its value and state, rendering the step S20 unable to perform as it is designed. The program will jump
directly to S21 and S22. Therefore, it should be noted that, although reusing elements in a program is not prohibited,
you should avoid reusing them in neighboring steps, or accidents may occur.

5. Failing to inter-lock elements


During SFC programming, certain elements may become contradictory to each other under some special transfer
conditions. Inter-locking is then necessary.
Take the following forward & backward operation program as an example, where Y0 and Y1 are respectively forward
and backward output. X0 is forward operation, X1 is backward operation, and X2 the is stop button. Y0 and Y1 should
be inter-locked, that is to say, they should not be ON at the same time.
However, in this example, when Y0 is ON, if X1 is ON and the S33 is validated, Y1 will be also ON, within the same
scan cycle with Y0.
278 Chapter 7 SFC Tutor

Therefore, you need to add an interlock to the program by adding a Y0 NC contact before the Y1 output coil, as shown
in the following figure.

6. Confusing jumps with transfers


Jumps are used between different procedures or non-neighboring steps, while transfers are used between
neighboring steps. It is prohibited to change an output coil into a SET instruction where a jump should be used, or
change a output coil into a SET instruction where a transfer should be used.

7. Using parallel merge for selection branches


In a selection branch structure, only one selection is valid. However, when it is mixed with a parallel branch structure,
the selection branch structure may never end. As shown in the following figure. In the left part, when flow 1 runs to step
S41, it meets the transfer condition of a parallel merge. But the system will never run flow 2. Therefore the transfer will
never occur, making flow 1 unable to end.

Flow 1 Flow 2

Modify

The same operation

Empty step
Flow 1 cannot end due to the
parallel structure.

As shown in the right part, to correct it, you need to add a step S42 whose function is the same as S41. Then add an
empty step S43 that serves as a structural block without actual function. Design the transfer conditions for S38, S41
and S43 according to the actual situation.

7.4.2 Programming Tricks

1. Making use of empty steps


You may need empty steps to deal with the branches with grammatical problems. The empty steps do not provide
actual operation, but a necessary node in structure before the next transfer. See the following example.
In the left figure below, the selection merge is connected immediately with another selection branch structure. That is
prohibited. You can change it as the right figure shows: add an empty step.
Chapter 7 SFC Tutor 279

Modify
Inexecutable
parallel structure Add a empty step

In the left figure below, the selection merge is connected immediately with a parallel branch structure. That is
prohibited too. You can also change it as the right figure shows: add an empty step.

Modify

Inexecutable Add a empty step


parallel structure

You can address other tricky structures, such as parallel merge connected with parallel branches, or parallel branches
connected with selection branches, by adding an empty step.

2. Merging branches and transfer conditions


Some seemingly complicated branches are the result of bad design. You can simplify them by merging some
branches.
As shown below, the designer set a selection branch first, following it by two selection branches. However, simply four
selection branches will achieve the same. The original two-level transfer conditions become one level transfer
condition.

Mergeable conditions
Merge the mergeable
conditions

Modify

3. Making use of battery backup function


The S elements can be saved upon power failure by the battery. In this way the program can resume from the step
when the power failure occurred.
280 Chapter 7 SFC Tutor

7.5 Examples Of SFC Programming


The examples in this section are just illustrations of SFC programming, with simplified operations and conditions. The
equipment configuration is conceptual and for study only. Do not apply the example programs to actual use.

7.5.1 Simple Sequential Structure


The following example is an object lifting and conveying machine. This machine uses cylinder lifting devices and
rollers to convey the object tray from one conveying belt to another. The following figure is a top view of the machine.
Conveying Conveying
belt belt

Tray in Baffle plate Convey complete

Height OK In lift 2

Left-side lift cylinder


Limit switch
In lift 1 Lift Rollers Lift
Right-side lift cylinder Cylinder/solenoid valve

After the machine is started, the object tray will be conveyed to the entrance of the machine at the left side and trigger
the “Tray in” limit switch. If no other tray is occupying the machine, the “Baffle plate” will lower down to let the object
tray enter the machine. When the tray is completely into the lift when it triggers the “In lift 1” limit switch, the lift will
raise the tray until the “Height OK” limit switch is triggered. The rollers will then act to convey the tray to the lift on the
right side until the “In lift 2” limit switch is triggered. The lift will then lower to put the tray to the conveying belt on the
right. When the “Convey complete” limit switch is reset, a complete lift and convey process is over and the machine is
ready for the next round.
The input and output points are listed in the following table.
SN Address Monitored object SN Address Monitored object
1 X0 Tray in limit switch 8 Y0 Cylinder solenoid valve for the baffle plate
2 X1 In lift 1 limit switch 9 Y1 Cylinder solenoid valve for the left lift
3 X2 Height OK limit switch 10 Y2 Cylinder solenoid valve for the right lift
4 X3 In lift 2 limit switch 11 Y3 Roller motor contactor
5 X4 Convey complete 12 Y4 Motor contactor for the left conveying belt
6 X5 Start switch 13 Y5 Motor contactor for the right conveying belt
7 X6 Auxiliary signal of emergency switch

This is a simple sequential flow. The procedures are linear, without any selection or parallel procedures. Writing the
program with SFC would be faster and clearer than the conventional logic design method.
See the following figure for the SFC program and its LAD counterpart.
Start & stop control program section

Initial empty step


Use X0 as the transfer condition, and S20~S23 as the limit to prevent the next tray from entering before
the current operation ends
Lower the baffle plate to let the tray in lift 1. Delay: 1s

Delay (1s) time is up and start the next step


Lifting cylinders (Y1, Y2) act till Hight OK switch (X2) acts. Delay: 0.8s.

Delay (0.8s) time is up and start the next step


Start roller motor (Y3)

In lift 2 limit switch (X3) acts to enter the next step


The left & right lifts lower and the roller stops

X4 is reset to start a new round


Chapter 7 SFC Tutor 281
282 Chapter 7 SFC Tutor

7.5.2 Selection Branch Structure


The following example is a material mixing flow. Through this flow, two kinds of products, namely A and B, are
produced. See the following figure for the illustration of the manufacturing device.
A minor
ingredient pipe
Deionized B minor ingredient pipe
Major ingredient pipe water
Y0 valve Y2 valve
Y1 Major ingredient valve

Y3 valve

Mixing pot

Rinsing nozzle Rinsing nozzle

Stirring paddle

Y4 evacuation valve

To start the operation, the operator should select through the touch screen the product type, A or B, for the next batch
of product. As the second step, the major ingredient will be added until the added ingredient reaches 2000kg. As the
third step, minor ingredient, A for type A product or B for type B product, will be added until the added minor ingredient
reaches 500kg. As the forth step, the ingredients will be mixed round for 20 minutes. As the fifth step, the material will
be evacuated until the left material is less than 20kg and the delay is over. Then the machine is ready for the next
round.
If the machine is brand new, or the product type produced last time is different from what is going to be produced, you
need to open the deionized water valve and evacuation valve to rinse the machine for 5 minutes before the operation.
The input and output points are listed in the following table.
SN Address Monitored object SN Address Monitored object
1 X0 Deionized water valve open 10 X11 Evacuation valve open
2 X1 Deionized water valve closed 11 X12 Evacuation valve closed
3 X2 Major ingredient valve open 12 Y0 Solenoid valve for deionized water
4 X3 Major ingredient valve closed 13 Y1 Solenoid valve for major ingredient
5 X4 Minor ingredient A valve open 14 Y2 Solenoid valve for minor ingredient A
6 X5 Minor ingredient A valve closed 15 Y3 Solenoid valve for minor ingredient B
7 X6 Minor ingredient B valve open 16 Y4 Solenoid valve for evacuation
8 X7 Minor ingredient B valve closed 17 Y5 Mixing motor contactor
9 X10 Mixing motor running

Obviously this is a selection branch structured flow. You can select only one type of product , A or B, in a round.
Meanwhile, the flow has a selection and jump structure: the rinsing procedure.
The following figures are the corresponding SFC program and its LAD counterpart.
Chapter 7 SFC Tutor 283

Start & stop control program section

Initial empty step

To process product different from To process the same product as


last time, enter the rinsing step the last time, enter next step

Rinsing time (5min) is up


Add major ingredient

Branch for product A Branch for product B

The mixing step

Time (20min) is up
The evacuation step

Evacuation complete
Mark the product type this time
for the next round

Enter the next round


284 Chapter 7 SFC Tutor
Chapter 7 SFC Tutor 285

7.5.3 Parallel Branch Structure


The next example is a bottle packager. The packager seals the bottles and sticks labels to them. Meanwhile, it will
examine the bottle cap and label, so that the flawed products will be eliminated in the third procedure, while the
qualified products will continue to the next work flow.
If no bottle is sent from the last work flow, the packager will not conduct any sealing or labelling. The three procedures
are carried out at the same time, and each bottle moves from one position to another each time the rotary plate rotates.
See the following figure for the illustration of the packager.
Capping Labelling Eliminating
cylinder Y1 cylinder Y2 cylinder Y3

Capping cylinder Labelling cylinder Eliminating cylinder


rod BACK X10 rod BACK X11 rod BACK X12

Capping cylinder
Labelling cylinder Eliminating cylinder
rod OUT X7
rod OUT X6 rod OUT X5
Cap
Rotary plate of
packing machine

Bottle Bottle Bottle


Running direction
of rotary plate

Exit of rotary plate


ac of
e
hin
m ate
ing pl
ck ry
pa ota

lat n
R

y p ctio

Entrance of Rotary plate step


e
tar dire

rotary plate limit switch X0


El lind
of ning

im e
cy

in r Y
ro
n

at 3
Ru

in
g

Rotatary plate
Cap in position motor Y0
detection switch X2 Labelling Exit of disqualified
switc tection

cylinder Y2 products
h X3
l de

Bottle in position
Ca
detection switch X1
Labe

pp
i ng
cy
lin
de
rY
1

During the operation, the rotary plate rotates one step each time, which is detected by the X0 limit switch. The rotary
plate will stay at each step long enough for all the three procedures, driven by cylinders, are finished. The cylinder rod
OUT signal and cylinder rod BACK signal are monitored respectively.
The input and output points are listed in the following table.
SN Address Monitored object SN Address Monitored object
1 X0 Rotary plate step limit switch 8 X10 Capping cylinder rod BACK
2 X1 Bottle in position detection switch 9 X11 Labelling cylinder rod BACK
3 X2 Cap in position detection switch 10 X12 Eliminatiing cylinder rod BACK
4 X3 Label detection switch 11 Y0 Rotary plate motor
5 X5 Eliminating cylinder rod OUT 12 Y1 Capping cylinder
6 X6 Labelling cylinder rod OUT 13 Y2 Labelling cylinder
7 X7 Capping cylinder rod OUT 14 Y3 Eliminating cylinder
286 Chapter 7 SFC Tutor

It is obvious that this is a parallel branch structured flow. With every step that the rotary plate makes, all the tree
procedures are carried out at the same time. Then, when the three procedures are finished, the rotary plate will rotate
one step again. See the following figure for the corresponding SFC program and its LAD counterpart.
In the program, M1 ~ M3 are the qualification flags for the procedures of capping, labeling and eliminating respectively.
When the capping procedure runs to S22, X2 will check whether the capping is qualified or not. If yes, the
corresponding qualification flag M1 will be set. When the labeling procedure runs to S25, X3 will check whether the
labeling is qualified or not. If not, M2 will be reset. After all the procedures are complete, at step S29, the M2 state will
be transferred to M3, and M1 state will be transferred to M2.
The capping procedure will act according to X1 state. If X1 indicates no bottle is in position, the capping will not
proceed. The labeling procedure will act according to M2 state. If M2 is OFF, it indicates that the bottle in position is
disqualified, and the labeling will not proceed. The eliminating procedure will act according to M3. The elimination will
not be conducted when M3 is ON, which indicates that the bottle is qualified, or the elimination will be conducted
otherwise. In both cases, M3 will be reset in S32 to prepare for the next procedure.
Start & stop control program section

Initial empty step

When a X0 rising edge is detected The labelling procedures The eliminating procedures

The capping procedures


M2 qualification M3 qualification
flag flag

Transfer conditions

Jump when Jump upon Jump upon


Capping operation no bottle is disqualified qualified
in position product product

Labeling operation Elimination operation

Mark the qualified Mark the qualified Reset the M3


product (M1 ) product (M2 ) disqualification flag

Parallel merge
Transfer the
qualification flag
states from M1 to M2
and from M2 to M3
Chapter 7 SFC Tutor 287
288 Chapter 7 SFC Tutor
Chapter 8 Using High Speed I/O 289

Chapter 8 Using High Speed I/OInput

This chapter presents the usage and notes about the high speed counters, external pulse and PLS envelope.
8.1 High Speed Counter................................................................................................................................................................... 283
8.1.1 Configuration................................................................................................................................................................... 283
8.1.2 High Speed Counter And SM Auxiliary Relay Relationship....................................................... 错误!未定义书签。
8.1.3 Usage Of High Speed Counter....................................................................................................... 错误!未定义书签。
8.1.4 Points To Note About High Speed Counters..............................................................................................................289
8.2 External Pulse Capture Function.............................................................................................................................................. 290
8.3 High Speed Pulse Output............................................................................................................................. 错误!未定义书签。
8.3.1 High Speed Pulse Output Function................................................................................................错误!未定义书签。
8.3.2 Points To Note About High Speed Pulse Output......................................................................... 错误!未定义书签。
8.4 Configuring PLS Envelope Instruction........................................................................................................错误!未定义书签。
8.5 Notes On High Speed I/O Application......................................................................................................................................290
290 Chapter 8 Using High Speed I/O

8.1 High Speed Counter

8.1.1 Configuration
The built-in high speed counter for MC series small PLCs are configured as follows:
Table 8-1 High speed counter configuration
Max. frequency (kHz)
Input point
X0 X1 X2 X3 X4 X5 X6 X7 MC2 MC20 MC1
Counter
80 0 00
Counter C236 U/D*
50
Counter C237 U/D
Counter C238 U/D
Counter C239 U/D
1 phase 10
Counter C240 U/D
&1
Counter C241 U/D
point
Counter C301 U/D
input 100 /
Counter C302 U/D
mode
Counter C242 U/D Reset
Counter C243 U/D Reset
10
Counter C244 U/D Reset Start
Counter C245 U/D Reset Start
1 Counter C246 U D 50
phasebi Counter C247 U D Reset 10
-directio Counter C303 U D /
100
nal Counter C248 U D Reset
input Counter C249 U D Reset Start 10
mode Counter C250 U D Reset Start
Counter C251 Ph A Ph B 30
Counter C304 Ph A Ph B
Counter C305 Ph A Ph B /
Counter C306 Ph A Ph B
Counter C252 Ph A Ph B Reset
Counter C253 Ph A Ph B Reset
5
2 phase Counter C254 Ph A Ph B Reset Start
input Counter C255 Ph A Ph B Reset Start 50
mode Counter C256
Ph A Ph B
(X10 Reset)
Counter C257
Ph A Ph B
(X11 Reset)
/
Counter C258
Ph A Ph B
(X12 Reset)
Counter C259
Ph A Ph B
(X13 Reset)

In the modes listed in the preceding table, the high speed counters will act according to certain input and handle high
speed action according to interrupts. The counting practice is unrelated to the PLC scan cycle.
All the high speed counters are of the 32-bit bi-directional type. According to their different up/down switchover
methods, they fall into the following three categories:
Counter mode Counter operation
Counters C236 ~ C245 are down counters when SM236 ~ SM245 are ON, and up counters when C236
1 phase 1 point input
~ C245 are off.
Counters C246 ~ C250 are either up counters or down counters, dependent on the input. SM246 ~
1 phase bi-directional
SM255 are the direction flags of C246 ~ C255.
input
SM element OFF: counting up. SM element ON: counting down.
Counter C251 ~ C255 acts according to the input. They count up when phase A is on and phase B
2-phase input
changes from OFF to ON, and count down when phase A is ON and phase B changes from ON to OFF.

MC Series Small PLC Programming Manual


Chapter 8 Using High Speed I/O 291

SM246 ~ SM255 are the direction flags of C246 ~ C255.


SM element OFF: counting up. SM element ON: counting down.
Counter direction as shown:
+1 +1 -1 -1

ON
A
OFF

ON
B
OFF

Counter direction as shown:


+1 +1 +1 +1 -1 -1 -1 -1

ON
A
OFF
2 phase quadruple input
ON
B
OFF

+1 +1 +1 +1 -1 -1 -1 -1

8.1.2 MC Small Series PLC Internal High-speed Counter Comparison

Name MC280 MC100 MC80 MC200


Single phase
8×100 kHz 6: 2(50kHz) + 4 (10kHz)
counting channel
AB phase counting
4×50kHz 2: 1 (30kHz) + 1 (5kHz)
I/O channel
Max. total
frequency of 800kHz 60kHz 60kHz 80kHz
high-speed counter
16-bit up counter:
C0 ~ C199
32-bit bi-directional
counter: C200 ~ 16-bit up counter: C0 ~ C199
Elements Counter C235 32-bit bi-directional counter: C200 ~ C235
32-bit high speed 32-bit high speed counter: C236 ~ C259
counter: C236 ~
C259
C301 ~ C306

8.1.3 Relationship between High-speed Counter and SM Auxiliary relay


Up/Down counter shift by SM auxiliary relay
Type Counter SN Up/Down setting
C236 SM236
C237 SM237
C238 SM238
C239 SM239
C240 SM240
1 phase 1 point input C241 SM241
C242 SM242
C243 SM243
C244 SM244
C245 SM245
C301 SM301
292 Chapter 8 Using High Speed I/O

C302 SM302

Quadruple shift by SM auxiliary relay


Type Counter SN Quadruple setting
C251 SM100
C252 SM100
C253 SM102
C254 SM100
C255 SM102
C256 SM100
2-phase input
C257 SM101
C258 SM103
C259 SM104
C304 SM101
C305 SM103
C306 SM104

Differences in quadruple switch by SM auxiliary relay in each model PLC


Address Name R/W MC200 MC100 MC280
SM100 AB phase input for X0 or X1, one and quadruple switch R/W √ √ √
SM101 AB phase input for X2 or X3, one and quadruple switch R/W √ √ √
SM102 AB phase input for X3 or X4, one and quadruple switch R/W √
SM103 AB phase input for X4 or X5, one and quadruple switch R/W √
SM104 AB phase input for X6 or X7, one and quadruple switch R/W √

SM auxiliary relay for monitoring counting direction


Type Counter SN Up/Down monitor
C246 SM246
C247 SM247
C248 SM248
1 phase 1 point input
C249 SM249
C250 SM250
C303 SM303
C251 SM251
C252 SM252
C253 SM253
C254 SM254
C255 SM255
2-phase input
C256 SM256
C257 SM257
C258 SM258
C259 SM259
C304 SM304

MC Series Small PLC Programming Manual


Chapter 8 Using High Speed I/O 293

C305 SM305
C306 SM306

8.1.4 Usage Of High Speed Counter


1 phase 1 point input high speed counter
The 1 phase 1 point input high speed counter starts to count only when the pulse input changes from OFF to ON, with
the counting direction determined by its corresponding SM element.
Example:

The time sequence chart of the contacts action in the program is shown in the following figure:
X11 & X6 are ON, C244 starts to count.
X10 is ON, C244 is cleared
X12 & SM244 are OFF, C244 counts up.
X12 & SM244 are ON, C244 counts down
C244 counts 3, and C244 contact state changes
When X11 & X6 are ON, and X2 changes to ON,
C244 data and contact are cleared
X12

SM244

X2
X11

X6

X10

X0

5
4 4
3 3 3
2 2
1 1
C244 0 0 0
-1
-2
-3
-4 -4
-5
C244 contact

Note:
1. Counter input point: X0.
2. High speed counters, when used in instructions DHSCS, DHSCR, DHSZ, DHSP and DHST,
can trigger operations free from the scan cycle.

1 phase bi-directional input high speed counter


The 1 phase bi-directional input high speed counter starts to count only when the pulse input changes from OFF to ON.
The two input points determines its counting direction, which is monitored by its corresponding SM element.
Example:
294 Chapter 8 Using High Speed I/O

The time sequence chart of the contacts action in the program is shown in the following figure:
X10 is ON, C250 is cleared regardless of X11 and X7
X11 & X7: ON, C250 starts to count. X3 changes from OFF to ON
C250 counts up. SM250 is not being driven
C250 value reaches 3, C250 contact changes X11 & X7: ON. If X5 is ON, C250 is
cleared, and the contact is reset
X4 changes from OFF to ON, C250
X5 counts down. SM250 is being driven
X11

X7

X10

X3

X4

SM250

5
4 4
3 3 3
2 2
C250 1 1
0 0 0
-1
-2
-3
-4 -4
-5

C250 contact

Note:
1. Counter input points: X3 & X4.
2. High speed counters, when used in instructions DHSCS, DHSCR, DHSZ, DHSP and DHST,
can trigger operations free from the scan cycle.

2 phase input high speed counter


The 2 phase input high speed counter starts to count only when the pulse input changes from OFF to ON. The phase
difference of the two pulse inputs determines the counting direction, which is monitored by the corresponding SM
element.
Example:

MC Series Small PLC Programming Manual


Chapter 8 Using High Speed I/O 295

The time sequence chart of the contacts action in the program is shown in the following figure:

X10 is ON,C254 is cleared regardless of X11 & X6


X11: ON. If X6 is ON, C254 starts to count. X0 is ON, and X11
changes from OFF to ON, X254 counts up. SM254 is not being
driven.
C254 values reaches 3, C254 contact changes X11 & X6: ON, X2 changes ON, C254
X0: ON. X1 changes from ON to OFF, is cleared, and the contact is reset
X2 C254 counts down. SM254 is being driven

X11

X6

X10

X0

X1

SM254

5
4 4
3 3 3
2 2
C254 1 1
0 0 0
-1
-2
-3
-4 -4
-5
C254 contact

Note:
1. Counter input points: X0 & X1.
2. High speed counters, when used in instructions DHSCS, DHSCR, DHSZ, DHSP and DHST,
can trigger operations free from the scan cycle.

2 phase quadruple input high speed counter


The 2 phase quadruple input high speed counter starts to count only when the pulse input changes from OFF to ON.
The phase difference of the two pulse inputs determines the counting direction, which is monitored by the
corresponding SM element.
296 Chapter 8 Using High Speed I/O

The time sequence chart of the contacts action in the program is shown in the following figure:

8.1.5 Points To Note About High Speed Counters


Classification of high speed counters
C236, C237, C246 and C251 can be used as both hardware counters and software counters, depending on the modes
in which they are used. All the other high speed counters are software counters.
Maximum combined frequency
1. The maximum combined frequency, or the sum of frequencies of all signals input at any time, should not exceed
80kHz on the following two occasions:
When multiple high-speed counters (hardware counting mode) are used simultaneously, or when the high speed
counters (hardware counting mode) and the SPD instruction are used at the same time.
2. The maximum combined frequency when multiple software high speed counters, or when high speed counters and
the SPD instruction, are used at the same time, is shown in the following table:
Scenario Maximum combined frequency
Instructions DHSCS, DHSCR, DHSCI, DHSZ, DHSP and DHST are not used 80kHz
Instructions DHSCS, DHSCR, DHSCI, DHSP or DHST are used 30kHz
Instruction DHSZ is used 20kHz

Maximum frequency of hardware counter


Counters C236, C237, C246 and C251 are the only four potential hardware counters. Among which:
C236, C237 and C246 are 1 phase counters. Their maximum counting frequency is 50kHz.
C251 is a 2-phase counter. Its maximum counting frequency is 30kHz.

MC Series Small PLC Programming Manual


Chapter 8 Using High Speed I/O 297

Maximum frequency of software counters


The high speed counters used in instructions DHSCS, DHSCR, DHSCI, DHSP or DHST are all in software counting
mode. The maximum input frequency for the 1-phase counters is 10kHz; for 2-phase counters: 5kHz.
When used in the DHSZ instruction, the maximum frequency for the 1-phase counters is 5kHz; for 2-phase counters:
4kHz.

8.2 External Pulse Capture Function


The input points that provides the external pulse capture function are X0 ~ X7. The corresponding SM elements are
listed below:
Input point Corresponding SM element
X0 SM90
X1 SM91
X2 SM92
X3 SM93
X4 SM94
X5 SM95
X6 SM96
X7 SM97

 Note
1. When the output input point changes from OFF to ON, the SM element of the corresponding terminal will be set to ON.
2. SM90 ~ SM97 will be cleared when the user program starts.
3. The total pulse frequency input through X0 ~ X7 should be smaller than 80kHz.
4. If high speed counters or SPD instructions are used on the same input point, the pulse capture function will become invalid
after the first scan cycle, regardless of the validity of the instructions.

8.3 Notes On High Speed I/O Application


The input points X0 ~ X7 can input signals for functions including high speed counter, SPD, pulse capture and external
interrupt. However, such functions cannot be used at the same time, for the chances are that several functions could
require the same input point(s). Therefore, during the PLC programming, only one of the several functions that an
input point can provide is available. If X0 ~ X7 are repeatedly used in a user program, the program will not pass the
compiling.
Among the functions of high speed counter, SPD, pulse capture and external interrupt, the function that X0 ~ X7 can
provide respectively are listed in the following table.
Input point Max. frequency
X0 X1 X2 X3 X4 X5 X6 X7
Counter (kHz)
Counter236 U/D* 50
Counter237 U/D 50
1 Counter238 U/D
phase Counter 239 U/D
&1 Counter 240 U/D
point Counter 241 U/D
10
input Counter 242 U/D Reset
mode Counter 243 U/D Reset
Counter 244 U/D Reset Start
Counter 245 U/D Reset Start
1 Counter 246 U D 50
phase Counter 247 U D Reset
bi-dire Counter 248 U D Reset
ctional Counter 249 U D Reset Start 10
input
Counter 250 U D Reset Start
mode
2 Counter 251 Ph A Ph B 30
phase Counter 252 Ph A Ph B Reset 5
298 Chapter 8 Using High Speed I/O

bi-dire Counter 253 Ph A Ph B Reset


ctional Counter 254 Ph A Ph B Reset Start
mode Counter 255 Ph A Ph B Reset Start
Input Input Input Input Input Input
SPD instruction 10
point point point point point point
Input Input Input Input Input Input Input Input
Pulse capture function
point point point point point point point point
External interrupts SN
0/10 1/11 2/12 3/13 4/14 5/15 6/16 7/17
(rising/trailing edge)
Note:
U: UP; D: Down

MC Series Small PLC Programming Manual


Chapter 9 Using Interrupts 299

Chapter 9 Using Interrupts

This chapter details the mechanism, processing procedures and usage of various interrupts.
9.1 Interrupt Program........................................................................................................................................................................ 293
9.2 Processing Interrupt Event.........................................................................................................................................................294
9.3 Timed Interrupt.............................................................................................................................................................................294
9.4 External Interrupt......................................................................................................................................................................... 296
9.5 High-speed Counter Interrupt....................................................................................................................................................297
9.6 PTO Output Completion Interrupt............................................................................................................................................. 298
9.7 Power Failure Interrupt............................................................................................................................................................... 299
9.8 Serial Port Interrupt..................................................................................................................................................................... 299

EC Series Small PLC Programming Manual


300 Chapter 9 Using Interrupts

9.1 Interrupt Program


When an interrupt event occurs, the normal scan cycle will be interrupted and the interrupt program will be executed,
which is called the interrupt mechanism. For the event-triggered control tasks that requires priority, you often need to
use this special mechanism.
The system provides many kinds of programmable interrupt resources. Each kind of interrupt resource can trigger a
type of interrupt events, and each type of interrupt event are independently numbered.
In order to deal with a certain interrupt event, you must compile a processing program, that is, an interrupt program,
which is an independent POU in the user program.
An event number must be designated for each interrupt program in order to link the interrupt program with the interrupt
event designated with the event SN. When responding to the interrupt request of the interrupt event, the system will
call the corresponding interrupt program based on the interrupt event number.
The following are the interrupt resources provided by MC series small PLC:
Event Enabling Event Enablin
Interrupt event Interrupt event
number SM number g SM
0 X0 input rising edge interrupt SM40 29 Power failure interrupt SM56
Character sending interrupt of
1 X1input rising edge interrupt SM41 30 SM48
communication port 0
Character receiving interrupt of
2 X2 input rising edge interrupt SM42 31 SM49
communication port 0
Frame sending interrupt of
3 X3 input rising edge interrupt SM43 32 SM50
communication port 0
Frame receiving interrupt of
4 X4 input rising edge interrupt SM44 33 SM51
communication port 0
Character sending interrupt of
5 X5 input rising edge interrupt SM45 34 SM52
communication port 1
Character receiving interrupt of
6 X6 input rising edge interrupt SM46 35 SM53
communication port 1
Frame sending interrupt of
7 X7 input rising edge interrupt SM47 36 SM54
communication port 1
Frame sending interrupt of Frame receiving interrupt of
8 SM59 37 SM55
communication port 2 communication port 1
Frame receiving interrupt of Character sending interrupt of
9 SM60 38 SM57
communication port 2 communication port 2
Character receiving interrupt of
communication port 2Frame SM58S
10 X0 input falling edge interrupt SM40 3937
receiving interrupt of communication M55
port 1
High-speed counter interrupt
SM65S
11 X1 input falling edge interrupt SM41 4038 6Character sending interrupt of
M57
communication port 2
High-speed counter interrupt
SM65S
12 X2 input falling edge interrupt SM42 4139 7Character receiving interrupt of
M58
communication port 2
PTO (Y2) output completion
SM72S
13 X3 input falling edge interrupt SM43 4240 interruptHigh-speed counter interrupt
M65
6
PTO (Y4) output completion
SM74S
14 X4 input falling edge interrupt SM44 4441 interruptHigh-speed counter interrupt
M65
7
PTO (Y5) output completion
SM75S
15 X5 input falling edge interrupt SM45 4542 interruptPTO (Y2) output completion
M72
interrupt
PTO (Y6) output completion
SM76S
16 X6 input falling edge interrupt SM46 4644 interruptPTO (Y4) output completion
M74
interrupt

EC Series Small PLC Programming Manual


Chapter 9 Using Interrupts 301

Event Enabling Event Enablin


Interrupt event Interrupt event
number SM number g SM
PTO (Y7) output completion
SM77S
17 X7 input falling edge interrupt SM47 4745 interruptPTO (Y5) output completion
M75
interrupt
Interpolation completion interrupt 1
SM69S
18 PTO (Y0) output completion interrupt SM63 5046 (Y0,Y2)PTO (Y6) output completion
M76
interrupt
Interpolation completion interrupt 2
SM78S
19 PTO (Y1) output completion interrupt SM64 5147 (Y4,Y5)PTO (Y7) output completion
M77
interrupt
Interpolation completion interrupt 3
SM79S
20 High-speed counter interrupt 0 SM65 5250 (Y6,Y7)Interpolation completion
M69
interrupt 1 (Y0,Y2)
High-speed output passing position
SM61S
21 High-speed counter interrupt 1 SM65 5351 interrupt 1Interpolation completion
M78
interrupt 2 (Y4,Y5)
High-speed output passing position
SM62S
22 High-speed counter interrupt 2 SM65 5452 interrupt 2Interpolation completion
M79
interrupt 3 (Y6,Y7)
High-speed output passing position
SM105
23 High-speed counter interrupt 3 SM65 5553 interrupt 3High-speed output passing
SM61
position interrupt 1
High-speed output passing position
SM106
24 High-speed counter interrupt 4 SM65 5654 interrupt 4High-speed output passing
SM62
position interrupt 2
High-speed output passing position
SM107
25 High-speed counter interrupt 5 SM65 5755 interrupt 5High-speed output passing
SM105
position interrupt 3
Setting:
High-speed output passing position
SD66 SM108
26 Timed interrupt 0 5856 interrupt 6High-speed output passing
Enabling: SM106
position interrupt 4
SM66
Setting:
PTO (Y3) output completion
SD67 SM73S
27 Timed interrupt 1 5957 interruptHigh-speed output passing
Enablin: M107
position interrupt 5
SM67
Setting:
SD68 High-speed output passing position
28 Timed interrupt 2 58 SM108
Enabling: interrupt 6
SM68
59 PTO (Y3) output completion interrupt SM73

9.2 Processing Interrupt Event


1. When a certain interrupt event occurs, if it is enabled, its corresponding event number will be added to the interrupt
request queue, which is 8-record long and FIFO.
2. Processing of the interrupt request by system:
1) If the system detects that any request in the interrupt queue, it will stop the normal execution of user program.
2) The system will read in the request queue the head record, which is the number of the first interrupt event. The
interrupt program corresponding to the event number will be called and executed.
3) When the interrupt program is finished, the corresponding head record of the request queue will be deleted, and
all the following records will take one step forward.
4) The system will repeat these procedures until the queue is empty.
5) When the interrupt request queue is null, the system will continue to execute the interrupted main program.
3. The system can handle only one interrupt request at one time. When the system is processing an interrupt request,
a new interrupt event will be added to the interrupt request queue rather than being responded immediately. The
system will process it after all the requests ahead of it in the queue are processed.

EC Series Small PLC Programming Manual


302 Chapter 9 Using Interrupts

4. When there are 8 records in the interrupt request queue, the system will automatically mask the new interrupt event
so that no new requests will be added to the queue. The mask will not be cancelled until all the requests in the queue
are processed and the interrupted main program is executed.

 Note
1. The interrupts should be brief, or abnormalities may occur, including the mask of other interrupt events (missing of interrupt
requests), system scan overtime and low execution efficiency of main program.
2. It is prohibited to call other subprograms in the interrupt program.
3. If you want to refresh I/O immediately during the interrupt, use the REF instruction. Note that the execution time of REF is
related to the number of the I/Os to be refreshed.
4. An interrupt event can generate an interrupt request only when the corresponding interrupt event is enabled (which requires
setting the corresponding SM element ON), and the global interrupt enable flag shall be on.
5. When an interrupt request with no corresponding interrupt program in the user program is generated, the request will be
responded to, but the response is empty.

9.3 Timed Interrupt


Description
The timed interrupt is the interrupt event generated by the system from time to time based on the user setting.
The timed interrupt program is applicable to the situation that requires timed and immediate processing by the system,
such as the timed sampling of analogue signals, and timed updating analogue output according to certain waveform.
You can set the intervals (unit: ms) for the timed interrupts by setting the corresponding SD elements. The system will
generate the interrupt event when the set time interval is reached (recommended minimum interval: > 4ms).
The ON/OFF status of certain SM elements can enable/disable the corresponding timed interrupts.
The system provides 3 kinds of timed interrupt resources.
Table 9-1 Timed interrupt resource list
Timed interrupt Interrupt event number Intervals of timed interrupt (SD) Enable control (SM)
0 26 SD66 SM66
1 27 SD67 SM67
2 28 SD68 SM68

 Note
1. Setting of enable control elements cannot affect the execution of the timed interrupts in the interrupt request queue.
2. The timing for a re-enabled interrupt will start from zero.

To change the interval of the timed interrupt when the program is running, it is recommended to follow the following
procedures:
1. Disable the timed interrupt.
2. Change the interval.
3. Enable the time interrupt.
Example
This example uses timed interrupt 0 to flip the Y0 output once a second, which makes Y0 flash.
1. Compile an interrupt program for the interrupt event.

EC Series Small PLC Programming Manual


Chapter 9 Using Interrupts 303

2. Specify an interrupt event number for the interrupt program:

3. Set the interval for the timed interrupt and enable the timed interrupt in the main program.

9.4 External Interrupt


Description
The external interrupt is related to the actual PLC input points. It is classified into input rising edge interrupt and input
falling edge interrupt. In the user program, add the actions related to external event to the external interrupt program.
The highest response frequency of the system to the external event is 1K. The external events over 1K may be lost.
The rising edge interrupt and falling edge interrupt cannot be used on the same port simultaneously. All the external
interrupts are only valid when the global interrupt control EI and corresponding enabling SM are valid.
The detailed relationship is as follows:

Interrupt number Enabling element Interrupt number Enabling element


0 or 10 SM40 4 or 14 SM44
1 or 11 SM41 5 or 15 SM45
2 or 12 SM42 6 or 16 SM46
3 or 13 SM43 7 or 17 SM47

EC Series Small PLC Programming Manual


304 Chapter 9 Using Interrupts

The external interrupts are numbered as follows:


Interrupt number Interrupt source Interrupt number Interrupt source
0 X0 input rising edge interrupt 9 Reserved
1 X1 input rising edge interrupt 10 X0 input falling edge interrupt
2 X2 input rising edge interrupt 11 X1 input falling edge interrupt
3 X3 input rising edge interrupt 12 X2 input falling edge interrupt
4 X4 input rising edge interrupt 13 X3 input falling edge interrupt
5 X5 input rising edge interrupt 14 X4 input falling edge interrupt
6 X6 input rising edge interrupt 15 X5 input falling edge interrupt
7 X7 input rising edge interrupt 16 X6 input falling edge interrupt
8 Reserved 17 X7 input falling edge interrupt

The single input impulse frequency of X0 - X7 is less than 200Hz.


Example
In the example, the system upsets the output of Y0 based on the corresponding external interrupt 0 function and rising
edge input event of X0.
1. Compile the interrupt program to flip Y0 status once upon every interrupt and output immediately. To use an interrupt,
you should select its corresponding interrupt number. See the following figure for the specific operation.

2. Write EI instruction in the main program, and set SM40, the interrupt enabling flag of X0 input rising edge interrupt,
valid.

EC Series Small PLC Programming Manual


Chapter 9 Using Interrupts 305

9.5 High-speed Counter Interrupt


Description
The high-speed counter interrupt must be used together with the HCNT instruction or DHSCI instruction, and
generates high-speed counter interrupt based on the value of the high-speed counter. You can compile programs
related to external pulse input in the high-speed interrupt program. The high-speed counter interrupts (20 ~ 25) are
valid only when the EI instruction and corresponding interrupt enable flag are valid.
Example
This example uses the high speed counter function of X0 to call the interrupt program (number 20) when the external
counter C236 reaches the value specified through the DHSCI instruction.
1. Compile interrupt program, choose an interrupt number for each interrupt subprogram. See the following figure for
the specific operation.

2. Write EI instruction in the main program, and set SM65, the interrupt enabling flag of high speed counter interrupt,
valid. Drive the high-speed counter C236 and high-speed counter interrupt instruction.
306 Chapter 9 Using Interrupts

9.6 PTO Output Completion Interrupt


Description
The PTO output completion interrupt is triggered when enable flag (SM63 or SM64) is set and the high-speed pulse
output at Y0 or Y1 is finished. You can carry out the relevant processing in the interrupt sub-program. This function is
applicable only to MC100 series PLC.
Example
This example uses the high-speed pulse output of Y0 to call the interrupt program (number 18) after Y0 high-speed
pulse output is finished.
1. Code function in interrupt program (INT_1): Compile program for the interrupt code to realize the control. Choose
the corresponding interrupt number for each interrupt. See INT_1 for the specific operation.

2. Code function in main program: Enable the global interrupt of the system and the enable flag SM63 of PTO output
interrupt. Use PLS instruction.

EC Series Small PLC Programming Manual


Chapter 9 Using Interrupts 307

9.7 Power Failure Interrupt


When the enable flag of SM56 is set and the main module has detected the power failure, the power failure interrupt
will be triggered and the user can carry out the relevant processing in the interrupt sub-program. This function is
applicable only to MC100 series PLC.
As the power failure interrupt subprogram is executed when the system has no external power supply, the execution
duration of power failure interrupt subprogram shall not be over 5ms. Otherwise, the power failure retention
component cannot be completely saved.

9.8 Serial Port Interrupt


Description
Serial port interrupt: Under the free port protocol mode of serial port, the system will generate interrupt event based on
the sending or receiving events of serial port.
For each serial port, the system supports 4 interrupt resources for the user. The interrupt program of serial port is
mainly used when special processing is required for the receiving and sending of character/frame at the serial port and
timely processing is requested. It is able to respond to the processing of completing character/frame XMT/RCV without
being influenced by scanning time.
Set the ON/OFF status of SM component and the serial port interrupt can be enabled or disabled. When the serial port
interrupt is disabled, the ones that have been added to the interrupt queue will continue to be executed.
Do not call the XMT instruction of serial port in the processing subprogram of character sending interrupt when the
power flow is normally on. Otherwise, it may lead to interrupt subprogram nesting which blocks the execution of user
program.
Interrupt of frame receiving and sending refers to the interrupt event that is delivered after the XMT and RCV
instructions of the serial port are executed.
Serial port interrupt resource list:
Event number Corresponding interrupt event Interrupt enabling SM
30 Character sending interrupt of communication port 0 SM48
31 Character receiving interrupt of communication port 0 SM49
32 Frame sending interrupt of communication port 0 SM50
33 Frame receiving interrupt of communication port 0 SM51
34 Character sending interrupt of communication port 1 SM52
35 Character receiving interrupt of communication port 1 SM53
36 Frame sending interrupt of communication port 1 SM54
37 Frame receiving interrupt of communication port 1 SM55
8 Character sending interrupt of communication port 2 SM59
9 Character receiving interrupt of communication port 2 SM60
38 Frame sending interrupt of communication port 2 SM57
39 Frame receiving interrupt of communication port 2 SM58
308 Chapter 9 Using Interrupts

Example
In the example, with the sending interrupt function of serial port frame, the system will flip Y3 output once when a
frame is sent out and generate flashing effect based on the frequency of the character sending frame.
1. Compile interrupt program and the processing code when the serial port sending frame is completed and the
interrupt is triggered.

2. Specify interrupt event number for the interrupt program:

3. Compile the code of the sending frame interrupt of enable serial port in the main program.

For the detailed example of serial port interrupt, please refer to Chapter 10 Using Communication Function.

EC Series Small PLC Programming Manual


Chapter 10 Using Communication Function 309

Chapter 10 Using Communication Function

This chapter introduces the communication function of MC series small PLC, including the communication resources
and communication protocols, and uses examples to illustrate.
10.1 Communication Resource....................................................................................................................................................... 303
10.2 Programming Port Protocol..................................................................................................................................................... 303
10.3 Free Port Communication Protocol........................................................................................................................................ 303
10.3.1 Introduction....................................................................................................................................................................303
10.3.2 Parameter Setting of Free Port.................................................................................................................................. 303
10.3.3 Free Port Instruction.....................................................................................................................................................305
10.4 Modbus Communication Protocol...........................................................................................................................................307
10.4.1 Introduction....................................................................................................................................................................307
10.4.2 Characteristics Of Links...............................................................................................................................................307
10.4.3 RTU Transfer Mode..................................................................................................................................................... 307
10.4.4 ASCII Transfer Mode................................................................................................................................................... 307
10.4.5 Supported Modbus Function Code............................................................................................................................307
10.4.6 Addressing Mode Of PLC Element............................................................................................................................308
10.4.7 Modbus Slave............................................................................................................................................................... 309
10.4.8 Reading & Writing Elements.......................................................................................................................................309
10.4.9 Handle Of Double Word.............................................................................................................................................. 309
10.4.10 Handle Of LONG INT.................................................................................................................................................310
10.4.11 Diagnostic Function Code.........................................................................................................................................310
10.4.12 Error Code................................................................................................................................................................... 310
10.4.13 Modbus Parameter Setting....................................................................................................................................... 311
10.4.14 Modbus Instruction.....................................................................................................................................................311
10.5 MCbus Communication Protocol............................................................................................................................................ 314
10.5.1 Introduction....................................................................................................................................................................314
10.5.2 MCbus Network Structure........................................................................................................................................... 315
10.5.3 MCbus Refresh Mode..................................................................................................................................................315
10.5.4 MCbus Parameter Setting...........................................................................................................................................321
10.5.5 Example......................................................................................................................................................................... 322
310 Chapter 10 Using Communication Function

10.1 Communication Resource


The baud rates applicable to MC series small PLC are listed in the following table:
protocolCommunication
Supported baud rates for different protocols
port
Free port protocol,
Modbus communication
115200, 57600, 38400, 19200, 9600, 4800, 2400, 1200
protocolCommunication
port 0
MCbus communication
protocolCommunication 115200, 57600, 38400, 19200, 9600, 4800, 2400, 1200
port 1

The communication protocols that MC series small PLC supports are listed in the following table:
Basic Communication
Port type Supported protocol
module port
Programming port protocol, free port protocol, Modbus communication protocol(slave
Port 0 RS-232
station), MCbus communication protocol(master station, slave station)
MC200
RS-232 or Free port protocol, Modbus communication protocol (master station, slave station),
Port 1
RS-485 MCbus communication protocol (master station, slave station)
Programming port protocol, free port protocol, Modbus communication protocol
Port 0 RS-232
(slave station), MCbus communication protocol (master station, slave station)
MC100
RS-232 or Free port protocol, Modbus communication protocol (master station, slave station)
Port 1
RS-485 MCbus communication protocol (master station, slave station)
Programming port protocol, free port protocol, Modbus communication protocol(slave
Port 0 RS-232
station), MCbus communication protocol(master station, slave station)
Free port protocol, Modbus communication protocol (master station, slave station),
MC280 Port 1 RS-485
MCbus communication protocol (master station, slave station)
Free port protocol, Modbus communication protocol (master station, slave station),
Port 2 RS-485
MCbus communication protocol (master station, slave station)

You can also set the mode selection switch of MC series PLC to TM to transfer port 0 to programming port protocol.

10.2 Programming Port Protocol


The programming port protocol is an internal protocol dedicated to the communication between the host and the PLC.

10.3 Free Port Communication Protocol

10.3.1 Introduction
The free port protocol is a communication mode with user-defined data file format. It supports two data formats: ASCII
and binary. The free port protocol realizes data communication through instructions and can only be used when PLC is
in the RUN state.
The free port communication instructions include XMT (sending instruction) and RCV (receive instruction).

10.3.2 Parameter Setting of Free Port


Select Communication Port in the System block dialogue box, and select Freeport protocol in port 0 or port 1
setting area to enable the Freeport setting button as follows:
Chapter 10 Using Communication Function 311

OK Cancel Help

The parameter setting of free port is as follows:

Configurable items are listed in the following table:


Item Setting Remark
38400,19200, 9600, 4800, 2400, -
Baud rate
1200. Defaut: 9600
Data bit 7 or 8 (default) -
Parity None (default), odd, even -
Stop bit 1 (default) or 2 -
Allow start -
Check to allow. Default: not allowed
character detection
Start receiving after the designated start character is detected.
Start character
0 to 255 (corresponding to 00 to FF) Save the received characters (including the start character) to
detection (setting)
the designated BFM
Allow end character
Check to allow. Default: not allowed
detection
End character Stop receiving after the preset end character is received, and
0 to 255 (corresponding to 00 to FF)
detection (setting) save the end character to the BFM
Intercharacter
Check to enable. Default: disabled
timeout (enabling)
Intercharacter Stop receiving if the interval between two received characters is
0 to 65535ms
timeout (setting) longer than the timeout setting
When the power flow is valid and the communication conditions
are met, that is, the timing for the receiving is started when the
Interframe timeout
Check to enabling. Default: disabled communication serial port has not been taken up, if the receiving
(enabling)
of one frame has not been finished when the time is up,
terminate the RCV.
Interframe timeout When the RCV power flow is valid and the communication
0 to 65535 ms
(setting) conditions are met, the timing will start as soon as the
312 Chapter 10 Using Communication Function

Item Setting Remark


communication serial port starts to receive. If a frame is not
received completely when the set time is up, the reception ends

10.3.3 Free Port Instruction


Points to note
The free port instructions XMT and RCV can be used to send/receive data to/from the designated communication port.
For the usage of the free port instruction, refer to 6.12.11 XMT: Free-Port Sending (XMT) Instruction and 6.12.12
RCV: Free-Port Receiving (RCV) Instruction.
Note that to use free port instruction on a certain port, you need to set the free port protocol and communication
parameter for the communication port through the system block of X-builder. In addition, you need to download the
system setting to the PLC and restart it.

Example
Example 1: Send a 5-byte data and then receive a 6-byte data through communication port 1.
The data to be sent: 01 FF 00 01 02 The data to be received: 01 FF 02 03 05 FE

Save the received data to D elements starting with D10. Each byte occupies one D element, as shown below:
01 FF 02 03 05 FE
D10 D11 D12 D13 D14 D15

1. Change the setting of communication port in the


system block to free port communication and set the
related parameters.
2. When the power flow of SM1 is valid, save the
to-be-sent data to the communication BFM starting with
D0. Send data with XMT instruction and reset SM122
(transmission complete flag bit) before the sending.
3. Set SM122 after the transmission, and begin to
receive data upon the rising edge. The maximum length
for the received characters is 6.
4. Set SM123 after the data is received, and perform the
corresponding operation based on the receiving
completion information register (SD125).
5. Use X5 as the enable bit for interrupting the sending
and receiving.
Chapter 10 Using Communication Function 313

Example 2: Send and receive data through communication port 1.

Different from “Example 1”, when sending the high & low
bytes of a word element, the element must be divided
into high-& low-byte parts.
For instance, if you want to send the content of D2, you
can store its high byte and low byte separately in D3 and
D4, and then send D3 and D4. You can also store the
data in a K4MX (such as K4M0 of in this example)
element. Take K2M0 as high byte and K2M8 as low
byte.
314 Chapter 10 Using Communication Function

10.4 Modbus Communication Protocol

10.4.1 Introduction
For the serial port communication of MC series small PLC, Modbus communication protocol is available. Two
communication modes: ASCII and RTU (MC100 only supports RTU mode) are supported. The PLC can be set as the
master or slave station.

10.4.2 Characteristics Of Links


1. Physical layer: RS-232, RS-485
2. Link layer: asynchronous transfer mode
1) Data bit: 7 bits (ASCII) or 8 bits (RTU)
2) Transfer rate: 1200, 2400, 4800, 9600, 19200, 38400
3) Check method: even check, odd check or no check
4) Stop bit: 1 or 2 stop bits
3. Networking configuration: up to 31 sets of equipment. Address range: 1 to 31. Broadcast is supported.

10.4.3 RTU Transfer Mode


1. Hexadecimal data.
2. The interval between two characters shall not be less than the time of 1.5 characters.
3. There is no frame head or tail, and the interval between two frames is at least the time of 3.5 characters.
4. Use CRC16 check.
5. The maximum length of RTU frame is 256 bytes and the frame structure is as follows:
Structure of frame Address Function code Data CRC
Nubmer of Bytes 1 1 0 to 252 2

6. Calculation of interval among characters:


If the communication baud rate is 19200, the interval of 1.5 characters is 1/19200×11×1.5×1000 = 0.86ms.
The interval of 3.5 characters is 1/19200×11×3.5×1000 = 2ms.

10.4.4 ASCII Transfer Mode


1. Use ASCII data communication.
2. The frame takes “: (3A)”as the head, and CRLF (0D 0A) as the tail.
3. The allowed interval among characters is 1s.
4. Use LRC check.
5. The frame of ASCII is longer than that of RTU. It is required two character codes for transferring one byte (HEX) in
ASCII mode. The maximum length for data field (2×252) of ASCII is twice of RTU data field (252). The maximum
length of ASCII frame is 513 characters and the structure of frame is as follows:
Structure of frame head Address Function code Data LRC Tail
Byte 1 2 2 0 to 2*252 2 2

10.4.5 Supported Modbus Function Code


Supported modbus function codes include 01, 02, 03, 05, 06, 08, 15 and 16.
Chapter 10 Using Communication Function 315

10.4.6 Addressing Mode Of PLC Element


1. Relationship between read-write element function code and the element:
Function code Name of function code Modicon data address Type of operational element Remark
01 read coil status 0Note 1:xxxx Y, X, M, SM, S, T, C Bit read
02 read discrete input status 1 Note 2:xxxx X Bit read
03 read register status 4 Note 3:xxxx Note 4 D, SD, Z, T, C Word read
05 write single coil status 0:xxxx Y, M, SM, S, T, C Word write
06 write single register status 4:xxxx D, SD, Z, T, C Word write
15 write multiple coils status 0:xxxx Y, M, SM, S, T, C Bit write
write multiple registers
16 4:xxxx D, SD, Z, T, C Word write
status
Note:
1. 0 means “coil”.
2. 1 means “discrete input”.
3. 4 means “register”.
4. xxxx means range “1 ~ 9999”. Each type has an independent logic address range of 1 to 9999 (protocol address starts from 0).
5. 0, 1 and 4 do not have the physical meaning and are not involved in actual addressing.
6. Users shall not write X element with function codes 05 and 15; otherwise, the system will not feed back the error information if the
written operand and data are correct, but the system will not perform any operation on the write instruction.

2. Relationship between PLC Element and Modbus Communication Protocol Address:


Element Type Physical element Protocol address Supported function code Notes
Y0 ~ Y377 Output status, element
Y Bit 0000 ~ 0255 01, 05, 15
(octal code) 256 points in total code: Y0 toY7, Y10 toY17
Input status, it supports
X0 ~ X377 1200 to01455 01, 05, 15 two kinds of address, the
X Bit
(octal code) 256 points in total 0000 to0255 02 element code is same as
above
M Bit M0 ~ M1999 2000 ~ 3999 01, 05, 15
SM Bit SM0 ~ SM255 4400 ~ 4655 01, 05, 15
S Bit S0 ~ S991 6000 ~ 6991 01, 05, 15
T Bit T0 ~ T255 8000 ~ 8255 01, 05, 15 Status of T element
C Bit C0 ~ C255 9200 ~ 9455 01, 05, 15 Status of C element
D Word D0 ~ D7999 0000 ~ 7999 03, 06, 16
SD Word SD0 ~ SD255 8000 ~ 8255 03, 06, 16
Z Word Z0 ~ Z15 8500 ~ 8515 03, 06, 16
T Word T0 ~ T255 9000 ~ 9255 03, 06, 16 current value of T element
current value of C element
C Word C0 ~ C199 9500 ~ 9699 03, 06, 16
(WORD)
Double current value of C element
C C200 ~ C255 9700 ~ 9811 03, 16
word (DWORD)
Double current value of C element
C C256 ~ C306 10000~10101 03, 16
word (DWORD)
R Word R0 ~ R32767 13000~45767 03, 06, 16
Note:
The protocol address is the address used on data transfer and corresponds with the logic address of Modicon data. The protocol
address starts from 0 and the logic address of Modicon data begins with 1, that is, protocol address + 1 = logic address of Modicon
data. For example, if M0 protocol address is 2000, and its corresponding logic address of Modicon data will be 0:2001. In practice,
the read and write of M0 is completed through the protocol address, e.g.: read M0 element frame (sent from the master station):

01 01 07 D0 00 01 FD 47
CRC check code
Number of elements to read
Starting address. The decimal value of 07D0 is 2000
Function code
Station No.
316 Chapter 10 Using Communication Function

10.4.7 Modbus Slave


Modbus slave responds to the master station according to the received message of local address, rather than sending
out message actively. The slave only supports Modbus function codes 01, 02, 03, 05, 06, 08, 15 and 16. The other
codes are illegal function codes (except broadcast frame).

10.4.8 Reading & Writing Elements


All the function codes supported by MC200, except 08 are used for read and write of the element. In principle, in one
frame, there are 2000 bits and 125 words for reading, 1968 bits and 120 words for writing at most. However, the
actual protocol addresses for elements of different types are different and discontinuous (e.g.: Y377's protocol address
is 255, X0’s protocol address is 1200). Therefore, when reading or writing an element, the element read for one time
can only be the same type, and the maximum number of the read elements depends on the elements of this type that
are actually defined. For example, when reading element Y (Y0 – Y377, 256 points in total), the protocol address
ranges from 0 to 255, the corresponding logic address of Modicon data is from 1 to 256, and the maximum number of
elements Y that can be read is 256.
The examples are as follows:
1. XMT from master station: 01 01 00 00 01 00 3D 9A
01 – address; 01- function code; 00 00 – starting address; 01 00 – number of elements to read; 3D 9A – check
Response of slave station: provide correct response
2. XMT from master station: 01 01 00 00 01 01 FC 5A
The starting address for the reading of master station is 0000. 01 01 (257) elements are read, which is beyond the
defined number of elements Y.
Response of slave station: 01 81 03 00 51
The data from the slave station response is illegal, because 257>256, and 256 is the allowed maximum number of
elements Y.
3. XMT from master station: 01 01 00 64 00 A0 7D AD
The starting address for the reading of master station: 0064 (decimal 100)
Number of elements read: 00 A0 (decimal 160)
Slave station response: 01 81 02 C1 91
The slave station responds with illegal data address, because there are only 156 elements Y starting with the
protocol address 100, but 160>156, 160 is illegal.
4. XMT from master station: 01 04 00 02 00 0A D1 CD
The frame of XMT function code 04 of master station
Response of slave station: 01 84 01 82 C0
The slave station responds with illegal function code. 04 is not supported by MC200.

 Note
1. Element X does not support write operation (that is, the write of element X is invalid). For the writable properties of elements
SM and SD, refer to 0Special Auxiliary Relay and 0Special Data Register (if the element is un-writable, the write operation is
invalid).
2. The address of the slave station is 01, the last two bytes are CRC check code and the second byte is function code.

10.4.9 Handle Of Double Word


The current count value of C element is word or double word. The value from C200 to C255 are double words, which
are read and written through the function code (03, 16) of the register. Every two registers correspond to a C double
word. Only the pair can be read and written from/into register upon reading or writing.
For example, read the RTU frame of three C double word elements from C200 to C202:
01 03 25 E4 00 06 8E F3
CRC check code
Number of elements to read: 6
Starting address 9700
Function code
Station No.
Chapter 10 Using Communication Function 317

In the returned data, 9700 and 9701 are two addresses for the content of C200. 9700 is the high 16 bits and 9701 is
the low 16 bits.
When reading the double word, if the starting address read is not even number, then the system will respond with error
code of illegal address; if the read number of registers is not an even number, the system will respond with error code
of illegal data.
For example:
XTM from master station: 01 03 25 E5 00 04 5E F2
The starting address for the reading of master station : 4 word elements of 25 E5 (decimal 9701,)
Response of slave station: 01 83 02 C0 F1
Response of slave station: illegal data address
XTM from slave station: 01 03 25 E4 00 05 CE F2
The starting address for master station read: 5 word elements of 25 E5
Response of slave station: 01 83 03 01 31
The data sent back from slave station is illegal.

10.4.10 Handle Of LONG INT


A LONG INT data can be saved in two D elements. For example, if a LONG INT data is saved in D3 and D4 of MC
series PLC, the high 16 bits will be stored in D3 and the low 16 bits will be stored in D4. This is also true when the
master station reads LONG INT data through Modbus and reorganize the data into 32 bits.
The storage principle for FLOAT is the same as the storage principle for LONG INT data.

10.4.11 Diagnostic Function Code


Diagnostic function code is used for test the communication between the master station and slave station, or the
internal error of the slave station. The supported diagnostic sub-function codes are as follows:
Function Sub-function Function Sub-function
Name of sub-function code Name of sub-function code
code code code code
Return bus communication error
08 00 Return query data 08 12
count
08 01 Restart communication option 08 13 Return bus exceptional error count
08 04 Forced listen only mode 08 14 Return slave message count
08 10 Clear the counter 08 15 Return salve no response count
08 11 Return bus message count 08 18 Return bus character overrun count

10.4.12 Error Code


For the XMT of master station, the slave station returns data or statistic value in the data field under the normal
response status. But in the abnormal response status, the server will return error code in the data field. Refer to the
following table for error codes:
Error code Meaning of error code
0x01 illegal function code
0x02 illegal register address
0x03 illegal data
In addition, if the slave station receives data under the following situations, no message will be returned:
1) Error in broadcast frame, e.g. data error, address error;
2) Characters overrun, e.g. RTU frame over 256 bytes;
3) Under RTU transfer mode, interval between two characters time out, which is the same as receiving error frame,
and no message will be returned;
4) Listen-only mode of slave station;
5) The slave station received ASCII error frame, including frame tail error, character range error.

 Note
Read station is equipped with compulsory element. What is read is the value run by the program, which may be inconsistent with
the compulsory value.
318 Chapter 10 Using Communication Function

10.4.13 Modbus Parameter Setting


Set communication port in system block
There are two serial ports (serial port 0 and 1) on the communication port interface. Communication port 0 only
supports Modbus slave station, while communication port 1 supports both master and slave stations.
Set Modbus communication parameters
There is a button of default value on Modbus operand interface. The default value is the communication setting
recommended by Modbus communication protocol. For the parameter setting items, refer to Table XX.
Item Setting
Station No. 0 to 31
Baud rate 38400, 19200, 9600, 4800, 2400, 1200
Data bit set to 7 or 8 bits; 7 for ASCII mode, 8 for RTU mode
Parity check bit set to no check, odd check and even check
Stop bit set to 1 or 2; set to 1 for odd or even check; set to 2 for no check status
It can be set to master or slave station; communication port 1 can be set to master/slave station,
Modbus master/slave
communiation port 0 can only be set to slave station
transfer mode Select RTU mode or ASCII mode
main mode timeout The time for waiting the slave response by master is over the set value.
Note: After the operand is set and downloaded in the system block, it will be valid only after one operation.

10.4.14 Modbus Instruction


When PLC is used as Modbus master station, the Modbus data frame can be sent/received through Modbus
instruction provided by system. For the detailed use of Modbus instruction, refer to 6.12.1 Modbus: Modbus Master
Station Communication Instruction.
If PLC is set to master station, there is a timeout item in main mode when setting Modbus parameter in the system
block. To ensure the correctness of the received data, the timeout period shall be longer than a scan cycle of Modbus
slave station and with reasonable margin. For example, if MC200 is the slave station and a scan cycle of MC200 is
300ms, the main mode timeout of the master station shall be over 300ms. It is proper to set the timeout to 350ms.
Chapter 10 Using Communication Function 319

Application program
Example 1: When MC200 PLC is Modbus master station as well as slave station, read bit status of No.5 station. The
protocol address of slave station read by master station is the bit value ranging from 11 to 39. Assuming that the read
data are as follows, the storage location for the received data starts from D100, save the address to D100, function
code to D101 and number of registers in D102. Save the read bit value in the units beginning with D103.
42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27
X X X 0 0 1 1 0 0 0 0 1 0 1 1 0
D106 D105

26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11
1 1 0 0 0 1 1 0 1 1 1 0 0 0 0 1
D104 D103

If the read number of the registers is not the times of 8, add 0 to the high bits. In the above example, it has added 0 to 3
high bits (40, 41 and 42) in D106.

1. Designate 5 as the address of the slave station


to be accessed (save to D0).
2. Designate 1 as the function code (save to D1).
3. The address of the register to be read is 11
(Save to D2/D3 according to high and low bytes).
4. The number of registers to be read is 29 (Save to
D4/D5 according to high bits and low bits).
5. The received data is saved to D100.
6. If the receive is completed (set SM135 ), add 1 to
D200.
7. If the communication fails (set SM136), add 1 to
D201 and save the error code to D202.
8. SM124 is the idle flag of the communication port.

 Note
1. When logic address is used for addressing the bit element of MC200 PLC, the logic address 1 is the protocol address 0. In the
above example, reading the value of 11 ~ 39 bits (protocol address) in the slave station, the logic address shall start from 12.
2. The failure of this communication will not affect the next communication, that is, if there are two Modbus XMT instructions in
one user program, the first communication fails and has error code, it will not influence the data sending of the second Modbus
instruction. Thus, in the example, we placed the error code of SD139 in D202, which can be observed through D202.
3. For the message sending of the slave station, if the master station is in listen-only mode, there will be no data to be returned
and the system will display error flag. Therefore, when using Modbus of MC200, if MC200 is the master station, the user shall
clearly know which PLC slave station is under listen-only mode, so as to ensure that the failure of the communication is not
caused by the listen-only mode of the slave station.
320 Chapter 10 Using Communication Function

Example 2: MC200 is the Modbus master station, the slave station is also an MC200 basic module. Read the status
of bit elements (protocol address: 2000 ~ 2017) in No.5 station.
The read data are as follows:
The received frame starts from D100.
D100 is for saving address
D101 is for saving function code
D102 is for saving the number of registers
Units beginning with D103 are for saving the read value of bit element

1. The program has designated 5 as the address


of the slave station to be accessed (save to D0).
2. The program has designated 1 as function
code (save to D1).
3. The starting address of the register to be
read is 07D0 (hexadecimal, save to D2/D3
according to high bits and low bits).
4. The number of registers to be read is 18 (Save
to D4/D5 according to high bits and low bits).
5. The received data is saved to D100.
6. If the receive is completed (set SM135), add 1
to D200.
7. If the communication fails (set SM136), add 1
to D201 and save the error code to D202.
8. SM124 is the idle flag of the communication
port.
Chapter 10 Using Communication Function 321

Example 3: MC200 is the Modbus master station as well as the slave station. Read the status of the bit element with
the protocol address ranging from 40 to 43 of No.5 station.
The read data are as follows:
The received frame starts from D100.
D100 is for saving address
D101 is for saving function code
D102 is for saving the number of registers
Units beginning with D103 are for saving the read value of bit element
40 element 40 element 41 element 41 element 42 element 42 element 43 element 43 element
high bits low bits high bits low bits high bits low bits high bits LSB
D103 D104 D105 D106 D107 D108 D109 D110

1. The program has designated 5 as the address of


the slave station to be accessed (save to D0).
2. The program has designated 3 as function code
(save to D1).
3. The starting address of the register to be read is 40
(save to D2/D3 according to high bits and low bits).
4. The number of registers to be read is 4 (Save to
D4/D5 according to high bits and low bits).
5. The received data is saved to D100.
6. If the receiving is completed (set SM135 ), add 1 to
D200.
7. If the communication fails (set SM136), add 1 to
D201 and save the error code to D202.
8. SM124 is the idle flag of the communication port.

10.5 MCbus Communication Protocol

10.5.1 Introduction
MCbus is a small PLC network developed by Shenzhen Megmeet Control Technology Co., Ltd. The physical layer of
MCbus uses RS-485, so the PLC can be directly connected through communication port 1 or connected through
communication port 0 by RS-232/RS-485 converter. The connected PLC of MCbus can automatically exchange the
values between D elements and M elements, which makes the access to the other PLC elements on the network as
convenient as accessing its own element. In MCbus, the data access between PLCs is completely equivalent (N:N
communication network).
It is convenient to configure MCbus. Most parameters of MCbus only need to be configured on No.0 PLC. In addition,
MCbus supports online modification of the network parameters, and is able to detect the newly added PLC
automatically. If any PLC is disconnected from the network, the other PLCs will continue to exchange the data. It is
also able to monitor the communication status of the whole network through the relevant SM element of any PLC in
MCbus.
322 Chapter 10 Using Communication Function

10.5.2 MCbus Network Structure


MCbus supports two kinds of network: single-layer network and multiple-layer network (as shown in the following
figures):

...

RS 485

Figure 10-1 MCbus single-layer network

...
RS 485

RS485/232 converter

(Connecting node)

...
RS 485

Figure 10-2 MCbus multiple-layer network

In the single-layer network, each PLC only connects to MCbus through 1 communication port. In the multiple-layer
network, the layer-to-layer PLC (intermediate node) shall be connected, and the two communication ports of PLC shall
be connected to different layers. The single-layer network can support up to 32 PLCs , while each layer of
multiple-layer network can support 16 PLCs at most.

10.5.3 MCbus Refresh Mode


The PLCs connected to MCbus can automatically realize the exchange between parts of D elements and M elements
in the network. The quantity and numbering of elements D and M are fixed, and the elements are called “Elements
Sharing Area”. If PLC uses MCbus, the value of the Elements Sharing Area will keep refreshing automatically, so as to
keep the value consistency of the Elements Sharing Area for each PLC in the network.

0# PLC 1# PLC 2#PLC ... 7# PLC

0#SND area (W) 0#RCV area (R) 0# RCV area (R) 0# RCV area (R)
1#RCV area (R) 1#SND area (W) 1# RCV area (R) 1# RCV area (R)
2#RCV area (R) 2#RCV area (R) 2#SND area (W) 2# RCV area (R)
3# RCV area (R) 3# RCV area (R) 3# RCV area (R) 3# RCV area (R)
4# RCV area (R) 4# RCV area (R) 4# RCV area (R) 4# RCV area (R)
5# RCV area (R) 5# RCV area (R) 5# RCV area (R) 5# RCV area (R) Note:
6# RCV area (R) 6# RCV area (R) 6# RCV area (R) 6# RCV area (R) SND area: sending area
RCV area: receiving area
7# RCV area (R) 7# RCV area (R) 7# RCV area (R) 7# SND area (W) W: write
R: read

As shown in the above figure, each PLC with MCbus connected has a writable sending area in the Elements Sharing
Area. MCbus will automatically send the information (values of designated elements D and M) of the writable sending
area to other PLCs, receive the information from other PLCs and save it to the read-only sending area.
The element number in the Elements Sharing Area is fixed (64 D elements and 512 M elements can be shared) and
these elements are distributed to more than one PLC. Therefore, the less PLCs are connected to the network, the
more elements can be distributed to each PLC. The relationship is defined by MCbus refresh mode:
Chapter 10 Using Communication Function 323

Distribution of D element on MCbus single-layer network:


Distribution of D element
Mode 1 Mode 2 Mode 3 Mode 4 Mode 5
in sending area
D7700 to D7701 #0
#0
D7702 to D7703 #1
#0
D7704 to D7705 #2
#1
D7706 to D7707 #3
#0
D7708 to D7709 #4
#2
D7710 to D7711 #5
#1
D7712 to D7713 #6
#3
D7714 to D7715 #7
#0
D7716 to D7717 #8
#4
D7718 to D7719 #9
#2
D7720 to D7721 #10
#5
D7722 to D7723 #11
#1
D7724 to D7725 #12
#6
D7726 to D7727 #13
#3
D7728 to D7729 #14
#7
D7730 to D7731 #15
D7732 to D7733 #16
#8
D7734 to D7735 #17
#4
D7736 to D7737 #18
#9
D7738 to D7739 #19
#2
D7740 to D7741 #20
#10
D7742 to D7743 #21
#5
D7744 to D7745 #22
#11
D7746 to D7747 #23
#1
D7748 to D7749 #24
#12
D7750 to D7751 #25
#6
D7752 to D7753 #26
#13
D7754 to D7755 #27
#3
D7756 to D7757 #28
#14
D7758 to D7759 #29
#7
D7760 to D7761 #30
#15
D7762 to D7763 #31

Explanation:
1) In mode 1, the D elements distributed to the sending area by 0# station are D7700 and D7701. D7700 and
D7701 can be written by the PLC of 0# station, and directly read by other stations (1#--31#).
2) In mode 2, the D elements distributed to the sending area by 0# station are D7700, D7701, D7701 and D7703.
The elements can be written by the PLC of 0# station and directly read by other stations (1#--15#).
324 Chapter 10 Using Communication Function

Distribution of M element on MCbus single-layer network:


Distribution of M element
Mode 1 Mode 2 Mode 3 Mode 4 Mode 5
in sending area
M1400 to M1415 #0
#0
M1416 to M1431 #1
#0
M1432 to M1447 #2
#1
M1448 to M1463 #3
#0
M1464 to M1479 #4
#2
M1480 to M1495 #5
#1 #0
M1496 to M1511 #6
#3
M1512 to M1527 #7
M1528 to M1543 #8
#4
M1544 to M1559 #9
#2
M1560 to M1575 #10
#5
M1576 to M1591 #11
#1
M1592 to M1607 #12
#6
M1608 to M1623 #13
#3 #0
M1624 to M1639 #14
#7
M1640 to M1655 #15
M1656 to M1671 #16
#8
M1672 to M1687 #17
#4
M1688 to M1703 #18
#9
M1704 to M1719 #19
#2
M1720 to M1735 #20
#10
M1736 to M1751 #21
#5
M1752 to M1767 #22
#11
M1768 to M1783 #23
#1
M1784 to M1799 #24
#12
M1800 to M1815 #25
#6
M1816 to M1831 #26
#13
M1832 to M1847 #27
#3
M1848 to M1863 #28
#14
M1864 to M1879 #29
#7
M1880 to M1895 #30
#15
M1896 to M1911 #31

Explanation:
1) In mode 1, the M elements distributed to the sending area by 0# station range from M1400 to M1415. The
elements can be written by the PLC of 0# station and directly read by other stations (1#--31#).
2) In mode 2, the M elements distributed to the sending area by 0# station range from M1400 to M1431. The
elements can be written by the PLC of 0# station and directly read by other stations (1#--31#).
Chapter 10 Using Communication Function 325

Distribution of D element on MCbus multiple-layer network (layer 0):


Distribution of D element in
Mode 6 Mode 7 Mode 8 Mode 9
sending area
D7700 to D7701 #0
#0
D7702 to D7703 #1
#0
D7704 to D7705 #2
#1
D7706 to D7707 #3
#0
D7708 to D7709 #4
#2
D7710 to D7711 #5
#1
D7712 to D7713 #6
#3
D7714 to D7715 #7
D7716 to D7717 #8
#4
D7718 to D7719 #9
#2
D7720 to D7721 #10
#5
D7722 to D7723 #11
#1
D7724 to D7725 #12
#6
D7726 to D7727 #13
#3
D7728 to D7729 #14
#7
D7730 to D7731 #15

Explanation:
In mode 6, D7700 and D7701 are distributed to the sending area by 0# station (layer 0). They can be written by the
PLC of 0# station and directly read by the other stations (1#--15#).
Distribution of D element on MCbus multiple-layer network (layer 1):
Distribution of D element in
Mode 10 Mode 11 Mode 12 Mode 13
sending area
D7732 to D7733 #0
#0
D7734 to D7735 #1
#0
D7736 to D7737 #2
#1
D7738 to D7739 #3
#0
D7740 to D7741 #4
#2
D7742 to D7743 #5
#1
D7744 to D7745 #6
#3
D7746 to D7747 #7
D7748 to D7749 #8
#4
D7750 to D7751 #9
#2
D7752 to D7753 #10
#5
D7754 to D7755 #11
#1
D7756 to D7757 #12
#6
D7758 to D7759 #13
#3
D7760 to D7761 #14
#7
D7762 to D7763 #15

Explanation:
In mode 10, D7732 and D7733 are distributed to the sending area by 0# station (layer 0). They can be written by
the PLC of 0# station and directly read by the other stations (1#--15#).
326 Chapter 10 Using Communication Function

Distribution of M element on MCbus multiple-layer network (layer 0):


Distribution of M element in
Mode 6 Mode 7 Mode 8 Mode 9
sending area
M1400 to M1415 #0
#0
M1416 to M1431 #1
#0
M1432 to M1447 #2
#1
M1448 to M1463 #3
#0
M1464 to M1479 #4
#2
M1480 to M1495 #5
#1
M1496 to M1511 #6
#3
M1512 to M1527 #7
M1528 to M1543 #8
#4
M1544 to M1559 #9
#2
M1560 to M1575 #10
#5
M1576 to M1591 #11
#1
M1592 to M1607 #12
#6
M1608 to M1623 #13
#3
M1624 to M1639 #14
#7
M1640 to M1655 #15

Explanation:
In mode 6, the M elements distributed to the sending area by 0# station (layer 0) range from M1400 to M1415. The
elements can be written by the PLC of 0# station and directly read by other stations (1#--15#).
Distribution of M element on MCbus multiple-layer network (layer 1):
Distribution of M element
Mode 10 Mode 11 Mode 12 Mode 13
in sending area
M1656 to M1671 #0
#0
M1672 to M1687 #1
#0
M1688 to M1703 #2
#1
M1704 to M1719 #3
#0
M1720 to M1735 #4
#2
M1736 to M1751 #5
#1
M1752 to M1767 #6
#3
M1768 to M1783 #7
M1784 to M1799 #8
#4
M1800 to M1815 #9
#2
M1816 to M1831 #10
#5
M1832 to M1847 #11
#1
M1848 to M1863 #12
#6
M1864 to M1879 #13
#3
M1880 to M1895 #14
#7
M1896 to M1911 #15

Explanation:
In mode 10, the M elements distributed to the sending area by 0# station (layer 1) range from M1656 to M1671.
The elements can be written by the PLC of 0# station and directly read by other stations (1#--15#).

 Note:
Once PLC is configured with MCbus communication protocol, D7700 ~ D7763 and M1400 ~ M1911 will become the public
resource for data exchange on the network. Please pay attention to these elements when using them in the program!
Chapter 10 Using Communication Function 327

10.5.4 Enhanced Refrech Mode


In order to support more shared elements, MC series PLC provides mode 14 to 18. These modes only apply to the
situation where there is single-layer structure and more shared elements.
Distribution of D element Mode 14 Mode 5 Mode 16 Mode 17 Mode 18
D7500 to D7507 #0
#0
D7508 to D7515 #1
#0
D7516 to D7523 #2
#1
D7524 to D7531 #3
#0
D7532 to D7539 #4
#2
D7540 to D7547 #5
#1
D7548 to D7555 #6
#3
D7556 to D7563 #7
#0
D7564 to D7571 #8
#4
D7572 to D7579 #9
#2
D7580 to D7587 #10
#5
D7588 to D7595 #11
#1
D7596 to D7603 #12
#6
D7604 to D7611 #13
#3
D7612 to D7619 #14
#7
D7620 to D7627 #15
D7628 to D7635 #16
#8
D7636 to D7643 #17
#4
D7644 to D7651 #18
#9
D7652 to D7659 #19
#2
D7660 to D7667 #20
#10
D7668 to D7675 #21
#5
D7676 to D7683 #22
#11
D7684 to D7691 #23
#1
D7692 to D7699 #24
#12
D7700 to D7707 #25
#6
D7708 to D7715 #26
#13
D7716 to D7723 #27
#3
D7724 to D7731 #28
#14
D7732 to D7739 #29
#7
D7740 to D7747 #30
#15
D7748 to D7755 #31
328 Chapter 10 Using Communication Function

10.5.5 MCbus Parameter Setting


Select Communication Port in the System block dialogue box, and select MCbus protocol in the port 0 or port 1
setting area to enable the MCbus setting button as follows:

OK Cancel Help

Click the MCbus setting button to enter the MCbus protocol setting dialogue box as shown below:

As shown in the preceding figure, the MCbus parameters are set through the system block. The Station no. shall
begin with 0#. Several PLCs cannot share the same station number. 0# station is used for starting and setting the
whole network. The setting of Max number of sites, Additional delay time, Retry times and Mode can be realized
through 0# station. For the stations with other station numbers, except that the Baud rate and Parity check shall be
consistent with those of 0# station, they only need to set their own Station no., as shown in the following figure:
Chapter 10 Using Communication Function 329

The Max number of sites refers to the total number of PLCs used in the network. If 6 PLCs are used in total, the value
shall be set to 6 and the station number of the 6 PLCs ranges from 0 to 5. If you want to add another two PLCs to the
network later without any interruption of the network, you can set the Max number of sites to 8. The numbers of the
newly added PLCs are 6# and 7#. When 6# and 7# are connected to the network, they will be automatically detected
by MCbus within one second and included into the data exchange with 0#-5#.

10.5.6 Example

There are 5 PLCs in total and the station numbers range from 0# to 4#. Select 3 for the refresh mode. If you want to
save the sum of D100 in 0#PLC and D305 in 2#PLC to the D500 of 4#PLC, you can program as follows:
Programming 0#: MOV D100 D7700
Programming 2#: MOV D305 D7716
Programming 4#: ADD D7700 D7716 D500
Explanation: The example shows the MCbus single-layer network. There are 5 PLC stations on the network and the
refresh mode is set to 3. Each station can be distributed with 8 D elements and 64 M elements. The D elements
distributed to 0# station range from D7700 to D7707, the ones to 2# station range from D7716 to D7723 and the ones
to 4# station range from D7732 to D7739. Save the D100 value of 0# station to the public area D7700 distributed by
the network, D305 value of 2# station to the public area D7716 distributed by the network. Execute sum operation of
D7700 and D7716 in 4#PLC and save the sum to the local element D50.
330 Chapter 10 Using Communication Function

Chapter 11 Motion Control Tutor

ZRN Regress to origin instruction


PLSV Variable speed pulse output instruction
DRVI Control relative position instruction
DRVA Control absolute position instruction
DSZR Zero Return With DOG Instruction
Motion STOPDV Pulse output interrupt Instruction
control LIN Line Interpolation Instruction
CW Clockwise circular arc interpolation instruction
instruction
CCW Counterclockwise circular arc interpolation instruction
GEARBOX ELECTRONIC GEAR instruction
DRVC Closed-loop Control relative position instruction
CAMTABLE Set ELECTRONIC CAM table instruction
CAMBOX ELECTRONIC CAM instruction

11.1.1 Setting Up An Absolute Position System


The absolute position system obtains the absolute position data of the servo motor by detecting the current position
and the total cycle number of the motor PG. In this way, we can set up an absolute coordinates system of the
mechanical position. The following figure is a schematic diagram of an absolute position system:
AC power
PLC Servo amplifier supply
Instruction pulse output

Servo motor control


AC
Other I/O Instruction direction output
Program
Clearing pulse output
scan
Absolute position
communication
Zero point data

Backup battery
Storing absolute Absolute position
- +
position data detection

Position data
Power Sustain
& total cycle
supply number

PG Servo motor

Figure 11-1 Absolute position system

As shown in the figure, the PG of an absolute position system is special because it is battery backed, which protects its
position data and total cycle number upon power failure. That means even after a power failure, the servo amplifier
can obtain the current absolute position data after power on.
After power on, the PLC can obtain absolute position data from the servo amplifier through communication. PLC can
then use its Position instructions to control the servo amplifier and motor to realize precision positioning over
mechanical parts, and automatically refreshes its absolute position data. In this way, a positioning system based on
absolute position coordinates can be set up.
Chapter 11 Motion Control Tutorial 331

11.1.2 Mechanical Diagram Of Absolute Position System


The mechanical diagram of the absolute position system that is based on the Position instructions of MC series small
PLC is shown in the following figure.
Speed
Zero return speed

Crawling speed
Position

Return limit
Return start point

Forward limit
Reverse direction Proximity detection (front) Forward direction

Proximity signal
Zero point (back) detection device
Return limit switch Workbench Forward limit switch

Front Back

Servo motor

Screw rod

ON ON
Proximity signal state

OFF
OFF
Workbench position

Figure 11-2 Absolute position system based


on Position instructions of MC series small PLC

In this system, the servo motor drives the screw rod, which in turn drives the workbench. The location of the
workbench in the stroke is detected by an absolute PG. During the zero return, the servo motor will decelerate to the
crawling speed when the proximity sensor detects the fore-end of the workbench. When the proximity sensor
detects the rear-end of the workbench, it sends the zero returned signal to the PLC to stop high speed pulse output.
Note that the forward limit switch and backward limit switch are a must. Because the zero return instruction (ZRN) is
incapable of auto-searching the proximity signal, the zero return operation must start earlier than where the proximity
sensor is located. You can jog-adjust the position of the workbench through designing and programming.

11.1.3 Overview Of Position Instructions For MC series PLC


The MC series small PLC provides Position instructions, including ZRN, PLSV, DRVI, DRVA and ABS, to control
various servo amplifiers and servo motors in the absolute position system. The absolute position data is available
through the corresponding servo amplifier.
Name MC280 MC200 MC100 MC80
Control axes 8/6/4 2 2 2
Maximum output 200kHz 100kHz 100kHz 50kHz
frequency
Mode of pulse output Open collector Open collector Open collector Open collector
Form of pulse output Pulse+direction, Pulse+direction Pulse+direction Pulse+direction
forward+reversion.
Acceleration and Keystone Keystone Keystone Keystone
deceleration process acceleration and acceleration and acceleration and acceleration and
deceleration, triangle deceleration deceleration deceleration
prevent
332 Chapter 10 Using Communication Function

Interpolation 2 axes linear ----- ----- -----


interpolation, circular
interpolation
Synchronize function Position syn, ----- ----- -----
electronic gear.
Absolute position ABS instruction read -----
detection
Position range -2147483648~+2147483647(pulse)

11.1.4 Points To Note For Using Position instructions ZRN, PLSV, DRVI And DRVA
Transistor output
MC series small PLC with transistor output must be used.
Requirements of Position instructions during programming
The Position instructions can be used repeatedly in the program. However, note that:
1. One high speed pulse output point (Y0 or Y1) can be driven only by one Position instruction (or high speed
instruction) at any time.
2. After the power flow of one Position instruction turns OFF, it cannot turn ON before the next PLC scan cycle.
Notes on using instructions PLSY, PLSR and PLS at the same time
From the functional perspective, it is recommended to use DRVI instead of high speed pulse output instructions PLSY,
PLSR and PLS, because the DRVI instruction can update the absolute position registers SD80 ~ SD83 automatically.
The registers SD80 ~ SD83 can be used to store the present absolute position after the Position instruction is used.
Their values are based on the change of registers SD50 ~ SD53 and the control signal direction when the Position
instruction is executed. In this way, SD80 ~ SD83 and SD50 ~ SD53 are inter-related. Do not write SD50 ~ SD53 when
Position instructions are being executed, or SD80 ~ SD83 will be messed up.
If it is necessary to use Position instructions and high speed pulse output instructions PLSY, PLSR or PLS at the same
time, do write a PLC program so that registers SD80 ~ SD83 can be updated correctly.
Limits on the actual output frequency of Position instructions
The minimum frequency of the actual output pulse upon the execution of Position instructions is limited by the
following formula:
Fmax  500
Fmin_ acc 
T

Where Fmax is the highest frequency set in SD85 or SD86, T is the acceleration or deceleration time (unit: ms) set
in SD87, and the result Fmin_ acc is the minimum output frequency.
If the output frequency specified in the Position instruction is F, the possible three output frequencies are:
 No output, when F is smaller than the minimum frequency or bigger than Fmax
 Fmin_ acc (when F < Fmin_ acc )
 F (when Fmin_ acc ≤F≤ Fmax )

11.1.5 Special Elements Related To Position instructions


The definitions and distribution of output axes for MC280 are shown as follow.
Chapter 11 Motion Control Tutorial 333

Table 11-2 Definition of MC280-1616BTA8 output axis


MAX
Output Supported Speed
Definition of output point FRQ Interpolation Definition of output mode
axis mode (KHz)
(KHz)
Pulse Y0
Pulse +
Unlimited
direction Direction
except Y0 X-axis pulse
0 FWD Y0 200 (the first
FWD + REV
REV Y1 Interpolation )
Phase A Y0/ Y1
Dual phase
Phase B Y1/ Y0
Pulse Y1 FWD + REV
Pulse + X-axis
Unlimited OFF
direction Direction direction(the
1 except Y1 200 ON
first
Phase A Y1/ Y0
Dual phase Interpolation ) OFF
Phase B Y0/ Y1 100 ON
Pulse + Pulse Y2
FWD REV
direction Direction Y3
Y-axis
FWD Y2
2 FWD + REV 200 pulse(the first
REV Y3
Interpolation )
Phase A Y2/ Y3
Dual phase
Phase B Y3/ Y2
Pulse Y3
Pulse + Y-axis
Unlimited
direction Direction direction (the
3 except Y3 200
first
Phase A Y3/ Y2
Dual phase Interpolation )
Phase B Y2/ Y3
Pulse Y4 X-axis pulse or
Pulse +
Unlimited direction(the
4 direction Direction 100
except Y4 second
PWM adjustable duty ratio Interpolation)
Pulse Y5 X-axis pulse or
Pulse +
Unlimited direction(the
5 direction Direction 100
except Y5 second
PWM adjustable duty ratio Interpolation)
20
Pulse Y6 Y-axis pulse or
Pulse +
Unlimited direction(the
6 direction Direction 100
except Y6 second
PWM adjustable duty ratio Interpolation)
Pulse Y7 Y-axis pulse or
Pulse +
Unlimited direction(the
7 direction Direction 100
except Y7 second
PWM adjustable duty ratio Interpolation)

Table 11-3 Definition of MC280-1616BTA6 output axis


MAX
Output Supported Speed
Definition of output point FRQ Interpolation Definition of output mode
axis mode (KHz)
(KHz)
0 Pulse + Pulse Y0 200 X-axis pulse
direction Unlimited (the first
Direction
except Y0 Interpolation )
FWD Y0
FWD + REV
REV Y1
100
Phase A Y0/ Y1
Dual phase
Phase B Y1/ Y0
Pulse + Pulse Y1 X-axis
1 direction Unlimited 200 direction(the
Direction
except Y1 first
334 Chapter 10 Using Communication Function

MAX
Output Supported Speed
Definition of output point FRQ Interpolation Definition of output mode
axis mode (KHz)
(KHz)
Phase A Y1/ Y0 Interpolation ) FWD + REV
Dual phase OFF
Phase B Y0/ Y1
ON
Pulse + Pulse Y2
direction Direction Y3 OFF
Y-axis ON
FWD Y2
2 FWD + REV 200 pulse(the first
REV Y3 FWD REV
Interpolation )
Phase A Y2/ Y3
Dual phase
Phase B Y3/ Y2
Pulse Y3
Pulse + Y-axis
Unlimited
direction Direction direction (the
3 except Y3 200
first
Phase A Y3/ Y2
Dual phase Interpolation )
Phase B Y2/ Y3
Pulse Y4 X-axis pulse or
Pulse +
Unlimited direction(the
4 direction Direction 100
except Y4 second
PWM adjustable duty ratio Interpolation)
20
Pulse Y5 X-axis pulse or
Pulse +
Unlimited direction(the
5 direction Direction 100
except Y5 second
PWM adjustable duty ratio Interpolation)

Table 11-4 Definition of MC280-1616BTA4 output axis


MAX
Output Supported Speed
Definition of output point FRQ Interpolation Definition of output mode
axis mode (KHz)
(KHz)
Pulse Y0
Pulse +
Unlimited
direction Direction
except Y0 X-axis pulse
0 FWD Y0 200 (the first
FWD + REV
REV Y1 Interpolation )
Phase A Y0/ Y1
Dual phase
Phase B Y1/ Y0
Pulse Y1 FWD + REV
Pulse + X-axis
Unlimited OFF
direction Direction direction(the
1 except Y1 200 ON
first
Phase A Y1/ Y0
Dual phase Interpolation ) OFF
Phase B Y0/ Y1 100 ON
Pulse + Pulse Y2
FWD REV
direction Direction Y3
Y-axis
FWD Y2
2 FWD + REV 200 pulse(the first
REV Y3
Interpolation )
Phase A Y2/ Y3
Dual phase
Phase B Y3/ Y2
Pulse Y3
Pulse + Y-axis
Unlimited
direction Direction direction (the
3 except Y3 200
first
Phase A Y3/ Y2
Dual phase Interpolation )
Phase B Y2/ Y3

Table 11-5 Definition of MC200E-1616BTA8 output axis


Output Supported MAX FRQ
Definition of output point Definition of output mode
axis mode (KHz)
Chapter 11 Motion Control Tutorial 335

Output Supported MAX FRQ


Definition of output point Definition of output mode
axis mode (KHz)
Pulse + Pulse Y0
direction Direction Unlimited except Y0
0 200
Phase A Y0/ Y1
Dual phase
Phase B Y1/ Y0
Pulse + Pulse Y1
direction Direction Unlimited except Y1
1 200
Phase A Y1/ Y0 FWD + REV
Dual phase OFF
Phase B Y0/ Y1
ON
Pulse + Pulse Y2
direction Direction Y3 OFF
2 200
Phase A Y2/ Y3 ON
Dual phase
Phase B Y3/ Y2 FWD REV
Pulse + Pulse Y3
direction Direction Unlimited except Y3
3 200
Phase A Y3/ Y2
Dual phase
Phase B Y2/ Y3
Pulse + Pulse Y4
4 direction Direction Unlimited except Y4 100
PWM adjustable duty ratio
Pulse + Pulse Y5
5 direction Direction Unlimited except Y5 100
PWM adjustable duty ratio
Pulse + Pulse Y6
6 direction Direction Unlimited except Y6 100
PWM adjustable duty ratio
Pulse + Pulse Y7
7 direction Direction Unlimited except Y7 100
PWM adjustable duty ratio

Table 11-6 Definition of MC200E-1616BTA6 output axis


Output Supported MAX FRQ
Definition of output point Definition of output mode
axis mode (KHz)
Pulse + Pulse Y0
direction Direction Unlimited except Y0
0 200
Phase A Y0/ Y1
Dual phase
Phase B Y1/ Y0
Pulse + Pulse Y1
direction Direction Unlimited except Y1
1 200
Phase A Y1/ Y0
Dual phase
Phase B Y0/ Y1
Pulse + Pulse Y2
direction Direction Y3
2 200
Phase A Y2/ Y3 FWD + REV
Dual phase
Phase B Y3/ Y2 OFF

Pulse + Pulse Y3 ON

direction Direction Unlimited except Y3 OFF


3 200
Phase A Y3/ Y2 ON
Dual phase
Phase B Y2/ Y3
FWD REV
Pulse + Pulse Y4
4 direction Direction Unlimited except Y4 100
PWM adjustable duty ratio
Pulse + Pulse Y5
5 direction Direction Unlimited except Y5 100
PWM adjustable duty ratio
336 Chapter 10 Using Communication Function

Table 11-7 Definition of MC200E-1616BTA4 output axis


Output Supported MAX FRQ
Definition of output point Definition of output mode
axis mode (KHz)
Pulse + Pulse Y0
direction Direction Unlimited except Y0
0 200
Phase A Y0/ Y1
Dual phase
Phase B Y1/ Y0
Pulse + Pulse Y1
direction Direction Unlimited except Y1
1 200
Phase A Y1/ Y0 FWD + REV
Dual phase OFF
Phase B Y0/ Y1
ON
Pulse + Pulse Y2
direction Direction Y3 OFF
2 200
Phase A Y2/ Y3 ON
Dual phase
Phase B Y3/ Y2 FWD REV
Pulse + Pulse Y3
direction Direction Unlimited except Y3
3 200
Phase A Y3/ Y2
Dual phase
Phase B Y2/ Y3

 Note
When using an output axis to connect a servo, you need to use the output points in pairs. All output axes can use the “pulse +
direction” mode, while output axes 0 and 1 can use the “FWD + REV” mode. In the “pulse + direction” mode, the pulse and
direction signal of output axes 0 and 1 correspond to fixed output points. You can select direction signals for output axes 2 ~ 5.
When selecting direction signals, the output point cannot be used for other purposes at the same time. For example, do not share
the same output point with the pulse or direction signal of other output axes. In the “FWD + REV” mode, the output points
corresponding to the FWD and REV signals are fixedly defined. For output axis 0 or 1, no matter which output mode is defined,
so long as a locating or high-speed I/O instruction is using the axis, the two output points corresponding to the axis cannot be
used for other purposes.

Table 11-8 High-speed output control (Y0/Y1)


Addr. Name Action and function R/W
When this element is set, the pulse output complete interrupt of Y0 is
Y0 pulse output complete
SM63 enabled; when this element is cleared, the pulse output complete interrupt is R/W
interrupt enalbing
disabled
Y0 high speed pulse output
SM80 Y0 high speed pulse output stop instruction R/W
control
SM82 Y0 pulse output monitor Monitor the state of high speed output channel Y0. ON: busy. OFF: ready R
SM280 Clearing function enabling Enabling the CLR signal output function (Y0) for ZRN and DSZR instructions R/W
When SM281 set, the Y element wohse SN is the value of SD206 is the
Clearing signal element
SM281 clearing signal of Y0. Otherwise, by default, Y10 is the clearing signal of Y0. R/W
assignment enabling
This is applicable to DSZR
SM282 Zero return direction Y0, applicable to DSZR R/W
SM283 Forward rotation limit Y0, applicable to DSZR R/W
SM284 Reverse rotation limit Y0, applicable to DSZR R/W
SM285 Proximity signal logic reverse Y0, applicable to DSZR R/W
Zero point signal logic
SM286 Y0, applicable to DSZR R/W
reverse
Locating instruction being Monitor the state of high speed output channel Y0 when executing DSZR.
SM288 R/W
driven ON: busy. OFF: ready
Note: When SM280 is set, the default clearing signal Y10 corresponding to the output axis will output a CLR pulse upon zero return.
The pulse width is 20ms + 1 scan cycle. If the default clearing signal of this axis is used for other purposes, you should reset SM280
to disable the clearing function

Table 11-9 High-speed pulse output control (Y0/Y1)


Addr. Name Register content R/W
SD50 Total output pulse number (MSB) Used to calculate and store the absolute position. Each time a locating R/W
Chapter 11 Motion Control Tutorial 337

SD51 Total output pulse number (LSB) instruction is executed, SD50 ~ SD51 and direction signal are used to R/W
Current value (MSB) of absolute calculate and update SD200 ~ SD201. Each time the absolute position
SD200 R/W
position data is read from servo driver upon power on, the data (32-bit long
Current value (LSB) of absolute integer) should be stored to SD200
SD201 R/W
position
SD202 Max. speed (MSB) The max. speed when the output axis executes a locating instruction. R/W
SD203 Max. speed (LSB) Range: 10 ~ 200000. Unit: pulse R/W
The base speed when the output axis executes a locating instruction,
SD204 Base speed R/W
slower than 1/10 of the max. speed
The acc./dec. time when the output axis executes a locating instruction.
SD205 Acc./Dec. time R/W
Range: 50 ~ 5000. Unit: ms
When SM281 is set, SD206 specifies the SN of the Y element that will
SD206 Clearing signal element R/W
be the clearing signal
Applicable to the DSZR instruction as the crawling speed when
SD207 Crawling speed R/W
executing the instruction
SD208 Zero return speed (MSB) Applicable to the DSZR instruction as the zero return speed when R/W
SD209 Zero return speed (LSB) executing the instruction R/W
Applicable to PLS, used to detect the SN of the current section being
SD220 Section SN. of PLS output R
output
Note
1: SD202 ~ SD205 are adjustable according to your needs, just make sure they are set before the locating instruction is driven. If
they are changed during the execution of a locating instruction, the instruction execution may fail.
2: the base speed must be slower than 1/10 of the max. speed, or there will be no pulse output. No pulse will be output also when
the speed of a locating instruction exceeds the range between base speed and max. speed

Table 11-10 High-speed output control (Y2/Y3)


Addr. Name Action and function R/W
High speed output 2
SM72 Enable set as 1 R/W
complete interrupt enabling
SM262 Y2 pulse output stop Y2 will stop pulse output when this element is set R/W
Y2 pulse output monitor
SM272 Monitor Y2 high speed pulse output (ON: busy. OFF: ready) R
(busy/ready)
Applicable to the axis corresponding to Y2 when using DSZR/ZRN. When this
SM320 Clearing function enabling element is set, the CLR signal output of the zero return instruction is valid, or R/W
invliad otherwise
Applicable to the axis corresponding to Y2 when using DSZR. When this
Clearing signal element
SM321 element is set, the Y element, whose SN is the value of SD206, is a clearing R/W
assignment enabling
signal. When this element is cleared, Y12 is the clearing signal by default
Applicable to the axis corresponding to Y2 when using DSZR. When this
SM322 Zero return direction element is set, the zero return direction is the FWD direction. When this R/W
element is cleared, the zero return direction is the REV direction
Applicable to the axis corresponding to Y2 when using DSZR. When this
SM323 FWD limit element is set, it means the limit to the FWD direction is reached, or not R/W
reached otherwise
Applicable to the axis corresponding to Y2 when using DSZR. When this
SM324 REV limit element is set, it means the limit to the REV direction is reached, or not R/W
reached otherwise
Applicable to the axis corresponding to Y2 when using DSZR. When this
element is set, it means negative logic (proximity signal being ON when input
SM325 Proximity signal logic reverse R/W
is OFF), or positive logic (proximity signal being ON when input is ON)
otherwise
Applicable to the axis corresponding to Y2 when using DSZR. When this
element is set, it means negative logic (zero point signal being ON when input
SM326 Zero point logic reverse R/W
is OFF), or positive logic (zero point signal being ON when input is ON)
otherwise
Locating instruction being Monitor the state of high speed output channel Y2 when executing DSZR. ON:
SM328 R/W
driven busy. OFF: ready
Note: When SM320 is set, the default clearing signal Y12 corresponding to the output axis will output a CLR pulse upon zero return.
The pulse width is 20ms + 1 scan cycle. If the default clearing signal of this axis is used for other purposes, you should reset SM320
to disable the clearing function
338 Chapter 10 Using Communication Function

Table 11-11 High-speed pulse output control (Y2/Y3)


Addr. Name Register content R/W
SD160 Total output pulse number (MSB) R/W
Used to calculate and store the absolute position. Each time a locating
SD161 Total output pulse number (LSB) R/W
instruction is executed, SD160 ~ SD161 and direction signal are used to
Current value (MSB) of absolute
SD320 calculate and update SD320 ~ SD321. Each time the absolute position data R/W
position
is read from servo driver upon power on, the data (32-bit long integer) should
Current value (LSB) of absolute
SD321 be stored to SD320 R/W
position
SD322 Max. speed (MSB) The max. speed when the output axis executes a locating instruction. Range: R/W
SD323 Max. speed (LSB) 10 ~ 200000. Unit: pulse R/W
The base speed when the output axis executes a locating instruction, slower
SD324 Base speed R/W
than 1/10 of the max. speed
The acc./dec. time when the output axis executes a locating instruction.
SD325 Acc./Dec. time R/W
Range: 50 ~ 5000. Unit: ms
When SM321 is set, SD326 specifies the SN of the Y element that will be the
SD326 Clearing signal element R/W
clearing signal
Applicable to the DSZR instruction as the crawling speed when executing the
SD327 Crawling speed R/W
instruction
SD328 Zero return speed (MSB) Applicable to the DSZR instruction as the zero return speed when executing R/W
SD329 Zero return speed (LSB) the instruction R/W
SD222 Section SN. of PLS output Applicable to PLS, used to detect the SN of the current section being output R
Note
1: SD322 ~ SD325 are adjustable according to your needs, just make sure they are set before the locating instruction is driven. If
they are changed during the execution of a locating instruction, the instruction execution may fail
2: the base speed must be slower than 1/10 of the max. speed, or there will be no pulse output. No pulse will be output also when
the speed of a locating instruction exceeds the range between base speed and max. speed

Table 11-12 High-speed output control (Y4)


Addr. Name Action and function R/W
Pulse output complete When this element is set, the Y4 pulse output complete interrupt is enabled;
SM74 R/W
interrupt enalbing when this element is cleared, the pulse output complete interrupt is disabled
When set, this element can stop the high speed pulse output of Y4; when
SM264 Pulse output stop control R/W
this element is cleared, the output resumes
SM274 Pulse output monitor Monitor the state of high speed output channel Y4. ON: busy. OFF: ready R
Applicable to the axis corresponding to Y4 when using DSZR/ZRN. When
SM340 Clearing function enabling this element is set, the CLR signal output of the zero return instruction is R/W
valid, or invliad otherwise
Applicable to the axis corresponding to Y4 when using DSZR. When this
Clearing signal element
SM341 element is set, the Y element, whose SN is the value of SD206, is a clearing R/W
assignment enabling
signal. When this element is cleared, Y14 is the clearing signal by default
Applicable to the axis corresponding to Y4 when using DSZR. When this
SM342 Zero return direction element is set, the zero return direction is the FWD direction. When this R/W
element is cleared, the zero return direction is the REV direction
Applicable to the axis corresponding to Y4 when using DSZR. When this
SM343 FWD limit element is set, it means the limit to the FWD direction is reached, or not R/W
reached otherwise
Applicable to the axis corresponding to Y4 when using DSZR. When this
SM344 REV limit element is set, it means the limit to the REV direction is reached, or not R/W
reached otherwise
Applicable to the axis corresponding to Y4 when using DSZR. When this
element is set, it means negative logic (proximity signal being ON when
SM345 Proximity signal logic reverse R/W
input is OFF), or positive logic (proximity signal being ON when input is ON)
otherwise
Applicable to the axis corresponding to Y4 when using DSZR. When this
element is set, it means negative logic (zero point signal being ON when
SM346 Zero point logic reverse R/W
input is OFF), or positive logic (zero point signal being ON when input is
ON) otherwise
Locating instruction being Monitor the state of high speed output channel Y4 when executing DSZR.
SM348 R/W
driven ON: busy. OFF: ready
Note: When SM340 is set, the default clearing signal Y14 corresponding to the output axis will output a CLR pulse upon zero return.
Chapter 11 Motion Control Tutorial 339

The pulse width is 20ms + 1 scan cycle. If the default clearing signal of this axis is used for other purposes, you should reset SM340
to disable the clearing function

Table 11-13 High-speed pulse output control (Y4)


Addr. Name Register content R/W
SD164 Total output pulse number (MSB) R/W
Used to calculate and store the absolute position. Each time a locating
SD165 Total output pulse number (LSB) R/W
instruction is executed, SD164 ~ SD165 and direction signal are used to
Current value (MSB) of absolute
SD340 calculate and update SD340 ~ SD341. Each time the absolute position data R/W
position
is read from servo driver upon power on, the data (32-bit long integer) should
Current value (LSB) of absolute
SD341 be stored to SD340 R/W
position
SD342 Max. speed (MSB) The max. speed when the output axis executes a locating instruction. Range: R/W
SD343 Max. speed (LSB) 10 ~ 200000. Unit: pulse R/W
The base speed when the output axis executes a locating instruction, slower
SD344 Base speed R/W
than 1/10 of the max. speed
The acc./dec. time when the output axis executes a locating instruction.
SD345 Acc./Dec. time R/W
Range: 50 ~ 5000. Unit: ms
When SM341 is set, SD346 specifies the SN of the Y element that will be the
SD346 Clearing signal element R/W
clearing signal
Applicable to the DSZR instruction as the crawling speed when executing the
SD347 Crawling speed R/W
instruction
SD348 Zero return speed (MSB) Applicable to the DSZR instruction as the zero return speed when executing R/W
SD349 Zero return speed (LSB) the instruction R/W
SD224 Section SN. of PLS output Applicable to PLS, used to detect the SN of the current section being output R
Note
1: SD342 ~ SD345 are adjustable according to your needs, just make sure they are set before the locating instruction is driven. If
they are changed during the execution of a locating instruction, the instruction execution may fail
2: the base speed must be slower than 1/10 of the max. speed, or there will be no pulse output. No pulse will be output also when
the speed of a locating instruction exceeds the range between base speed and max. speed

Table 11-14 High-speed output control (Y5)


Addr. Name Action and function R/W
Pulse output complete When this element is set, the Y5 pulse output complete interrupt is enabled;
SM75 R/W
interrupt enalbing when this element is cleared, the pulse output complete interrupt is disabled
When set, this element can stop the high speed pulse output of Y5; when
SM265 Pulse output stop control R/W
this element is cleared, the output resumes
SM275 Pulse output monitor Monitor the state of high speed output channel Y5. ON: busy. OFF: ready R
Applicable to the axis corresponding to Y5 when using DSZR/ZRN. When
SM350 Clearing function enabling this element is set, the CLR signal output of the zero return instruction is R/W
valid, or invliad otherwise
Applicable to the axis corresponding to Y5 when using DSZR. When this
Clearing signal element
SM351 element is set, the Y element, whose SN is the value of SD206, is a clearing R/W
assignment enabling
signal. When this element is cleared, Y15 is the clearing signal by default
Applicable to the axis corresponding to Y5 when using DSZR. When this
SM352 Zero return direction element is set, the zero return direction is the FWD direction. When this R/W
element is cleared, the zero return direction is the REV direction
Applicable to the axis corresponding to Y5 when using DSZR. When this
SM353 FWD limit element is set, it means the limit to the FWD direction is reached, or not R/W
reached otherwise
Applicable to the axis corresponding to Y5 when using DSZR. When this
SM354 REV limit element is set, it means the limit to the REV direction is reached, or not R/W
reached otherwise
Applicable to the axis corresponding to Y5 when using DSZR. When this
element is set, it means negative logic (proximity signal being ON when
SM355 Proximity signal logic reverse R/W
input is OFF), or positive logic (proximity signal being ON when input is ON)
otherwise
Applicable to the axis corresponding to Y5 when using DSZR. When this
element is set, it means negative logic (zero point signal being ON when
SM356 Zero point logic reverse R/W
input is OFF), or positive logic (zero point signal being ON when input is
ON) otherwise
340 Chapter 10 Using Communication Function

Addr. Name Action and function R/W


Locating instruction being Monitor the state of high speed output channel Y5 when executing DSZR.
SM358 R/W
driven ON: busy. OFF: ready
Note: When SM350 is set, the default clearing signal Y15 corresponding to the output axis will output a CLR pulse upon zero return.
The pulse width is 20ms + 1 scan cycle. If the default clearing signal of this axis is used for other purposes, you should reset SM350
to disable the clearing function
Chapter 11 Motion Control Tutorial 341

Table 11-15 High-speed pulse output control (Y5)


Addr. Name Register content R/W
SD166 Total output pulse number (MSB) R/W
Used to calculate and store the absolute position. Each time a locating
SD167 Total output pulse number (LSB) R/W
instruction is executed, SD166 ~ SD167 and direction signal are used to
Current value (MSB) of absolute
SD350 calculate and update SD350 ~ SD351. Each time the absolute position R/W
position
data is read from servo driver upon power on, the data (32-bit long
Current value (LSB) of absolute
SD351 integer) should be stored to SD350 R/W
position
SD352 Max. speed (MSB) The max. speed when the output axis executes a locating instruction. R/W
SD353 Max. speed (LSB) Range: 10 ~ 100000. Unit: pulse R/W
The base speed when the output axis executes a locating instruction,
SD354 Base speed R/W
slower than 1/10 of the max. speed
The acc./dec. time when the output axis executes a locating instruction.
SD355 Acc./Dec. time R/W
Range: 50 ~ 5000. Unit: ms
When SM351 is set, SD356 specifies the SN of the Y element that will be
SD356 Clearing signal element R/W
the clearing signal
Applicable to the DSZR instruction as the crawling speed when executing
SD357 Crawling speed R/W
the instruction
SD358 Zero return speed (MSB) Applicable to the DSZR instruction as the zero return speed when R/W
SD359 Zero return speed (LSB) executing the instruction R/W
Applicable to PLS, used to detect the SN of the current section being
SD225 Section SN. of PLS output R
output
Note
1: SD352 ~ SD355 are adjustable according to your needs, just make sure they are set before the locating instruction is driven. If
they are changed during the execution of a locating instruction, the instruction execution may fail
2: the base speed must be slower than 1/10 of the max. speed, or there will be no pulse output. No pulse will be output also when
the speed of a locating instruction exceeds the range between base speed and max. speed

Table 11-16 High-speed output control (Y6)


Addr. Name Action and function R/W
Pulse output complete When this element is set, the Y6 pulse output complete interrupt is enabled;
SM76 R/W
interrupt enalbing when this element is cleared, the pulse output complete interrupt is disabled
When set, this element can stop the high speed pulse output of Y6; when
SM266 Pulse output stop control R/W
this element is cleared, the output resumes
SM276 Pulse output monitor Monitor the state of high speed output channel Y6. ON: busy. OFF: ready R
Applicable to the axis corresponding to Y6 when using DSZR/ZRN. When
SM360 Clearing function enabling this element is set, the CLR signal output of the zero return instruction is R/W
valid, or invliad otherwise
Applicable to the axis corresponding to Y6 when using DSZR. When this
Clearing signal element
SM361 element is set, the Y element, whose SN is the value of SD206, is a clearing R/W
assignment enabling
signal. When this element is cleared, Y16 is the clearing signal by default
Applicable to the axis corresponding to Y6 when using DSZR. When this
SM362 Zero return direction element is set, the zero return direction is the FWD direction. When this R/W
element is cleared, the zero return direction is the REV direction
Applicable to the axis corresponding to Y6 when using DSZR. When this
SM363 FWD limit element is set, it means the limit to the FWD direction is reached, or not R/W
reached otherwise
Applicable to the axis corresponding to Y6 when using DSZR. When this
SM364 REV limit element is set, it means the limit to the REV direction is reached, or not R/W
reached otherwise
Applicable to the axis corresponding to Y6 when using DSZR. When this
element is set, it means negative logic (proximity signal being ON when
SM365 Proximity signal logic reverse R/W
input is OFF), or positive logic (proximity signal being ON when input is ON)
otherwise
Applicable to the axis corresponding to Y6 when using DSZR. When this
element is set, it means negative logic (zero point signal being ON when
SM366 Zero point logic reverse R/W
input is OFF), or positive logic (zero point signal being ON when input is
ON) otherwise
342 Chapter 10 Using Communication Function

Addr. Name Action and function R/W


Locating instruction being Monitor the state of high speed output channel Y6 when executing DSZR.
SM368 R/W
driven ON: busy. OFF: ready
Note: When SM360 is set, the default clearing signal Y16 corresponding to the output axis will output a CLR pulse upon zero return.
The pulse width is 20ms + 1 scan cycle. If the default clearing signal of this axis is used for other purposes, you should reset SM360
to disable the clearing function

Table 11-17 High-speed pulse output control (Y6)


Addr. Name Register content R/W
SD168 Total output pulse number (MSB) R/W
Used to calculate and store the absolute position. Each time a locating
SD169 Total output pulse number (LSB) R/W
instruction is executed, SD168 ~ SD169 and direction signal are used to
Current value (MSB) of absolute
SD360 calculate and update SD360 ~ SD361. Each time the absolute position data R/W
position
is read from servo driver upon power on, the data (32-bit long integer) should
Current value (LSB) of absolute
SD361 be stored to SD360 R/W
position
SD362 Max. speed (MSB) The max. speed when the output axis executes a locating instruction. Range: R/W
SD363 Max. speed (LSB) 10 ~ 100000. Unit: pulse R/W
The base speed when the output axis executes a locating instruction, slower
SD364 Base speed R/W
than 1/10 of the max. speed
The acc./dec. time when the output axis executes a locating instruction.
SD365 Acc./Dec. time R/W
Range: 50 ~ 5000. Unit: ms
When SM361 is set, SD366 specifies the SN of the Y element that will be the
SD366 Clearing signal element R/W
clearing signal
Applicable to the DSZR instruction as the crawling speed when executing the
SD367 Crawling speed R/W
instruction
SD368 Zero return speed (MSB) Applicable to the DSZR instruction as the zero return speed when executing R/W
SD369 Zero return speed (LSB) the instruction R/W
SD226 Section SN. of PLS output Applicable to PLS, used to detect the SN of the current section being output R
Note
1: SD362 ~ SD365 are adjustable according to your needs, just make sure they are set before the locating instruction is driven. If
they are changed during the execution of a locating instruction, the instruction execution may fail.
2: the base speed must be slower than 1/10 of the max. speed, or there will be no pulse output. No pulse will be output also when
the speed of a locating instruction exceeds the range between base speed and max. speed

Table 11-18 High-speed output control (Y7)


Addr. Name Action and function R/W
Pulse output complete When this element is set, the Y7 pulse output complete interrupt is enabled;
SM77 R/W
interrupt enalbing when this element is cleared, the pulse output complete interrupt is disabled
When set, this element can stop the high speed pulse output of Y7; when
SM267 Pulse output stop control R/W
this element is cleared, the output resumes
SM277 Pulse output monitor Monitor the state of high speed output channel Y7. ON: busy. OFF: ready R
Applicable to the axis corresponding to Y7 when using DSZR/ZRN. When
SM370 Clearing function enabling this element is set, the CLR signal output of the zero return instruction is R/W
valid, or invliad otherwise
Applicable to the axis corresponding to Y7 when using DSZR. When this
Clearing signal element
SM371 element is set, the Y element, whose SN is the value of SD206, is a clearing R/W
assignment enabling
signal. When this element is cleared, Y17 is the clearing signal by default
Applicable to the axis corresponding to Y7 when using DSZR. When this
SM372 Zero return direction element is set, the zero return direction is the FWD direction. When this R/W
element is cleared, the zero return direction is the REV direction
Applicable to the axis corresponding to Y7 when using DSZR. When this
SM373 FWD limit element is set, it means the limit to the FWD direction is reached, or not R/W
reached otherwise
Applicable to the axis corresponding to Y7 when using DSZR. When this
SM374 REV limit element is set, it means the limit to the REV direction is reached, or not R/W
reached otherwise
Applicable to the axis corresponding to Y7 when using DSZR. When this
element is set, it means negative logic (proximity signal being ON when
SM375 Proximity signal logic reverse R/W
input is OFF), or positive logic (proximity signal being ON when input is ON)
otherwise
Chapter 11 Motion Control Tutorial 343

Applicable to the axis corresponding to Y7 when using DSZR. When this


element is set, it means negative logic (zero point signal being ON when
SM376 Zero point logic reverse R/W
input is OFF), or positive logic (zero point signal being ON when input is
ON) otherwise
Locating instruction being Monitor the state of high speed output channel Y7 when executing DSZR.
SM378 R/W
driven ON: busy. OFF: ready
Note: When SM370 is set, the default clearing signal Y17 corresponding to the output axis will output a CLR pulse upon zero return.
The pulse width is 20ms + 1 scan cycle. If the default clearing signal of this axis is used for other purposes, you should reset SM370
to disable the clearing function

Table 11-19 High-speed pulse output control (Y7)


Addr. Name Register content R/W
SD170 Total output pulse number (MSB) R/W
Used to calculate and store the absolute position. Each time a locating
SD171 Total output pulse number (LSB) R/W
instruction is executed, SD170 ~ SD171 and direction signal are used to
Current value (MSB) of absolute
SD370 calculate and update SD370 ~ SD371. Each time the absolute position data R/W
position
is read from servo driver upon power on, the data (32-bit long integer) should
Current value (LSB) of absolute
SD371 be stored to SD370 R/W
position
SD372 Max. speed (MSB) The max. speed when the output axis executes a locating instruction. Range: R/W
SD373 Max. speed (LSB) 10 ~ 100000. Unit: pulse R/W
The base speed when the output axis executes a locating instruction, slower
SD374 Base speed R/W
than 1/10 of the max. speed
The acc./dec. time when the output axis executes a locating instruction.
SD375 Acc./Dec. time R/W
Range: 50 ~ 5000. Unit: ms
When SM371 is set, SD376 specifies the SN of the Y element that will be the
SD376 Clearing signal element R/W
clearing signal
Applicable to the DSZR instruction as the crawling speed when executing the
SD377 Crawling speed R/W
instruction
SD378 Zero return speed (MSB) Applicable to the DSZR instruction as the zero return speed when executing R/W
SD379 Zero return speed (LSB) the instruction R/W
SD227 Section SN. of PLS output Applicable to PLS, used to detect the SN of the current section being output R
Note
1: SD372 ~ SD375 are adjustable according to your needs, just make sure they are set before the locating instruction is driven. If
they are changed during the execution of a locating instruction, the instruction execution may fail.
2: the base speed must be slower than 1/10 of the max. speed, or there will be no pulse output. No pulse will be output also when
the speed of a locating instruction exceeds the range between base speed and max. speed

Monitors of high speed pulse output channels


Addr. Name Function R/W MC200 MC100 Remark
Y0 high speed pulse Y0 high speed pulse output stop Setting SM80 and SM81 respectively
SM80 R/W √ √
output control instruction can disable the high speed pulse
Y1 high speed pulse Y1 high speed pulse output stop output of Y0 and Y1, and resetting
SM81 R/W √ √
output control instruction SM80 & SM81 enables the function
Y0 high speed pulse Y0 high speed pulse output
SM82 R √ √ SM82 and SM83 can be used to
output monitor mointor (ON: busy. OFF: ready)
monitor the state of high speed
Y1 high speed pulse Y1 high speed pulse output
SM83 R √ √ output channel
output monitor monitor (ON: busy. OFF: ready)
When SM85 is set, the CLR signals
Clearing function Output of CLR signal for ZRN for high speed outputs Y0 and Y1
SM85 R/W √
enabled instruction enabled are output through Y2 and Y3
respectively

 Note
If SM85 is set, when the ZRN instruction is executed, Y2 or Y3 will output a CLR pulse with the width of 20ms longer than the
scan cycle. If Y2 or Y3 is used for other purposes, you should reset SM85 to disable that function.
344 Chapter 10 Using Communication Function

Special data registers for Position instructions


Initial
Addr. Name R/W MC200 MC100 Remark
value
Current value of Y0 output Position SD80 ~ SD83 are used to store and
SD80 R/W V1.29 √
instruction (MSB) calculate the absolute position. Their values
0
The current value of Y0 output Position are based on SD50 ~ SD53 and the control
SD81 R/W V1.29 √
instruction (LSB) signal direction when the Position
The current value of Y1 output Position instruction is executed. Whenever the PLC
SD82 R/W V1.29 √
instruction (MSB) is ON and the absolute position data is read
0
The current value of Y1 output Position from the servo amplifier, put the position
SD83 R/W V1.29 √
instruction (LSB) data (32-bit integer) into SD80 or SD82
Basic frequency of executing of 1. You can change SD84, SD85, SD86 and
SD84 R/W V1.29 √ 5000
instructions ZRN, DRVI and DRVA SD87 according to the actual need.
Highest frequency of executing of However, do not make the change during
SD85 instructions ZRN, DRVI and DRVA R/W V1.29 √ the execution of Position instruction, or the
(MSB) instruction may fail.
100000
Highest frequency of executing of 2. The SD84 basic frequency must be
SD86 instructions ZRN, DRVI and DRVA R/W V1.29 √ smaller than 1/10 of SD85 highest
(LSB) frequency, or SD84 will be set automatically
as 1/10 of highest frequency. When the
Acceleration or deceleration time of
frequency in a Position instruction is smaller
SD87 executing of instructions ZRN, DRVI R/W V1.29 √ 1000
than the basic frequency or higher than the
and DRVA
highest frequency, no pulse will be output
Chapter 11 Motion Control Tutorial 345

System wiring diagram(0418)

220Vac

HC-MFS13
L N
Note 9
QF KM
L1 U U
220Vac Servo
L2 V V motor
L3 W W
L11 PE E
PLC L21 PE

PG connecting Absoluate
X0 Stop cable
CN2 value
X1 Zero return PG
X2 Forward jogging
Servo
X3 Reverse jogging
amplifier
X4 Forward position control
X5 Reverse position control
X6 Proximity signal
X7 System start
COM
S/S CN1B
Note 10
+24V COM
COM SG

Shielded cable CN1A


Instruction pulse
Y0 PP
COM0 SG
Y1 SD
COM1 Shielded cable
Clearing signal
Y2 CR
Y3 SG
SD
Instruction direction signal
Y4 NP
COM2 SG
Shielded cable SD
COM
OPC
CN1B
CN1B
X10 DO1 Note 1
EMG Emergency stop button
X11 ZSP Note 2
RES Reset button
X12 TLC Note 3
LSP Forward limit swtich
X13 ALM
LSN Reverse limit switch
X14 RD
SG
COM SG
Y10 SON Note 4

Y11 ABSM Note 5

Y12 ABSR Note 6

COM3
EC10-1614BTA Note 7
MR-J2S-10A
Note 8

Note 1: ABSM serves as the ABS bit 1 transmission cable when set ON, or as the locating complete signal when set OFF.
Note 2: ABSM serves as the ABS bit 2 transmission cable when set ON, or as the zero speed signal when set OFF.
Note 3: ABSM serves as the "data transmission ready" signal when set ON, or as the "torque being limited" when set OFF.
Note 4: Servo enabling signal. It must be set before the ABS instruction is executed.
Note 5: The ABS transmission mode signal.
Note 6: The ABS transmission request signal.
Note 7: It must be a PLC basic module with transistor output.
Note 8: Install the servo amplifier according to the related instruction manual. Note that many plugs looks the same, do not get confused.
Note 9: You need to control KM through the program to cut off the power upon alarms or emergencies.
Note 10: The PLC uses sink input in this example. Short the +24V and the S/S terminals here.

Figure 11-3 System wiring diagram

Program example
The aimed functions of the program are:
 When the PLC enters the RUN state, read the absolute position data from the servo amplifier through the ABS
instruction or through communication (note that in this case, the servo amplifier must be powered on with the
PLC at least at the same time)
 SM85 is set after PLC enters the RUN state to set the output clearing function, and Y2 will output a clearing
pulse whenever zero return occurs.
 Press the JOG+ button to jog forward.
 Press the JOG - button to jog backward.
 When the workbench is away from the zero point farther than the proximity detection point, press the Zero
Return button to make it return to the zero point.
346 Chapter 10 Using Communication Function

 Press the STOP button and a running workbench will stop immediately.
 Use the Forward/Reverse Positioning control buttons to locate the workbench
Chapter 11 Motion Control Tutorial 347
348 Chapter 10 Using Communication Function
Appendix 1 Special Auxiliary Relay 349

Special Auxiliary Relay

All the special auxiliary relays are initialized when the PLC changes from STOP to RUN. Those that have been set in
system setting will be set to the present value after that initialization.

 Note
The reserved SD and SM elements are not listed in the table. The reserved SM elements are by default read only (R).

PLC Work State Flag


Addr. Name Action and function R/W MC200 MC100 MC280
SM0 Monitoring run bit This bit is high in the RUN state, and low in the STOP state R √ √ √
This bit is set high when PLC changes form STOP to RUN, and
SM1 Initial run pulse bit R √ √ √
set low after a scan cycle
This bit is set high after system power-on, and set low after a
SM2 Power on flag bit R √ √ √
scan cycle
This bit is set when system error occurs after power-on or after
SM3 System error PLC changes from STOP to RUN, or reset if no system error R √ √ √
occurs
Battery voltage This bit is set when the battery voltage is too low, or reset if the
SM4 R √ √
low battery voltage is detected higher than 2.4V
This bit is set when PLC detects AC power off (detecting time
AC power failure
SM5 40ms). If the power is on after the delay of power off detecting R √ √ √
detection bit
time (set in SD05), the bit will be reset
This bit is set when PLC detects the 24Vdc power failure
24Vdc power
SM6 (detecting time 50ms). If within the following 50ms the power is R √ √ √
failure
detected to be back, this bit will be reset
If this bit is set as 1 (configurable only through system block),
No battery work the Battery-backed data lost error (code: 43) and the
SM7 R √ √
mode Forced-table lost error (code: 44) will not be reported upon
system battery failure
Constant scan Set this bit, and the scan time will be constant (configurable
SM8 R √ √ √
mode only through system block)
Set this bit, and the PLC can change from STOP to ON when
Input point startup
SM9 the designated X input point is ON (configurable only through R √ √ √
mode
system block)

Clock Running Bit


Addr. Name Action and function R/W MC200 MC100 MC280
Crystal oscillation (period: 10ms). Reverse every half period. The
SM10 10ms clock R √ √ √
first half period is 0 when the user program starts
Crystal oscillation (period: 100ms). Reverse every half period.
SM11 100ms clock R √ √ √
The first half period is 0 when the user program starts
Crystal oscillation (period: 1s). Reverse every half period. The
SM12 1s clock R √ √ √
first half period is 0 when the user program starts
Crystal oscillation (period: 1min). Reverse every half period. The
SM13 1min clock R √ √ √
first half period is 0 when the user program starts
Crystal oscillation (period: 1 hour). Reverse every half period.
SM14 1hour clock R √ √ √
The first half period is 0 when the user program starts
Scan cycle This bit reverses once every scan cycle (The first period is 0
SM15 R √ √ √
oscillation bit when the user program starts)
High speed ring 0.1ms,16bit
SM16 counter enable Reset: High speed ring counter starte R/W √
flag Clear: High speed ring counter stop
350 Appendix 1 Special Auxiliary Relay

Addr. Name Action and function R/W MC200 MC100 MC280

AC failure Set 1:220V 3.001


SM17 R/W
detection Clear 0:110/220V √

Unsaving
Set 1:input/output clear,LM clear,after that SM19 reset 3.009
SM18 elements R/W
automaticly √
clearing
Saving
Set 1: the power failure retention component reset,after that 3.009
SM19 elements R/W
SM19 reset automaticly √
clearing

User Program Execution Error


MC2
Addr. Name Action and function R/W MC200 MC100
80
This bit is set upon instruction execution error. Ths
Instruction execution
SM20 corresponding error type code is written into SD20. This bit is R √ √ √
error
cleared after the execution succeeds
Instruction register
This bit is set upon instruction execution error. The
SM21 number subscript R √ √ √
corresponding error type code is written into SD20
overflow
This bit is set upon instruction execution error. The
Instruction parameter
SM22 corresponding error type code is written into SD20. This bit is R √ √ √
illegal
cleared after the execution succeeds

SM30 Instruction execute end Connect when MODRW instruction end R √ √

Interrupt Control
MC28
Addr. Name Action and function R/W MC200 MC100
0
SM40 X0 input rising/falling edge interrupt enabling flag bit Enable when set as 1 R/W √ √ √
SM41 X1 input rising/falling edge interrupt enabling flag bit Enable when set as 1 R/W √ √ √
SM42 X2 input rising/falling edge interrupt enabling flag bit Enable when set as 1 R/W √ √ √
SM43 X3 input rising/falling edge interrupt enabling flag bit Enable when set as 1 R/W √ √ √
SM44 X4 input rising/falling edge interrupt enabling flag bit Enable when set as 1 R/W √ √ √
SM45 X5 input rising/falling edge interrupt enabling flag bit Enable when set as 1 R/W √ √ √
SM46 X6 input rising/falling edge interrupt enabling flag bit Enable when set as 1 R/W √ √ √
SM47 X7 input rising/falling edge interrupt enabling flag bit Enable when set as 1 R/W √ √ √
SM48 COM 0 character transmission interrupt enabling flag bit Enable when set as 1 R/W √ √
SM49 COM 0 character reception interrupt enabling flag bit Enable when set as 1 R/W √ √
SM50 COM 0 frame transmission interrupt enabling flag bit Enable when set as 1 R/W √ √
SM51 COM 0 frame reception interrupt enabling flag bit Enable when set as 1 R/W √ √
SM52 COM 1 character transmission interrupt enabling flag bit Enable when set as 1 R/W √ √
SM53 COM 1 character reception interrupt enabling flag bit Enable when set as 1 R/W √ √
SM54 COM 1 frame transmission interrupt enabling flag bit Enable when set as 1 R/W √ √
SM55 COM 1 frame reception interrupt enabling flag bit Enable when set as 1 R/W √ √
SM56 Power failure interrupt Enable when set as 1 R/W √ √
SM57 COM 2 character transmission interrupt enabling flag bit Enable when set as 1 R/W √
SM58 COM 2 character reception interrupt enabling flag bit Enable when set as 1 R/W √
SM59 COM 2 frame transmission interrupt enabling flag bit Enable when set as 1 R/W √
SM60 COM 2 frame reception interrupt enabling flag bit Enable when set as 1 R/W √
SM61 Position interrupt 1 enabling flag bit Enable when set as 1 R/W √
SM62 Position interrupt 2 enabling flag bit Enable when set as 1 R/W √
SM63 PTO (Y0) output finish interrupt enable flag bit Enable when set as 1 R/W √ √
SM64 PTO (Y1) output finish interrupt enable flag bit Enable when set as 1 R/W √ √
SM65 High speed counter interrupt enabling flag bit Enable when set as 1 R/W √ √ √
SM66 Timed interrupt 0 enabling flag bit Enable when set as 1 R/W √ √ √
SM67 Timed interrupt 1 enabling flag bit Enable when set as 1 R/W √ √ √
Appendix 1 Special Auxiliary Relay 351

MC28
Addr. Name Action and function R/W MC200 MC100
0
SM68 Timed interrupt 2 enabling flag bit Enable when set as 1 R/W √ √ √
Interpolation interrupt 1 √
SM69 Interpolation complete interrupt 1 enable flag bit R/W
when set as 1
POT(Y2)output complete √
SM72 High speed output 2 complete interrupt enable flag bit R/W
interrupt
POT(Y3)output complete √
SM73 High speed output 3 complete interrupt enable flag bit R/W
interrupt
POT(Y4)output complete √
SM74 High speed output 4 complete interrupt enable flag bit R/W
interrupt
POT(Y5)output complete √
SM75 High speed output 5 complete interrupt enable flag bit R/W
interrupt
POT(Y6)output complete √
SM76 High speed output 6 complete interrupt enable flag bit R/W
interrupt
POT(Y7)output complete √
SM77 High speed output 7 complete interrupt enable flag bit R/W
interrupt
Interpolation interrupt 1 √
SM78 Interpolation complete interrupt 2 enable flag bit R/W
when set as 1
Interpolation interrupt 1 √
SM79 Interpolation complete interrupt 3 enable flag bit R/W
when set as 1
Position interrupt 3 when √
SM105 Position interrupt 3 enabling flag bit R/W
set as 1
Position interrupt 4 when √
SM106 Position interrupt 4 enabling flag bit R/W
set as 1
Position interrupt 5 when √
SM107 Position interrupt 5 enabling flag bit R/W
set as 1
Position interrupt 6 when √
SM108 Position interrupt 6 enabling flag bit R/W
set as 1

Peripherals instrucion
Addr. Name Action and function R/W MC200 MC100 MC280
SM70 Print mode select Set 1:1~16 characters,set 0:8 characters fixed R √ √
SM71 Printing Set 1:printing R √ √

High Speed Pulse Output Control


MC28
Addr. Name Function R/W MC200 MC100
0
SM80 Y0 high speed pulse output control Y0 high speed pulse output stop instruction R/W √ √ √
SM81 Y1 high speed pulse output control Y1 high speed pulse output stop instruction R/W √ √
Y0 high speed pulse output mointor (ON: busy.
SM82 Y0 high speed pulse output monitor R √ √ √
OFF: ready)
Y1 high speed pulse output mointor (ON: busy.
SM83 Y1 high speed pulse output monitor R √ √
OFF: ready)
Output of CLR signal for ZRN instruction
SM85 Reset function valid R/W √
enabled
ON;interrupt program and subroutine can call
Y0 interrupt driving inpulse output
SM86 PLSY instruction,drive repeatedly as the main R √ √ √
enable
program call
ON;interrupt program and subroutine can call
Y1 nterrupt driving inpulse output
SM87 PLSY instruction,drive repeatedly as the main R √ √ √
enable
program call

SM88 Envelop execute repeatedly On: Envelop execute repeatedly √

PLSV frequency convertion by


SM89 On: frequency convertion by degrees √
degrees
352 Appendix 1 Special Auxiliary Relay

Pulse Capture Monitoring Bit


Addr. Name Function R/W MC200 MC100 MC280
Capture rising edge pulse at √ √ √
SM90 R/W
input X0
Capture rising edge pulse at √ √ √
SM91 Input X1 pulse capture monitoring bit R/W
input X1
Capture rising edge pulse at √ √ √
SM92 Input X2 pulse capture monitoring bit R/W
input X2
Capture rising edge pulse at √ √ √
SM93 Input X3 pulse capture monitoring bit R/W
input X3
Capture rising edge pulse at √ √ √
SM94 Input X4 pulse capture monitoring bit R/W
input X4
Capture rising edge pulse at √ √ √
SM95 Input X5 pulse capture monitoring bit R/W
input X5
Capture rising edge pulse at √ √ √
SM96 Input X6 pulse capture monitoring bit R/W
input X6
Capture rising edge pulse at √ √ √
SM97 Input X7 pulse capture monitoring bit R/W
input X7
Note:
1. All the elements in this table are cleared when the PLC changes from STOP to RUN. The pulse capture will fail when the HSNT or
SPD instruction is being executed at the same input point. For details, see 6.10.8 SPD: Pulse Detection Instruction and 6.10.1
HCNT: High-speed Counter Drive Instruction.
2. For hardware counters, the total pulse frequency input through X0 ~ X7 (using pulse capture, SPD instruction or HCNT
instructions, but not high speed compare instructions) is ≤80k. For software counters, that frequency (using instructions DHSCS,
DHSCI, DHSZ, DHSP or DHST for driven high speed counters) is ≤30k.

Quadruplicated frequency
Addr. Name Function R/W MC200 MC100 MC280
Capture rising edge pulse at
SM100 The AB phase 1 or 4 times switch of X0,X1 R/W √ √ √
input X0
Capture rising edge pulse at
SM101 The AB phase 1 or 4 times switch of X2,X3 R/W √ √ √
input X1
Capture rising edge pulse at
SM102 The AB phase 1 or 4 times switch of X3,X4 R/W √
input X2
Capture rising edge pulse at
SM103 The AB phase 1 or 4 times switch of X4,X5 R/W √
input X3
Capture rising edge pulse at
SM104 The AB phase 1 or 4 times switch of X6,X7 R/W √
input X4
Appendix 1 Special Auxiliary Relay 353

Free Port (Port 0)


Addr. Name Action and function R/W MC200 MC100 MC280
This bit is set when XMT instruction is used, and
is cleared after the transmission is over. You can
Port 0 transmission
SM110 manually clear this bit to halt the current R/W √ √ √
enabling flag bit
transmission at Port 0. The transmission can
resume when power flow is on again
This bit is set when RCV instruction is used, and
is cleared after the transmission is over. You can
Port 0 reception
SM111 manually clear this bit to halt the current R/W √ √ √
enabling flag bit
transmission at Port 0. The transmission can
resume when power flow is on again
Port 0 transmission
SM112 This bit is set after the transmission is over R/W √ √ √
complete flag bit
Port 0 reception
SM113 This bit is set after the reception is over R/W √ √ √
complete flag bit
SM114 Port 0 idle flag bit This bit is set when the port is idle R √ √ √

 Note
SM112 ~ SM114 are the flags for the reception, complete and idle states in all communication protocols that are supported by
PORT 0. For example, the PORT 0 of MC100 PLC supports MCbus, Modbus and Freeport. No matter which protocol is used,
the functions of SM112 ~ SM114 remain the same.

Free Port (Port 1)


Addr. Name Action and function R/W MC200 MC100 MC280
This bit is set when XMT instruction is used, and is cleared
Port 1 transmission after the transmission is over. You can manually clear this
SM120 R/W √ √ √
enabling flag bit bit to halt the current transmission at Port 1. The
transmission can resume when power flow is on again
This bit is set when RCV instruction is used, and is cleared
Port 1 reception after the transmission is over. You can manually clear this
SM121 R/W √ √ √
enabling flag bit bit to halt the current transmission at Port 1. The
transmission can resume when power flow is on again
Port 1 transmission
SM122 This bit is set after the transmission is over R/W √ √ √
complete flag bit
Port 1 reception
SM123 This bit is set after the reception is over R/W √ √ √
complete flag bit
SM124 Port 1 idle flag bit This bit is set when the port is idle R √ √ √

 Note
SM122 ~ SM124 are the flags for the reception, complete and idle states in all communication protocols that are supported by
Port 1 . For example, the Port 1 of MC100 PLC supports MCbus, Modbus and Freeport. No matter which protocol is used, the
functions of SM122 ~ SM124 remain the same.

Modbus Communication
MC2
Addr. Name Action and function R/W MC200 MC100
80
COM1 Modbus communication
SM135 This bit is set after the communication is over R/W √ √ √
complete
COM1 Modbus communication
SM136 This bit is set upon communication error R/W √ √ √
error
COM2 Modbus communication
SM137 This bit is set upon communication error R/W √ √
complete
COM2 Modbus communication
SM138 This bit is set upon communication error R/W √ √
error
354 Appendix 1 Special Auxiliary Relay

MCbus Communication
Addr. Name Action and function R/W MC200 MC100 MC280
SM140 Station 0 communication error flag R √ √ √
SM141 Station 1 communication error flag R √ √ √
SM142 Station 2 communication error flag R √ √ √
SM143 Station 3 communication error flag R √ √ √
SM144 Station 4 communication error flag R √ √ √
SM145 Station 5 communication error flag R √ √ √
SM146 Station 6 communication error flag R √ √ √
SM147 Station 7 communication error flag R √ √ √
SM148 Station 8 communication error flag R √ √ √
SM149 Station 9 communication error flag R √ √ √
SM150 Station 10 communication error flag R √ √ √
SM151 Station 11 communication error flag R √ √ √
SM152 Station 12 communication error flag R √ √ √
SM153 Station 13 communication error flag R √ √ √
SM154 Station 14 communication error flag R √ √ √
SM155 Station 15 communication error flag R √ √ √
SM156 Station 16 communication error flag R √ √ √
SM157 Station 17 communication error flag R √ √ √
SM158 Station 18 communication error flag R √ √ √
SM159 Station 19 communication error flag R √ √ √
SM160 Station 20 communication error flag R √ √ √
SM161 Station 21 communication error flag R √ √ √
SM162 Station 22 communication error flag R √ √ √
SM163 Station 23 communication error flag R √ √ √
SM164 Station 24 communication error flag R √ √ √
SM165 Station 25 communication error flag R √ √ √
SM166 Station 26 communication error flag R √ √ √
SM167 Station 27 communication error flag R √ √ √
SM168 Station 28 communication error flag R √ √ √
SM169 Station 29 communication error flag R √ √ √
SM170 Station 31 communication error flag R √ √ √
SM171 Station 32 communication error flag R √ √ √

Enabling Flag Of Integrated Analog Channel


Addr. Name Action and function R/W MC200 MC100 MC280
Enabling flag of AD Sampling at AD channel 0 is enabled
SM172 R/W √
channel 0 when this bit is set to 1
Enabling flag of AD Sampling at AD channel 1 is enabled
SM173 R/W √
channel 1 when this bit is set to 1
Voltage/current enabling
SM174 1 for current input and 0 for voltage input R/W √
flag of AD channel 0
Voltage/current enabling
SM175 1 for current input and 0 for voltage input R/W √
flag of AD channel 1
Enabling flag of DA Output at DA channel 0 is enabled when
SM178 R/W √
channel 0 this bit is set to 1
Appendix 1 Special Auxiliary Relay 355

Operation Flag Bit


Addr. Name Action and function R/W MC200 MC100 MC280
This bit is set when the related calculation result
SM180 Zero flag bit R/W √ √ √
is zero. You can clear or set this bit manually
This bit is set when the result of the related
SM181 Carry/overflow flag bit calculation is a carry. You can clear or set this R/W √ √ √
bit manually
This bit is set when the result of the related
SM182 borrow flag bit calculation is a borrow. You can clear or set this R/W √ √ √
bit manually
This bit is set when the whole table is √ √ √
SM185 Table comparison flag R/W
completed
Digital block compare √
SM188 Reset when the compare result is 1 R/W
reset

ASCII Code Conversion Instruction Flag


Addr. Name Action and function R/W MC200 MC100 MC280
0: the most and least significant bytes of every word
ASC instruction are stored with one ASCII code
SM186 R/W √ √
storing mode flag 1: the least significant byte of every word is stored
with one ASCII code

SAVER instruction Set the flag bit when all of data reversed,reset while
SM189 R √
execute end flag bit the instruction execute effective

System Bus Error Flag


Addr. Name Action and function R/W MC200 MC100 MC280
The bit, when set 1, would stop the system. You can
reset this bit by:
Basic module
SM190 1. Powering-on the PLC again R √ √ √
bus error flag bit
2. Changing PLC status from STOP to RUN
3. Downloading a new program
1. This bit is set and the system raises an alarm when a
General module general module bus operation error occurs
SM191 R √ √ √
bus error flag bit 2. This bit is reset automatically when the system error
is removed
1. This bit is set and the system raises an alarm when a
Special module special module bus operation error occurs
SM192 R √ √ √
bus error flag bit 2. This bit is reset automatically when the system error
is removed

Real-Time Clock Error Flag


Addr. Name Action and function R/W MC200 MC100 MC280
This bit is set upon real-time clock error
SM193 R/W of real time clock error This bit is automatically cleared if system R √ √ √
fault is removed
356 Appendix 1 Special Auxiliary Relay

Counting Direction Of Bi-directional Counters


Addr. Counter addr. Function R/W MC200 MC100 MC280
SM200 C200 R/W √ √ √
SM201 C201 R/W √ √ √
SM202 C202 R/W √ √ √
SM203 C203 R/W √ √ √
SM204 C204 R/W √ √ √
SM205 C205 R/W √ √ √
SM206 C206 R/W √ √ √
SM207 C207 R/W √ √ √
SM208 C208 R/W √ √ √
SM209 C209 R/W √ √ √
SM210 C210 R/W √ √ √
SM211 C211 R/W √ √ √
SM212 C212 R/W √ √ √
SM213 C213 R/W √ √ √
SM214 C214 R/W √ √ √
SM215 C215 When SM2 _ _ is of high level, the R/W √ √ √
SM216 C216 corresponding C2_ _ becomes a R/W √ √ √
SM217 C217 down counter R/W √ √ √
SM218 C218 When SM2 _ _ is of low level, the R/W √ √ √
SM219 C219 corresponding C2_ _ becomes a R/W √ √ √
SM220 C220 up counter R/W √ √ √
SM221 C221 R/W √ √ √
SM222 C222 R/W √ √ √
SM223 C223 R/W √ √ √
SM224 C224 R/W √ √ √
SM225 C225 R/W √ √ √
SM226 C226 R/W √ √ √
SM227 C227 R/W √ √ √
SM228 C228 R/W √ √ √
SM229 C229 R/W √ √ √
SM230 C230 R/W √ √ √
SM231 C231 R/W √ √ √
SM232 C232 R/W √ √ √
SM233 C233 R/W √ √ √
SM234 C234 R/W √ √ √
SM235 C235 R/W √ √ √
Appendix 1 Special Auxiliary Relay 357

Counting Direction And Monitoring Of High Speed Counter


Type Addr. Name Register content R/W MC200 MC100 MC280
SM236 C236 R √ √ √
SM237 C237 R √ √ √
SM238 C238 R √ √ √
Single SM239 C239 R √ √ √
phase SM240 C240 R √ √ √
The high & low level of SM2 _ _
single
SM241 C241 corresponds to the counting down & up R √ √ √
point
SM301 C301 of the counter respectively R √
counting
SM302 C302 R √
input
SM242 C242 R √ √ √
SM243 C243 R √ √ √
SM244 C244 R √ √ √
Single SM245 C245 R √ √ √
phase SM246 C246 R √ √ √
bidirect- SM247 C247 R √ √ √
ional SM301 C301 R √
counting SM248 C248 R √ √ √
When the single phase bi-directional
input SM249 C249 R √ √ √
counter and 2-phase counter C2 _ _ is in
SM250 C250 the down counting mode, the R √ √ √
SM251 C251 corresponding SM2 _ _ becomes high R √ √ √
SM304 C304 level; when in up counting mode, the R √
SM305 C305 corresponding SM2 _ _ becomes low R √
level
SM306 C306 R √
AB
SM252 C252 R √ √ √
phase
counting SM253 C253 R √ √ √
input SM254 C254 R √ √ √
SM255 C255 R/ √ √ √
SM256 C256 R/ √
SM257 C257 R/ √
SM258 C258 R/ √
SM259 C259 R/ √
358 Appendix 1 Special Auxiliary Relay

Enhanced Positioning

Addr. Name Action and function R/W MC200 MC100 MC280


Interrupt input assignment √ √
SM260 Y0,Y1, applicable to DSZR/DVIT R/W
enabling
Y1 high speed pulse output √
SM261 Y1 high speed pulse output stop instruction R/W
control
SM262 Y2 pulse output stop Y2 will stop pulse output when this element is set R/W √
SM263 Y3 pulse output stop Y3 will stop pulse output when this element is set R/W √
When set, this element can stop the high speed pulse output √
SM264 Pulse output stop control R/W
of Y4; when this element is cleared, the output resumes
When set, this element can stop the high speed pulse output √
SM265 Pulse output stop control R/W
of Y5; when this element is cleared, the output resumes
When set, this element can stop the high speed pulse output √
SM266 Pulse output stop control R/W
of Y6; when this element is cleared, the output resumes
When set, this element can stop the high speed pulse output √
SM267 Pulse output stop control R/W
of Y7; when this element is cleared, the output resumes
Monitor the state of high speed output channel Y1. ON: busy. √
SM271 Y1 pulse output monitor R
OFF: ready
Y2 pulse output monitor √
SM272 Monitor Y2 high speed pulse output (ON: busy. OFF: ready) R
(busy/ready)
Y3 pulse output monitor √
SM273 Monitor Y3 high speed pulse output (ON: busy. OFF: ready) R
(busy/ready)
Monitor the state of high speed output channel Y4. ON: busy. √
SM274 Pulse output monitor R
OFF: ready
Monitor the state of high speed output channel Y5. ON: busy. √
SM275 Pulse output monitor R
OFF: ready
Monitor the state of high speed output channel Y6. ON: busy. √
SM276 Pulse output monitor R
OFF: ready
Monitor the state of high speed output channel Y7. ON: busy. √
SM277 Pulse output monitor R
OFF: ready
Enabling the CLR signal output function (Y0) for ZRN and √ √
SM280 Clearing function enabling R/W
DSZR instructions
When SM281 set, the Y element wohse SN is the value of √ √
Clearing signal element
SM281 SD206 is the clearing signal of Y0. Otherwise, by default, Y10 R/W
assignment enabling
is the clearing signal of Y0. This is applicable to DSZR
SM282 Zero return direction Y0, applicable to DSZR R/W √ √
SM283 Forward rotation limit Y0, applicable to DSZR/DVIT R/W √ √
SM284 Reverse rotation limit Y0, applicable to DSZR/DVIT R/W √ √
SM285 Proximity signal logic reverse Y0, applicable to DSZR R/W √ √
Zero point signal logic √ √
SM286 Y0, applicable to DSZR R/W
reverse
Position instruction being √ √
SM288 Y0, applicable to DSZR/DVIT R/W
driven
Enabling the CLR signal output function (Y1) for ZRN and √
SM310 Clearing function enabling R/W
DSZR instructions
When SM311 set, the Y element wohse SN is the value of √
Clearing signal element
SM311 SD316 is the clearing signal of Y1. Otherwise, by default, Y11 R/W
assignment enabling
is the clearing signal of Y1. This is applicable to DSZR
SM312 Zero return direction Y1, applicable to DSZR R/W √
SM313 Forward rotation limit Y1, applicable to DSZR R/W √
SM314 Reverse rotation limit Y1, applicable to DSZR R/W √
SM315 Proximity signal logic reverse Y1, applicable to DSZR R/W √
Zero point signal logic √
SM316 Y1, applicable to DSZR R/W
reverse
Position instruction being Monitor the state of high speed output channel Y1 when √
SM318 R/W
driven executing DSZR. ON: busy. OFF: ready
Appendix 1 Special Auxiliary Relay 359

Applicable to the axis corresponding to Y2 when using √


SM320 Clearing function enabling DSZR/ZRN. When this element is set, the CLR signal output R/W
of the zero return instruction is valid, or invliad otherwise
Applicable to the axis corresponding to Y2 when using DSZR. √
Clearing signal element When this element is set, the Y element, whose SN is the
SM321 R/W
assignment enabling value of SD206, is a clearing signal. When this element is
cleared, Y12 is the clearing signal by default
Applicable to the axis corresponding to Y2 when using DSZR. √
When this element is set, the zero return direction is the FWD
SM322 Zero return direction R/W
direction. When this element is cleared, the zero return
direction is the REV direction
Applicable to the axis corresponding to Y2 when using DSZR. √
SM323 FWD limit When this element is set, it means the limit to the FWD R/W
direction is reached, or not reached otherwise
Applicable to the axis corresponding to Y2 when using DSZR. √
SM324 REV limit When this element is set, it means the limit to the REV R/W
direction is reached, or not reached otherwise
Applicable to the axis corresponding to Y2 when using DSZR. √
When this element is set, it means negative logic (proximity
SM325 Proximity signal logic reverse R/W
signal being ON when input is OFF), or positive logic
(proximity signal being ON when input is ON) otherwise
Applicable to the axis corresponding to Y2 when using DSZR. √
When this element is set, it means negative logic (zero point
SM326 Zero point logic reverse R/W
signal being ON when input is OFF), or positive logic (zero
point signal being ON when input is ON) otherwise
Position instruction being Monitor the state of high speed output channel Y2 when √
SM328 R/W
driven executing DSZR. ON: busy. OFF: ready
Applicable to the axis corresponding to Y3 when using √
SM330 Clearing function enabling DSZR/ZRN. When this element is set, the CLR signal output R/W
of the zero return instruction is valid, or invliad otherwise
Applicable to the axis corresponding to Y3 when using DSZR. √
Clearing signal element When this element is set, the Y element, whose SN is the
SM331 R/W
assignment enabling value of SD336, is a clearing signal. When this element is
cleared, Y13 is the clearing signal by default
Applicable to the axis corresponding to Y3 when using DSZR. √
When this element is set, the zero return direction is the FWD
SM332 Zero return direction R/W
direction. When this element is cleared, the zero return
direction is the REV direction
Applicable to the axis corresponding to Y3 when using DSZR. √
SM333 FWD limit When this element is set, it means the limit to the FWD R/W
direction is reached, or not reached otherwise
Applicable to the axis corresponding to Y3 when using DSZR. √
SM334 REV limit When this element is set, it means the limit to the REV R/W
direction is reached, or not reached otherwise
Applicable to the axis corresponding to Y3 when using DSZR. √
When this element is set, it means negative logic (proximity
SM335 Proximity signal logic reverse R/W
signal being ON when input is OFF), or positive logic
(proximity signal being ON when input is ON) otherwise
Applicable to the axis corresponding to Y3 when using DSZR. √
When this element is set, it means negative logic (zero point
SM336 Zero point logic reverse R/W
signal being ON when input is OFF), or positive logic (zero
point signal being ON when input is ON) otherwise
Position instruction being Monitor the state of high speed output channel Y3 when √
SM338 R/W
driven executing DSZR. ON: busy. OFF: ready
Applicable to the axis corresponding to Y4 when using √
SM340 Clearing function enabling DSZR/ZRN. When this element is set, the CLR signal output R/W
of the zero return instruction is valid, or invliad otherwise
Applicable to the axis corresponding to Y4 when using DSZR. √
Clearing signal element When this element is set, the Y element, whose SN is the
SM341 R/W
assignment enabling value of SD206, is a clearing signal. When this element is
cleared, Y14 is the clearing signal by default
360 Appendix 1 Special Auxiliary Relay

Applicable to the axis corresponding to Y4 when using DSZR. √


When this element is set, the zero return direction is the FWD
SM342 Zero return direction R/W
direction. When this element is cleared, the zero return
direction is the REV direction
Applicable to the axis corresponding to Y4 when using DSZR. √
SM343 FWD limit When this element is set, it means the limit to the FWD R/W
direction is reached, or not reached otherwise
Applicable to the axis corresponding to Y4 when using DSZR. √
SM344 REV limit When this element is set, it means the limit to the REV R/W
direction is reached, or not reached otherwise
Applicable to the axis corresponding to Y4 when using DSZR. √
When this element is set, it means negative logic (proximity
SM345 Proximity signal logic reverse R/W
signal being ON when input is OFF), or positive logic
(proximity signal being ON when input is ON) otherwise
Applicable to the axis corresponding to Y4 when using DSZR. √
When this element is set, it means negative logic (zero point
SM346 Zero point logic reverse R/W
signal being ON when input is OFF), or positive logic (zero
point signal being ON when input is ON) otherwise
Position instruction being Monitor the state of high speed output channel Y4 when √
SM348 R/W
driven executing DSZR. ON: busy. OFF: ready
Applicable to the axis corresponding to Y5 when using √
SM350 Clearing function enabling DSZR/ZRN. When this element is set, the CLR signal output R/W
of the zero return instruction is valid, or invliad otherwise
Applicable to the axis corresponding to Y5 when using DSZR. √
Clearing signal element When this element is set, the Y element, whose SN is the
SM351 R/W
assignment enabling value of SD206, is a clearing signal. When this element is
cleared, Y15 is the clearing signal by default
Applicable to the axis corresponding to Y5 when using DSZR. √
When this element is set, the zero return direction is the FWD
SM352 Zero return direction R/W
direction. When this element is cleared, the zero return
direction is the REV direction
Applicable to the axis corresponding to Y5 when using DSZR. √
SM353 FWD limit When this element is set, it means the limit to the FWD R/W
direction is reached, or not reached otherwise
Applicable to the axis corresponding to Y5 when using DSZR. √
SM354 REV limit When this element is set, it means the limit to the REV R/W
direction is reached, or not reached otherwise
Applicable to the axis corresponding to Y5 when using DSZR. √
When this element is set, it means negative logic (proximity
SM355 Proximity signal logic reverse R/W
signal being ON when input is OFF), or positive logic
(proximity signal being ON when input is ON) otherwise
Applicable to the axis corresponding to Y5 when using DSZR. √
When this element is set, it means negative logic (zero point
SM356 Zero point logic reverse R/W
signal being ON when input is OFF), or positive logic (zero
point signal being ON when input is ON) otherwise
Position instruction being Monitor the state of high speed output channel Y5 when √
SM358 R/W
driven executing DSZR. ON: busy. OFF: ready
Applicable to the axis corresponding to Y6 when using √
SM360 Clearing function enabling DSZR/ZRN. When this element is set, the CLR signal output R/W
of the zero return instruction is valid, or invliad otherwise
Applicable to the axis corresponding to Y6 when using DSZR. √
Clearing signal element When this element is set, the Y element, whose SN is the
SM361 R/W
assignment enabling value of SD206, is a clearing signal. When this element is
cleared, Y16 is the clearing signal by default
Applicable to the axis corresponding to Y6 when using DSZR. √
When this element is set, the zero return direction is the FWD
SM362 Zero return direction R/W
direction. When this element is cleared, the zero return
direction is the REV direction
Applicable to the axis corresponding to Y6 when using DSZR. √
SM363 FWD limit When this element is set, it means the limit to the FWD R/W
direction is reached, or not reached otherwise
Appendix 1 Special Auxiliary Relay 361

Applicable to the axis corresponding to Y6 when using DSZR. √


SM364 REV limit When this element is set, it means the limit to the REV R/W
direction is reached, or not reached otherwise
Applicable to the axis corresponding to Y6 when using DSZR. √
When this element is set, it means negative logic (proximity
SM365 Proximity signal logic reverse R/W
signal being ON when input is OFF), or positive logic
(proximity signal being ON when input is ON) otherwise
Applicable to the axis corresponding to Y6 when using DSZR. √
When this element is set, it means negative logic (zero point
SM366 Zero point logic reverse R/W
signal being ON when input is OFF), or positive logic (zero
point signal being ON when input is ON) otherwise
Position instruction being Monitor the state of high speed output channel Y6 when √
SM368 R/W
driven executing DSZR. ON: busy. OFF: ready
Applicable to the axis corresponding to Y7 when using √
SM370 Clearing function enabling DSZR/ZRN. When this element is set, the CLR signal output R/W
of the zero return instruction is valid, or invliad otherwise
Applicable to the axis corresponding to Y7 when using DSZR. √
Clearing signal element When this element is set, the Y element, whose SN is the
SM371 R/W
assignment enabling value of SD206, is a clearing signal. When this element is
cleared, Y17 is the clearing signal by default
Applicable to the axis corresponding to Y7 when using DSZR. √
When this element is set, the zero return direction is the FWD
SM372 Zero return direction R/W
direction. When this element is cleared, the zero return
direction is the REV direction
Applicable to the axis corresponding to Y7 when using DSZR. √
SM373 FWD limit When this element is set, it means the limit to the FWD R/W
direction is reached, or not reached otherwise
Applicable to the axis corresponding to Y7 when using DSZR. √
SM374 REV limit When this element is set, it means the limit to the REV R/W
direction is reached, or not reached otherwise
Applicable to the axis corresponding to Y7 when using DSZR. √
When this element is set, it means negative logic (proximity
SM375 Proximity signal logic reverse R/W
signal being ON when input is OFF), or positive logic
(proximity signal being ON when input is ON) otherwise
Applicable to the axis corresponding to Y7 when using DSZR. √
When this element is set, it means negative logic (zero point
SM376 Zero point logic reverse R/W
signal being ON when input is OFF), or positive logic (zero
point signal being ON when input is ON) otherwise
Position instruction being Monitor the state of high speed output channel Y7 when √
SM378 R/W
driven executing DSZR. ON: busy. OFF: ready
SM430 Timing clock output 1 Applicable to DUTY instruction R/W √
SM431 Timing clock output 2 Applicable to DUTY instruction R/W √
SM432 Timing clock output 3 Applicable to DUTY instruction R/W √
SM433 Timing clock output 4 Applicable to DUTY instruction R/W √
SM434 Timing clock output 5 Applicable to DUTY instruction R/W √
Y0/Y1 AB Phase Pulse √
SM440 Applicable to DRVI,DRVA,DRVC and PLSV instruction R/W
Enable
Y2/Y3 AB Phase Pulse √
SM441 Applicable to DRVI,DRVA,DRVC and PLSV instruction R/W
Enable
Y6/Y7 AB Phase Pulse √
SM443 Applicable to DRVI,DRVA,DRVC and PLSV instruction R/W
Enable
362 Appendix 2 Special Data Register

Special Data Register

 Note
1. All special data registers except SD50 ~ SD55 will be initialized when the PLC changes from STOP to RUN.
2. The reserved SD and SM elements are not listed in the table. The reserved SD elements are by default read only.

PLC Work State Data


Addr. Name Action and function R/W MC200 MC100 MC280 Range
SD00 PLC type 20 means MC200 R √ √ √
SD01 Version For example, 100 means V1.00 R √ √ √
For example, 8 means an 8k step
SD02 Capacity of user program R √ √ √
program
Store the code of occured system
SD03 System error code R √ √ √
error
SD04 Battery voltage For example 36 means 3.6V R √ √ √
Configurable only through system
block. Any setting smaller than
Setting of AC power 10 ~
SD05 10ms or bigger than 100ms will be R √ √ √
failure detection delay 100ms
regarded as 10ms or 100ms
respectively
SD06 High speed output axles 4 or 6 R √
Number of extension I/O
SD07 R √ √
module
Number of special
SD08 R √ √
module
Setting the input points for operation control. Decimal (X0 is
SD09 displayed as 0; X10, 8. Maximum:15). Configurable through R √ √ 0~15 √
system block
Number of basic module The most significant byte: input.
SD10 R √ √
I/O points The least significant byte: output
Number of extension The most significant byte: input.
SD11 R √ √
module I/O points The least significant byte: output
Number of basic module The most significant byte: input.
SD12 R V1.29 √
analog I/O points The least significant byte: output
SD13 Reserve

SD14 Reserve

SD15 Reserve

SD16 Reserve √

SD17 Reserve

When SM16 reset,ascending zhe


High speed circle
SD18 circle counter(0.1ms,32 bit) R/W 3.009
counter(MSB)
0—429496729.5ms
High speed circle
SD19 R/W 3.009
counter(LSB)

Operation Error Code FIFO Area


Addr. Name Action and function R/W MC200 MC100 MC280 Range
SD20 Reserved operation error code 0 In the order of arrival, the R √ √ √
SD21 Reserved operation error code 1 latest five operation error R √ √ √
SD22 Reserved operation error code 2 codes are reserved. R √ √ √
Appendix 2 Special Data Register 363

SD23 Reserved operation error code 3 SD20 always stores the R √ √ √


SD24 Reserved operation error code 4 latest error codes R √ √ √

FROM/TO Error
Addr. Name R/W MC200 MC100 MC280 Range
Special modules’ numbering is wrong (starting with 0) Initial
SD25 R √ √ √
when using FROM/TO instruction value: 255
The I/O chips’ numbering is wrong (starting with 0) Initial
SD26 R √ √ √
when refreshing I/O value: 255

Scan Time
MC10
Addr. Name Action and function R/W MC200 MC280 Range
0
SD30 Current scan value Current scan time (unit: ms) R √ √ √
SD31 Min. scan time Min. scan time (uint: ms) R √ √ √
SD32 Max. scan time Max. scan time (unit: ms) R √ √ √
Default: 0ms. Unit: 1ms. When the
constant scan time is longer than the
user monitoring overtime setting,
user program overtime alarm will be
raised. When a scan cycle of user
program is longer than the constant
0~
SD33 Constant scan time scan time, the cycle constant scan R √ √ √
1000ms
mode is invalid automatically and no
alarm will be raised.
SD33 is regarded as 1000ms when it
is set bigger than 1000ms
(configurable only through the system
block)
Default: 100ms. Unit: 1ms. Any
setting smaller than 100 or bigger
User program 100 ~
SD34 than 1000 will be regarded as 100 or R √ √ √
overtime 1000ms
1000 respectively. Configurable only
through system block

 Note
1. The error tolerance of SD30, SD31 and SD32 is 1ms.
2. It is recommended to set the user program overtime (SD34) at least 5ms bigger than the constant scan time (SD33). Otherwise,
due to the influence of system operation and user program, the system is apt to report user program overtime error.

Input Filtering Constant Setting


MC10
Addr. Name Action and function R/W MC200 MC280 Range
0
Configurable only through
SD35 Input filtering constant R √ √ √ 0 ~ 60
system block

Configurable only through


SD36 Input filtering constant R √ √ 0 ~ 60
system block
364 Appendix 2 Special Data Register

High-Speed Input Filtering Time Constant Setting


Addr. Name Action and function R/W MC200 MC100 MC280 Range
When high-speed input signal cycle
High-speed input X0
SD40 is less than setpoint, the input signal R/W 3.001√ 0 ~ 1000us
filtering time (us)
is filtered.
When high-speed input signal cycle
High-speed input X1
SD41 is less than setpoint, the input signal R/W 3.001√ 0 ~ 1000us
filtering time (us)
is filtered.
When high-speed input signal cycle
High-speed input X2
SD42 is less than setpoint, the input signal R/W 3.001√ 0 ~ 1000us
filtering time (us)
is filtered.
When high-speed input signal cycle
High-speed input X3
SD43 is less than setpoint, the input signal R/W 3.001√ 0 ~ 1000us
filtering time (us)
is filtered.

High-speed Input Cycle Calculating


Addr. Name Action and function R/W MC200 MC100 MC280
High-speed input X0 cycle Interval bettwen two rising input pluse of X0,
SD44 R/W 3.009 √
calculating for high bit when SM16 is set, it starts to calcute.

High-speed input X0 cycle


SD45 R/W 3.009 √
calculating for low bit
High-speed input X1 cycle Interval bettwen two rising input pluse of X1,
SD46 R/W 3.009
calculating for high bit when SM16 is set, it starts to calcute.
High-speed input X1 cycle
SD47 R/W 3.009
calculating for low bit

High-speed Pulse Output Monitoring

Addr. Name R/W MC200 MC100 MC280 Range


Output pulse number at Y0 for PLSY and PLSR
SD50 R/W √ √ √
instructions (MSB)
Output pulse number at Y0 for PLSY and PLSR
SD51 R/W √ √ √
instructions (LSB)
Output pulse number at Y1 for PLSY and PLSR
SD52 R/W √ √ √
instructions (MSB)
Output pulse number at Y1 for PLSY and PLSR
SD53 R/W √ √ √
instructions (LSB)
Total output pulse number at Y0 and Y1 for PLSY and
SD54 R/W √ √ √
PLSR instructions (MSB)
Total output pulse number at Y0 and Y1 for PLSY and
SD55 R/W √ √ √
PLSR instructions (LSB)
SD56 Current section of the PLS instruction that outputs Y0 R √ √
SD57 Current section of the PLS instruction that outputs Y1 R √ √

SD160
Output pulse number at Y2 for PLSY and PLSR R/W √
instructions (MSB)

SD161
Output pulse number at Y2 for PLSY and PLSR R/W √
instructions (LSB)

SD162
Output pulse number at Y3 for PLSY and PLSR R/W √
instructions (MSB)

SD163
Output pulse number at Y3 for PLSY and PLSR R/W √
instructions (LSB)

SD164
Output pulse number at Y4 for PLSY and PLSR R/W √
instructions (MSB)
Appendix 2 Special Data Register 365

SD165
Output pulse number at Y4 for PLSY and PLSR R/W √
instructions (LSB)

SD166
Output pulse number at Y5 for PLSY and PLSR R/W √
instructions (MSB)

SD167
Output pulse number at Y5 for PLSY and PLSR R/W √
instructions (LSB)

SD168
Output pulse number at Y6 for PLSY and PLSR R/W √
instructions (MSB)

SD169
Output pulse number at Y6 for PLSY and PLSR R/W √
instructions (LSB)

SD170
Output pulse number at Y7 for PLSY and PLSR R/W √
instructions (MSB)

SD171
Output pulse number at Y7 for PLSY and PLSR R/W √
instructions (LSB)
366 Appendix 2 Special Data Register

Timed Interrupt Cycle


Addr. Name Register content R/W MC200 MC100 MC280 Range
1~
The interrupt will not occur when
SD66 Cycle of timed interrupt 0 R/W √ √ √ 32767m
the value is not within 1 ~ 32767
s
1~
The interrupt will not occur when
SD67 Cycle of timed interrupt 1 R/W √ √ √ 32767m
the value is not within 1 ~ 32767
s
1~
The interrupt will not occur when
SD68 Cycle of timed interrupt 2 R/W √ √ √ 32767m
the value is not within 1 ~ 32767
s
Note:
An error of ±1ms may occur when the system processes a user timed interrupt. To ensure the normal operation of the
interrupt, it is recommended to set the cycle of timed interrupts to be bigger or equal to 5ms.

Position Instruction
Initial
Addr. Name R/W MC200 MC100 MC280
value
The current value of Y0 output Position instruction
SD80 R/W √
(MSB) 0
SD81 The current value of Y0 output Position instruction (LSB) R/W √
The current value of Y1 output Position instruction
SD82 R/W √
(MSB) 0
SD83 The current value of Y1 output Position instruction (LSB) R/W √
Basic frequency of executing of instructions ZRN, DRVI
SD84 R/W √ 0
and DRVA
Highest frequency of executing of instructions ZRN,
SD85 R/W √
DRVI and DRVA (MSB)
100.000
Highest frequency of executing of instructions ZRN,
SD86 R/W √
DRVI and DRVA (LSB)
Acceleration or deceleration time of executing of
SD87 R/W √ 100
instructions ZRN, DRVI and DRVA
SD88 Envelope rising time (ms) R/W √ √ √ 100
SD89 Envelope falling time (ms) R/W √ √ √ 100

Real-Time Clock
Addr. Name Register content R/W MC200 MC100 MC280 Range
SD100 Year For real-time clock R √ √ √ 2000 ~ 2099
SD101 Month For real-time clock R √ √ √ 1 ~ 12 months
SD102 Day For real-time clock R √ √ √ 1 ~ 31 days
SD103 Hour For real-time clock R √ √ √ 0 ~ 23 hours
SD104 Minute For real-time clock R √ √ √ 0 ~ 59 minutes
SD105 Second For real-time clock R √ √ √ 0 ~ 59 seconds
√ √ √ 0 (Sunday) ~ 6
SD106 Week For real-time clock R
(Saturday)
Note:
You can set these elements only with the TWR instruction or through the host computer
Appendix 2 Special Data Register 367

Reception Control And State Of Free Port (Port 0)


Addr. Name Register content R/W MC200 MC100 MC280 Range
b2, b1, b0
000 = 38,400
001 = 19,200
010 = 9,600
SD110.0 ~ SD110.2 port
011 = 4,800
baud rate
100 = 2,400
101 = 1,200
110=57,600
111=115,200
SD110.3 0 = 1 stop bit
Stop bit 1 = 2 stop bits
0 = even parity
SD110.4 parity check
1 = odd parity
SD110.5 parity check 0 = no check
Free
enabling 1 = check
port
Data bit of every character
0 SD110.6
SD110 0 = 8 bits R √ √ √
mode Character data bit
1 = 7 bits
state
SD110.7
word 1 = start character specified
free-port receiving start
0 = start character unspecified
mode
SD110.8 free-port 1 = end character specified
receiving end mode 0 = end character unspecified
SD110.9
1: word overtime enabled
Free-port word overtime
0: word overtime disabled
enabling
SD110.10 free-port frame 1 = frame overtime enabled
overtime enabling 0 = frame overtime disabled
SD110.11 Reserved
0: word register valid at LSB
SD110.12 the most/least
1: word register valid at both MSB
significant byte valid
and LSB
SD110.13 ~ SD110.15 Reserved
SD111 Start character R/W √ √ √
SD112 End character R/W √ √ √
Default: 0ms (word overtime 1~
SD113 Word overtime setting R/W √ √ √
omitted) 32767ms
Default: 0ms (frame overtime 1~
SD114 Frame overtime setting R/W √ √ √
omitted) 32767ms
Bit 0: set when receiving ends
Bit 1: set when specified end
character is received
Bit 2: set when max. character
Receiving completion message
SD115 number is received R √ √ √
code
Bit 3: set upon word overtime
Bit 4: set upon frame overtime
Bit 5: set upon parity check error
Bits 6 ~ 15: reserved
SD116 Characters currently received R √ √ √
Total number of currently received
SD117 R √ √ √
characters
SD118 Characters currently sent R √ √
368 Appendix 2 Special Data Register

Freeport Reception Control And State (Port 1)


Addr. Name Register content R/W MC200 MC100 MC280 Range
b2, b1, b0
000 = 38,400
001 = 19,200
010 = 9,600
SD120.0 ~ SD120.2
011 = 4,800
Port baud rate
100 = 2,400
101 = 1,200
110=57,600
111=115,200
0 = 1 stop bit
SD120.3 stop bit
1 = 2 stop bits
SD120.4 parity 0 = even parity
check 1 = odd parity
SD120.5 parity 0 = disabled
check enabling 1 = enabled
Data bit of every character
SD120.6 data bit of
Free 0: 8-bit character
every character
port 1 1: 7-bit character
SD120 mode SD120.7 free-port R √ √ √
state receiving 1: start-character specified
word start-character 0: start-character unspecified
mode
SD120.8 free-port
1: end-character specified
receiving
0: end-character unspecified
end-character mode
SD120.9 free port
1: word overtime enabled
word overtime
0: word overtime disabled
enabling
SD120. 10 free port
1: frame overtime enabled
frame overtime
0: frame overtime disabled
enabling
SD120.11 Reserved
SD120.12 the 0: word register valid at LSB
most/least 1: word register valid at both the
significant byte valid most and LSBs
SD120.13 ~
Reserved
SD120.15
SD121 Start character R/W √ √ √
SD122 End character R/W √ √ √
Default: 0ms (word overtime 0~
SD123 Word overtime setting R/W √ √ √
omitted) 32767ms
Default: 0ms (frame overtime 0~
SD124 Frame overtime setting R/W √ √ √
omitted) 32767ms
Bit 0: set when receiving ends
Bit 1: set when specified end
character is received
Bit 2: set when max. character
Receiving completion
SD125 number is received R √ √ √
message code
Bit 3: set upon word overtime
Bit 4: set upon frame overtime
Bit 5: set upon parity check error
Bits 6 ~ 15: reserved
SD126 Characters currently recived R √ √ √
Total number of currently
SD127 R √ √ √
received characters
SD128 Characters currently sent R √ √ √
Appendix 2 Special Data Register 369

Modbus/MCbus Setting
Addr. Name R/W MC200 MC100 MC280 Range
MOD (1 ~ 32) ,
SD130 Local station No. (PORT 0) R/W √ √ √
EMR (0 ~ 31)
Max. timeout time of PORT 0 (post-sending
SD131 R/W √ √
and pre-receiving) / MCbus extra delay
SD132 PORT 0 retry times R/W √ √
SD133 MCbus network update mode (PORT 0) R/W √ √ 1 ~ 13
MOD (1 ~ 32),
SD135 Local station No. (Port 1 ) R/W √ √ √
EMR (0 ~ 31)
Max. timeout time of Port 1 (post-sending and
SD136 R/W √ √ √
pre-receiving) /MCbus extra delay
SD137 Port 1 retry times R/W √ √ √ 0 ~ 100
SD138 MCbus network update mode (Port 1 ) R/W √ √ √ 1 ~ 13
SD139 Error code of Modbus master (Port 1 ) R √ √ √
370 Appendix 2 Special Data Register

Freeport Reception Control And State (Port 2)


Addr. Name Register content R/W MC200 MC100 MC280 Range
b2, b1, b0
000 = 38,400
001 = 19,200
010 = 9,600
SD140.0 ~ SD140.2
011 = 4,800
Port baud rate
100 = 2,400
101 = 1,200
110=57,600
111=115,200
0 = 1 stop bit
SD140.3 stop bit
1 = 2 stop bits
SD140.4 parity 0 = even parity
check 1 = odd parity
SD140.5 parity 0 = disabled
check enabling 1 = enabled
Data bit of every character
SD140.6 data bit of
Free 0: 8-bit character
every character
port 1 1: 7-bit character
SD140 mode SD140.7 free-port R √
state receiving 1: start-character specified
word start-character 0: start-character unspecified
mode
SD140.8 free-port
1: end-character specified
receiving
0: end-character unspecified
end-character mode
SD140.9 free port
1: word overtime enabled
word overtime
0: word overtime disabled
enabling
SD140. 10 free port
1: frame overtime enabled
frame overtime
0: frame overtime disabled
enabling
SD140.11 Reserved
SD140.12 the 0: word register valid at LSB
most/least 1: word register valid at both the
significant byte valid most and LSBs
SD140.13 ~
Reserved
SD140.15
SD141 Start character R/W √
SD142 End character R/W √
Default: 0ms (word overtime 0~
SD143 Word overtime setting R/W √
omitted) 32767ms
Default: 0ms (frame overtime 0~
SD144 Frame overtime setting R/W √
omitted) 32767ms
Bit 0: set when receiving ends
Bit 1: set when specified end
character is received
Bit 2: set when max. character
Receiving completion
SD145 number is received R √
message code
Bit 3: set upon word overtime
Bit 4: set upon frame overtime
Bit 5: set upon parity check error
Bits 6 ~ 15: reserved
SD146 Characters currently recived R √
Total number of currently
SD147 R √
received characters
SD148 Characters currently sent R √
Appendix 2 Special Data Register 371

Modbus/MCbus Setting(PORT2)
Addr. Name R/W MC200 MC100 MC280 Range
SD150 Local station No. (PORT 2) R/W √ √ MOD (1 ~ 32)
Max. timeout time of PORT 2 (post-sending
SD151 R/W √ √
and pre-receiving) / MCbus extra delay
SD152 PORT 2 retry times R/W √ √ 0~100
SD159 Error code of Modbus master (Port 2 ) R √ √

Setting & Reading Of Integrated Analog Signal Channel


Addr. Name R/W MC200 MC100 MC200 Range
SD172 Average sample value of AD CH0 R √ -10000~+10000
SD173 Sampling times of AD CH0 R/W √ 1 ~ 1000
SD174 Average sample value of AD CH1 R √ -10000~+10000
SD175 Sampling times of AD CH1 R/W √ 1 ~ 1000
SD178 Output value of DA CH0 R/W √ -10000~+10000

Note:the default of SD173 and SD175 is 8

Usage Of DHSP And DHST Instructions


Addr. Name R/W MC200 MC100 MC280 Range
SD180 MSB of DHSP table comparison output data R/W √ √ √
SD181 LSB of DHSP table comparison output data R/W √ √ √
SD182 MSB of DHST or DHSP table comparison data R/W √ √ √
SD183 LSB of DHST or DHSP table comparison data R/W √ √ √
SD184 Record No. of the table being executed R/W √ √ √

Error Flag
Addr. Name R/W MC200 MC100 MC280 Range
SD191 No. of the module where bus error occured R √ √
SD192 No. of the special module where bus error occured R √ √
SD193 MODBUS error (PORT0) R √
SD194 MODBUS error (PORT1) R √
SD195 MODBUS error (PORT2) R √

Motion Control

Addr. Name R/W MC200 MC100 MC280


SD200 Y0 current value (MSB) of absolute position R/W √ √ √
SD201 Y0 current value (LSB) of absolute position R/W √ √ √
SD202 Max. speed (MSB) R/W √ √ √
SD203 Max. speed (LSB) R/W √ √ √
SD204 Base speed R/W √ √ √
SD205 Acc./Dec. time R/W √ √ √
Table 11-20 High-speed pulse output control (Y1)
Addr. Name Register content R/W
SD52 Total output pulse number (MSB) Used to calculate and store the absolute position. Each time a Position R/W
SD53 Total output pulse number (LSB) instruction is executed, SD52 ~ SD53 and direction signal are used to R/W
372 Appendix 2 Special Data Register

Current value (MSB) of absolute calculate and update SD310 ~ SD311. Each time the absolute position
SD310 R/W
position data is read from servo driver upon power on, the data (32-bit long
Current value (LSB) of absolute integer) should be stored to SD310
SD311 R/W
position
SD312 Max. speed (MSB) The max. speed when the output axis executes a Position instruction. R/W
SD313 Max. speed (LSB) Range: 10 ~ 200000. Unit: pulse R/W
The base speed when the output axis executes a Position instruction,
SD314 Base speed R/W
slower than 1/10 of the max. speed
The acc./dec. time when the output axis executes a Position instruction.
SD315 Acc./Dec. time R/W
Range: 50 ~ 5000. Unit: ms
When SM311 is set, SD316 specifies the SN of the Y element that will
SD316 Clearing signal element R/W
be the clearing signal
Applicable to the DSZR instruction as the crawling speed when
SD317 Crawling speed R/W
executing the instruction
SD318 Zero return speed (MSB) Applicable to the DSZR instruction as the zero return speed when R/W
SD319 Zero return speed (LSB) executing the instruction R/W
Note
1: SD312 ~ SD315 are adjustable according to your needs, just make sure they are set before the Position instruction is driven. If
they are changed during the execution of a Position instruction, the instruction execution may fail.
2: the base speed must be slower than 1/10 of the max. speed, or there will be no pulse output. No pulse will be output also when
the speed of a Position instruction exceeds the range between base speed and max. speed
Appendix 2 Special Data Register 373

Table 11-21 High-speed pulse output control (Y2)


Addr. Name Register content R/W
SD160 Total output pulse number (MSB) R/W
Used to calculate and store the absolute position. Each time a Position
SD161 Total output pulse number (LSB) R/W
instruction is executed, SD160 ~ SD161 and direction signal are used to
Current value (MSB) of absolute
SD320 calculate and update SD320 ~ SD321. Each time the absolute position data R/W
position
is read from servo driver upon power on, the data (32-bit long integer) should
Current value (LSB) of absolute
SD321 be stored to SD320 R/W
position
SD322 Max. speed (MSB) The max. speed when the output axis executes a Position instruction. Range: R/W
SD323 Max. speed (LSB) 10 ~ 200000. Unit: pulse R/W
The base speed when the output axis executes a Position instruction, slower
SD324 Base speed R/W
than 1/10 of the max. speed
The acc./dec. time when the output axis executes a Position instruction.
SD325 Acc./Dec. time R/W
Range: 50 ~ 5000. Unit: ms
When SM321 is set, SD326 specifies the SN of the Y element that will be the
SD326 Clearing signal element R/W
clearing signal
Applicable to the DSZR instruction as the crawling speed when executing the
SD327 Crawling speed R/W
instruction
SD328 Zero return speed (MSB) Applicable to the DSZR instruction as the zero return speed when executing R/W
SD329 Zero return speed (LSB) the instruction R/W
SD222 Section SN. of PLS output Applicable to PLS, used to detect the SN of the current section being output R
Note
1: SD322 ~ SD325 are adjustable according to your needs, just make sure they are set before the Position instruction is driven. If
they are changed during the execution of a Position instruction, the instruction execution may fail
2: the base speed must be slower than 1/10 of the max. speed, or there will be no pulse output. No pulse will be output also when
the speed of a Position instruction exceeds the range between base speed and max. speed
Table 11-22 High-speed pulse output control (Y3)
Addr. Name Register content R/W
SD162 Total output pulse number (MSB) R/W
Used to calculate and store the absolute position. Each time a Position
SD163 Total output pulse number (LSB) R/W
instruction is executed, SD162 ~ SD163 and direction signal are used to
Current value (MSB) of absolute
SD330 calculate and update SD330 ~ SD331. Each time the absolute position data R/W
position
is read from servo driver upon power on, the data (32-bit long integer) should
Current value (LSB) of absolute
SD331 be stored to SD330 R/W
position
SD332 Max. speed (MSB) The max. speed when the output axis executes a Position instruction. Range: R/W
SD333 Max. speed (LSB) 10 ~ 200000. Unit: pulse R/W
The base speed when the output axis executes a Position instruction, slower
SD334 Base speed R/W
than 1/10 of the max. speed
The acc./dec. time when the output axis executes a Position instruction.
SD335 Acc./Dec. time R/W
Range: 50 ~ 5000. Unit: ms
When SM331 is set, SD336 specifies the SN of the Y element that will be the
SD336 Clearing signal element R/W
clearing signal
Applicable to the DSZR instruction as the crawling speed when executing the
SD337 Crawling speed R/W
instruction
SD338 Zero return speed (MSB) Applicable to the DSZR instruction as the zero return speed when executing R/W
SD339 Zero return speed (LSB) the instruction R/W
Note
1: SD332 ~ SD335 are adjustable according to your needs, just make sure they are set before the Position instruction is driven. If
they are changed during the execution of a Position instruction, the instruction execution may fail
2: the base speed must be slower than 1/10 of the max. speed, or there will be no pulse output. No pulse will be output also when
the speed of a Position instruction exceeds the range between base speed and max. speed

Table 11-23 High-speed pulse output control (Y4)


Addr. Name Register content R/W
SD164 Total output pulse number (MSB) Used to calculate and store the absolute position. Each time a Position R/W
SD165 Total output pulse number (LSB) instruction is executed, SD164 ~ SD165 and direction signal are used to R/W
Current value (MSB) of absolute calculate and update SD340 ~ SD341. Each time the absolute position data
SD340 R/W
position is read from servo driver upon power on, the data (32-bit long integer) should
374 Appendix 2 Special Data Register

Current value (LSB) of absolute be stored to SD340


SD341 R/W
position
SD342 Max. speed (MSB) The max. speed when the output axis executes a Position instruction. Range: R/W
SD343 Max. speed (LSB) 10 ~ 200000. Unit: pulse R/W
The base speed when the output axis executes a Position instruction, slower
SD344 Base speed R/W
than 1/10 of the max. speed
The acc./dec. time when the output axis executes a Position instruction.
SD345 Acc./Dec. time R/W
Range: 50 ~ 5000. Unit: ms
When SM341 is set, SD346 specifies the SN of the Y element that will be the
SD346 Clearing signal element R/W
clearing signal
Applicable to the DSZR instruction as the crawling speed when executing the
SD347 Crawling speed R/W
instruction
SD348 Zero return speed (MSB) Applicable to the DSZR instruction as the zero return speed when executing R/W
SD349 Zero return speed (LSB) the instruction R/W
Note
1: SD342 ~ SD345 are adjustable according to your needs, just make sure they are set before the Position instruction is driven. If
they are changed during the execution of a Position instruction, the instruction execution may fail
2: the base speed must be slower than 1/10 of the max. speed, or there will be no pulse output. No pulse will be output also when
the speed of a Position instruction exceeds the range between base speed and max. speed
Appendix 2 Special Data Register 375

Table 11-24 High-speed pulse output control (Y5)


Addr. Name Register content R/W
SD166 Total output pulse number (MSB) R/W
Used to calculate and store the absolute position. Each time a Position
SD167 Total output pulse number (LSB) R/W
instruction is executed, SD166 ~ SD167 and direction signal are used to
Current value (MSB) of absolute
SD350 calculate and update SD350 ~ SD351. Each time the absolute position R/W
position
data is read from servo driver upon power on, the data (32-bit long
Current value (LSB) of absolute
SD351 integer) should be stored to SD350 R/W
position
SD352 Max. speed (MSB) The max. speed when the output axis executes a Position instruction. R/W
SD353 Max. speed (LSB) Range: 10 ~ 100000. Unit: pulse R/W
The base speed when the output axis executes a Position instruction,
SD354 Base speed R/W
slower than 1/10 of the max. speed
The acc./dec. time when the output axis executes a Position instruction.
SD355 Acc./Dec. time R/W
Range: 50 ~ 5000. Unit: ms
When SM351 is set, SD356 specifies the SN of the Y element that will be
SD356 Clearing signal element R/W
the clearing signal
Applicable to the DSZR instruction as the crawling speed when executing
SD357 Crawling speed R/W
the instruction
SD358 Zero return speed (MSB) Applicable to the DSZR instruction as the zero return speed when R/W
SD359 Zero return speed (LSB) executing the instruction R/W
Note
1: SD352 ~ SD355 are adjustable according to your needs, just make sure they are set before the Position instruction is driven. If
they are changed during the execution of a Position instruction, the instruction execution may fail
2: the base speed must be slower than 1/10 of the max. speed, or there will be no pulse output. No pulse will be output also when
the speed of a Position instruction exceeds the range between base speed and max. speed

Table 11-25 High-speed pulse output control (Y6)


Addr. Name Register content R/W
SD168 Total output pulse number (MSB) R/W
Used to calculate and store the absolute position. Each time a Position
SD169 Total output pulse number (LSB) R/W
instruction is executed, SD168 ~ SD169 and direction signal are used to
Current value (MSB) of absolute
SD360 calculate and update SD360 ~ SD361. Each time the absolute position data R/W
position
is read from servo driver upon power on, the data (32-bit long integer) should
Current value (LSB) of absolute
SD361 be stored to SD360 R/W
position
SD362 Max. speed (MSB) The max. speed when the output axis executes a Position instruction. Range: R/W
SD363 Max. speed (LSB) 10 ~ 100000. Unit: pulse R/W
The base speed when the output axis executes a Position instruction, slower
SD364 Base speed R/W
than 1/10 of the max. speed
The acc./dec. time when the output axis executes a Position instruction.
SD365 Acc./Dec. time R/W
Range: 50 ~ 5000. Unit: ms
When SM361 is set, SD366 specifies the SN of the Y element that will be the
SD366 Clearing signal element R/W
clearing signal
Applicable to the DSZR instruction as the crawling speed when executing the
SD367 Crawling speed R/W
instruction
SD368 Zero return speed (MSB) Applicable to the DSZR instruction as the zero return speed when executing R/W
SD369 Zero return speed (LSB) the instruction R/W
Note
1: SD362 ~ SD365 are adjustable according to your needs, just make sure they are set before the Position instruction is driven. If
they are changed during the execution of a Position instruction, the instruction execution may fail.
2: the base speed must be slower than 1/10 of the max. speed, or there will be no pulse output. No pulse will be output also when
the speed of a Position instruction exceeds the range between base speed and max. speed
376 Appendix 2 Special Data Register

Table 11-26 High-speed pulse output control (Y7)


Addr. Name Register content R/W
SD170 Total output pulse number (MSB) R/W
Used to calculate and store the absolute position. Each time a Position
SD171 Total output pulse number (LSB) R/W
instruction is executed, SD170 ~ SD171 and direction signal are used to
Current value (MSB) of absolute
SD370 calculate and update SD370 ~ SD371. Each time the absolute position data R/W
position
is read from servo driver upon power on, the data (32-bit long integer) should
Current value (LSB) of absolute
SD371 be stored to SD370 R/W
position
SD372 Max. speed (MSB) The max. speed when the output axis executes a Position instruction. Range: R/W
SD373 Max. speed (LSB) 10 ~ 100000. Unit: pulse R/W
The base speed when the output axis executes a Position instruction, slower
SD374 Base speed R/W
than 1/10 of the max. speed
The acc./dec. time when the output axis executes a Position instruction.
SD375 Acc./Dec. time R/W
Range: 50 ~ 5000. Unit: ms
When SM371 is set, SD376 specifies the SN of the Y element that will be the
SD376 Clearing signal element R/W
clearing signal
Applicable to the DSZR instruction as the crawling speed when executing the
SD377 Crawling speed R/W
instruction
SD378 Zero return speed (MSB) Applicable to the DSZR instruction as the zero return speed when executing R/W
SD379 Zero return speed (LSB) the instruction R/W
Note
1: SD372 ~ SD375 are adjustable according to your needs, just make sure they are set before the Position instruction is driven. If
they are changed during the execution of a Position instruction, the instruction execution may fail.
2: the base speed must be slower than 1/10 of the max. speed, or there will be no pulse output. No pulse will be output also when
the speed of a Position instruction exceeds the range between base speed and max. speed

Table 11-27 Signal annuciator state


Addr. Name Register content R/W
Among S900 ~ S999, save the SN of the element whose SN
SD401 Smalleset SN of ON state annuciator R/W
is the smallest among all that act. Initial value: 0

Table 11-28 Timer clock output state


Addr. Name Register content R/W
SD430 Scan times for timed clock output 1 / R/W
SD431 Scan times for timed clock output 2 / R/W
SD432 Scan times for timed clock output 3 / R/W
SD433 Scan times for timed clock output 4 / R/W
SD434 Scan times for timed clock output 5 / R/W
Table 11-29 Creep speed and Creepage Distance
Addr. Name Register content R/W
SD450 Y0 Creepage Distance / R/W
SD451 Y0 Creep speed / R/W
SD452 Y1 Creepage Distance / R/W
SD453 Y1 Creep speed / R/W
SD454 Y2 Creepage Distance / R/W
SD455 Y2 Creep speed / R/W
SD456 Y3 Creepage Distance / R/W
SD457 Y3 Creep speed / R/W
SD462 Y6 Creepage Distance / R/W
SD463 Y6 Creep speed / R/W
SD464 Y7 Creepage Distance / R/W
SD465 Y7 Creep speed / R/W
Table 11-30 Binding Axis number of the Port
Addr. Name Register content R/W
Binding Axis number of the Port Y0(eg:If
SD480 0x0001,then Port Y0 output Y-Axis’ Pulses.If 0x000f R/W
0x000f, then Port Y0 output X-Axis’ Pulses)
Appendix 2 Special Data Register 377

Binding Axis number of the Port Y1(eg:If


SD481 0x0002,then Port Y1 output Z-Axis’ Pulses.If 0x000f R/W
0x000f, then Port Y1 output Y-Axis’ Pulses)
Binding Axis number of the Port Y2(eg:If
SD482 0x0003,then Port Y2 output U-Axis’ Pulses.If 0x000f R/W
0x000f, then Port Y2 output Z-Axis’ Pulses)
Binding Axis number of the Port Y3(eg:If
SD483 0x0004,then Port Y3 output V-Axis’ Pulses.If 0x000f R/W
0x000f, then Port Y3 output U-Axis’ Pulses)
Binding Axis number of the Port Y4(eg:If
SD484 0x0005,then Port Y4 output W-Axis’ Pulses.If 0x000f R/W
0x000f, then Port Y4 output V-Axis’ Pulses)
Binding Axis number of the Port Y5(eg:If
SD485 0x0006,then Port Y5 output A-Axis’ Pulses.If 0x000f R/W
0x000f, then Port Y5 output W-Axis’ Pulses)
Binding Axis number of the Port Y6(eg:If
SD486 0x0007,then Port Y6 output B-Axis’ Pulses.If 0x000f R/W
0x000f, then Port Y6 output A-Axis’ Pulses)
Binding Axis number of the Port Y7(eg:If
SD487 0x0000,then Port Y7 output X-Axis’ Pulses.If 0x000f R/W
0x000f, then Port Y7 output B-Axis’ Pulses)
378 Appendix 3 Reserved Elements

Reserved Elements

Start addr. End addr. Remark


D7940 D7969 Buffer area for transmission of inverter instructions
D7970 D7999 Buffer area for reception of inverter instructions
D7700 D7763 MCbus network shared area
M1400 M1911 MCbus network shared area
D6000 D6999 EROMWR instruction operation area

 Note
See the related instruction and function description for the usage of the elements in the preceding table.
Appendix 5 Inverter Instruction Error Code 379

Inverter Instruction Error Code

Error code Description


0x1 Illegal functional code
0x2 Illegal register address
0x3 Data error (data outside the range)
0x4 Slave operation failure (including the error due to invalid data, although the data is in the range)
0x5 Valid instruction. Processing. Mainly used to save data to EEPROM
0x6 Slave busy. Please try again later. Mainly used to save data to EEPROM
0x18 Information fram error, including information length error and parity check error
0x20 Parameter unchangeable
0x21 Parameter unchangeable during operation (applicable to only EV3100)
0x22 Password protected
380 Appendix 6 System Error Code

System Error Code

MC20
Error code Description Error type Description MC100
0
0 No error √ √
1~9 Reserved √ √
System hardware error
User program stops, and ERR indicator turns on.
10 SRAM error System error To remove this fault, power off the PLC and √
check the hardware
User program stops, and ERR indicator turns on.
11 FLASH error System error To remove this fault, power off the PLC and √
check the hardware
User program stops, and ERR indicator turns on.
12 Communication port error System error To remove this fault, power off the PLC and √
check the hardware
User program stops, and ERR indicator turns on.
13 Real-time clock error System error To remove this fault, power off the PLC and √
check the hardware
User program stops, and ERR indicator turns on.
14 I2C error System error To remove this fault, power off the PLC and √
check the hardware
External setting error (20 ~ 23)
User program stops, and ERR indicator turns on.
20 Serious local I/O error System error To remove this fault, power off the PLC and √
check the hardware
ERR indicator blinks. This alarm is cleared
21 Serious extension I/O error System error √
automatically upon the removal of the fault
ERR indicator blinks. This alarm is cleared
22 Serious special module error System error √
automatically upon the removal of the fault
Update error of real-time clock
ERR indicator blinks. This alarm is cleared
23 (incorrect time is read during system System error √
automatically upon the removal of the fault
update)
ERR indicator blinks. This alarm is cleared
24 EEPROM write / read operation error System error √
automatically upon the removal of the fault
ERR indicator blinks. This alarm is cleared
25 Local analog signal error System error √
automatically upon the removal of the fault
System special module configuration ERR indicator blinks. This alarm is cleared
26 System error √
error automatically upon the removal of the fault
Storage error (40 ~ 45)
User program stops, and ERR indicator turns on.
40 User program file error System error To remove this fault, download new program or √ √
format the disk
User program stops, and ERR indicator turns on.
41 System configuration file error System error To remove this fault, download new system √ √
configuration files or format the disk
User program stops, and ERR indicator turns on.
42 Data block file error System error To remove this fault, download new data block √ √
file or format the disk
User program keeps running ERR indicator
43 Battery-backed data lost System error blinks. To remove this fault, clear the register, or √ √
format the disk, or reset
User program keeps running. ERR indicator
44 Forced-table lost System error blinks. To remove this fault, clear the register, or √ √
force, or format the disk, or reset
User program keeps running ERR indicator is
45 User information file error System error off. To remove this fault, download new program √ √
and data block files, or format the disk
Appendix 6 System Error Code 381

MC20
Error code Description Error type Description MC100
0
46 ~ 59 Reserved
Instruction execution error (60~75)
60 User program compilation error Execution error User program stops, and ERR indicator turns on. √ √
61 User program operation overtime error Execution error User program stops, and ERR indicator turns on. √ √
illegal user program instruction execution
62 Execution error User program stops, and ERR indicator turns on. √ √
error
Illegal element type of instruciton
63 Execution error User program stops, and ERR indicator turns on. √ √
operand
64 Illegal instruction operand value Execution error √ √
65 Outside instruction element range Execution error √ √
User program keeps running, ERR indicator
66 Subprogram stack overflow Execution error √ √
keeps off. The corresponding error code will be
67 User interrupt request queue overflow Execution error √ √
prompted in SD20
68 Illegal label jump or subprogram call Execution error √ √
69 Divided by 0 error Execution error √ √
When stack size, or stack elements are smaller
70 Definition error of stack operated Execution error than zero, or stack element number exceeds the √ √
limit of stack size
71 Reserved √ √
Undefined user subprogram or interrupt
72 Execution error √ √
subprogram
Using FROM/TO instruciton to access
73 Execution error √
module not existing
I/O error when using FROM/TO
74 Execution error √
instruction
75 I/O error when using REF instruction Execution error √ √
Cannot set real time clock time using
76 Execution error √ √
TWR
Parameter 3 of PLSR instruction
77 Execution error √ √
inappropriate under constant scan
BFM unit of accessed special module
78 Execution error √
exceeds range
79 ABS Data Read Timeout Execution error √
80 ABS Data Read and Check Error Execution error √
382 Appendix 7 Modbus Communication Protocol (EC series)

Modbus Communication Protocol (MC series)

Modbus Communication Protocol Overview


MC series small PLC has two communication ports: PORT 0 (also the programming port), which supports Modbus
slave station, and Port 1 , which supports Modbus master station and slave station (configurable through ConstrolStar).
Their features include:
1. Using RS485 or RS232 port, with RS-232 3-line system as the physical interface.
2. Supportive of RTU mode and ASCII mode, but not of the change of the ASCII ending character.
3. Being the Modbus slave station, the addresses range from 1 to 31.
4. Supportive of broadcast mode. The broadcast is effective for write and sub-function codes of diagnosis.
5. Suppoting baud rates including 38,400 bps, 19,200 bps, 9,600 bps, 4,800 bps, 2,400 bps and 1,200 bps.
(Default: 19200, 8 bits, 1 stop bit, even check)
6.Supportive of data field 2 × 252 bytes (ASII mode) or 252 bytes (RTU mode).

Supported Modbus Function Code and Element Addressing


The slave station supports function codes 01, 02, 03, 05, 06, 08, 15, 16 (decimal).
Pay attention to the following points during the reading:
Relationship between read-write element function code and the element
Function code Name of function code Modicon data address Type of operational element Remark
01 read coil status 0Note 1:xxxx Y, X, M, SM, S, T, C Bit read
02 read discrete input status 1 Note 2:xxxx X Bit read
03 read register status 4 Note 3:xxxx Note 4 D, SD, Z, T, C Word read
05 write single coil status 0:xxxx Y, M, SM, S, T, C Word write
06 write single register status 4:xxxx D, SD, Z, T, C Word write
15 write multiple coils status 0:xxxx Y, M, SM, S, T, C Bit write
16 write multiple registers status 4:xxxx D, SD, Z, T, C Word write
Note:
1. 0 means “coil”.
2. 1 means “discrete input”.
3. 4 means “register”.
4. xxxx means range “1 ~ 9999”. Each type has an independent logic address range of 1 to 9999 (protocol address starts from 0).
5. 0, 1 and 4 do not have the physical meaning and are not involved in actual addressing.
6. Users shall not write X element with function codes 05 and 15; otherwise, the system will not feed back the error information if the
written operand and data are correct, but the system will not perform any operation on the write instruction.

Relationship between PLC Element and Modbus Communication Protocol Address


Protocol Supported
Element Type Physical element Notes
address function code
Y0 to Y377 output status, element
Y bit 0000 ~ 0255 01, 05, 15
(octal code) 256 points in total code: Y0 ~ Y7, Y10 ~ Y17
input status, it supports two
X0 to X377 1200 ~ 01455 01, 05, 15 kinds of address, the
X bit
(octal code) 256 points in total 0000 ~ 0255 02 element code is same as
above
M bit M0 to M1999 2000 ~ 3999 01, 05, 15
SM bit SM0 to SM255 4400 ~4655 01, 05, 15
S bit S0 ~ S991 6000 ~ 6991 01, 05, 15
T bit T0 ~ T255 8000 ~ 8255 01, 05, 15 status of T element
C bit C0 ~ C255 9200 ~ 9455 01, 05, 15 status of C element
D word D0 ~ D7999 0000 ~ 7999 03, 06, 16
SD word SD0 ~ SD255 8000 ~ 8255 03, 06, 16
Z word Z0 ~ Z15 8500 ~ 8515 03, 06, 16
Appendix 7 Modbus Communication Protocol (EC Series) 383

Protocol Supported
Element Type Physical element Notes
address function code
T word T0 ~ T255 9000 ~ 9255 03, 06, 16 current value of T element
current value of C element
C word C0 ~ C199 9500 ~ 9699 03, 06, 16
(WORD)
current value of C element
C Double word C200 ~ C255 9700 ~ 9811 03, 16
(WORD)
Note:
The protocol address is the address used on data transfer and corresponds with the logic address of Modicon data. The protocol
address starts from 0 and the logic address of Modicon data begins with 1, that is, protocol address + 1 = logic address of Modicon
data. For example, if M0 protocol address is 2000, and its corresponding logic address of Modicon data will be 0:2001. In practice,
the read and write of M0 is completed through the protocol address, for example: read M0 element frame (sent from the master):

01 01 07 D0 00 01 FD 47
CRC check code
Number of elements to read
Starting address. The decimal value of 07D0 is 2000
Function code
Station No.

Abnormal response description:


Abnormal code Definition
0x01 Illegal function code
0x02 Illegal register address
0x03 Illegal data

Note the following:


1. Elements X and Y use octal system. There are 256 points in total from X0 to X377, 256 points from Y0 to Y377, with
the combinations of Y0 ~ Y7, Y10 ~ Y17 and Y20 ~ Y27. etc.
2. Two addressing methods are available for Element X. One is the protocol address of 1200-1455 with corresponding
function codes of 01, 05 and 15; the other is the protocol address of 0-255 with function code 02.
3. Processing of double-word element: C element is a counter. It has status and current value. C200 ~ C255 are 32-bit
elements, but each C element in the range will get two protocol addresses during the protocol address compiling. For
example: The protocol address of C200 is 9700 ~ 9701. When reading the elements though Modbus, both the starting
protocol address and the number of the read elements shall be even number.
4. For most SM, SD elements, the real value cannot be written through Modbus, but PLC salve station will still return
“OK“ to indicate the completion of write operation, which is allowable.
5. In addition, the Modbus communication protocol of MC200 supports the read and write of double word element,
LONG INT variable and floating point number. In the PLC of MC200, 32-bit data are stored with high bits at high
address. For example, a 32-bit data is stored in two D elements (D3 and D4), with 16 high bits in D3 and 16 low bits in
D4, as shown in the following figure: (Refer to the description for the specific example)
High
D3
High Low 16-bit
16-bit 16-bit Low
D4
16-bit
32-bit data

Modbus Function Code Description

Read coil status (0x01)


Up to 256 bit-element can be read in MC series PLC.
1. Request frame
Initial address Number of elements Check code
Address Function code (01H)
H L H L (CRC or LRC)

2. Response frame
If the read address is not the times of 8, the remaining bits will be filled with 0 (starting with the high bits).
384 Appendix 7 Modbus Communication Protocol (EC series)

Function code Number of bytes read Read data Read data Check code
Address ......
(01H) (n) No.1 No.n (CRC or LRC

B7 B6 B5 B4 B3 B2 B1 B0

Read discrete input status (0x02)


In the PLC of GCM series, it specially refers to X element. The function code only supports the read function of X
element with the maximum read number of 256.
1. Request frame
starting address Number of elements Check code
Address Function code (02H)
H L H L (CRC or LRC)

2. Response frame
If the read address is not the times of 8, the remaining bits will be filled with 0 (starting with the high bits).

Function code Number of bytes read Read data Read data Check code
Address ...
(02H) (n) No.1 No.n (CRC or LRC

B7 B6 B5 B4 B3 B2 B1 B0

Read Holding Registers (0x03)


It refers to reading the value of data (word) register at the slave station, with the maximum number of registers of 125
read each time. It does not support broadcast.
1. Request frame
Starting address Number of elements Check code
Address Function Code (03H)
H L H L (CRC or LRC)

2. Response frame

Read data No.1 Read data No.n Check code


Address Function code (03H) Number of bytes read (n) ...
(CRC or LRC)
H L H L

Force (Write) Single Coil (0x05)


Force (Write) single coil writes bit element value to the slave station and supports broadcast, i.e. writing the same
element to all slave stations. It supports 1 bit element at most.
1. Request frame
Starting address Written element value Check code
Address Function Code (05H)
H L H L (CRC or LRC)

Note: The written value of the element is 0xFF00 (ON, 1) or 0x0000 (OFF, 0).
2. Response frame
Response frame is the repeat of request frame.
Starting address Written element value Check code
Address Function code (05H)
H L H L (CRC or LRC)
Appendix 7 Modbus Communication Protocol (EC Series) 385

Preset (write) Single Register (0x06)


Preset (Write) single register writes word element value to the slave station and supports broadcast, i.e. writing the
same element to all slave stations. It supports 1 bit element at most.
1. Request frame
Starting address Written element value Check code
Address Function code (06H)
H L H L (CRC or LRC)

2. Response frame
Response frame is the repeat of Request frame.
Starting address Written element value Check code
Address Function code (06H)
H L H L (CRC or LRC)

Return Diagnostic Check (0 x 08)


Diagnostic register and communication error information can be obtained through returning diagnostic check.
Diagnostic code Description
0x00 Return Request frame
0x 01 Restart Comm Option
0x 04 Listen Only Mode of Slave Station
0x0a Clear Ctrs and Diagnostic Reg
0x0b Return Bus Message Count
0x0c Return Bus CRC Error Count
0x0d Return Bus Exception Error Cnt
0x0e Return Slave Message Count
0x0f Return Slave No Response Cnt
0x12 Return Bus Char. Overrun Cnt

The frame description of sub-function code is as follows.


Return request frame (0x00):
1. Request frame
Function word Any character Check code
Address Function code (0x08H)
(0x00H) (0x00H) H L (CRC or LRC)

2. Response frame
Return request frame intact.
Function word Any character Check code
Address Function code (0x08H)
(0x00H) (0x00H) H L (CRC or LRC)

Restart communication option (0x01):


After receiving the frame, PLC will exit from Listen Only mode (Broadcast frame is supported).
1. Request frame
The normal Data field is 0x00 00 or 0xff 00.
Function word Data field Check code
Address Function code (0x08H)
0x00H 0x01H H L (CRC or LRC)

2. Response frame
Function word Data field Check code
Address Function code (0x08H)
0x00H 0x01H H L (CRC or LRC)

Listen only mode of slave station (0x04):


Slave station enters Listen Only mode. None of the instructions will be executed or responded. The slave station can
only recognize the restart communication option instruction and enters the online mode after receiving the instruction
(Broadcast frame is supported).
386 Appendix 7 Modbus Communication Protocol (EC series)

1. Request frame
Function word Data field Check code
Address Function code (0x08H)
(0x00H) (0x04H) 0x00H 0x00H (CRC or LRC)

2. Response frame
No return
Clear counter and diagnostic register (0x0A):
Clear all counters (Broadcast frame is supported).
1. Request frame
Function word Data field Check code
Address Function code (0x08H)
(0x00H) (0x0AH) 0x00H 0x00H (CRC or LRC)

2. Response frame
Function Function word Data field Check code
Address
code (0x08H) (0x00H) (0x0AH) 0x00H 0x00H (CRC or LRC)

Return bus message count (0x0B):


Record the total number of the messages to all master stations from the slave stations since the last starting, clearing
and power-on of counter, which excludes the message of CRC error.
1. Request frame
Function word Data field Check code
Address Function code (0x08H)
(0x00H) (0x0BH) 0x00H 0x00H (CRC or LRC)

2. Response frame
Function word Data field Check code
Address Function code (0x08H)
(0x00H) (0x0BH) H L (CRC or LRC)

CRC error count (0x0C):


Record the number of CRC errors received by slave station since the last starting, clearing and power-on of counter.
1. Request frame
Function word Data field Check code
Address Function code (0x08H)
(0x00H) (0x0CH) 0x00H 0x00H (CRC or LRC)

2. Response frame
Function word Data field Check code
Address Function code (0x08H)
(0x00H) (0x0CH) H L (CRC or LRC)

Return Slave Exception Error Count (0x0D):


Record the number of the exception error that detected by slave station since the last starting, clearing and power-on
of counter, which includes the error detected in the broadcast message.

1. Request frame
Function word Data field Check code
Address Function code (0x08H)
(0x00H) (0x0DH) 0x00H 0x00H (CRC or LRC)

2. Response frame
Function word Data field Check code
Address Function code (0x08H)
(0x00H) (0x0DH) H L (CRC or LRC)

Return Slave Message Count (0x0E)


Record the number of the addressing messages received by the slave station since the last starting, clearing and
power-on of counter.
Appendix 7 Modbus Communication Protocol (EC Series) 387

1. Request frame
Function word Data field Check code
Address Function code (0x08H)
(0x00H) (0x0EH) 0x00H 0x00H (CRC or LRC)

2. Response frame
Function word Data field Check code
Address Function code (0x08H)
(0x00H) (0x0EH) H L (CRC or LRC)

Return Slave No Response Count (0x0F)


Record the number of messages that have not returned to the slave station since the last starting, clearing and
power-on of counter.
1. Request frame
Function word Data field Check code
Address Function code (0x08H)
(0x00H) (0x0FH) 0x00H 0x00H (CRC or LRC)

2. Response frame
Function word Data field Check code
Address Function code (0x08H)
(0x00H) (0x0FH) H L (CRC or LRC)

Return Bus Character Overrun Count (0x12)


Record the number of the messages that cannot be addressed due to the character overrun since the last starting,
clearing and power-on of counter.
1. Request frame
Function Function word Data field Check code
Address
code (0x08H) (0x00H) (0x12H) 0x00H 0x00H (CRC or LRC)

2. Response frame
Function Function word Data field Check code
Address
code (0x08H) (0x00H) (0x12H) H L (CRC or LRC)

Force (Write) Multiple Coils (0x0F Hex )


At most 1968 bit elements (0x07b0) can be written and the number is changeable according to the defined range.
1. Request frame
Starting Number of
Function Number Written Written
address elements Check code
Address code of bytes(n) element ... element
(CRC or LRC)
(0FH) H L H L value No.1 value No.N

B7 B6 B5 B4 B3 B2 B1 B0

2. Response frame
Function starting address Number of elements Check code
Address
code (0FH) H L H L (CRC or LRC)

Preset(reset) Multiple Registers (0x10 Hex)


At most 120 registers (0x78) can be written
1. Request frame
Function Starting Number of Number Written element Written element
Check code
Address code address elements of bytes value No.1 ... value No.N
(CRC or LRC)
(0x10H) H L H L (n) H L H L
388 Appendix 7 Modbus Communication Protocol (EC series)

2. Response frame
Starting
Number of elements Check code
Address Function code (0x10H) address
(CRC or LRC)
H L H L

Faulty Response Frame (0x80+function code)


Response Frame:
Check code
Address Function code Error code (see above)
(CRC or LRC)

Function code refers to the function code of the captured request frame + 0x80

Points To Note
1. Refer to the address classification of elements, the elements read each time shall be of the same type. For example,
elements X and Y cannot be read in one frame.
2. The address and data range of the element shall be within the range specified by the protocol. For example:
For Y element, the protocol address range is 0000 ~ 0255 (Y0-Y377):
If the read starting address is 1 and 256 elements are read, address error will be returned (error code 02), because
there are only 255 Y elements that start with 1.
If the read starting address is 0 and 257 elements are read, data error will be returned (error code 03), because the
actual defined number of Y elements is only 256.
If the read starting address is 0 and 256 elements are read, the status of 256 elements will be returned.
In other words, the read number of the elements must be within the actually defined range. It is true for read/write of
bit/word elements.

Example Of Modbus Communication Control


Rather than transmitting any message actively, the Modbus slave station only decides whether to respond to the
message from the master station based on the specific situation after receiving the message for the local station. The
slave station only supports Modbus function codes 01, 02, 03, 05, 06, 08, 15 and 16. The rest will be responded with
illegal function code (except broadcast frame).
Read and write of element:
Except function code 08, the other supported function codes can read and write element. In principle, one frame can
read up to 2000 bit elements 125 word elements, and write 1968 bit elements and 120 word elements at most.
However, the real protocol addresses are separate and discontinuous for different elements, therefore, when reading
or writing an element, the elements read at one time can only be the same type and the maximum number of the read
or written elements is related to the actually defined number of the elements. For example, when reading Y element
(Y0-Y377), the protocol address ranges from 0 to 255, the logic address of the corresponding Modicon data is 1-256
and the maximum number of elements can be read is 256. See the following examples:
Note: The address of the slave station is 01, the last two bytes are CRC check code and the second byte is function
code.
1. XMT from master station: 01 01 00 00 01 00 3D 9A
01 address; 01 function code; 00 00 starting address; 01 00 number of read elements; 3D 9A check
Slave station response: return correct response
2. XMT from master station: 01 01 00 00 01 01 FC 5A
The master station reads 01 01 elements (257), which is over the defined range of Y elements.
Slave station response: 01 81 03 00 51
The response of the slave station is illegal data, because 257>256, 256 is the allowed maximum number of Y
elements.
3. XMT from master station: 01 01 00 64 00 A0 7D AD
Appendix 7 Modbus Communication Protocol (EC Series) 389

00 64(decimal 100) is the starting address for master station to read, 00 A0 (decimal 160) is the number of the
elements.
Slave station response: 01 81 02 C1 91
The response of the slave station is illegal address, because there are only 156 Y elements which are defined to
start from 100 and 160 Y elements have exceeded the number.
4. XMT from master station: 01 01 01 2C 00 0A 7C 38
The master station reads 10 bit elements of 01 2C (decimal 300).
Slave station response: 01 81 02 C1 91
The response of the slave station is illegal address, because protocol address 300 has no definition of bit element.
5. XMT from master station: 01 04 00 02 00 0A D1 CD
The mater station sends the frame of function code 04.
Slave station response: 01 84 01 82 C0
The response of the slave station is illegal function code.
6. XMT from master station: 01 02 00 00 00 0A F8 0D
Master station reads input element (X element), 10 (X0-X9) from the starting address 00 00.
Slave station response: 01 02 02 00 00 B9 B8
The slave station responds with correct information, which has 02 bytes, and the content is 00 00.
7. XMT from master station: 01 01 04 B0 00 0A BC DA
Master station reads 10 bit elements(X0-X9) starting with 04 B0 (decimal 1200).
Slave station response: 01 01 02 00 00 B9 FC

 Note
1. The slave station responds with 02 bytes, and the content is 00 00.
2. X element does not support write.

Processing of double-word elements


1. The current value of C element is word element or double word element. The values from C200 to C255 are double
word elements, which are read and written through the function codes (03, 16) of read/write register. The address of
every two registers corresponds to one C double word element, and the registers can only be read or written in pair.
For example, read the RTU fame of three C double word elements (C200-C202):

01 03 25 E4 00 06 8E F3
CRC check code
Number of elements to read: 6
Starting address: 9700
Function code
Station No.

In the returned data, 9700 and 9701 are the two addresses representing the content of C200. 9700 is the high 16 bits
and 9701 is the low 16 bits.
2. When reading the double word element, if the starting address for the reading is not an even number, the error
code of illegal address will be returned. For example:
XMT from master station: 01 03 25 E5 00 04 5E F2
The starting address for the reading sent by the master is 25 E5 (four word elements, decimal 9701).
Slave station response: 01 83 02 C0 F1
Slave station response: illegal data address
3. If the number of the read elements is not an even number, the error code of illegal data will be returned. For
example:
XMT from master station: 01 03 25 E4 00 05 CE F2
25 E4: The starting address for master station reading, 5 word elements
Slave response: 01 83 03 01 31
Slave station returns illegal data.
390 Appendix 7 Modbus Communication Protocol (EC series)

Processing of LONG INT data:


Based on the storage method of PLC in GCM, one LONG INT data can be saved in two D elements. For example:
Store one LONG INT data in D3 and D4, D3 is used for storing high 16 bits, D4 is used for storing low 16 bits in
Megmeet PLC. If master station reads LONG INT data through Modbus, the 32-bit data shall be regrouped based on
the LONG INT storage principle of MEGMEET PLC after reading the data.
Storage principle of FLOAT is the same as the storage principle of LONG INT.

Description Of Broadcast
The slave station supports broadcast but not all the function codes. The slave station supports function codes 01, 02,
03, 05, 06, 08, 15 and 16 (decimal). Wherein, 01, 02 and 03 can read element but do not support broadcast, no
response will be gotten after sending out the broadcast; 05, 06, 15 and 16 can write element and support broadcast,
no response will be gotten after sending out the broadcast, but slave station will process the received data; 08 is the
diagnostic function code, it does not support the broadcast except its sub-function codes 0x01, 0x04 and 0x0A
(Hexadecimal).
Appendix 7 Modbus Communication Protocol (EC Series) 391

Modbus Communication Error Code

Error codes Description


0x01 Illegal functional code
0x02 Illegal register address
0x03 Data number error
0x10 Communication overtime (longer than the preset maximum communication time)
0x11 Data frame reception error
0x12 Parameter error (mode or master/slave parameter setting error)
0x13 Error occurs because the local station number coincides with the instruction-set station number
0x14 Element address overflow (the data received or sent is too much for the stroring area)
0x15 Command execute failed

0x16 The address of receive and transmit do not match

0x17 The function code of receive and transmit do not match

0x18 Frame error:

0x19

0x1A

0x1B

0x1C

0x1D

0x1E
392 Appendix 8 ASCII Code Table

ASCII Code Table

High 3-bit
ASCII HEX
0 1 2 3 4 5 6 7
` (pause
0 NUL DLE SPACE 0 @ P p
mark)
1 SOH DC1 ! 1 A Q a q
2 STX DC2 " 2 B R b r
3 ETX DC3 # 3 C S c s
4 EOT DC4 $ 4 D T d t
5 ENQ NAK % 5 E U e u
6 ACK SYN & 6 F V f v
, (single
7 BEL ETB 7 G W g w
quotation marks)
Low 4-bit 8 BS CAN ( 8 H X h x
9 HT EM ) 9 I Y i y
A LF SUB * : J Z j z
B VT ESC + ; K [ k {
I (vertical
C FF FS , (comma) < L l
slash)
- (subtraction
D CR GS = M ] m }
sign)
E SO RS . > N ^ n ~
-
F SI US / ? O o DEL
(Underline)
Appendix 9 Instruction Index 393

Instruction Index
Progra MC80 MC280
Influenced
Instruction Instruction function m MC200 MC100 Page
flag bit
steps
ABS Read current value instruction 8 √ √ 242
ACOS Floating Point Arc Cosine 7 √
Zero,
ADD Integer math instructions 7 Carry, √ √ √ √ 104
Borrow
ANB Power-flow block and 1 √ √ √ √ 72
AND NO contact power-flow and 1 √ √ √ √ 70
AND< Compare integer AND< instruction 5 √ √ √ √ 216
AND<= Compare integer AND<= instruction 5 √ √ √ √ 216
AND<> Compare integer AND <> instruction 5 √ √ √ √ 216
AND= Compare integer AND= instruction 5 √ √ √ √ 216
AND> Compare integer AND > instruction 5 √ √ √ √ 216
AND>= Compare integer AND > =instruction 5 √ √ √ √ 216
ANDD< Compare double integer ANDD< instruction 7 √ √ √ √ 219
ANDD<= Compare double integer ANDD<= instruction 7 √ √ √ √ 219
ANDD<> Compare double integer ANDD<> instruction 7 √ √ √ √ 219
ANDD= Compare double integer ANDD= instruction 7 √ √ √ √ 219
ANDD> Compare double integer ANDD> instruction 7 √ √ √ √ 219
ANDD>= Compare double integer ANDD>= instruction 7 √ √ √ √ 219
Compare floating point number ANDR<
ANDR< 7 √ √ √ √ 222
instruction
Compare floating point number ANDR<=
ANDR<= 7 √ √ √ √ 222
A instruction
Compare floating point number ANDR<>
ANDR<> 7 √ √ √ √ 222
instruction
Compare floating point number ANDR=
ANDR= 7 √ √ √ √ 222
instruction
Compare floating point number ANDR>
ANDR> 7 √ √ √ √ 222
instruction
Compare floating point number ANDR>=
ANDR>= 7 √ √ √ √ 222
instruction
ANI NC contact power-flow and 1 √ √ √ √ 70
ANR Annunciator Reset 1 √
ANS Timed Annunciator Set 7 √
ASC ASCII Code conversion instruction 19 √ √ 131
ASIN Floating Point Arc Sine 7 Zero √
ASCII-hexadecimal integer conversion
ATI 7 √ √ 133
instruction
ATAN Floating Point Arc Tangent 7 Zero √
Zero,
ALT Alternate state 11 Carry, √ √ √
Borrow
Zero,
ABSD Absolute drum sequencer 9 Carry, √ √
Borrow
BAND Word bit contactor AND instruction 5 √ √ √ √ 212
BANI Word bit contactor ANI instruction 5 √ √ √ √ 212
BCD Word to 16-bit BCD instruction 5 √ √ √ √ 127
BIN 16-bit BCD to word instruction 5 √ √ √ √ 128
B
BITS Counting ON bit in word instruction 5 √ √ √ √ 209
BKADD ADD batch integer data 9 √
BKCMP Block data compare 9 √
BKSUB SUB batch integer data 9 √
394 Appendix 9 Instruction Index

Progra MC80 MC280


Influenced
Instruction Instruction function m MC200 MC100 Page
flag bit
steps
BLD Word bit contactor LD instruction 5 √ √ √ √ 211
BLDI Word bit contactor LDI instruction 5 √ √ √ √ 211
BMOV Move data block transmission instruction 7 √ √ √ √ 96
BON Check specified bit status 7 √
BOR Word bit contactor OR instruction 5 √ √ √ √ 212
BORI Word bit contactor ORI instruction 5 √ √ √ √ 213
BOUT Word bit coil output instruction 5 √ √ √ √ 214
BRST Word bit coil reset instruction 5 √ √ √ √ 214
BSET Word bit coil set instruction 5 √ √ √ √ 214
BTOW BYTE to WORD 7 √
Depen
dent on
the
parame
CALL Calling a subprogram √ √ √ √ 94
ter of
the
subpro
gram
CAMBOX Electronic cam instruction 11 √
CAMTAB
Setting the electronic cam data table 11 √
LE
CCITT CCITT check instruction 7 √ √ √ √ 204
C
CCW Counterclockwise circular arc interpolation 12 √
CFEND Conditional end from user main program 1 √ √ √ √ 92
Conditional return from user interrupt
CIRET 1 √ √ √ √ 93
subprogram
CJ Conditional jump 3 √ √ √ √ 91
COS Floating point number COS instruction 7 Zero √ √ √ √ 118
CRC16 CRC16 check instruction 7 √ √ √ √ 205
CSRET Conditional return from user subprogram 1 √ √ √ √ 94
CTR 16-bit counter loop cycle counting instruction 5 √ √ √ √ 82
CTU 16-bit counter counting up instruction 5 √ √ √ √ 81
CMP Compare 7 √ √ √
CW Clockwise circular arc interpolation 12 √
Zero,
DADD Add double integer instruction 10 Carry, √ √ √ √ 108
Borrow
DBAND Dead band control 9 √
DBCD Double word to 32-bit BCD instruction 7 √ √ √ √ 127
DBIN 32-bit BCD to double word instruction 7 √ √ √ √ 128
DBITS Counting ON bit in double word instruction 6 √ √ √ √ 209
DCMP< Compare date< instruction 7 √ √ √ √ 166
DCMP<= Compare date<= instruction 7 √ √ √ √ 166
DCMP<> Compare date<> instruction 7 √ √ √ √ 166
DCMP= Compare date= instruction 7 √ √ √ √ 166
D DCMP> Compare date> instruction 7 √ √ √ √ 166
DCMP>= Compare date>= instruction 7 √ √ √ √ 166
DCNT 32-bit counting instruction 7 √ √ √ √ 83
DDEC Decrement double integer instruction 4 √ √ √ √ 111
DDIV Divide double integer instruction 10 √ √ √ √ 110
DEC Decrement integer instruction 3 √ √ √ √ 107
DECO Decode instruction 5 √ √ √ √ 208
Zero,
DEG Floating point radian to degree conversion 7 √
Carry
Double integer to floating point number
DFLT 7 √ √ √ √ 125
instruction
DFMOV Fill data block double word instruction 9 √ √ √ √ 97
Appendix 9 Instruction Index 395

Progra MC80 MC280


Influenced
Instruction Instruction function m MC200 MC100 Page
flag bit
steps
Read double word from special module buffer
DFROM 10 √ √ √ √ 152
register instruction
DGBIN 32-bit gray code to double word instruction 7 √ √ √ √ 130
DGRY Double word to 32-bit gray code instruction 7 √ √ √ √ 129
High-speed counting compare interrupt
DHSCI 10 √ √ √ √ 172
trigger instruction
High-speed counting compare reset
DHSCR 10 √ √ √ √ 173
instruction
DHSCS High-speed counting compare set instruction 10 √ √ √ √ 171
High-speed counting table compare pulse
DHSP 10 √ √ √ √ 178
output instruction
High-speed Output Passing Position
DHSPI 10 √ √ √ √
Compare Interrupt Trigger
High-speed counting table compare
DHST 10 √ √ √ √ 176
instruction
High-speed counting zone compare
DHSZ 13 √ √ √ √ 175
instruction
DI Disable interrupt instruction 1 √ √ √ √ 93
DINC Increment double integer instruction 4 √ √ √ √ 111
Zero,
Floating point number to double integer
DINT 7 Carry, √ √ √ √ 126
instruction
Borrow
DIS 4-bit Grouping of Word Data 7 √
DIV Divide integer instruction 7 √ √ √ √ 105
Move double word data transmission
DMOV 7 √ √ √ √ 95
instruction
DMUL Multiply double integer instruction 10 √ √ √ √ 109
DNEG Negative double integer instruction 7 √ √ √ √ 112
DRCL 32-bit carry circular shift left instruction 9 Carry √ √ √ √ 146
DRCR 32-bit carry circular shift right instruction 9 Carry √ √ √ √ 145
DROL 32-bit circular shift left instruction 9 Carry √ √ √ √ 144
DROR 32-bit circular shift right instruction 9 Carry √ √ √ √ 144
DRVA Control absolute position instruction 11 √ √ 242
Closed loop relative / absolute position
DRVC 11 √
control instruction
DRVI Control relative position instruction 11 √ √ 240
DSHL 32-bit shift left instruction 9 √ √ √ √ 148
DSHR 32-bit shift right instruction 9 √ √ √ √ 147
DSQT Square root double integer instruction 7 √ √ √ √ 110
Zero,
DSUB Subtract double integer instruction 10 Carry, √ √ √ √ 109
Borrow
DSUM Sum double integer instruction 9 Zero √ √ √ √ 114
DTI Double integer to integer instruction 6 √ √ √ √ 124
Read double word from special module buffer
DTO 10 √ √ √ √ 154
register instruction
DUTY Timing pulse generation 7 √
DVABS Double integer absolute value instruction 7 √ √ √ √ 112
DWAND AND double word instruction 10 √ √ √ √ 139
DWINV NOT double word Instruction 10 √ √ √ √ 141
DWOR OR double word instruction 10 √ √ √ √ 140
DWXOR Exclusive-OR double word instruction 10 √ √ √ √ 140
DXCH Exchange double word instruction 7 √ √ √ √ 99
Zero,
DABSD Absolute drum dequencer 11 Carry, √ √ √
Borrow
396 Appendix 9 Instruction Index

Progra MC80 MC280


Influenced
Instruction Instruction function m MC200 MC100 Page
flag bit
steps
Zero,
DSZR DOG Search Zero Return 9 Carry, √ √ √
Borrow
ED Power flow falling edge detection 1 √ √ √ √ 75
EI Enable interrupt instruction 1 √ √ √ √ 93
ENCO Encode instruction 5 √ √ √ √ 208
错误!未
EROMW
E EEPROM write instruction 7 √ √ 定义书
R
签。
EU Power flow rising edge detection 2 √ √ 74
Zero,
EXP Floating point number EXP instruction EXP 7 √ √ √ √ 120
Carry
FIFO First-in-first-out instruction 7 Zero √ √ √ √ 101
FLT Integer to floating point number instruction 6 √ √ √ √ 125
FMOV Fill data block instruction 7 √ √ √ √ 97
F
FOR Cycle instruction 3 √ √ √ √ 89
Read word from special module buffer
FROM 9 √ √ √ √ 151
register instruction
GBIN 16-bit gray code to word instruction 5 √ √ √ √ 128
GRY Word to 16-bit gray code instruction 5 √ √ √ √
G Zero,
GEARBO
ELECTRONIC GEAR instruction 9 Carry, √ 129
X
Borrow
HACKLE Hackle wave signal output instruction 12 √ √ √ √ 190
HCNT High-speed counter drive instruction 7 √ √ √ √ 170
H
HOUR Timing list instruction 8 √ √ √ √ 165
HTOS Hour to second conversion 5 √
INC Increment integer instruction 3 √ √ √ √ 106
Zero,
INT Floating point number to integer instruction 6 Carry, √ √ √ √ 125
Borrow
I
INV Power-flow block inverse 1 √ √ √ √ 75
hexadecimal integer-ASCII conversion
ITA 7 √ √ 132
instruction
ITD Integer to double integer instruction 6 √ √ √ √ 125
LBL Jump label definition 3 √ √ √ √ 91
LCNV Engineering value conversion instruction 9 √
LD NO contact power-flow loading 1 √ √ √ √ 69
LD< Compare integer LD< instruction 5 √ √ √ √ 215
LD<= Compare integer LD<= instruction 5 √ √ √ √ 215
LD<> Compare integer LD<> instruction 5 √ √ √ √ 215
LD= Compare integer LD= instruction 5 √ √ √ √ 215
LD> Compare integer LD> instruction 5 √ √ √ √ 215
LD>= Compare integer LD>= instruction 5 √ √ √ √ 215
LDD< Compare double integer LDD< instruction 7 √ √ √ √ 217
LDD<= Compare double integer LDD<= instruction 7 √ √ √ √ 217
L
LDD<> Compare double integer LDD<> instruction 7 √ √ √ √ 217
LDD= Compare double integer LDD= instruction 7 √ √ √ √ 217
LDD> Compare double integer LDD> instruction 7 √ √ √ √ 217
LDD>= Compare double integer LDD>= instruction 7 √ √ √ √ 217
LDI NC contact power-flow loading 1 √ √ √ √ 69
Compare floating point number LDR<
LDR< 7 √ √ √ √ 221
instruction
Compare floating point number LDR<=
LDR<= 7 √ √ √ √ 221
instruction
Compare floating point number LDR<>
LDR<> 7 √ √ √ √ 221
instruction
Appendix 9 Instruction Index 397

Progra MC80 MC280


Influenced
Instruction Instruction function m MC200 MC100 Page
flag bit
steps
Compare floating point number LDR=
LDR= 7 √ √ √ √ 221
instruction
Compare floating point number LDR>
LDR> 7 √ √ √ √ 221
instruction
Compare floating point number LDR>=
LDR>= 7 √ √ √ √ 221
instruction
LIFO Last-in-first-output instruction 7 Zero √ √ √ √ 101
LIMIT Limit control 9 √
LIN Line Interpolation Instruction 12 √
Zero,
LN Floating point number LN instruction 7 √ √ √ √ 120
Carry
Zero,
LOG Floating point common logarithm 7 √
Carry
LRC LRC check instruction 7 √ √ √ √ 206
MC Main control 3 √ √ √ √ 76
MCR Main control remove 1 √ √ √ √ 77
MEAN Mean Value 7 √
Modbus master station communication
Modbus 8 √ √ √ √ 197
instruction
MODLIN
Modbus form instruction 12 √ √
M K
MOV Move word data transmission instruction 5 √ √ √ √ 95
MPP Output power-flow stack pop off 1 √ √ √ √ 74
MPS Output power-flow input stack 1 √ √ √ √ 73
MRD Read output power-flow stack top value 1 √ √ √ √ 74
MUL Multiply integer instruction 8 √ √ √ √ 105
MODRW Mdodbus and write instruction 14 √ √
NEG Negative integer instruction 5 √ √ √ √ 108
N NEXT Return from cycle 1 √ √ √ √ 89
NOP No operation 1 √ √ √ √ 76
OR NO contact power-flow or 1 √ √ √ √ 71
OR< Compare integer OR< instruction 5 √ √ √ √ 217
OR<= Compare integer OR<= instruction 5 √ √ √ √ 217
OR<> Compare integer OR<> instruction 5 √ √ √ √ 217
OR= Compare integer OR= instruction 5 √ √ √ √ 217
OR> Compare integer OR> instruction 5 √ √ √ √ 217
OR>= Compare integer OR>= instruction 5 √ √ √ √ 217
ORB Power-flow block or 1 √ √ √ √ 73
ORD< Compare double integer ORD< instruction 7 √ √ √ √ 220
ORD<= Compare double integer ORD<= instruction 7 √ √ √ √ 220
ORD<> Compare double integer ORD<> instruction 7 √ √ √ √ 220
ORD= Compare double integer ORD= instruction 7 √ √ √ √ 220
ORD> Compare double integer ORD> instruction 7 √ √ √ √ 220
O ORD>= Compare double integer ORD>= instruction 7 √ √ √ √ 220
ORI NC contact power-flow or 1 √ √ √ √ 71
Compare floating point number ORR<
ORR< 7 √ √ √ √ 223
instruction
Compare floating point number ORR<=
ORR<= 7 √ √ √ √ 223
instruction
Compare floating point number ORR<>
ORR<> 7 √ √ √ √ 223
instruction
Compare floating point number ORR=
ORR= 7 √ √ √ √ 223
instruction
Compare floating point number ORR>
ORR> 7 √ √ √ √ 223
instruction
Compare floating point number ORR>=
ORR>= 7 √ √ √ √ 223
instruction
398 Appendix 9 Instruction Index

Progra MC80 MC280


Influenced
Instruction Instruction function m MC200 MC100 Page
flag bit
steps
OUT Power-flow output 1 √ √ √ √ 72
OUT Sxx SFC state jumb 3 √ √ √ √ 78
PID PID instruction 9 √ √ √ √ 185
PLS Pulse Output Instruction of Envelop 7 √ √ 183
Count pulse with acceleration/deceleration
PLSR 10 √ √ √ √ 182
output instruction
PLSV Variable speed pulse output instruction 8 √ √ 239
P PLSY Count pulse output instruction 9 √ √ √ √ 181
Floating point number exponentiation Zero,
POWER 10 √ √ √ √ 119
instruction Carry
PR Print (ASCII Code) 5 √ √ √
PUSH Push instruction 7 Carry √ √ √ √ 99
PWM PWM pulse output instruction 7 √ √ √ √ 184
RAD Floating point degree to radian conversion 7 Zero √
Zero,
RADD Add floating point number instruction 10 √ √ √ √ 114
Carry
RAMP Ramp wave signal output instruction 12 √ √ √ √ 189
RCL 16-bit carry circular shift left instruction 7 Carry √ √ √ √ 144
RCR 16-bit carry circular shift right instruction 7 Carry √ √ √ √ 143
RCV Free-port receiving (RCV) instruction 7 √ √ √ √ 203
Zero,
RDIV Divide floating point number instruction 10 √ √ √ √ 116
Carry
REF Set input filtering constant instruction 5 √ √ √ √ 155
R
REFF Set input filtering constant instruction 3 √ √ √ √ 154
RET SFC program end 1 √ √ √ √ 79
RLCNV Engineering value conversion instruction 12 √
Move floating point number data transmission
RMOV 7 √ √ √ √ 96
instruction
Zero,
RMUL Multiply floating point number instruction 10 √ √ √ √ 115
Carry
RND Random number generation 3 √
RNEG Negative floating point number instruction 7 √ √ √ √ 117
ROL 16-bit circular shift left instruction 7 Carry √ √ √ √ 142
ROR 16-bit circular shift right instruction 7 Carry √ √ √ √ 141
RSQT Square root floating point number instruction 7 Zero √ √ √ √ 116
RST Reset 1 √ √ √ √ 76
RST Sxx SFC state delete 3 √ √ √ √ 79
Zero,
R RSUB Subtract floating point number instruction 10 √ √ √ √ 114
Carry
RSUM Sum floating point number instruction 9 √ √ √ √ 121
Floating point number absolute value
RVABS 7 √ √ √ √ 117
instruction
RCMP Compare floating point number set instruction 9 √ √ √
SCL Scaling 7 √
SEG Word to 7-segment encode 5 √ √ √ √
SER Search a data stack 9 √
SET Set 1 √ √ √ √ 76
SET Sxx SFC state shift 3 √ √ √ √ 78
SFTL Shift left byte instruction 9 √ √ √ √ 150
SFTR Shift right byte instruction 9 √ √ √ √ 149
S
SHL 16-bit shift left instruction 7 √ √ √ √ 147
SHR 16-bit shift right word instruction 7 √ √ √ √ 146
SIN Floating point number SIN instruction 7 Zero √ √ √ √ 118
SPD Pulse detection instruction 7 √ √ √ √ 180
SQT Square root integer instructions 5 √ √ √ √ 106
STL SFC state load instruction 3 √ √ √ √ 78
STOH Second to hour conversion 5 √
Appendix 9 Instruction Index 399

Progra MC80 MC280


Influenced
Instruction Instruction function m MC200 MC100 Page
flag bit
steps
STRADD Link character strings 7 √
STRINST
Character string search 9 √
R
STRLEFT Extracting character string data from the left 7 √
STRLEN Character string length detection 5 √
STRMID
Random selection of character strings 7 √
R
STRMID
Random replacement of character strings 7 √
W
STRMOV Character string transfer 5 √
STRRIG
Extracting character string data from the right 7 √
HT
STOP User program stop 1 √ √ √ √ 93
Zero,
SUB Subtract integer instruction 7 Carry, √ √ √ √ 104
Borrow
SUM Sum integer instruction 8 Zero √ √ √ √ 113
SWAP Swap bytes 3 √ √ √ √ 98
Zero,
TADD Add clock instruction 7 √ √ √ √ 163
Carry
Zero,
TAN Floating point number TAN instruction 7 √ √ √ √ 119
Carry
TCMP< Compare time< instruction 7 √ √ √ √ 167
TCMP<= Compare time>= instruction 7 √ √ √ √ 167
TCMP<> Compare time<> instruction 7 √ √ √ √ 167
TCMP= Compare time= instruction 7 √ √ √ √ 167
TCMP> Compare time> instruction 7 √ √ √ √ 167
TCMP>= Compare time>= instruction 7 √ √ √ √ 167
TKY Ten key input 7 √
T TMON Monostable timing instruction 5 √ √ √ √ 81
Read word from special module buffer
TO 9 √ √ √ √ 153
register instruction
TOF Off-delay timing instruction 5 √ √ √ √ 80
TON On-delay timing instruction 5 √ √ √ √ 79
TONR On-delay remember timing instruction 5 √ √ √ √ 80
TRD Read real-time clock instruction 3 √ √ √ √ 161
TRIANGL
Triangle wave signal output instruction 12 √ √ √ √ 191
E
Zero,
TSUB Subtract clock instruction 7 √ √ √ √ 164
Borrow
TWR Write real-time clock instruction 3 √ √ √ √ 162
U UNI 4-bit Linking of word data √
VABS Integer absolute value instruction 5 √ √ √ √ 107
V
VRRD Read analog potentiometer value instruction 5 √ √ √ √ 154
WAND AND word instruction 7 √ √ √ √ 136
WDT User program watchdog reset 1 √ √ √ √ 92
WINV NOT word instruction 5 √ √ √ √ 139
WOR OR word instruction 7 √ √ √ √ 137
W
WSFL Shift left word instruction 9 √ √ √ √ 103
WSFR Shift right word instruction 9 √ √ √ √ 102
WTOB WORD to BYTE 7 √
WXOR Exclusive-OR word instruction 7 √ √ √ √ 137
XCH Exchange word instruction 5 √ √ √ √ 98
X
XMT Free-port sending (XMT) instruction 7 √ √ √ √ 202
ZONE Zone control 9 √
Z ZRN Regress to origin instruction 11 √ √
ZRST Batch bit reset instruction 5 √ √ √ √ 207
400 Appendix 9 Instruction Index

Progra MC80 MC280


Influenced
Instruction Instruction function m MC200 MC100 Page
flag bit
steps
ZSET Set batch bit instruction 5 √ √ √ √ 207
Appendix 10 Hign Speed Counter Comparison Table 401

Classified Instruction Index

Program Influenced MC MC MC80 MC280


Instruction Instruction function Page
steps flag bit 200 100
LD NO contact power-flow loading 1 √ √ √ √ 69
LDI NC contact power-flow loading 1 √ √ √ √ 69
AND NO contact power-flow and 1 √ √ √ √ 70
ANI NC contact power-flow and 1 √ √ √ √ 70
OR NO contact power-flow or 1 √ √ √ √ 71
ORI NC contact power-flow or 1 √ √ √ √ 71
OUT Power-flow output 1 √ √ √ √ 72
SET Set 1 √ √ √ √ 76
RST Reset 1 √ √ √ √ 76
ANB Power-flow block and 1 √ √ √ √ 72
ORB Power-flow block or 1 √ √ √ √ 73
INV Power-flow block inverse 1 √ √ √ √ 75
NOP No operation 1 √ √ √ √ 76
Basic MPS Output power-flow input stack 1 √ √ √ √ 73
instruction MRD Read output power-flow stack top value 1 √ √ √ √ 74
MPP Output power-flow stack pop off 1 √ √ √ √ 74
MC Main control 3 √ √ √ √ 76
MCR Main control remove 1 √ √ √ √ 77
EU Power flow rising edge detection 2 √ √ √ √ 74
ED Power flow falling edge detection 2 √ √ √ √ 75
TON On-delay timing instruction 5 √ √ √ √ 79
TOF Off-delay timing instruction 5 √ √ √ √ 80
TMON Monostable timing instruction 5 √ √ √ √ 81
TONR On-delay remember timing instruction 5 √ √ √ √ 80
CTU 16-bit counter counting up instruction 5 √ √ √ √ 81
16-bit counter loop cycle counting
CTR 5 √ √ √ √ 82
instruction
DCNT 32-bit counting instruction 7 √ √ √ √ 83
LBL Jump label definition 3 √ √ √ √ 91
CJ Conditional jump 3 √ √ √ √ 91
Depend
ent on
CALL Calling a subprogram √ √ √ √ 94
the
program
CSRET Conditional return from user subprogram 1 √ √ √ √ 94
Program
CFEND Conditional end from user main program 1 √ √ √ √ 92
control
Conditional return from user interrupt
instruction CIRET 1 √ √ √ √ 93
subprogram
FOR Cycle instruction 3 √ √ √ √ 89
NEXT Return from cycle 1 √ √ √ √ 89
WDT User program watchdog reset 1 √ √ √ √ 92
STOP User program stop 1 √ √ √ √ 93
EI Enable interrupt instruction 1 √ √ √ √ 93
DI Disable interrupt instruction 1 √ √ √ √ 93
STL SFC state load instruction 3 √ √ √ √ 78
SET Sxx SFC state shift 3 √ √ √ √ 78
SFC
OUT Sxx SFC state jump 3 √ √ √ √ 78
instruction
RST Sxx SFC state reset 3 √ √ √ √ 79
RET SFC program end 1 √ √ √ √ 79
402 Appendix 10 Classified Instruction Index

Program Influenced MC MC MC80 MC280


Instruction Instruction function Page
steps flag bit 200 100
MOV Move word data transmission instruction 5 √ √ √ √ 95
Move double word data transmission
DMOV 7 √ √ √ √ 95
Data instruction
transmission Move floating point number data
RMOV 7 √ √ √ 96
instruction transmission instruction
BMOV Move data block transmission instruction 7 √ √ √ √ 96
SWAP Swap bytes 3 √ √ √ √ 98
XCH Exchange word instruction 5 √ √ √ √ 98
DXCH Exchange double word instruction 7 √ √ √ √ 99
FMOV Fill data block instruction 7 √ √ √ √ 97
DFMOV Fill data block double word instruction 9 √ √ √ √ 97
Data flow
WSFR Shift right word instruction 9 √ √ √ √ 102
instruction
WSFL Shift left word instruction 9 √ √ √ √ 103
PUSH Push instruction 7 Carry √ √ √ √ 99
FIFO First-in-first-out instruction 7 Zero √ √ √ √ 101
LIFO Last-in-first-output instruction 7 Zero √ √ √ √ 101
Zero, Carry,
ADD Add integer instructions 7 √ √ √ √ 104
Borrow
Zero, Carry,
DADD Add double integer instruction 10 √ √ √ √ 108
Borrow
Zero, Carry,
SUB Subtract integer instruction 7 √ √ √ √ 104
Borrow
Zero, Carry,
DSUB Subtract double integer instruction 10 √ √ √ √ 109
Borrow
INC Increment integer instruction 3 √ √ √ √ 106
DINC Increment double integer instruction 4 √ √ √ √ 111
Integer / DEC Decrement integer instruction 3 √ √ √ √ 107
double DDEC Decrement double integer instruction 4 √ √ √ √ 111
integer math MUL Multiply integer instruction 8 √ √ √ √ 105
instruction DMUL Multiply double integer instruction 10 √ √ √ √ 109
DIV Divide integer instruction 7 √ √ √ √ 105
DDIV Divide double integer instruction 10 √ √ √ √ 110
VABS Integer absolute value instruction 5 √ √ √ √ 107
DVABS Double integer absolute value instruction 7 √ √ √ √ 112
NEG Negative integer instruction 5 √ √ √ √ 108
DNEG Negative double integer instruction 7 √ √ √ √ 112
SQT Square root integer instructions 5 √ √ √ √ 106
DSQT Square root double integer instruction 7 √ √ √ √ 110
SUM Sum integer instruction 8 Zero √ √ √ √ 113
DSUM Sum double integer instruction 9 Zero √ √ √ √ 114
RADD Add floating point number instruction 10 Zero, Carry √ √ √ √ 114
RSUB Subtract floating point number instruction 10 Zero, Carry √ √ √ √ 114
RMUL Multiply floating point number instruction 10 Zero, Carry √ √ √ √ 115
RDIV Divide floating point number instruction 10 Zero, Carry √ √ √ √ 116
Floating point number absolute value
RVABS 7 √ √ √ √ 117
instruction
Floating point number absolute value
RNEG 7 √ √ √ √ 117
instruction
Floating point
Square root floating point number
number math RSQT 7 Zero √ √ √ √ 116
instruction
instruction
SIN Floating point number SIN instruction 7 Zero √ √ √ √ 118
COS Floating point number COS instruction 7 Zero √ √ √ √ 118
TAN Floating point number TAN instruction 7 Zero, Carry √ √ √ √ 119
LN Floating point number LN instruction 7 Zero, Carry √ √ √ √ 120
EXP Floating point number EXP instruction 7 Zero, Carry √ √ √ √ 120
Floating point number exponentiation
POWER 10 Zero, Carry √ √ √ √ 119
instruction
RSUM Sum floating point number instruction 9 √ √ √ √ 121
Appendix 10 Hign Speed Counter Comparison Table 403

Program Influenced MC MC MC80 MC280


Instruction Instruction function Page
steps flag bit 200 100
ASIN Floating Point Arc Sine 7 Zero √
ACOS Floating Point Arc Cosine 7 √
ATAN Floating Point Arc Tangent 7 Zero √
Floating point degree to radian
RAD 7 Zero √
conversion
Floating point radian to degree
DEG 7 Zero, Carry √
conversion
LOG Floating point common logarithm 7 Zero, Carry √
WAND AND word instruction 7 √ √ √ √ 136
DWAND AND double word instruction 10 √ √ √ √ 139
WOR OR word instruction 7 √ √ √ √ 137
Word/double
DWOR OR double word instruction 10 √ √ √ √ 140
word logic
WXOR Exclusive-OR word instruction 7 √ √ √ √ 137
instruction
DWXOR Exclusive-OR double word instruction 10 √ √ √ √ 140
WINV NOT word instruction 5 √ √ √ √ 139
DWINV NOT double word Instruction 7 √ √ √ √ 141
ROR 16-bit circular shift right instruction 7 Carry √ √ √ √ 141
DROR 32-bit circular shift right instruction 9 Carry √ √ √ √ 144
ROL 16-bit circular shift left instruction 7 Carry √ √ √ √ 142
DROL 32-bit circular shift left instruction 9 Carry √ √ √ √ 144
RCR 16-bit carry circular shift right instruction 7 Carry √ √ √ √ 143
DRCR 32-bit carry circular shift right instruction 9 Carry √ √ √ √ 145
Shift / rotate RCL 16-bit carry circular shift left instruction 7 Carry √ √ √ √ 144
instruction DRCL 32-bit carry circular shift left instruction 9 Carry √ √ √ √ 146
SHR 16-bit shift right word instruction 7 √ √ √ √ 146
DSHR 32-bit shift right instruction 9 √ √ √ √ 147
SHL 16-bit shift left instruction 7 √ √ √ √ 147
DSHL 32-bit shift left instruction 9 √ √ √ √ 148
SFTL Shift left byte instruction 9 √ √ √ √ 150
SFTR Shift right byte instruction 9 √ √ √ √ 149
DECO Decode instruction 5 √ √ √ √ 208
ENCO Encode instruction 5 √ √ √ √ 208
BITS Counting ON bit in word instruction 5 √ √ √ √ 209
Enhanced bit
Counting ON bit in double word
logic DBITS 6 √ √ √ √ 209
instruction
instruction
ZRST Batch bit reset instruction 5 √ √ √ √ 207
ZSET Set batch bit instruction 5 √ √ √ √ 207
BON Check specified bit status 7 √
HCNT High-speed counter drive instruction 7 √ √ √ √ 170
High-speed counting compare set
DHSCS 10 √ √ √ √ 171
instruction
High-speed counting compare reset
DHSCR 10 √ √ √ √ 173
instruction
High-speed counting compare interrupt
DHSCI 10 √ √ √ √ 172
trigger instruction
High-speed counting zone compare
DHSZ 13 √ √ √ √ 175
instruction
High speed High-speed counting table compare
DHST 10 √ √ √ √ 176
I/O instruction instruction
High-speed counting table compare pulse
DHSP 10 √ √ √ √ 178
output instruction
SPD Pulse detection instruction 7 √ √ √ √ 180
PLSY Count pulse output instruction 9 √ √ √ √ 181
Count pulse with
PLSR acceleration/deceleration output 10 √ √ √ √ 182
instruction
PWM PWM pulse output instruction 7 √ √ √ √ 184
PLS Pulse Output Instruction of Envelop 7 √ √ √ 183
404 Appendix 10 Classified Instruction Index

Program Influenced MC MC MC80 MC280


Instruction Instruction function Page
steps flag bit 200 100
PID PID instruction 9 √ √ √ √ 185
RAMP Ramp wave signal output instruction 12 √ √ √ √ 189
TRIANGLE Triangle wave signal output instruction 12 √ √ √ √ 191
HACKLE Hackle wave signal output instruction 12 √ √ √ √ 190
Control
Zero, Carry,
calculation ABSD Absolute drum sequencer 9 √ √
Borrow
instruction
Zero, Carry,
DABSD Absolute drum sequencer 11 √ √ √
Borrow
Zero, Carry,
ALT Alternate state 11 √ √ √
Borrow
Read word from special module buffer
FROM 9 √ √ √ √ 151
register instruction
Read double word from special module
DFROM 10 √ √ √ √ 152
buffer register instruction
Write word to special module buffer
TO 9 √ √ √ √ 153
register instruction
Write double word to special module
DTO 10 √ √ √ √ 154
buffer register instruction
External Read analog potentiometer value
equipment VRRD 5 √ √ √ √ 154
instruction
instruction REFF Set input filtering constant instruction 3 √ √ √ √ 154
REF Instant refresh I/O instruction 5 √ √ √ √ 155
错误!
未定
EROMWR Write EEPROM instruction 7 √ √ √
义书
签。
PR Print (ASCII Code) 5 √ √ √
TKY Ten key input 7 √
ABS Read current value instruction 8 √ √ √ 242
ZRN Regress to origin instruction 11 √ √ √ 239
PLSV Variable speed pulse output instruction 8 √ √ √ 240
DRVI Control relative position instruction 11 √ √ √ 240
DRVA Control absolute position instruction 11 √ √ √ 242
Zero, Carry,
DSZR DOG Search Zero Return 9 √ √ √
Borrow
LIN Line Interpolation Instruction 12 √
Position CW Clockwise circular arc interpolation 12 √
instruction Counterclockwise circular arc
CCW 12 √
interpolation
Closed loop relative / absolute position
DRVC 11 √
control instruction
Zero, Carry,
GEARBOX ELECTRONIC GEAR instruction 9 √
Borrow
CAMBOX Electronic cam instruction 11 √
CAMTABL
Setting the electronic cam data table 11 √
E
TRD Read real-time clock instruction 3 √ √ √ √ 161
TWR Write real-time clock instruction 3 √ √ √ √ 162
TADD Add clock instruction 7 Zero, Carry √ √ √ √ 163
Real-time
Zero,
clock TSUB Subtract clock instruction 7 √ √ √ √ 164
Borrow
instruction
HOUR Timing list instruction 8 √ √ √ √ 165
HTOS Hour to second conversion 5 √
STOH Second to hour conversion 5 √
LD= Compare integer LD= instruction 5 √ √ √ √ 215
Compare
LDD= Compare double integer LDD= instruction 7 √ √ √ √ 217
contactor
Compare floating point number LDR=
instruction LDR= 7 √ √ √ √ 221
instruction
Appendix 10 Hign Speed Counter Comparison Table 405

Program Influenced MC MC MC80 MC280


Instruction Instruction function Page
steps flag bit 200 100
LD> Compare interger LD> instruction 5 √ √ √ √ 215
LDD> Compare double integer LDD> instruction 7 √ √ √ √ 217
Compare floating point number LDR>
LDR> 7 √ √ √ √ 221
instruction
LD>= Compare integer LD>= instruction 5 √ √ √ √ 215
Compare double integer LDD>=
LDD>= 7 √ √ √ √ 217
instruction
Compare floating point number LDR>=
LDR>= 7 √ √ √ √ 221
instruction
LD< Compare integer LD< instruction 5 √ √ √ √ 215
LDD< Compare double integer LDD< instruction 7 √ √ √ √ 217
Compare floating point number LDR<
LDR< 7 √ √ √ √ 221
instruction
LD<= Compare integer LD<= instruction 5 √ √ √ √ 215
Compare double integer LDD<=
LDD<= 7 √ √ √ √ 217
instruction
Compare floating point number LDR<=
LDR<= 7 √ √ √ √ 221
instruction
LD<> Compare integer LD<> instruction 5 √ √ √ √ 215
Compare double integer LDD<>
LDD<> 7 √ √ √ √ 217
instruction
Compare floating point number LDR<>
LDR<> 7 √ √ √ √ 221
instruction
AND= Compare integer AND= instruction 5 √ √ √ √ 216
Compare double integer ANDD=
ANDD= 7 √ √ √ √ 219
instruction
Compare floating point number ANDR=
ANDR= 7 √ √ √ √ 222
instruction
AND> Compare integer AND> instruction 5 √ √ √ √ 216
Compare double integer ANDD>
ANDD> 7 √ √ √ √ 219
instruction
Compare floating point number ANDR>
ANDR> 7 √ √ √ √ 222
instruction
AND>= Compare integer AND>= instruction 5 √ √ √ √ 216
Compare double integer ANDD>=
ANDD>= 7 √ √ √ √ 219
instruction
Compare floating point number ANDR>=
ANDR>= 7 √ √ √ √ 222
instruction
AND< Compare integer AND< instruction 5 √ √ √ √ 216
Compare double integer ANDD<
ANDD< 7 √ √ √ √ 219
instruction
Compare floating point number ANDR<
ANDR< 7 √ √ √ √ 222
Compare instruction
contactor AND<= Compare integer AND<= instruction 5 √ √ √ √ 216
instruction Compare double integer ANDD<=
ANDD<= 7 √ √ √ √ 219
instruction
Compare floating point number ANDR<=
ANDR<= 7 √ √ √ √ 222
instruction
AND<> Compare integer AND<> instruction 5 √ √ √ √ 216
Compare double integer ANDD<>
ANDD<> 7 √ √ √ √ 219
instruction
Compare floating point number ANDR<>
ANDR<> 7 √ √ √ √ 222
instruction
OR= Compare integer OR= instruction 5 √ √ √ √ 217
Compare double integer ORD=
ORD= 7 √ √ √ √ 220
instruction
Compare floating point number ORR=
ORR= 7 √ √ √ √ 223
instruction
406 Appendix 10 Classified Instruction Index

Program Influenced MC MC MC80 MC280


Instruction Instruction function Page
steps flag bit 200 100
OR> Compare integer OR> instruction 5 √ √ √ √ 217
Compare double integer ORD>
ORD> 7 √ √ √ √ 220
instruction
Compare floating point number ORR>
ORR> 7 √ √ √ √ 223
instruction
OR>= Compare integer OR>= instruction 5 √ √ √ √ 217
Compare double integer ORD>=
ORD>= 7 √ √ √ √ 220
instruction
Compare floating point number ORR>=
ORR>= 7 √ √ √ √ 223
instruction
OR< Compare integer OR< instruction 5 √ √ √ √ 217
Compare double integer ORD<
ORD< 7 √ √ √ √ 220
instruction
Compare floating point number ORR<
ORR< 7 √ √ √ √ 223
instruction
OR<= Compare integer OR<= instruction 5 √ √ √ √ 217
Compare
Compare double integer ORD<=
contactor ORD<= 7 √ √ √ √ 220
instruction
instuction
Compare floating point number ORR<=
ORR<= 7 √ √ √ √ 223
instruction
OR<> Compare integer OR<> instruction 5 √ √ √ √ 217
Compare double integer ORD<>
ORD<> 7 √ √ √ √ 220
instruction
Compare floating point number ORR<>
ORR<> 7 √ √ √ √ 223
instruction
CMP Compare 7 √ √ √
LCMP Compare double integer set instruction 9 √ √ √
Compare floating point number set
RCMP 9 √ √ √
instruction
ITD Integer to double integer instruction 6 √ √ √ √ 125
DTI Double integer to integer instruction 6 √ √ √ √ 124
Integer to floating point number
FLT 6 √ √ √ √ 125
instruction
Double integer to floating point number
DFLT 7 √ √ √ √ 125
instruction
Floating point number to integer Zero, Carry,
INT 6 √ √ √ √ 125
instruction Borrow
Floating point number to double integer Zero, Carry,
DINT 7 √ √ √ √ 126
instruction Borrow
BCD Word to 16-bit BCD instruction 5 √ √ √ √ 127
DBCD Double word to 32-bit BCD instruction 7 √ √ √ √ 127
BIN 16-bit BCD to word instruction 5 √ √ √ √ 128
Data
DBIN 32-bit BCD to double word instruction 7 √ √ √ √ 128
converting
GRY Word to 16-bit gray code instruction 5 √ √ √ √ 129
instruction
Double word to 32-bit gray code
DGRY 7 √ √ √ √ 129
instruction
GBIN 16-bit gray code to word instruction 5 √ √ √ √ 130
32-bit gray code to double word
DGBIN 7 √ √ √ √ 130
instruction
SEGI Word to 7-segment encode 5 √ √ √ √ 131
ASC ASCII Code conversion instruction 19 √ √ √ 131
hexadecimal integer-ASCII conversion
ITA 7 √ √ √ 132
instruction
ASCII-hexadecimal integer conversion
ATI 7 √ √ √ 133
instruction
LCNV Engineering value conversion instruction 9 √
RLCNV Engineering value conversion instruction 12 √
Word BLD Word bit contactor LD instruction 5 √ √ √ √ 211
Appendix 10 Hign Speed Counter Comparison Table 407

Program Influenced MC MC MC80 MC280


Instruction Instruction function Page
steps flag bit 200 100
contactor BLDI Word bit contactor LDI instruction 5 √ √ √ √ 211
instruction BAND Word bit contactor AND instruction 5 √ √ √ √ 212
BANI Word bit contactor ANI instruction 5 √ √ √ √ 212
BOR Word bit contactor OR instruction 5 √ √ √ √ 212
BORI Word bit contactor ORI instruction 5 √ √ √ √ 213
BSET Word bit coil set instruction 5 √ √ √ √ 214
BRST Word bit coil reset instruction 5 √ √ √ √ 214
BOUT Word bit coil output instruction 5 √ √ √ √ 214
Modbus master station communication
Modbus 8 √ √ √ √ 197
instruction
Communicati XMT Free-port sending (XMT) instruction 7 √ √ √ √ 202
on instruction RCV Free-port receiving (RCV) instruction 7 √ √ √ √ 203
MODRW Mdodbus and write instruction 14 √ √
MODLINK Modbus form instruction 12 √ √
CCITT CCITT check instruction 7 √ √ √ √ 204
Data check
CRC16 CRC16 check instruction 7 √ √ √ √ 205
instruction
LRC LRC check instruction 7 √ √ √ √ 206
DCMP= Compare date= instruction 7 √ √ √ √ 166
DCMP> Compare date> instruction 7 √ √ √ √ 166
Compare
DCMP< Compare date< instruction 7 √ √ √ √ 166
date
DCMP>= Compare date>= instruction 7 √ √ √ √ 166
instruction
DCMP<= Compare date<= instruction 7 √ √ √ √ 166
DCMP<> Compare date<> instruction 7 √ √ √ √ 166
TCMP= Compare time= instruction 7 √ √ √ √ 167
TCMP> Compare time> instruction 7 √ √ √ √ 167
Compare
TCMP< Compare time< instruction 7 √ √ √ √ 167
time
TCMP>= Compare time>= instruction 7 √ √ √ √ 167
instruction
TCMP<= Compare time<= instruction 7 √ √ √ √ 167
TCMP<> Compare time<> instruction 7 √ √ √ √ 1
MEAN Mean Value 7 √
WTOB WORD to BYTE 7 √
Data BTOW BYTE to WORD 7 √
processing UNI 4-bit Linking of word data √
instruction DIS 4-bit Grouping of Word Data 7 √
ANS Timed Annunciator Set 7 √
ANR Annunciator Reset 1 √
Datablock BKADD ADD batch integer data 9 √
processing BKSUB SUB batch integer data 9 √
instruction BKCMP Block data compare 9 √
LIMITLimit control 9 √
DBAND Dead band control 9 √
Data table
ZONE Zone control 9 √
insturction
SCL Scaling 7 √
SER Search a data stack 9 √
STRADD Link character strings 7 √
STRLEN Character string length detection 5 √
STRINSTRCharacter string search 9 √
Extracting character string data from the
Character STRLEFT 7 √
left
string
STRRIGH Extracting character string data from the
instruction 7 √
T right
STRMIDR Random selection of character strings 7 √
STRMIDW Random replacement of character strings 7 √
STRMOV Character string transfer 5 √
Other RND Random number generation 3 √
instruction DUTY Timing pulse generation 7 √
408 Appendix 10 Classified Instruction Index

High Speed Counter Comparison Table

Max. frequency (kHz)


Input point
X0 X1 X2 X3 X4 X5 X6 X7
Counter
Counter C236 U/D*
50
Counter C237 U/D
Counter C238 U/D
Counter C239 U/D
1 10
phase Counter C240 U/D
&1 Counter C241 U/D
point Counter C301 U/D
100 /
input Counter C302 U/D
mode Counter C242 U/D Reset
Counter C243 U/D Reset 10
Counter C244 U/D Reset Start
Counter C245 U/D Reset Start
Counter C246 U D 50
1
Counter C247 U D Reset 10
phase
bi-dire Counter C303 U D /
100
ctional Counter C248 U D Reset
input 10
Counter C249 U D Reset Start
mode
Counter C250 U D Reset Start
Counter C251 Ph A Ph B 30
Counter C304 Ph A Ph B
Counter C305 Ph A Ph B /
Counter C306 Ph A Ph B
Counter C252 Ph A Ph B Reset
2 Counter C253 Ph A Ph B Reset
Counter C254 Ph A Ph B Reset Start 5
phase
50
input Counter C255 Ph A Ph B Reset Start
mode Counter C256
Ph A Ph B
(X10 Reset)
Counter C257
Ph A Ph B
(X11 Reset)
/
Counter C258
Ph A Ph B
(X12 Reset)
Counter C259
Ph A Ph B
(X13 Reset)
Note:
1. U: UP
2. D: Do

You might also like