0% found this document useful (0 votes)
13 views484 pages

Vs Series

The VS Series PLC Programming Manual provides comprehensive guidance on programming the VS series PLC, including component descriptions, basic and application instructions, and communication functions. It covers installation, wiring, maintenance, and safety precautions, emphasizing the PLC's reliability and versatility in industrial control. The manual also includes detailed tables and examples for various programming techniques and applications.
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)
13 views484 pages

Vs Series

The VS Series PLC Programming Manual provides comprehensive guidance on programming the VS series PLC, including component descriptions, basic and application instructions, and communication functions. It covers installation, wiring, maintenance, and safety precautions, emphasizing the PLC's reliability and versatility in industrial control. The manual also includes detailed tables and examples for various programming techniques and applications.
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/ 484

VS Series PLC

Programming Manual

Version: 2.0 Date: August , 2018

Preface
The purpose of this book is to give programming inspires for the VS series PLC. For the installation, wiring,
maintenance and safety precautions of VS Series PLC, please refer to the VS Series PLC Product Manual.

Name of Manual Content

Descriptions of VS Series PLC components


VS Series PLC
Programming Manual Functions of basic instructions and application instruction
(This book)
Precautions regarding programming

Introduction to VS Series PLC

Environment, wiring and installation cautions of VS Series PLC


VS Series PLC Product Manual
Precautions of environment, wiring and installment

Instructions of optional devices

Trademark

VIGOR is a registered trademark of VIGOR ELECTRIC CORP. in Taiwan.

WINDOWS ® is a registered trademark of Microsoft Corporation in the United States.

Other products or service names appeared in this book are the property of their companies .
Table of Contents

1. Introduction of VS series PLC 1


1-1 The Basic Concept of PLC Users 1
1-1-1 Introduction of PLC 1
1-1-2 Conguration of PLC 1
1-1-3 PLC Operation and Scan Time 3
1-1-4 PLC Input Signals 4
1-1-5 PLC Output Signals 5
1-1-6 Some Improper Diagrams at a PLC Program 5
1-1-7 Double Coil Output 6
1-1-8 Conclusion 6
1-2 The VS Series PLC Products Overview 7
1-3 Specification Table of All the VS Series Main Units 8
1-4 Overview of VS series PLC models 10

2. Component Descriptions 13
2-1 Table of Components 13
2-2 External Input (X) and External Output (Y) 14
2-2-1 External Input (X) 14
2-2-2 External Output (Y) 15
2-2-3 External Input/Output Assigned Numbers 16
2-3 Auxiliary Relay (M) 18
2-4 Step Relay (S) 19
2-5 Timer (T) 20
2-5-1 General Timers 20
2-5-2 Retentive Timers 20
2-5-3 Using a Timer in a Subroutine 21
2-5-4 Methods to Appoint the Set Value of a Timer 21
2-5-5 Detailed Description about the Output Action and Accuracy of a Timer 21
2-6 Counter (C) 22
2-6-1 16- bit Counter 22
2-6-2 32- bit Counter 23
2-6-3 Methods to Appoint the Set Value of a Counter 24
2-7 Software High Speed Counter 25
2-7-1 1-Phase High Speed Counter 26
2-7-2 2-Phase High Speed Counter 27
2-7-3 A/B Phase High Speed Counter 28
2-7-4 Precautions for Using the Software High Speed Counter 29
2-8 Data Register (D) and Expansion Register (R) 31
2-9 Index Register (V and Z) 32
2-9-1 Using Index Register in Basic Instruction 32
2-9-2 Using Index Register in Application Instruction 33
2-9-3 Demonstration Program Using Index Register 33
2-10 Mark Pointer and Branch Pointer (P) 35
2-11 Table Nickname and Table Code (Q) 36
2-12 Interrupt Pointer (I) 37
2-13 Numerical System 39
2-14 Special Relay and Special Register 42
2-14-1 Table of Special Relay 42
2-14-2 Instruction Table of Special Register 47
2-14-3 Error Code Description 52
2-15 The X0~X7 High Speed Input Function Description 53
2-15-1 External Interrupt 54
2-15-2 Pulse Capture 55
2-15-3 Pulse Measurement 56
2-15-4 Hardware High Speed Counter 58
2-16 Expansion Card Related Components 61
2-16-1 The DIO Expansion Card Related Components 62
2-16-2 The Communication Expansion Card Related Components 63
2-16-3 The Special Function Expansion Card Related Components 65
2-17 Special Function Module 70
2-17-1 Buffer Memory BFM in the VS-4AD Module 71
2-17-2 Buffer Memory BFM in the VS-2DA Module 72
2-17-3 Buffer Memory BFM in the VS-3A Module 73
2-17-4 Buffer Memory BFM in the VS-6A Module 74
2-17-5 Buffer Memory BFM in the VS-4TC Module 75
2-17-6 Buffer Memory BFM in the VS-8TC Module 76
2-17-7 Buffer Memory BFM in the VS-2PT Module 77
2-17-8 Buffer Memory BFM in the VS-4PT Module 78

3. Basic Instruction 79
3-1 Basic Instruction Table 79
3-2 The LD, LDI, AND, ANI, OR, ORI, INV, OUT and END Instructions 81
3-3 The LDP, LDF, ANDP, ANDF, ORP, OPF, MEP and MEF Instructions 82
3-4 The ANB and ORB Instructions 83
3-5 The MPS, MRD and MPP Instructions 84
3-6 The MC and MCR Instructions 85
3-7 The SET and RST Instructions 86
3-8 The PLS and PLF Instructions 86
3-9 The OUT and RST Instructions for the Timer or Counter 87
3-10 Significant Notes for Programming 88
3-10-1 Convert the Ladder Diagram to the Instruction List 88
3-10-2 Programming Techniques 89

4. Sequential Function Chart (SFC) and Step Ladder (STL) 91


4-1 What is the Sequential Function Chart (SFC) 91
4-1-1 The Framework of SFC 91
4-1-2 Basic Components of SFC 91
4-1-3 State and Action of SFC 92
4-1-4 Types of SFC 93
4-2 Compiling the Sequential Function Chart (SFC) 94
4-2-1 Create the Flowchart of the Sequential Procedures 94
4-2-2 Convert the Flowchart to the SFC 95
4-2-3 Use the Ladder Master S to Edit the SFC 95
4-3 Description the Application Types of SFC 96
4-3-1 Single Flow, Jump and Repeat Flow During the Flowchart Transfer 96
4-3-2 Selective Branch and Merge 97
4-3-3 Simultaneously Parallel Branch and Merge 97
4-3-4 Special Notices About the SFC 98
4-4 Precautions About the Composition of the SFC 99
4-5 STL / SFC Relevant Special Components 101
4-6 The Relationship Between the SFC and STL 102
4-6-1 The Step Ladder Instruction (STL) 102
4-6-2 Compare the Descriptive Methods Between the SFC and STL 103
4-7 Examples of SFC Applications 105
4-7-1 Construct the Repeat / Single Run / Single Step Control Modes for a Park Fountain 105
4-7-2 Filling Bottles 107
4-7-3 Trafc Lights 110
4-7-4 Mechanical Double-Decked Parking Space 119

5 General Rules of Application Instructions 121


5-1 The Formats of Application Instructions 121
5-2 Data Process of Application Instructions 123
5-3 Precautions of Using Application Instruction 124

6. Application Instructions 125


6-1 Application Instruction Table 125
6-2 Program Flow Instructions 131
6-3 Comparison, Move and Code Exchange Instructions 139
6-4 Arithmetic and Logical Operation Instructions 149
6-5 Rotary and Shift Instructions 157
6-6 Data Operation Instructions 165
6-7 High Speed Processing Instructions 177
6-8 Handy Instructions 193
6-9 External Setting and Display Instructions 205
6-10 Serial Communication Instructions 217
6-11 Handy Instructions 243
6-12 Floating Point Arithmetic Instructions 255
6-13 Advanced Data Processing and MBUS Instructions 281
6-14 Real Time Clock Related Instructions 293
6-15 Code Conversion and Timer Instructions 303
6-16 RND, DUTY, CRC and HHCMV Instructions 311
6-17 Block Data Handling Instructions 317
6-18 Character String Handling Instructions 321
6-19 Data Table Handling and Shift Instructions 335
6-20 In-Line Comparison Instructions 341
6-21 Handy Instructions and DABIN, BINDA, HSCT Instructions 343
6-22 Positioning Control Instructions 353

7. Statement of Communication Functions 355


7-1 Key Points of Communication Functions 355
7-1-1 Fundamental Object about the Communication Function 355
7-1-2 Notes for Constructing Communication Systems 356
7-2 Structure of Communication System 358
7-2-1 Main Unit Built-in Communication Port 362
7-2-2 VS-485-EC Communication Expansion Card 363
7-2-3 VS-485A-EC Communication Expansion Card 364
7-2-4 VS-D485-EC Communication Expansion Card 365
7-2-5 VS-D485A-EC Communication Expansion Card 366
7-2-6 VS-D232-EC Communication Expansion Card 367
7-2-7 VS-D52A-EC Communication Expansion Card 368
7-2-8 VS-ENET-EC Communication Expansion Card 369
7-3 Communication Types 370
7-3-1 Selections of Communication Types 370
7-3-2 VS Computer Link Slave 371
7-3-3 VS Computer Link Master 375
7-3-4 VB Computer Link Slave 382
7-3-5 MODBUS Slave 383
7-3-6 MODBUS Master 384
7-3-7 CPU Link 391
7-3-8 Non Protocol 397
7-4 VS Series PLC Communication Protocol 408

8. Statement of Positioning Control Functions 417


8-1 Positioning Parameter Setup 418
8-1-1 Assign the positioning Units 419
8-1-2 Basic Parameters 420
8-1-3 Positioning Operation Setting Up 421
8-2 Special Components Related to Positioning Control Instructions 425
8-3 Positioning Control Instructions 429
8-4 Positioning Program Example 468
8-4-1 Positioning Program Example for the VS1 or VS2 Series PLC 468
8-4-2 Positioning Program Example for the VSM or VS3 Series PLC 470
8-4-3 8 Axes Positioning Program Example 472
1. Introduction of VS series PLC
1-1 The Basic Concept of PLC Users
1-1-1 Introduction of PLC
The programmable Logic Controller (PLC) is an industrial computer control system that is easy to maintain, low cost
and saves space. In addition to its programmable features, because it is used in the eld of industrial control, PLC is
also required to have high reliability and resistance to climate.
The concept of PLC was introduced by General Motors in 1968. It has been developed by decades. The initial PLC only
had the simple logic control ability, and thus was named as a programmable logic controller. Since Today's PLC
functions have covered the scopes of mathematical operations, servo control and communication links, the more
correct name for it should be programmable controller (referred to as PC), which means a controller that is
programmable. Due to the fact that it shares the same English abbreviation with the personal computer (referred to as
PC). Therefore, in order to distinguish, the programmable controller is referred to as PLC.
PLC has micro controller at its core. The rapid development of semiconductor technology has substantially increased
PLC's computing speed, program capacity and communication connectivity and decreased its prices. Coupled with the
demands on high reliability and resistance to climate the design requirements, PLC is widely used in the eld of
automatic control, and has become an extremely important part.

1-1-2 Configuration of PLC


Programming tool Peripheral equipment

Handheld programming Human-Machine Interface,


device or SCADA, other PLC,
PC programming software Inverter, Thermostat, .....

Programming Communication
Various input components

interface interface
Limit switch, Electromagnetic

Various loads
Output interface
Input interface

contactor,
Proximity switch, Motor,
Photoelectric switch, Program processing unit Indicator,
Button switch, Solenoid valve,
˙˙˙˙˙

˙˙˙˙˙
Program memory Data memory Power
for user program supply

Programmable controller

Fig.1-1 Processing Architecture of PLC

The conguration of programmable controller is shown in Fig. 1-1. Below describes the elements of a PLC briey:
Power supply Inside of a PLC consists of ordinary electronic circuit that must use low voltage DC power.
Currently, a PLC manufacturer provides with the AC or DC power input model for the customer to choose from.
The AC power model has a power supply circuit within the PLC to convert AC to DC. The DC power model needs to
provide its power from an external DC source (usually DC 24V) then the PLC uses the internal DC to DC circuit to
convert the power to supply the internal circuit require.
In the past, user prefers to use the AC power input models. However, since there are many related equipments
inside the control panel also required DC power, the use of an external DC power supply to provide all DC
consumptions is popular in recent years.
This is because the use of external DC power supply can avoid the event of unstable AC power input to damage the
controller (this problem is easy to handle if an external DC power supply is used);This is because the use of external
DC power supply can avoid the event of unstable AC power input to damage the controller (this problem is easy to
handle if an external DC power supply is used); therefore, the use of external power supply increases the stability of
control systems. On the other hand, it lowers the general cost of control systems. It is to kill two birds with one stone.

Program processing unit The CPU is the core of a PLC, that is responsible for interpreting the user programs
and calculating the results to achieve the purpose of control.
Small PLCs usually use microcontrollers as the core. Now the semiconductor technology has been able to integrate
CPU, memory and a variety of peripheral circuits into a SOC (System On Chip). This not only improves the overall
performance, but also reduces costs. So now, even small PLCs use high-performance 32-bit CPU chip to produce
controllers with fast execution, large program capacity and diverse functions, the real value for money.

1
Program memory The memory for the PLC user to store the compiled control program, can let the CPU to
interpret and compute then produces the control procedures.
The program memory must have the ability to preserve its contents, in order to continue work after the power is
resumption. At present, there are two ways.
The rst way is to use the SRAM (static random access memory) cooperated with a lithium battery. The advantages
of this method are more exible and less restrictive. But, the disadvantage is once the battery is exhausted, all the
program and settings will disastrously disappear.
The second method is to use non-volatile memory (such as EEPROM, Flash ROM, FRAM, etc.). By the no battery
required characteristic of those semiconductor components to preserve the program. Its advantages are stable and
reliable; but usually with higher cost, has the restriction on the number of writing times and slower in writing.
A control system which is composed by a small PLC usually got less care from the owner. Therefore, it is a better
choice to use battery-free non-volatile memory to store the user program.
Data memory The data memory in PLC is responsible for storing the data.
Both the operating system and the user program must have data workspace. Typically, SRAM (static random access
memory) is used as the data work area.
However, a part of the PLC data memory area must have latched feature to preserve the relevant parameter settings
and specic operating results when power is missing. There are two components can cooperate with the SRAM to
latch, one is the lithium battery, the other is the non-volatile (such as EEPROM, Flash ROM, FRAM, etc.) memory.
Regarding their advantages and disadvantages, please refer to the description of program memory.
Input interface The PLC reads external signals through its input interface to in order to operate as a reference
for the program.
In general, in order to prevent noise interference, the internal circuit of PLC inputs will isolate by photocouplers.
The acceptable voltage of the input photocoupler is not high, so special attention should be paid to the external
wiring. High voltage will damage the photocoupler and cause the input interface break down.
Output interface The PLC sends the computed result to its output interface, then to drive components and
reach the control action concretely.
In order to avoid interference from noises, at the output interface of a PLC has the isolation circuit. Typically, the
outputs are relays (by mechanically magnetic isolation) or transistors with photocouplers.
The relay output is the dry contact of switch which with the advantage of intuitive no current direction limit and
accepts AC or DC signal. The disadvantages are shorter life of contact, which is not a durable part and will affect the
controller's life. Also, the movement of its contact is slow (about 5 ~ 10ms) which is not suited for the fast response
output.
The transistor is a semiconductor contactless switch, which has advantages and disadvantages just opposite to a
relay.
According to the characteristics of the control objectives, should choose an appropriate output type when designing
the control system. In addition, for the purpose of the system reliability, may choose the transistor output type if it is
possible.
Programming interface The communication interface for to link the programming device with the PLC.
The user uses the programming device to write a control program and through the programming interface to load to
the PLC. Furthermore, monitoring and debugging to complete the program's calibration test.
Generally, the programming interface is a serial communication interface, the RS-232, RS-422 or RS-485 port is
popular. Recently there have been some PLC introduced with the USB interface to provide faster communication link.
Communication interface An interface which is responsible for linking PLC with the surrounding equipment for
data transmission.
Nowadays, the common communication interfaces are the RS-232, RS-422 and RS-485, also the use of Ethernet is
gradually increased.
In addition to protocol with their own products, the PLC manufacturers usually provide communication protocol with
MODICON's MODBUS to facilitate connecting with peripherals.
With the increasing complexity of automatic control systems, PLC manufacturers also pay attention to the
communication capacity to link with more peripherals. Therefore, higher level of PLC can provide several
communication interfaces to make it work with more peripherals and complete complex control demands.
Programming device The PLC manufacturer provides a device for users to program and debug.
Common programming devices include handheld programming device and PC programming software.
The handheld programming device usually uses the simple-text of Instruction List (IL), in fact it is an important part in
the programming development of a PLC. However, with the progress of the times and the popularity of personal
computers. The software at PC which can provide graphical interface and has become the best choice for PLC
programming.
Peripheral equipment Various devices are linked with the PLC to complete the control system together.
A PLC is often linked with peripheral equipments, such as the computer, human-machine interface (HMI), inverter,
thermostat, servo drive, power meter and other PLC.
The most commonly peripheral equipment which PLC operates with are:
1. A computer or human-machine interface connected to a PLC for machine settings and monitoring
2. A computer or human-machine interface connected with multiple PLCs that becomes a local network team and its
monitor.
3. Linking several PLCs for proceeding decentralized control.
4 Linking PLC to a variety of peripheral equipment of specic use, for extending control areas.

2
1-1-3 PLC Operation and Scan Time
The PLC systems use microcomputer technology to achieve the purpose of simulating traditional relay control panel.
The microcomputer rst reads the external inputs and then sequentially scans and executes the user program, so as to
calculate the control result that the user wants to achieve. Finally, it outputs the result to drive the external loads and
performs the real control action. The PLC execution order is shown in Fig. 1-2.
The PLC will sequentially execute the cycle ( ① receive external inputs; ② process the user program; ③ output the
computed results). Then, the time spent for one cycle is called a “Scan Time”.

① To receive the Loads the status (ON/OFF) form external input components via
external inputs the input interface and stores that into the data memory.

The CPU uses the status in the data memory and the rule of user
program to compute the results, then stores all the results into the
data memory.
X0 X1
Y0
Y0

˙˙˙˙˙˙˙˙
One cycle of ② To process the
“Scan Time” user program
User program
Y20 M100
Y25
M0 M105

③ To output the Transmits the operation result from the data memory to the
computed results output part, via the output interface to control external loads.

Fig. 1-2 PLC operation order and scan time

The PLC processes user program by the Sequential Scan (in the Ladder Diagram scans from left to right then from top
to bottom), as shown in Fig. 1-3. Therefore, must pay extra attention to the procedural order of the program.

Fig. 1-3 PLC makes the sequential scan at the Ladder Diagram

The “Scan Time” and “Sequential Scan” are the basic and the most important concepts. A PLC user must fully
understand those meanings, and pay attention about the inuences when designing the PLC program.

3
1-1-4 PLC Input Signals
PLC's input endpoint is a window for PLC to accept control signals from outside, and is used to interface with a variety
of switches and sensing elements. In recent years, the PLC functions have been tending to more developed
diversication, detecting elements connected with the input points are also more diverse. Therefore, it is necessary for
users to further understand the interface of PLC input point. Here are a few things to note:
1. As the PLC's work environment is often lled with a variety of noises and interfering sources, in order to work properly,
photocouplers are often used at input endpoint to isolate noises.
2. The reaction speeds of different photocouplers are varied. The High-speed photocouplers can transmit signals faster,
but the cost is higher. Therefore, high-speed photocouplers are often used at the input points of PLC which need
high-speed responses. In the rest of case, general photocouplers are used.
3. In order to prevent noise interferences, the input circuit of a PLC in addition to photocouplers, also added with lters.
Filters are divided into analog lters (composed of RC circuit) and digital lters (lter time is adjustable).
According to functional requirements the PLC inputs can be divided into high-speed and general inputs. The general
inputs are usually used in receiving signals which are not too fast, and often connected to the mechanical switchs
(signal may have bounce in action). Thus, approximately 10ms lter circuits are added with in the general inputs.
The high-speed inputs are usually designed for multiple functional inputs, those can be used as general inputs (need
longer lter time) and can also process high-speed signals (need tiny lter time). Therefore, digital lters are used
with high-speed inputs, they adjust lter time according to different needs (higher speed does not always mean better).
4. There is a time delay between the PLC's CPU received and the external signal input. The delay time is accumulated
with the aforementioned photocoupler and added lter.
5. In order to meet multiple requirements, the current PLCs are usually designed with some high-speed input
endpoints to execute some functions which require high speeds, such as high-speed counting, external
interruption, pulse capture, frequency meter and pulse measurement.
These signals usually require rapid responses and are relatively susceptible to noises. Therefore, in use, extra
attention should be paid to its wiring. To avoid interfering sources, isolation cables can be used to avoid any
interference.
6. There is certain amount of drive current at the PLC input endpoint, when using sensing elements, one must pay
attention, especially when using two-wire sensing elements.
7. PLC cannot read input signals which change too fast. For PLC, regardless of input signals, ON or OFF, its duration
must be longer than the scan time; otherwise, PLC is likely failed to read correct signals, as shown in Fig.1-4.
When input signal changes too fast to be read normally, the interrupt input function or pulse wave capture function
can be employed.

This ON signal is unreadable This ON signal is readable This OFF signal is unreadable

Input signal ON OFF ON OFF

User program processing User program processing User program processing

Receive the external One cycle of


Output the computed Time
results inputs “Scan Time”

Fig. 1-4 PLC cannot read input signal which is swap over too fast

4
1-1-5 PLC Output Signals
The PLC's output endpoint is a window for PLC to send out the computed results, and is used to interface with a variety
of loads. Since the output signals are to drive external loads and to complete machine's actions, must pay extra
attention about the safety. Please note the following points:
1. Never ignore the possibility of the PLC failure. It is required to design an external safety circuit and safety mechanism
to avoid accidents.
2. PLCs typically push external loads through relays or transistors. The difference between the characteristics of two is
great, with each advantages and disadvantages. In designing, one should select properly.
The advantages of using a relay are that its contact switch has no current polarity and promotes more current (about
2A), and AC or DC power supply can be used. Its shortcomings are that the contact switch is mechanical, with
mechanical life and electrical life limits. Basically, the relay is not a durable product, and becomes the unreliable
factor in a control system.
The advantages of using a transistor are since it switches by the semiconductor. The number of swap times is
unlimited and the speed of switch is fast, depending on demands could reach hundreds KHz. Its shortcomings are
has current polarity, can only be used for DC load, below 30V and with less current (about 0.1A ~ 0.5A).
When using a relay output, must pay attention to the frequency of action then to calculate the machine's life. That is
for to avoid controller breakdown due to the damage of the relay. Therefore, most control panels take the approach
of attaching a relay externally. Using external relays to promote loads can be considered as the most correct way to
assemble panels. At this point, a transistor output controller can be used to enhance the panel's reliability.
3. In order to prevent interference from noises, the PLC outputs must take isolation measures. The relay output is
magnetically isolated and this can cause an output delay of about 10 ms. The transistor output is isolated by a
photocoupler, the output delay is below 1ms for the general output but only several µs delay for high-speed output.
4. There is a specication of output capability for the load and should be taken seriously. Do not use excessively. In
general, the output specication of the relay is AC220V 2A or less; the transistor is DC30V 0.1A ~ 0.5A or less. For
the unsuitable load to push excessive output at a short time may not have a problem. However, it will certainly affect
the service life of PLC.

1-1-6 Some Improper Diagrams at a PLC Program


Some conventional circuits of relay switchboards cannot be directly replaced by the Ladder Diagrams at PLC.
The following diagrams indicate such circuit loops on the left and the alternative for PLC are on the right.

X1 X2
Y0
X0
Y0 X0

X2 X0 X2
X1 Y1
Y1
X1

X0 X1 X0
Y0 Y1
X1
Y1 Y0

X0 X0
Y0
X1 X1
Y0

5
1-1-7 Double Coil Output
The PLC program with the following characteristic will affect the operation result, please pay special attention.
1. When executing the user program PLC follows sequential scan (from left to right, up to down).
2. In the PLC executing process, only the contents of the data memory will be used and changed. Actually to drive the
external loads are performed after the execution of the program and there is a procedure to output the computing
results.
As the figure below shows, Y0 is set as OUT twice, which is referred to as double coil output In this case, it is the state
of X1 that actually drives external loads.
X0
Y0
˙˙˙˙˙˙˙˙˙˙

X1
Y0

To resolve the confusion of double coil output, methods are recommended as follows:
Parallel connect the driving conditions and then output once.
Use the SET, RST instructions.
Use the CJ instruction.
Use the Step Ladder (STL) instruction or Sequential Function Chart (SFC)

1-1-8 Conclusion
A PLC usually performs the important part in the automatic control system. Appropriate protection of the PLC can
improve the reliability of the system.
Traditional PLCs which we are familiar with usually use AC power supply, relay output and terminal block wiring. The AC
power supply unit is susceptible to damage due to the instability of the power system (especially in non-industrial
advanced countries). The relay output has the lifespan limit because of mechanical contact. Also, to disassemble the
wiring at terminal blocks is time-consuming, inconvenient to fault repair (although has separable terminal products but
with higher price).
The best conguration for the new generation of PLCs should be the combination of DC power supply, transistor output
and connector wiring to exclude factors which affect the reliability from PLC systems as far as possible. In addition, this
way makes it possible to reduce wiring time, reduce costs and improve maintenance convenience. It would be more p
erfect if they are equipped with a memory card to store programs and data . When a PLC fails, the really important and
difcult part is to transfer the program (which need system-related professionals to deal with), rather than the work of
dissembling a terminal block (what a general electromechanical person can handle). With a memory card, the PLC
replacement work can become easy.
Before using a PLC, you should really understand the specications of each elements and avoid excessive use (with
particular attention to power capacity and output specications). Also, choose the right products according to your
needs in order to design a high cost-effective control system.

PLC is the core of a control system!


Having correct knowledge and ideas helps you establish a
stable and reliable control system.

6
1-2 The VS Series PLC Products Overview

VS Series Controller Provides [Comprehensive] Control Application

Item Series VS1 General VS2 Advanced VSM Motion Control VS3 High Performance
Process Time of 0.17µs/Step 0.17 µs / Step 0.17 µs / Step 0.15 µs / Step
Basic Instruction
Memory Capacity of Project 16K Words 32K Words 32K Words 64K Words
Max. Input/Output Points 128 pt. + 24 (at Exp. Cards) 256 pt. + 24 (at Exp. Cards) 256 pt. + 24 (at Exp. Cards) 512 pt. + 24 (at Exp. Cards)
Programming Port Built-in 12Mbps high-speed Mini USB port
Unit Built-In Comm. Port CP1 (RS-485) provides various communication modes: Computer Link, MODBUS (Master / Slave), CPU Link, Non-protocol...
Expandable Comm. Port CP2 CP2 ~ CP3 CP2 ~ CP3 CP2 ~ CP5
Multi-Func. High Speed In 8 points 10 kHz 8 points 50 kHz 4 points 200 kHz ☆ & 4 points 50 kHz
Pulse Output 4 points (axes) 50 kHz※ 4 points (axes) 50 kHz※ 4 points (axes) 200 kHz※
Number of Special Modules 8 8 16
Number of Special Cards 1 3 3 3
Function of Expansion Card EC1 ~ EC3 for the DIO, communication (RS-232, RS-485) or special card (e.g. Analog, Temperature, Inverter Speed Control)
Function of Memory Card Maintenance-free user project & large data memory card provides the best subject transplanting method for system maintain

☆ For the VSM-28ML-D Line Driver model, its two Hardware High-Speed Counters can count 1 MHz pulses respectively.
※ Those 4 outputs are available generate 1 MHz pulses individually at the VSM-28-ML-D Line Driver model; 200 kHz at
the VSM/VS3's NPN; 50 kHz at the VS1/VS2's NPN or 5 kHz at the PNP Main Unit. Not available in the relay output unit.
The VS Family has the VS1 General, VS2 Advanced, VSM Motion Control and VS3 High Performance series controllers, the
complete product line can satisfy various applications from basic to high-end and the combination of the best balance between cost
and performance. Also, based on the concept of “the most suitable product” to enhance the competitive power and achieve the
value beyond price.
The VS1 General Series is suitable for various easy auto-control systems to satisfy with simple sequence control functions, such as
cargo lift, parking equipment, conveyor, shoe machinery, brick machinery, woodwork machinery, etc.
The VS2 Advanced Series is suitable for general purpose auto-control systems to satisfy with analog or temperature demanded
controls, such as passenger lift, rubber vulcanizer, plastic injection molding machine, metal stamping machine, packing machinery,
etc.
The VSM Motion Control Series is a good match for various industrial machinery needing precise positioning functions by
servo/stepper motors, which including labeling machine, sleeving machine, dispenser, lm laminating machine, pipe bending
machine, cutting machine, bar feeder, etc.
The VS3 High Performance Series is the solution for various control systems of complicated sequence or large scale, that
including printing machinery, automatic production line, semiconductor peripheral device, automated storage/retrieval system,
electroplating procedure control, etc.

7
1-3 Specification Table of All the VS Series Main Units
Item VS1 Series VS2 Series VSM Series VS3 Series
Operation Control Method Cyclic Operation by Stored Program
Programming Language Ladder Diagram + Sequential Function Chart (SFC) or Ladder Diagram + Step Ladder (STL)
I/O Control Method Batch Processing

Process Basic Instruction 0.17 µs 0.15 µs


Time Application Instruction A few µs ~ Hundreds of µs
Basic Instruction 29

Number of SFC Instruction 2


Instructions STL Instruction 2
Application Instruction 169 171 171 209
The project at the memory is including the parameter area, user program, pointers, tables and comments.
Project Memory Capacity (Flash ROM)
16k Words 32k Words 32k Words 64k Words
128 points + 256 points + 256 points + 512 points +
Max. Input/Output Points
24 at Expansion Card 24 at Expansion Card 24 at Expansion Card 24 at Expansion Card
Digital External Input (X) 64 points: X0 ~ X77 128 points: X0 ~ X177 128 points: X0 ~ X177 256 points: X0 ~ X377
Input /
Output External Output (Y) 64 points: Y0 ~ Y77 128 points: Y0 ~ Y177 128 points: Y0 ~ Y177 256 points: Y0 ~ Y377
General 6192 points: M0 ~ M1999,M4000 ~ M8191
Auxiliary
Relay Latched 2000 points: M2000 ~ M3999
(M)
Special 512 points: M9000 ~ M9511
Internal
Initial 10 points: S0 ~ S9
Relay
Step Relay General 3086 points: S10 ~ S499,S1500 ~ S4095
(S) Latched 900 points: S500 ~ S899,S1000 ~ S1499
Annunciator 100 points: S900 ~ S999 (Latched)
100mS 200 points: T0 ~ T199 (Timer range: 0.1 ~ 3,276.7 sec.)
10mS 46 points: T200 ~ T245 (Timer range: 0.01 ~ 327.67 sec.)
Timer (T) 1mS (Retentive) 4 points: T246 ~ T249 (Timer range: 0.001 ~ 32.767 sec.)
100mS (Retentive) 6 points: T250 ~ T255 (Timer range: 0.1 ~ 3,276.7 sec.)
1mS 256 points: T256 ~ T511 (Timer range: 0.001 ~ 32.767 sec.)
General 100 points: C0 ~ C99 (Range: 0 ~ 32,767)
16-bit Up
Counter Latched 100 points: C100 ~ C199 (Range: 0 ~ 32,767)
(C) 20 points: C200 ~ C219 (Range: –2,147,483,648 ~ 2,147,483,647)
32-bit General
Up / Down 15 points: C220 ~ C234 (Range: –2,147,483,648 ~ 2,147,483,647)
Latched

Software 1-Phase 11 points: C235 ~ C245 (Range: –2,147,483,648 ~ 2,147,483,647)


High Speed 32-bit
Up / Down, 2-Phase 5 points: C246 ~ C250 (Range: –2,147,483,648 ~ 2,147,483,647)
Counter
(C) Latched
A / B Phase 5 points: C251 ~ C255 (Range: –2,147,483,648 ~ 2,147,483,647)
Hardware High Speed Counter 2 points: HHSC1 ~ HHSC2 (Range: –2,147,483,648 ~ 2,147,483,647)
General (D) 7000 points: D0 ~ D6999
Latched (D) 2000 points: D7000 ~ D8999
Data
Special (SD) 512 points: D9000 ~ D9511
Register
Index Register (V / Z) 16 points: V0 ~ V7,Z0 ~ Z7
Extension Register (R) 10000 points: R0 ~ R9999 24000 points: R0~23999
Mark Pointer 1024 points: Each pointer can be named by P0 ~ P1023 or 16 characters
Branch Pointer (P) 1024 points: P0 ~ P1023
Table Nickname 32 points: Each table can be named by Q0 ~ Q31 or 16 characters
Pointer
Table Code (Q) 32 points: Q0 ~ Q31
Interrupt Pointer (I) 21 points: 8 pt. for external interrupt, 3 pt. for timer interrupt, 10 pt. for high speed counter interrupt
Nest Pointer (N) 8 points: N0 ~ N7

8
Item VS1 Series VS2 Series VSM Series VS3 Series

Decimal 16-bit K–32,768 ~ K32,767


(K) K–2,147,483,648 ~ K2,147,483,647
32-bit
Range of
Hexadecimal 16-bit H0 ~ HFFFF
Constant
(H) H0 ~ HFFFFFFFF
32-bit
Real No. (E) 32-bit E–3.402 + 38 ~ E3.402 + 38, decimal or exponent notation
Main Unit Programming 12Mbps high-speed Mini USB communication port
Built-in
Comm. Comm. Port Multi-Func. CP1 (RS-485) is available for the Computer Link, MODBUS, CPU Link, Non-Protocol, etc.
Function CP2 (at the EC1) CP2 ~ CP3 (at the EC1) CP2 ~ CP3 (at the EC1) CP2 ~ CP3 (at the EC1)
Expanded Multi-Func. Port
CP4 ~ CP5 (at the EC3)
200kHz × 4 points ☆ 200kHz × 4 points
Input Response Frequency 10kHz × 8 points 50kHz × 8 points
50kHz × 4 points 50kHz × 4 points
Input Response Time Adj. 8 points: X0 ~ X7 (0~60ms)
External Interrupt Input 8 points: X0 ~ X7 (with delay function)
Pulse Capture Input 8 points: X0 ~ X7
Multi-
Function Pulse Measurement Input 4 points: X0, X1, X3, X4 (with width period measurement function)
High Speed
Input Frequency Meter Input 8 points: X0 ~ X7
Software High Speed
Support 1, 2 or AB phase counting mode, 1-phase 8 points or 2/AB phase 4 sets max.
Counter
Hardware High Speed
2 sets: HHSC1 and HHSC2. Support U, U/D+DIR, U+D, AB×1, AB×2 or AB×4 operating mode
Counter

Electronic Handwheel Cooperate with high speed pulse output to control positioning
4 points 50kHz (4-axis 4 points 50kHz (4-axis
High Speed Pulse Output 4 points 200kHz (4-axis positioning control) ☆
positioning control) positioning control)
Real Time Clock (Optional) By installing VS-MCR Multi-Function Memory Card to indicate year, month, day, hour, min., sec. and week
By installing a VS-MCR/VS-MC card to expand no-battery required 16Mb latched memory for user project
Expansion Memory (Optional)
and 655,360 Words data bank

Number of Special Module


Special 8 8 16
Available
Module
Type of Special Module Analog I/O Module, Temperature Input Module, etc.
Expansion Card Socket
10/14M Main Unit (EC1), 20/24M Main Unit (EC1~EC2), 28/32M Main Unit (EC1~EC3)
at Unit
Expansion Type of Expansion Card DI/DO, communication or special function card (AI, AO, temperature input, inverter speed control, etc.)
Card
Number of Special Card 1
(VS-3AV-EC won't occupy) 3 3 3
Available

☆ At the VSM-28ML model, the 4 line driver input points for the HHSC1 & HHSC2 can individually count 1 MHz pulses; also, the 4 line driver
output points can individually generate 1MHz pulses.

9
1-4 Overview of VS series PLC models
Item Model Name Main Specification
VS1 Main Unit: 6 DI (DC 24V, X0~X5 10 kHz); 4 DO ★; 16K words project memory; 1 Expansion Card socket;
VS1-10M ★ -D I/O by screw-clamp terminal
VS1 Main Unit: 8 DI (DC 24V, X0~X7 10 kHz); 6 DO ★; 16K words project memory; 1 Expansion Card socket;
VS1-14M ★ -D I/O by screw-clamp terminal
VS1 Main Unit: 12 DI (DC 24V, X0~X7 10 kHz); 8 DO ★; 16K words project memory; 2 Expansion Card sockets;
VS1-20M ★ -D I/O by screw-clamp terminal
VS1 Series VS1 Main Unit: 4 DI (DC 24V, X0~X7 10 kHz); 10 DO ★; 16K words project memory;
VS1-24M ★ -D 2 Expansion Card sockets; I/O by screw-clamp terminal
Main Unit
VS1 Main Unit: 16 DI (DC 24V, X0~X7 10 kHz); 12 DO ★; 16K words project memory;
VS1-28M ★ -D 3 Expansion Card sockets; DIO Expansion Module available; I/O by screw-clamp terminal
VS1 Main Unit: 20 DI (DC 24V, X0~X7 10 kHz); 12 DO ★; 16K words project memory;
VS1-32M ★ -D 3 Expansion Card sockets; DIO Expansion Module available; I/O by screw-clamp terminal
VS1 Main Unit: 16 DI (DC 24V, X0~X7 10 kHz); 16 DO (100mA NPN transistor, Y0~Y3 50 kHz);
VS1-32MT-DI 16K words project memory; 3 Expansion Card sockets; DIO Expansion Module available; I/O by IDC connector.
VS2 Main Unit: 12 DI (DC 24V, X0~X7 50 kHz); 12 DO ★; 32K words project memory; 2 Expansion Card sockets;
VS2-24M ★ -D DIO Expansion & 8 Special Modules available; I/O by screw-clamp terminal
VS2 Series VS2 Main Unit: 16 DI (DC 24V, X0~X7 50 kHz); 16 DO ★; 32K words project memory; 3 Expansion Card sockets;
VS2-32M ★ -D DIO Expansion & 8 Special Modules available; I/O by screw-clamp terminal
Main Unit
VS2 Main Unit: 16 DI (DC 24V, X0~X7 50 kHz); 16 DO (100mA NPN transistor, Y0~Y3 50 kHz);
VS2-32MT-DI 32K words project memory; 3 EC sockets; DIO Expansion & 8 Special Modules available; I/O by IDC connector
VSM Development Tool Unit: Inner connected DI/DO (Y0~Y7 to X0~X7); 32K words project memory;
VSM-Mini Memory Card Socket; CP1 RS-485 Communication Port
VSM Main Unit: 8 DI (DC 24V, 4×200 kHz + 4×50 kHz); 6 DO (500mA NPN transistor, Y0~Y3 200 kHz);
VSM-14MT-D 32K words project memory; 1 Expansion Card socket; I/O by screw-clamp terminal
VSM Main Unit: 12 DI (DC 24V, 4×200 kHz + 4×50 kHz); 12 DO (500mA NPN transistor, Y0~Y3 200 kHz);
VSM-24MT-D 32K words project memory; 2 Expansion Card sockets; DIO Expansion & 8 Special Modules available;
I/O by screw-clamp terminal
VSM Series VSM Main Unit: 16 DI (DC 24V, 4×200 kHz + 4×50 kHz); 16 DO (500mA NPN transistor, Y0~Y3 200 kHz);
Main Unit VSM-32MT-D 32K words project memory; 3 Expansion Card sockets; DIO Expansion & 8 Special Modules available;
I/O by screw-clamp terminal
VSM Main Unit: 4 Line Driver DI (for 2 hardware counters up to 1 MHz) + 12 DI (DC 24V, 4×50 kHz & 8 normal);
VSM-28ML-D 8 Line Driver DO (4 × 1 MHz & 4 normal) + 4 DO (500mA NPN transistor); 32K words project memory;
3 Expansion Card sockets; DIO Expansion & 8 Special Modules available; I/O by screw-clamp terminal
VSM Main Unit: 16 DI (DC 24V, 4×200 kHz + 4×50 kHz); 16 DO (100mA NPN transistor, Y0~Y3 200 kHz);
VSM-32MT-DI 32K words project memory; 3 Expansion Card sockets; DIO Expansion & 8 Special Modules available;
I/O by IDC connector.
VS3 Main Unit: 16 DI (DC 24V, 4×200 kHz + 4×50 kHz); 16 DO ★(Y0~Y3 200 kHz at NPN transistor model);
VS3-32M ★ -D 64K words project memory; 3 Expansion Card sockets; DIO Expansion & 16 Special Modules available;
VS3 Series I/O by screw-clamp terminal
Main Unit VS3 Main Unit: 16 DI (DC 24V, 4×200 kHz + 4×50 kHz); 16 DO (100mA NPN transistor, Y0~Y3 200 kHz);
VS3-32MT-DI 64K words project memory; 3 EC sockets; DIO Expansion & 16 Special Modules available; I/O by IDC connector
VS-8 / 16X DI Expansion Module: 8 / 16 DI (DC 24V); input by screw-clamp terminal
VS-8 / 16Y ★ DO Expansion Module: 8 / 16 DO ★; output by screw-clamp terminal
VS-8XY ★ DIO Expansion Module: 4 DI (DC 24V); 4 DO ★; I/O by screw-clamp terminal
VS-16XY ★ DIO Expansion Module: 8 DI (DC 24V); 8 DO ★; I/O by screw-clamp terminal
DIO VS-28XYR DIO Expansion Module: 16 DI (DC 24V); 12 DO (2A Relay); I/O by screw-clamp terminal
Expansion
Module VS-32XY ★ DIO Expansion Module: 16 DI (DC 24V); 16 DO ★; I/O by screw-clamp terminal
VS-16X-I DI Expansion Module: 16 DI (DC 24V); input by IDC connector
VS-16YT-I DO Expansion Module: 16 DO (100mA NPN transistor); output by IDC connector
VS-16XYT-I DIO Expansion Module: 8 DI (DC 24V); 8 DO (100mA NPN transistor); I/O by IDC connector
VS-32XYT-I DIO Expansion Module: 16 DI (DC 24V); 16 DO (100mA NPN transistor); I/O by IDC connector
Power Power Repeater Module: DC 24V power input to transfer to DC 5V 500mA + DC 12V 800mA,
VS-PSD those inner power outputs provide for the Modules behind
Module
Analog Input Module: 4 channel (16-bit) inputs, each channel could input either –10~+10V, 4~20mA or
VS-4AD –20~+20mA; isolated
Analog Output Module: 2 channel (16-bit) outputs, each channel could output either –10~10V, 4~20mA or
VS-2DA –20~+20mA; isolated
Analog I/O Module: 2 channel (16-bit) inputs + 1 channel (16-bit) output, each channel could input/output either
VS-3A –10~+10V, 4~20mA or –20~+20mA; isolated
Special Analog I/O Module: 4 channel (16-bit) inputs + 2 channel (16-bit) outputs, each channel could input/output either
VS-6A –10~+10V, 4~20mA or –20~+20mA; isolated
Function
Module Thermocouple Temperature Input Module: 4 channel thermocouple (K, J, R, S, T, E, B or N type) inputs,
VS-4TC 0.1℃ / 0.1℉ resolution ; isolated
Thermocouple Temperature Input Module: 8 channel thermocouple (K, J, R, S, T, E, B or N type) inputs,
VS-8TC 0.1℃ / 0.1℉ resolution ; isolated
VS-2PT PT-100 Temperature Input Module: 2 channel (3-wire PT-100) inputs, 0.1℃ / 0.1℉ resolution ; isolated
VS-4PT PT-100 Temperature Input Module: 4 channel (3-wire PT-100) inputs, 0.1℃ / 0.1℉ resolution ; isolated

10
Item Model Name Main Specification

VS-4X-EC DI Expansion Card: 4 DI (DC 24V); output by screw-clamp terminal


VS-8X-EC DI Expansion Card: 8 DI (DC 24V); input by screw-clamp terminal
VS-4Y ★ -EC DO Expansion Card: 4 DO ★; output by screw-clamp terminal
DIO VS-8YT-EC DO Expansion Card: 8 DO (DC 24V, 300mA NPN transistor); output by screw-clamp terminal
Expansion
Card VS-4XY ★ -EC DIO Expansion Card: 2 DI (DC 24V); 2 DO ★; I/O by screw-clamp terminal
VS-8XY ★ -EC DIO Expansion Card: 4 DI (DC 24V); 4 DO ★; I/O by screw-clamp terminal
VS-8XI-EC DI Expansion Card: 8 DI (DC 24V); input by IDC connector
VS-8YTI-EC DO Expansion Card: 8 DO (DC 24V, 100mA NPN transistor); output by IDC connector
VS-485-EC RS-485 Communication Expansion Card: One non-isolated RS-485 port with TX / RX indicators; dist. 50m Max.
VS-485A-EC RS-485 Communication Expansion Card: One isolated RS-485 port with TX / RX indicators; dist. 1000m Max.
VS-D485-EC RS-485 Communication Expansion Card: Dual non-isolated RS-485 ports with TX / RX indicators; dist. 50m Max.

Comm. VS-D485A-EC RS-485 Communication Expansion Card: Dual isolated RS-485 ports with TX / RX indicators; dist. 1000m Max.
Expansion RS-232C Communication Expansion Card: Dual non-isolated RS-232 ports with TX / RX indicators;
Card VS-D232-EC dist. 15m Max.; wiring by the RX / TX / SG terminals
RS-485 + RS-232C Communication Expansion Card: One isolated RS-485 port (1000m) &
VS-D52A-EC one non-isolated RS-232C port (15m), both with TX / RX indicators and wiring by terminals
Ethernet + RS-485 Communication Expansion Card: One Ethernet port (with additional non-isolated RS-485, dist.
VS-ENET-EC 50m) & one non-isolated RS-485 port (dist. 50m), both with TX / RX indicators
Brief Voltage I/O Card: 2 channel (0 ~ 10V, 12-bit) inputs; 1 channel (0 ~ 10V, 10-bit) output; with a calibrated
VS-3AV-EC DC 10V output; non-isolated
Analog Input Card: 4 channel (12-bit) inputs, each channel could output either –10 ~ +10V, 4 ~ 20mA or
VS-4AD-EC
–20 ~ +20mA; non-isolated
Analog Output Card: 2 channel (12-bit) outputs, each channel could input either –10 ~ +10V, 4 ~ 20mA or
VS-2DA-EC –20 ~ +20mA; non-isolated
Analog I/O Card: 2 channel (12-bit) inputs + 2 channel (12-bit) outputs, each channel could input/output either
Special VS-4A-EC –10 ~ +10V, 4 ~ 20mA or –20 ~ +20mA; non-isolated
Function
Card VS-3ISC-EC Inverter Speed Control Card: 3 channel (0.1% resolution) voltage outputs; totally isolated for each channel
Thermocouple Temperature Input Card: 2 channel (K, J, R, S, T, E, B or N type thermocouple, 0.2 ~ 0.3℃
VS-2TC-EC resolution) inputs; non-isolated
Thermocouple Temperature Input Card: 4 channel (K, J, R, S, T, E, B or N type thermocouple, 0.2 ~ 0.3℃
VS-4TC-EC resolution) inputs; non-isolated
VS-1PT-EC PT-100 Temperature Input Card: 1 channel (3-wire PT-100, 0.1℃ resolution) input; non-isolated
VS-2PT-EC PT-100 Temperature Input Card: 2 channel (3-wire PT-100, 0.1℃ resolution) inputs; non-isolated
VS-MC Memory Card: No battery required 16Mb Flash ROM for user's project and data-bank (655,360 words) storage
Memory
Card Multi-Function Memory Card: 16Mb Flash ROM for user's project and data-bank (655,360 words) storage;
VS-MCR
with the Real Time Clock function
USB Communication Cable: Between the PLC's Mini USB Programming Port and a computer's A-type USB;
Connection VSPC-200A length: 200 cm
Cable
VSEC- □ □ □ Extension Cable: For the Expansion Slot of the VS series; length□□□:50/100 cm

VB-T8R 8 Relays Output Module: 16A 1c contact relays; with varistors and relay sockets

VB-T8RS 8 Relays Output Module: 5A 1a contact relays; with 5mm removable screw-clamp terminals

VB-T8M 8 MOSFETs Output Module: 2A current source MOSFETs; with yback diodes

VB-T16M 16 MOSFETs Output Module: 2A current source MOSFETs; with yback diodes

VB-T16TB 16 Points Adapted Board: Transfer between the IDC connectors and screw-clamp terminals
IDC
Connector VBIDC- □ □ □ IDC Ribbon Cable: Assembled with two 10-pin female connectors; length□□□:50/100/150/200/250/300 cm
Related VBIW- □ □ □ IDC Dispersed Wires: An IDC female connector with 10 rainbow 22 AWG wire; length□□□:50/100/200/300 cm
Accessory
VBIDC-FC100 10-pin Ribbon Cable: Flat, Grey, 28 AWG; length: 100 foot

VBIDC-FC250 10-pin Ribbon Cable: Flat, Grey, 28 AWG; length: 250 foot

VBIDC-HD20 10-pin IDC Connector: Female connector with strain relief, Grey, 20 pcs.

VBIDC-HD100 10-pin IDC Connector: Female connector with strain relief, Grey, 100 pcs.

VB-HT214 A crimping tool of IDC ribbon cable

★ Selectable output:
R: 2A Relay;
T: 0.5A NPN transistor (EC cards are 0.3A), at Y0~3 could generate purse (VS1/2: 50kHz; VSM/3: 200 kHz);
P: 0.5A PNP transistor, at Y0~3 could generate 1kHz purse
All Main Unit, Special Module and IDC's module are required DC 24V -15% / +20% power input

11
12
2. Component Descriptions
2-1 Table of Components
Item Description
VS1 Series X0~X77, 64 Pt.(named by the octal system)

External Input VS2 Series X0~X177, 128 Pt.(named by the octal system)
(X) VSM Series X0~X177, 128 Pt.(named by the octal system)
VS3 Series X0~X377, 256 Pt.(named by the octal system)
VS1 Series Y0~Y77, 64 Pt.(named by the octal system)

External Output VS2 Series Y0~Y177, 128 Pt.(named by the octal system)
(Y) VSM Series Y0~Y177, 128 Pt.(named by the octal system)
VS3 Series Y0~Y377, 256 Pt.(named by the octal system)

General use M0~M1999 , M4000~M8191, Tot.= 6192 Pt.


Auxiliary Relay
Latched M2000~M3999 , 2000 Pt.
(M)
Special use M9000~M9511 , 512 Pt.
General use S0~S9 , 10 Pt.

Step Relay Latched S10~S499, S1500~S4095 , Tot.= 3086 Pt.


(S) Special use S500~S899, S1000~S1499 , Tot.= 900 Pt.
Annunciator S900~S999, 100 Pt. latched
100mS T0~T199, 200 Pt.Range: 0.1~3,276.7 Sec.
10mS T200~T245, 46 Pt.Range: 0.01~327.67 Sec.
Timer
1mS Retentive T246~T249, 4 Pt.Range: 0.001~32.767 Sec.
(T)
100mS Retentive T250~T255, 6 Pt. Range: 0.1~3,276.7 Sec.
1mS T256~T511, 256 Pt. Range: 0.001~32.767 Sec.
C0~C99, 100 Pt. Range: 0~32,767
16-bit Up
Counter C100~C199, 100 Pt. (Range: 0~32,767; Latched)
(C) C200~C219, 20 Pt. (Range: -2,147,483,648~2,147,483,647)
32-bit Up / Down
C220~C234, 15 Pt. (Range: -2,147,483,648~2,147,483,647; Latched)
Software C235~C245, 11 Pt. 1-phase counter
High Speed For the X0~X7,
32-bit Up / Down, Latched C246~C250, 5 Pt. 2-phase counter each can be
Counter
used once
(C) C251~C255, 5 Pt., AB-phase counter
General use D0~D6999, 7000 Pt.
Register
Latched D7000~D8999, 2000 Pt.
(D)
Special use D9000~D9511, 512 Pt.
Index Register (V & Z) V0~V7, Z0~Z7, 16 Pt.

Extension Register VS1, VS2, VSM Series R0~R9999, 10000 Pt.


(R) VS3 Series R0~23999, 24000 Pt.
1024 points: Each pointer can be named by P0~P1023 or
Mark Pointer 1024 pointers in total
16 characters
Branch Pointer (P) 1024 points: P0~P1023
Table Nickname 32 points: Each table can be named by Q0~Q31 or 16 characters
32 tables in total
Table Code (Q) 32 points: Q0~Q31
External Interrupt 8 points: IX0P/F~IX7P/F

Interrupt Pointer Timer Interrupt 3 points: ITA□□~ITC□□


(I) Software High Speed Counter 8 points: IHC0~IHC7
Hardware High Speed Counter 2 points: IHHC1~IHHC2
Nested Pointer N N0~N7, 8 Pt.

Decimal 16-bit K–32,768~K32,767


(K) 32-bit K –2,147,483,648~K2,147,483,647

Hexadecimal 16-bit H 0~HFFFF


(H) 32-bit H 0~HFFFFFFFF
Real Number (E) 32-bit E−3.402 +38~E3.402 +38 decimal or exponent notation

13
2-2 External Input (X) and External Output (Y)
2-2-1 External Input (X)
VS Series PLCs read the ON/OFF status of various external switches and sensing elements as operating conditions
through the input points. To prevent problems such as noise interference and switch bouncing, there is a filter of about
10ms equipped at each input point. Since the external input X0~X7 of a Main unit are designated as multi-function input
points to perform various high speed functions, therefore, the filter time of these 8 input points is adjustable.
Functions of these 8 output points are listed below.

External Input Point Ref.


Function Page
X0 X1 X2 X3 X4 X5 X6 X7
Common Input Use D9020 to adjust the lter time as 0~60ms 179
Frequency Meter Use the SPD instruction to perform the speed detection function 186
Software High
Use C235~C255 1-phase/2-phase/AB phase counters, besides to generate IHC0~IHC7 interrupt 25
Speed Counter

External Interrupt IX0P/F IX1P/F IX2P/F IX3P/F IX4P/F IX5P/F IX6P/F IX7P/F 54
Pulse Capture M9170 M9171 M9172 M9173 M9174 M9175 M9176 M9177 55
Hardware High HHSC1, to make HHSC2, to make
Speed Counter the IHHC1 interrupt the IHHC2 interrupt 58

Width / Period Width / Period


Pulse Measurement 56
measurement measurement
Positioning Control Can be the input points of the positioning control's DOG, PG0, INT signals or for the handwheel. 423

For the descriptions of each item, please refer to the page listed at the “Ref. Page ” above.
The contact of a common input point in the program is available to work with an other special function.
When one of the X0~X7 performs a mentioned special function above, this input point is not reusable with another
special function. However, the External Interrupt could cooperate with Pulse Measurement function. (For details,
please see the specific function description.)
When a mentioned special function above performs, the filter time of this input point will be automatically adjusted to
0ms (deviates form D9020). To prevent noise interference, input points X0~X7 are also equipped with RC filters.
Thus, the filter time of 0 ms is not true 0 ms. In addition, the response time of input points X0~X7 is varied depending
on the Series of VS1, VS2, VSM or VS3.
When filter time is adjusted as 0ms, the minimum pulse width required to transmit input signals to respective input
points are listed as follows.

External Input Point


Series
X0 X1 X2 X3 X4 X5 X6 X7
VS1 50µs 50µs 50µs 50µs 50µs 50µs 50µs 50µs
VS2 10µs 10µs 10µs 10µs 10µs 10µs 10µs 10µs
VSM 2.5µs 2.5µs 10µs 2.5µs 2.5µs 10µs 10µs 10µs
VSM-28ML 0.5µs 0.5µs 10µs 0.5µs 0.5µs 10µs 10µs 10µs
VS3 2.5µs 2.5µs 10µs 2.5µs 2.5µs 10µs 10µs 10µs

When a multi-function input point is performing a special function, the response of the point requires fast and
relatively sensitive (the fast reaction, the more sensitive), contrarily susceptible to noise interference.Therefore, pay
special attention to its external wiring, try to avoid interfering sources, and use isolation lines.

14
2-2-2 External Output (Y)
The contacts of external output in the VS Series PLC are for the purpose of to drive external loads. By transmitting the
operation results through its external output points, the PLC drives various loads, such as motors, electromagnetic
valves, electromagnetic conductors, etc. and virtually perform control motions.
For various loading needs, the VS Series PLCs have different output types, such as relay, NPN transistor and PNP
transistor. Every relay has a coil and contact that uses magnetically coupled to separate the PLC internal circuit from
the external, but a transistor output uses a photocoupler to prevent noise interference.
Relay outputs have approximately 10ms of output delay, while transistor outputs have approx. 1ms. These delays
result that certain applications cannot be fully met. Therefore, the 4 output points of Y0~Y3 are designated to be
multi-function output points.

External output point Ref.


Function Page
Y0 Y1 Y2 Y3 No.
Common Output The output type is selectable, that includes the relay, NPN transistor or PNP transistor.
Paulse output Use the PLSY or PLSR instruction to generate a pulse string to the driver of stepper or servo motor 187
PWM Output Use the PWM instruction to generate PWM signal 189
Use the Positioning Control instruction to generate positioning pulses directly to the driver of the
Positioning Control 423
step motor or servo motor, by the method to execute the accurate positioning control

Except for the common output function, the other functions mentioned above can only available be used at a
transistor output main unit.
For the descriptions of each item, please refer to the page listed at the “Ref. Page No.” above.
At a time, each Y0~Y3 output point allows to execute one instruction of special function only. Also, cannot intermix
different functional groups mentioned above.
The frequency of the Y0~Y3 output at the VS1, VS2, VSM or VS3 series is different, the list below is the capability:

External output point


Series
Y0 Y1 Y2 Y3
VS1 50KHz 50KHz 50KHz 50KHz
VS2 50KHz 50KHz 50KHz 50KHz
VSM 200KHz 200KHz 200KHz 200KHz
VSM-28ML 1MHz 1MHz 1MHz 1MHz
VS3 200KHz 200KHz 200KHz 200KHz

15
2-2-3 External Input/Output Assigned Numbers
The identification numbers of the External Input/Output points are assigned by the octal numeral system.
The table below lists the assigned numbers of Input (X) and Output (Y) in the VS1 Main Unit:

Models VS1-10M VS1-14M VS1-20M VS1-24M VS1-28M VS1-32M VS1-32MT-DI

Input No. X0~X5 X0~X7 X0~X13 X0~X15 X0~X17 X0~X23 X0~X17


6 Pt. 8 Pt. 12 Pt. 14 Pt. 16 Pt. 20 Pt. 16 Pt.

Output No. Y0~Y3 Y0~Y5 Y0~Y7 Y0~Y11 Y0~Y13 Y0~Y13 Y0~Y17


4 Pt. 6 Pt. 8 Pt. 10 Pt. 12 Pt. 12 Pt. 16 Pt.

The table below lists the assigned numbers of Input (X) and Output (Y) in the VS2 Main Unit:

Models VS2-24M VS2-32M VS2-32MT-DI

Input No. X0~X13 X0~X17 X0~X17


12 Pt. 16 Pt. 16 Pt.

Output No. Y0~Y13 Y0~Y17 Y0~Y17


12 Pt. 16 Pt. 16 Pt.

The table below lists the assigned numbers of Input (X) and Output (Y) in the VSM Main Unit:

Models VSM-14MT-D VSM-24MT-D VSM-32MT-D VSM-32MT-DI VSM-28ML-D

Input No. X0~X7 X0~X13 X0~X17 X0~X17 X0~X17


8 Pt. 12 Pt. 16 Pt. 16 Pt. 16 Pt.

Output No. Y0~Y5 Y0~Y13 Y0~Y17 Y0~Y17 Y0~Y13


6 Pt. 12 Pt. 16 Pt. 16 Pt. 12 Pt.

The table below lists the assigned numbers of Input (X) and Output (Y) in the VS3 Main Unit:

Models VS3-32M VS3-32MT-DI

Input No. X0~X17 X0~X17


16 Pt. 16 Pt.

Output No. Y0~Y17 Y0~Y17


16 Pt. 16 Pt.

Notes for the VS1 Series PLC Module Expansion


The Main Unit of VS1-10M/VS1-14M/VS1-20M/VS1-24M is not equipped with the module expansion slot.
The Main Unit of VS1-28M/VS1-32M is equipped with the module expansion slot, which can reach 64 inputs and 64
outputs (X0~X77, Y0~Y77), 128 points in total.
The module expansion slot of the VS1 series PLC can be equipped with DIO modules, but not allow special module.
The Main Unit of VS1-28M/VS1-32MT-DI occupies the assigned numbers of X0~X17 and Y0~Y17. Therefore, the
first expansion module is started from X20 and Y20.
The Main Unit of VS1-32M occupies the assigned numbers of X0~X27 and Y0~Y17. Therefore, the first expansion
module is started from X30 and Y20.
X0 X23 X30 X40
S S X0 X1 X2 X3 X4 X5 X6 X7 S S X0 X1 X2 X3 X4 X5 X6 X7

INPUT X INPUT X

VS1-32MR VS-16XYR VS-8X

X0 1 2 3 4 5 6 7
10 11 12 13 14 15 16 17
20 21 22 23 X0 1 2 3 4 5 6 7 X0 1 2 3 4 5 6 7

PWR RUN ERR PWR PWR

Y0 1 2 3 4 5 6 7 Y0 1 2 3 4 5 6 7
10 11 12 13

DC24V
INPUT OUTPUT Y

C0 Y0 Y1 Y2 Y3 C1 Y4 Y5 Y6 Y7

Y0 Y13 Y20

The VS-8XY module occupies 8 input points and 8 output points.


The VS-28XYR expansion module will occupy 16 input and 16 output points. Besides, it is unable to expand any
module on its right side.

16
Notes for VS2, VSM and VS3 Series PLCs module expansion.
The Main Unit of VSM-14M is not equipped with the module expansion slot, cannot be connected with any
module or special module.
The Main Unit of VS2, VSM or VS3 equips a module expansion slot, could connect with DIO expansion modules and
special modules. (excluded the VSM-14M)
The Main Unit of VS2 or VSM can use expansion modules to handle up to 128 inputs (X0~X177) and 128 outputs
(Y0~Y177), total 256 I/O points. And also available 8 special modules.
The Main Unit of VS3 can use expansion modules to handle up to 256 inputs (X0~X377) and 256 outputs
(Y0~Y377), total 512 I/O points. And also available 16 special modules.
All the Special and DIO Expansion Modules are serial connected on the right side of the Main Unit, and the
connection sequence is without reserved. The closest Special Module is designated as the 1st. Special Module.
After that, the followed Special Module is the 2nd., and so on. But, the DIO Expansion Module will not interfere with
the ranking of Special Modules.
The Main Unit of VS2, VSM or VS3 will occupy the assigned numbers X0~X17 and Y0~Y17, thus the beginning I/O
address of the rst expansion unit/module are the X20 and Y20.
X0 X17 X20 X30

Y0 Y17 Y20 The 1st. Special Module

The VS-8XY module occupies 8 input points and 8 output points.


The VS-28XYR expansion module will occupy 16 input and 16 output points. Besides, it is unable to expand any
module on its right side.

The VS Main Unit has the circuit for inner power supplying but the expanded modules and cards do not have, all
power is from the Main Unit Please be aware of power consumption. If the inner power is insufficient, add the VS-PSD
power repeater module is required.
For the power consumption calculations of individual expansion modules and expansion cards, please refer to
“1-8 Specifications of Power Supply” in the Product Manual.

17
2-3 Auxiliary Relay (M)
The PLC includes considerable internal Auxiliary Relays (M), the function of those are to store up plenty ON/OFF status,
which provided data for the processing demand. The operating method of an Auxiliary Relay is the same way to
operate the External Output Y, but the contact of Auxiliary Relay can not directly drive an external load.
The identifier number of an Auxiliary Relay M uses the decimal method, and the functions can be divided into three
different types:
(1) General Auxiliary Relay
When the input power is cut off during the PLC operation, the contents of this kind relay will be cleared. After the
power resumes, the contents of this kind relay are all OFF.
(2) Latched Auxiliary Relay
When the input power is cut off during the PLC operation, the contents of this kind relay will be latched. After the
power resumes, the contents still remain. That means, if the content of a latched relay is ON before power cut, its
state will keep ON at the moment when the power is back.
Below show some examples:
Suppose there is a platform that, when the motor rotates forward and backward, it drives the platform to move left
and right. In addition, the left limit switch (X0) and the right limit switch (X1) are connected to the left and right
limitations of the moving range. If the operation of the motor should finish the uncompleted movement after the
power is returned, that must use a latched auxiliary relay.
X0 X1
M2000 Self-holding circuit, use M2000 to retain the platform moving to the right.
M2000

X1 X0
M2001 Self-holding circuit, use M2000 to retain the platform moving to the left.
M2001

Also, now there are many mechines using human-machine interface (HMI) as operation interface. In such cases,
many setups to PLCs by HMI may need the latched function.

(3) Special Auxiliary Relay


Each special relay has its own specific function. Some special relay has only the readable contact of its status, but
without the writable coil to be driven by the program. Do not use special relays which are not defined. For the details
of special relays, please refer to the section 2-14 “Special Relay and Special Register”.

The auxiliary relays in the VS1,VS2,VSM and VS3 series share exactly the same ranges.:
General Auxiliary Relay Latched Auxiliary Relay Special Auxiliary Relay
M0~M1999, M4000~M8191
M2000~M3999, Tot.= 2000 Pt. M9000~M9511, Tot.=512Pt.
Tot.=6192Pt.

18
2-4 Step Relay (S)
A Step Relay is the basic component in the Sequential Function Chart (SFC) or Step Ladder (STL). The identifier number
of a Step Relay S uses the decimal method, and the functions can be divided into four different types:
(1) Initial Step Relay
It is used in the initial status of the Sequential Function Chart .
(2) General Step Relay
It is for general use in the Sequential Function Chart. When power cut off occurs during PLC operation, the status will
be reverted to void (OFF).
(3) Latched Step Relay
When power cut off occurs during PLC operation, the status will be retained. When the power resumes, PLC can
continue its work from the Latched Step Relay.
(4) Annunciator Step Relay
The annunciator with latched function. It is mainly driven by the ANS (FNC46) instruction as a contact of the
annunciator, used to record the relevant warning messages to facilitate troubleshooting.

The Step Relays in the VS1, VS2, VSM and VS3 series share exactly the same ranges.
Initial Step Relay General Step Relay Latched Step Relay Annunciator Step Relay

S0~S9, 10 Pt. S10~S499, S1500~S4095 S500~S899, S1000~S1499 S900~S999, 100 Pt.


Tot.= 3086 Pt. Tot.= 900 Pt.

19
2-5 Timer (T)
The timers count the time are by increase counting. When the timer's Present Value = Set Value (the value designated
to a Timer), the contact of the timer is (ON).
The real Set Value of a timer = Designated number × Unit of the timer
The set value of a timer can be set directly by using a constant number K or indirectly by using the content value in a
Data Registers D or R. Also, can be modified by using the Index Register V/Z.

The definition of timers at the VS1,VS2,VSM and VS3 serie are exactly the same:
General (non-retentive) timer Retentive timer
100ms timer 10ms timer 1ms timer 1ms timer 100ms timer
0.1~3276.7 Sec. 0.01~327.67 Sec. 0.001~32.767 Sec. 0.001~32.767 Sec. 0.1~3276.7 Sec.
T0~T199 T200~T245 T256~T511 T246~T249 T250~T255
200 Pt. 46 Pt. 256 Pt. 4 Pt. 6 Pt.

2-5-1 General Timers

X0 K100 When X0 = ON, the present value of timer T0 starts to up count clock
T0 pulse by 100ms, and when its value reaches the set value, K100
T0 (10 seconds), its contact will be activated.
Y0 When the input contact X0 = OFF or power cut, the present value of the
timer will return to “0” and the contact will turn into OFF.

10 Sec.

X0
Set value (K100)

Present value of T0

Y0

2-5-2 Retentive Timers


When X1 = ON, the present value of timer T246 starts to up count clock
X1 K2000 pulse by 1ms, and when its value reaches the set value K2000
T246 (2 seconds), its contact will be activated.
T246
Y1 During the timer is counting, if the X1 turned OFF or power cut, the T246
X2 will pause counting and retain the present value. After the X1 turned ON
RST T246 again, it will resume counting to increase its present value continually,
until its present value = set value K2000 (2 seconds) and its contact will
become ON.
When X2 = ON, the present value of timer T246 returns to “0” and its
contact will be OFF.

t1 t2
t1+t2=2 Sec.
Retentive Retentive
X1 time time
Set value

Present value of T246

Y1

X2

20
2-5-3 Using a Timer in a Subroutine
When the PLC scans to the coil of an general non-retentive timer (not includs T192~T199), it accumulates or clears the
present value of the timer then controls its contact.
When the PLC scans to the END instruction, it accumulates or clears the current value of each T192~T199 timer then
controls its contact.
At the 1 ms system interrupt, it accumulates the present value of activated T246~T249 timers. Then when the PLC
scans to the timer's coil, it controls the contact of the timer.
To conclude, reminders for using timers in subroutine are shown below:
(1) A subroutine which will be executed once during each scan time can adopt all types of timers.
(2) A subroutine which will be executed several times during each scan time can adopt T192~T199 and T246~T249
timers.
(3) The subroutine which may not be executed at every scan time can adopt T192~T199 timers.
(4) An interrupt subroutine (which is only executed in interruption) must adopt T192~T199 timers.

2-5-4 Methods to Appoint the Set Value of a Timer


Direct setting by using a constant number K
X0 T200 is a timer using a 10 ms as the time unit.
K150
T200 When the setting constant K is 150, the set value of T200 is 1.5 Sec.
(150×10 ms=1500 ms=1.5 s).

Indirect setting by using a Data Register D


T200 is a timer using a 10 ms as the time unit.
X0
MOV K200 D0 If D0=200 , T200 = 2 Sec. timer.
X1 D0
T200 If D0=1000 , T200 =10 Sec. timer.
The set value of T200 can be modified by to change the content value
of D0.

2-5-5 Detailed Description about the Output Action and Accuracy of a Timer
Below shows the action procedures of a general non-retentive timer:

input processing During the timer T0 is started and the CPU repeatedly to
X0 execute its “OUT” coil. That may increase the present value
K120 of the timer by a few numbers (not only 1) if the period of
T0 scan time is more than the timer's resolution unit.
˙˙˙˙˙˙˙˙˙˙

X0 = OFF → ON
T0 Timer T0 is started T0
Y1 contact turned
to ON

Y1
ON

1st scan 2nd scan nth scan n+1th scan

At the moment, the accumulated time is reaching to 12 Sec.


Since the scan of CPU already passed the coil of T0, so the contact of
T0 would not be activated.

Below describes the accuracy of a timer, from the coil is triggered to the contact is turned ON:

+Ts α: 0.001 sec. for the 1 ms timer; 0.01 sec. for the 10 ms timer; 0.1 sec. for the 100 ms timer
-α T : Set time of timer (sec.)
Ts : scan time (sec.)
If in the program, a timer contact is written in front of its coil, the maximum timing error would be extra 2 Ts.
If the set time of timer is “0”, the output contact will action in the next scan.
For the T246~T249, which is using the system's 1ms interrupt to increase the current value if the coil of
the timer has been triggered.

21
2-6 Counter (C)
When the pulse input signal in a counter turns from OFF to ON, the present value of the counter will increase (+1 in a
up count) or decrease (-1 in a down count) each time, based on the counting types of counters. If the present value
equals to set value, the counter's contact turns to be ON.
The counrer's set value can be set directly by using a constant number K or indirectly by using the content value that
stored in the register D, R. Also, this can be modified by the Index Register V/Z.
The characteristics of the 16-bit and 32-bit counters are shown in the following table:
Item 1 6- bit counter 3 2- bit counter
Count Direction Up count Up or Down Count, bi-directional
1~32,767 (equivalent to 1, if the set value exceeds the
Available Set Value range) -2,147,483,648~ +2,147,483,647

Set Value Appoint Constant K or a data register Same as in the left column, but each 32-bit
value ocupies 2 data registers
Changes of Increase; retain if reaching the set value Continuing changing once reaching the set value
Present Value
Up count: turns ON if reaches the set value
Status of Contact Turns ON & retains if the current value reaches the set value Down count: turns OFF if passes through the set value

Reset Action When the RST instruction is executed, the present value becomes “0” and the contact will turn to be OFF.
Present Value
Register 16 bits 32 bits

The definition of counters at the VS1,VS2,VSM and VS3 serie are exactly the same:
1 6- bit counter 3 2- bit counter
General Latched General Latched
C0~C99 C100~C199 C200~C219 C220~C234
100 Pt. 100 Pt. 20 Pt. 15 Pt.

2-6-1 16- bit Counter


The present value of a general counter will be reset when a PLC encounters power cut off. However, the latched
counter will retain its present value before the power is cut off and starts from there when it is powered.

X0 The contact signal X1 is to drive the C0 counter. When the signal X1


RST C0 turns from OFF to ON once, the present value of C0 will increase by 1.
Then, on the tenth input turning ON, C0's output contact is activated,
X1 K10 turns ON. After that, the present value remains unchanged even the X1
C0 changes.
C0
Y0 When reset signal X0 is ON, the RST instruction operates. The present
value of C0 is reset to “0” and its contact will become OFF.

Reset signal X0

Count signal X1
10
9 Set value
8
7
6
5
4
3
2
1
Present value of C0 0

Y0

The counter's set value can be set by using a constant K directly or a content value in the Data Register D, R
indirectly. Also, this can be modified by the Index Register V/Z.
When the MOV instruction transfers a new present value to the counter and which is greater than its set value, the
counter's contact will turn to be ON promptly at the next input signal is ON, and meanwhile the present value will
become the same as the set value.

22
2-6-2 32- bit Counter

X0 The X0 drives the M9200 to define the UP/Down count direction of the
M9200 C200. It OFF is defined as an UP count; while ON for Down count.
X1 When the counting signal X2 switches from OFF to ON, C200
RST C200 accumulates counting, and the present value in the register alters.
X2 K- 5
C200 When the present value of a counter changes from -6 to -5, its output
contact switches from OFF to ON. When the present value of a counter
C200
changes from -5 to -6, its output contact switches from ON to OFF.
Y0
When the rest signal X1 is ON, the RST instruction is executed.
The present value of this counter will reset to “0” and its contact will be
OFF.

UP/Down control signal X0 Up Down Up


Rest signal X1
Counting signal X2

Present value of C200

If the output contact was ON

Y0

Since the range of a 32-bit present value is between -2,147,483,648 to +2,147,483,647. If a counter up counts
beyond +2,147,483,647, the present value will automatically change to -2,147,483,648. Similarly, the down counting
below - 2,147,483,648 will have the result +2,147,483,647. This is a typical “Ring Counter” technique.
When the power is turned off, the latched counter will retain its present value and status of the contact.
The 32-bit counter can be used as a 32-bit data register.
If use the DMOV instruction to transfer a number to the counter's present value register and which is greater than its
set value, then at the next input ON signal will let its present value accumulated but will not change the status of
contact.
The Up/Down direction control for a 32-bit counter C200~C234 is defined by the special relay M9200~M9234.
The C200's direction is defined by M9200. If the M9200 is OFF, the C200 executes up counting; ON counts down.
While the M9201 is to control the direction of the C201, and so on.
The counter's set value can be set by using a constant number K directly or a content value in a pair of continuous
Data Registers D, R indirectly. The value can be either a 32-bit positive or negative number.
In the part of 32-bit counter's output coil, its component ID number is not available to modify by the Index Register
V/Z. However, the set value can be modified by the V/Z.

23
2-6-3 Methods to Appoint the Set Value of a Counter

16-bit Counter
Direct setting by a constant number K Indirect setting by using a Data Register D
X0 K100 X0
C0 MOV K50 D0
X1 D0
C0 becomes a UP counter with 100 counts. C0

When D0=50, C0 becomes a counter with 50 counts.


When D0=200, C0 becomes a counter with 200 counts.
The set number of counts can be modified by changing
the value of D0.

32 -bit Counter
Direct setting by a constant number K Indirect setting by using a double word Data Register D
X0 K43210
C200 X0
DMOV K-5 D0
X1 D0
C200 becomes a UP/Down counter
C200
with the set value of K43210.

When the content's set value of a 32-bit register that


composed by D1 and D0 is K-5, the C200 becomes a
Up/Down counter with the set value of -5. (the D1 is for
upper 16-bit, D0 is for lower 16-bit).
The set value of the C200 can be modified by to change
the content value of the combined D1 and D0.

24
2-7 Software High Speed Counter
Each one of the input points X0~X7 in the VS series PLC can be used for high speed function, such as the high speed
counter, external interrupt or frequency meter. If a X0~X7 is not designed for high speed function, it can still be used as
a general input point.
For the purpose of the Software High Speed Counter, it uses the interrupt to receive and count every high speed input
pulse, hence with a “Software” in the front of its name. The counter is a 32-bit Up/Down counter with latched function,
and can be classified into three types. Their characteristics are shown in the table below:
Counter's ID No. Counter Type Count Direction Range of Set Value
1-phase Determined by M9235~M9245. OFF is defined as up count while
C235~C245 high speed counter ON as down count.

The up and down count signals have their own input points.
2- phase
C246~C250 The direction can be identified from M9246~M9250.
high speed counter -2,147,483,648
OFF means up counting; ON means down counting.

~
Determined by the sequence of A/B phase input signals.
Up counting if A-phase signal is ON then B-phase signal turns +2,147,483,647
A/B phase from OFF to ON.
C251~C255 high speed counter Down counting if A-phase signal is ON then B-phase signal turns
from ON to OFF.
The direction can be identified from M9251~M9255.
OFF means Up counting; ON means Down counting.

When input points X0~X7 are applied to perform the Software High Speed Counters (SHSC), there are two operation
modes available. The setting page is at the “Project Parameter Setup” within the programming software.
SHSC Mode 1
1-phase 2-phase A/B phase
Input

High Speed Counter High Speed Counter High Speed Counter


C235 C236 C237 C238 C239 C240 C241 C242 C243 C244 C245 C246 C247 C248 C249 C250 C251 C252 C253 C254 C255
X0 U/D U/D U/D U U U A A A
X1 U/D R R D D D B B B
X2 U/D U/D U/D R R R R
X3 U/D R R U U A A
X4 U/D U/D D D B B
X5 U/D R R R R R
X6 S S S
X7 S S S

SHSC Mode 2
1-phase 2-phase A/B phase
Input

High Speed Counter High Speed Counter High Speed Counter


C235 C236 C237 C238 C239 C240 C241 C242 C243 C244 C245 C246 C247 C248 C249 C250 C251 C252 C253 C254 C255
X0 U/D U/D U U A A
X1 U/D R D D B B
X2 U/D U/D U R A R
X3 U/D R U A
X4 U/D U/D D B
X5 U/D R D B
X6 U/D U A
X7 U/D D B
U: Count up input; D: Count down input; A: A-phrase input; B: B-phrase input
U/D: Up/Down counting signal input; R: Built-in Reset Input; S: Built-in Start-up input

Since a PLC only has 8 high speed inputs X0~X7, once an input point is occupied then it cannot be used for other
high speed functions. Therefore, users should plan carefully in order to make good use of these input points.
This section only describes the software high speed counters; for planning the PLC program, please refer to other
sections which are regarded more functions of high speed input points.
In Sections 2-7-1~2-7-3, the descriptions of various counters are based on SHSC Mode 1.

25
2-7-1 1-Phase High Speed Counter

X20 The X20 drives the M9235 to define the Up/Down count direction of the C235.
M9235
When the X22 is ON, the C235 will receive that count signal from the X0.
X21
RST C235 When the signal X21 is ON, the RST instruction is executed. C235's present
X22 K- 5 value is reset to “0” and its output contact becomes OFF.
C235
The C235~C240 (and the C241~C242 at the SHSC Mode 2) are 1-phase
high speed counters which should use the user program to control the
activation and reset processes.

Up/Down count control X20 Up Up


Down
Reset signal X21
start-up signal X22
count signal X0

Present value of C235

If the output contact was ON

Output contact of C235

When the start-up signal X22 is ON and there is pulse input from the X0 point, the present value of C235 will
Up/Down change.
When the present value of the C235 increases from -6 to -5, its output contact switches from OFF to ON. When the
present value of a counter decreases from -5 to -6, its output contact switches from ON to OFF.
If the counter up counts accumulated beyond +2,147,483,647, the present value will automatically change to
-2,147,483,648. Similarly, the down counting below -2,147,483,648 will have the result +2,147,483,647.
When the rest signal X1 is ON, the RST instruction is executed. Meanwhile, the C235 present value is reset to “0” and
its output contact becomes OFF.
The direction of Up/Down count for an 1-phase counter C235~C245 is determined by the ON/OFF status of related
M9235~M9245. If the relay is OFF, the counter executes Up counting; while ON is for Down counting.

X20 The X20 drives the M9242 to define the UP/Down count direction of the
M9242 C242.
X21 When X22 is ON, C242 is activated to receive the counting signal from X2.
RST C242
X22 D0 When X21 is ON, the RST instruction is executed. The C242's present
C242 value resets to “0” and its output contact becomes OFF. If the application
of C242 is not demanded to reset by the program, could ignore this line.
When X3 (the designated built-in reset signal of C242) is ON, the present
value of C242 will be reset to “0” and its contact will become OFF.
The set value of C242 is provided by the content value of D1 and D0.
The C241~C243 at the Mode 1 or C243~C245 at the Mode 2 are
1-phase high speed counters which should use the program to activate
then by the program or built-in reset input to clear.

X20 The X20 drives the M9244 to define the UP/Down count direction of the
M9244 C244.
X21 When X22 is ON and X6 is ON (the built-in start-up signal of C244),
RST C244 the C244 is activated to receive the counting signal from X0.
X22 K200
C244 When X21 is ON, the RST instruction is executed. The C244's present
value resets to “0” and its output contact becomes OFF. If the application
of C244 is not demanded to reset by the program, could ignore this line.
When X1 (the designated built-in reset signal of C244) is ON, the present
value of C244 will be reset to “0” and its contact will become OFF.
The C244~C245 at the Mode 1 are 1-phase high speed counters which
should use the program and start-up input to activate then by the
program or built-in reset input to clear.

26
2-7-2 2-Phase High Speed Counter

X20 When X21 is ON, the C246 receives counting signal from either X0 or X1
RST C246 input point.
X21 K-5
C246 When X20 is ON, the RST instruction is executed. C246's present value is
reset to 0, and its output contact becomes OFF.
The C246 2-phase high speed counter which should use the user program
to control the activation and reset processes.

Reset signal X20


Start-up signal X21
Up count signal X0
Down count signal X1

Present value of the C246

If the output contact was ON

Output contact of C246

When the start-up signal X21 is ON and there is a pulse entering from either X0 or X1, the present value of C246 will
Up/Down change.
When X0 changes from OFF to ON, the present value of C246 increases by 1.
When X1 changes from OFF to ON, the present value of C246 decreases by 1.
When the present value of the C235 increases from -6 to -5, its output contact switches from OFF to ON. Oppositely,
when the present value of a counter decreases from -5 to -6, its output contact switches from ON to OFF.
If the counter up counts accumulated beyond +2,147,483,647, the present value will automatically change to
-2,147,483,648. Similarly, the down counting below -2,147,483,648 will have the result +2,147,483,647.
The Up/Down counting direction of a 2-Phase High Speed Counter C246~C250 can be watched by to monitor the
M9246~M9250. The related relay OFF means up counting; ON means down counting.

X20 When X21 is ON, C248 is activated to receive the counting signal from
RST C248 X3 or X4.
X21 D0 When X3 changes from OFF to ON, the present value of C248 increases
C248 by 1.
When X4 changes from OFF to ON, the present value of C248 decreases
by 1.
When X20 is ON, the RST instruction is executed. The C248's present value is reset to “0” and its output contact
becomes OFF. If the application of C248 is not demanded to reset by the program, could ignore this line.
When X5 (the designated built-in reset signal of C248) is ON, the present value of C248 will be reset to “0” and its
contact will become OFF.
The set value of C248 is provided by the content value of D1 and D0.
The C247~C248 at the Mode 1 are 2-phase high speed counters which should use the program to activate then
by the program or built-in reset input to clear.

X20 When the X21 is ON and the X6 (designated start-up input of C249) is
RST C249 ON, the C249 is activated to receive the counting signal from X0 or X1.
X21 K100 When X0 changes from OFF to ON, the present value of C249 increases
C249 by 1.
When X1 changes from OFF to ON, the present value of C249 decreases
by 1.
When X20 is ON, the RST instruction is executed. The C249's present value is reset to “0” and its output contact
becomes OFF. If the application of C249 is not demanded to reset by the program, could ignore this line.
When X2 (the designated built-in reset signal of C249) is ON, the present value of C249 will be reset to “0” and its
contact will become OFF.
The C249~C250 at the Mode 1 are 2-phase high speed counters which should use the program and start-up
input to activate then by the program or built-in reset input to clear.

27
2-7-3 A/B Phase High Speed Counter
The A/B phase high speed counter is exclusively for receiving A/B phase pulses from a rotary or linear encoder.
X20
When X21 is ON, C251 is activated to receive pulse signals from input
RST C251
point X0 (A-phase) and X1 (B-phase). Then bases on the sequence of
X21 K-5 input signals to perform Up/Down count.
C251
when X20 is ON, the RST instruction is executed. C251's present value is
reset to 0, and its output contact becomes OFF.
The C251 A/B phase high speed counter should use the user program to
control the activation and reset processes.

Reset signal X20


Start-up signal X21 Rotary encoder reverses here
A-phase pulse X0
B-phase pulse X1

Present value of C251

If the output contact was ON

Contact point of C251

When the start-up signal X21 is ON and there are orderly pulses entering from X0 and X1, the present value of C251
will Up/Down change.
When X0 is ON (A-phase pulse is ON) and X1 turns from OFF to ON (B-phase pulse turns from OFF to ON),
the present value of C251 increases by 1.
When X0 is ON (A-phase pulse is ON) and X1 turns from ON to OFF (B-phase pulse turns from ON to OFF),
the present value of C251 decreases by 1.
The Up/Down counting direction of the A/B Phase High Speed Counter C251~C255 can be watched by to monitor
the M9251~M9255. The related relay OFF means up counting; ON means down counting.
The rotary encoder which is connected to a motor shaft that produces corresponding A/B phase pulse according to
the motor's forward/backward rotation. This A/B phase pulses are transmitted to C251's A/B phase inputs. Therefore,
the present value of C251 increases/decreases according to the motor's moving direction.

X20 When the X21 is ON and A/B phase pulses entering from X0 and X1 for
RST C252 the C251.
X21 D10 When X0 is ON and X1 turns from OFF to ON, the present value of C251
C252 increases by 1.
When X0 is ON and X1 turns from ON to OFF, the present value of C251
decreases by 1.
When the X20 is ON, the RST instruction is executed. The C252's present value is reset to “0” and its output
contact becomes OFF. If the application of the C252 is not demanded to reset by the program, could ignore this
line.
When the X2 (designated built-in reset input of C252) is ON, the present value of C252 will be reset to “0” and its
contact will become OFF.
The set value of C252 is provided by the content value of D11 and D10.
The C252~C253 at the Mode 1 are A/B phase high speed counters which should use the program to activate
then by the program or built-in reset input to clear.

X20 When the X21 is ON and the X7 (designated start-up input of C255) is
RST C255 ON, the C255 is activated to receive the counting signals from X3 and X4.
X21 K-200 When X3 is ON and X4 changes from OFF to ON, the present value of
C255 C255 increases by 1.
When X3 is ON and X4 changes from ON to OFF, the present value of
C255 decreases by 1.
When the X20 is ON, the RST instruction is executed. The C255's present value is reset to “0” and its output
contact becomes OFF. If the application of C255 is not demanded to reset by the program, could ignore this line.
When the X2 (designated built-in reset input of C255) is ON, the present value of C255 will be reset to “0” and its
contact will become OFF.
The C254~C255 at the Mode 1 are A/B phase high speed counters which should use the program and start-up
input to activate then by the program or built-in reset input to clear.

28
2-7-4 Precautions for Using the Software High Speed Counter
The VS series PLC is equipped with the Software High-Speed Counters (SHSC) and the Hardware High-Speed
Counters (HHSC). Since the Software High-Speed Counters operate in a way of interrupt and thus occupy
considerable CPU's capacity and influence its efficiency. In contrast, the Hardware High Speed Counters are
equipped with their own hardware circuits in charge of counting, which hardly occupy the efficacy of CPU. At the
application of high speed counter, the Hardware High-Speed Counters are recommended.
The Software High-Speed Counter comparison instructions (HSCS, HSCR, HSZ and HSCT) were to compare and
produce results immediately when the related inputs change, then the results could immediately transmit to the
specified outputs to drive the load.
Thus, using the Software High-Speed Counter comparison instruction can get the fastest comparison result.
However, because each related input changing is to be compared, that consumes the CPU time and reduces the
overall performance. Therefore, after a Software High-Speed Counter is started in the program, according to
application requirements user should appropriately make a choice between the use of this counter's output or
counter's comparison instructions.
The use of software high-speed counter comparison instructions in the program has the following limitations:
(1) Use not more than eight instructions simultaneously among HSCS, HSCR, HSZ and HSCT instructions.
(2) The HSCT instruction can only be used once in the program.
Note that the signal source of high-speed counters should not have clutter or even switch bounce signals. They will
cause the high-speed counter to count incorrectly.
When the Software High-Speed Counter is used in the program, the filter time of correlative inputs will automatically
adjust to the high speed mode.
The output contact status of the Software High-Speed Counter is determined by the count operation of the counter
input. The state of output contact cannot be affected by to insert a new present value which is equal to the set value.

To Active the Software High-Speed Counter

The conditional contact with the program for driving a Software High-Speed Counter is not the same as to use
for an input point of a general contour.
Therefore, please do not use the pulse input point corresponding to the Software High-Speed Counter as the
conditional for driving itself in the program. Doing so will make the count error.

Ideally the special relay M9000 should be used for activation.

M9000 K100 X0 K100


C235 C235

Correct Incorrect

The Output of Software High-Speed Counter

M9000 K100
C235
C235
Y0

The Software High-Speed Counter operate by the interrupt, the counting is not dependent to the scan time.
Therefore, when the external inputs make the counter's (present value) = (set value), the output contact of the
counter will change immediately.
However, as shown in the gure above, the contact state of the C235 will be transferred to Y0 when the program
is scanned there, and the state of Y0 will be actually sent to the output when the END instruction is executed. It is
still relevant to the scan time and is not an immediate output that drives the load.
If an immediate output is desired, the specic Software High-Speed Counter comparison instructions FNC 53
(DHSCS), FNC 54 (DHSCR), FNC 55 (DHSZ) and FNC 280 (DHSCT) can be used.
Finally, using relay outputs will still cause an output delay of about 10ms. If transistor outputs are used, there will
be an output delay of less than 1 ms. (depending on the response speed of the output point). This needs to be
taken into consideration if necessary.

29
The Counting Frequency of SHSC

There are two important factors in determining the frequency of SHSC counting:
(1) Limit of hardware circuit: the reaction speed of the photo couplers at high-speed input points X0~X7 and the
filter time of input filter circuits, those are limited the maximum pulse frequency can be fed into the PLC.
According to the controller series, the pulse frequency is listed in the following table.

Series X0 X1 X2 X3 X4 X5 X6 X7
VS1 10KHz 10KHz 10KHz 10KHz 10KHz 10KHz 10KHz 10KHz
VS2 50KHz 50KHz 50KHz 50KHz 50KHz 50KHz 50KHz 50KHz
VSM 200KHz 200KHz 50KHz 200KHz 200KHz 50KHz 50KHz 50KHz
VSM-28ML 1MHz 1MHz 50KHz 1MHz 1MHz 50KHz 50KHz 50KHz
VS3 200KHz 200KHz 50KHz 200KHz 200KHz 50KHz 50KHz 50KHz

When these input points are combined for an A/B phase counter, the counting frequency is reduced to half.
(2) Limit of total interruption frequency that PLC system can accept:
The VS series PLC can accept about 200kHz of total interruption frequency.
(The sum of 1-phase counting frequencies) + (The sum of 2-phase counting frequencies) + (The sum of
A/B-phase counting frequencies) × 2
= The total of the interrupt frequencies that occur by the Software High-Speed Counter
A lot of applications need to use interrupt at the PLC, those including the software HSC, external interrupt,
frequency meter, pulse measurement, pulse output instruction, timer interrupt and so on. When considering
the total interrupt frequency, these factors should be taken into an overall assessment.

The Notice About to Reset the Software High-Speed Counter

Usually to reset the Software High-Speed Counter, we use the following program. The counter stops counting
when the RST instruction is activated in the example.

X20
RST C235

Count signal X0

3 3
Although the pulse persistent,
2 it won't count during this period. 2
Current value of C235 1 1

Reset signal X20

C235 is continuously being reset


RST C235

To avoid above situations, please use the following program.


X20
RST C235 ---- A
M9001
RST C235 ---- B

Counting signal X0

4
3 3
2 2 Because RST instruction was released,
Present value of C235 1 1
it's ready to count.

Reset signal X20

Part A enables the RST Part B releases the RST


RST C235

30
2-8 Data Register (D) and Expansion Register (R)
The characteristics of the Data Register D and the Extension Register R are identical, so hereafter referred to as a Data
Register. The data register is used to store a numerical data. The data length is 16 bits and the Most Significant Bit
represents a positive/negative sign. A register can store a content value between -32,768 and +32,767. Also, that is
possible to combine two 16-bit registers into a 32-bit one; the 16 bits with a smaller number is defined as the lower 16
bits and the larger number is the upper 16 bits. A 32-bit data register can store a content value between -2,147,483,648
and +2,147,483,647, the Most Significant Bit represents a positive/negative sign.
The data register can be distinguished by its use as follows:
(1) General Register
When the PLC turns from RUN to STOP or its power is cut out the data in the register is reset to zero. If the M9033
is ON then the PLC turns from RUN to STOP, the data will retain; however, when the power is cut out, the data will
still be cleared and become “0”.
(2) Latched Register
When the PLC's power is disconnected, the data in the Latched Register will be maintained as same as the value
stored before the event occurred.
To clear the contents in the Latched Register, could use the RST or ZRST instruction.
The main purposes of the Latched Register are to store setup data, record data and the memory of mold parameter.
When the number of Latched Register is not enough or the stored data has the demand to be transplant, should
use the expanded memory card and put the data into the card.
VS series Memory Cards
The VS series PLC provides the VS-MC and VS-MCR memory cards. After the installation of a memory card,
655,360 words of latched data storage space are available. Data can be transferred between the data register
and the memory in the card via the data bank write instruction DBWR (FNC 91) and the data bank read
instruction DBRD (FNC 90).
Since the memory card uses Flash ROM to store data, the number of writes is limited to 100,000 times. The
improper use may shorten the lifespan of the Flash ROM. Therefore, use the DBWRP to substitute the DBWR
instruction in a program to write data, that could avoid unnecessary operations and extend the lifespan of the
Flash ROM.

(3) Special Register


Each Special Register has its own specific function, the main usage is as the storage of system status, error code
or status monitoring. For details, please refer to the section 2-14 “Special Relay and Special Register”.
(4) Extension Register
When the PLC turns from RUN to STOP or its power is cut out the data in the register is reset to zero.
If the M9033 is ON then the PLC turns from RUN to STOP, the data will retain; however, when the power is cut out,
the data will still be cleared and become “0”.

The function and discrimination of registers D in the VS1, VS2, VSM and VS3 series are exactly the same:

Series General Register Latched Register Special Register Extension Register

VS1
VS2 D0~D6999 D7000~D8999 D9000~D9511 R0~R9999, Tot.= 10000 Pt.
VSM Tot.= 7000Pt. Tot.= 2000 Pt. Tot.= 512 Pt.

VS3 R0~R25999, Tot.= 26000 Pt.

31
2-9 Index Register (V and Z)
Index Register V, Z is a very special register in the VS series PLC. Its purpose is to use the index to modify the operand
in an instruction, to serve the purpose of specifying the operand indirectly and exchangeable, thereby improving the
flexibility and efficiency of program editing.
The index register provides the ability to specify the operand with flexibility when the instruction is being executed. That
providing great help in the preparation of complex control program, and can often simplify the process. Here are some
possible applications for reference:
(1) At the Subroutine. There is generally a need for a subprogram to perform the same function repeatedly for different
operands.
(2) The instruction in the program has limitation about the used number of times.
(3) When the data in bulk needs process, the source or target data can be specified by the index register.
The index register is a 16-bit register, numbered from the V0 to the V7 and from the Z0 to the Z7, 16 points in total.
V, Z registers can be paired up to form a 32-bit register. In the 32-bit application instruction, V, Z registers should be
paired up as (V0, Z0) (V1, Z1)..... (V7, Z7); in specifying the operands, only Z register needs to be assigned.
16-bit 16-bit 32-bit
In the 32 bits instructions, only the Z0
V0 Z0 V0 Z0 needs to be specified.
V1 Z1 V1 Z1

V2 Z2 V2 Z2

V3 Z3 V3 Z3

V4 Z4 V4 Z4

V5 Z5 V5 Z5

V6 Z6 V6 Z6

V7 Z7 V7 Z7
Upper 16 bits Lower 16 bits

2-9-1 Using Index Register in Basic Instruction


The Index Registers can be used to modify the operand in a basic instruction, the modifiable components are shown
below:
The set value of T: when it uses K, D or R at the OUT coil.
The set value of C: when it uses K, D or R at the OUT coil.

Here provide some examples that Index registers V, Z modify operands:


When Z0=10, X0Z0=X12 (The X is named by octal number system)
Y5Z0=Y17 (The Y is named by octal number system)
M10Z0=M20
S2Z0=S12
K100Z0=K110
D0Z0=D10

Examples of using index register in basic instructions:


X0Z0 X1Z0 As shown in the left diagram it is a self-holding circuit.
Y0Z0
When Z0 = 0, that triggers by X0, releases by X1 and has an output at Y0.
Y0Z0
When Z0 = 5, that triggers by X5, releases by X6 and has an output at Y5.

X0 D0Z0 When Z0 = V0 = 0, X0 drives the T0 timer and D0 is the set value.


T0V0
When Z0 = 1 and V0 = 2, X0 drives the T2 timer and D1 is the set value.

32
2-9-2 Using Index Register in Application Instruction
The Index Registers can be used to modify the operand in an application instruction, the modifiable components are
shown below:
Bit component: X, Y, M, S
Pointer: P, Q (P as the label name of the jump or subroutine cannot be modified)
Word component: The present value of T and C
Index register D, R
The KnX, KnY, KnM, KnS which is composed by X, Y, M, S (Kn itself can not be modified)
The UnG at the part of G (Un itself can not be modified)
Constant: K, H

When using the index register in a 32-bit application instruction, be sure to use paired V, Z registers. At this point, pay
special attention to whether there is residual value in the upper register V. To be safe, use the DMOV instruction when
placing value into the V, Z paired registers.

Here provide some examples that Index registers V, Z are used to modify operands:
① 16-bit instructions, when Z0=4, ② 32-bit instructions(will occupyV,Zregisters), when (V1, Z1)=8,
Y27Z0=Y33 (The Y is named by octal X20Z1=X30 (The X is named by octal number system)
number system) M0Z1=M8
T5Z0=T9 D0Z1=D8
D0Z0=D4 K8M40Z1=K8M48
K4M8Z0=K4M12 R10Z1=R18
U1G0Z0=U1G4

2-9-3 Demonstration Program Using Index Register


Using index register in a subrountine
X0
MOV K0 Z0 When X0=OFF, Z0=0
X0
MOV K10 Z0 When X0=ON, Z0=10
M9000
CALL ARITHMETIC Call the “ARITHMETIC” subroutine
˙˙˙˙˙˙˙˙˙˙

FEND

ARITHMETIC The pointer label of the subroutine which is named “ARITHMETIC”


M9000
ADD D0Z0 D1Z0 D3Z0
When Z0=0, operates (D0+D1)×D2→(D4,D3)
MUL D3Z0 D2Z0 D3Z0 When Z0=10, operates (D10+D11)×D12→(D14,D13)

SRET

With the following program and external wiring, you can use the coded inputs to change the value of Z0. Then, can
select one of the present values in T0~T9 and display the number in the external seven-segment display.
Inputs X20~X23 are from the thumbwheel switch,
M9000 Using thumbwheel switch
then the instruction converts these inputs to a BIN to select a Timer to display
BIN K1X20 Z0 value and sends to the Z0, thus Z0 = 0~9.

BCD T0Z0 K4Y20 Convert the present value of T0Z0


(one of the selected T0~T9) to the 2
BCD code and send to Y20~Y37,
then via the external seven-segment
display to show the value.
X23 〜 X20

Y37 〜 Y20

Display the present value


of selected Timer

33
To add up all values in D0~D9 and store the result into the D10.
M9000
RST V1 Reset the content of V1 to zero

RST D100 Reset D100 to zero, this component is to store the result
Assign to execute 10 times within the loop, that for every command between the For
FOR K10
and Next instructions.
M9000
ADD D0V1 D100 D100 The value of D0V1 is accumulated to the D100 once at each cycle.

INC V1 Add 1 to the value of V1, and point to the next value to be accumulated.

NEXT End of the FOR~NEXT loop

If you want to get the result of the sum (D0~D99) at the D100 instead in the above program, only need to change the
K10 in FOR K10 to K100.

The sprinkler system sets different opening and closing times from Sundays to Saturdays. The following example
uses the set ON time at D0~D13 and the set OFF time at D20~D33 to drive the sprinkler motor by the output Y0.
The time data of the Real-Time Clock (RTC) is compared with the setting value of the time schedule to determine the
ON / OFF of the sprinkler motor.

Hr. Min. Hr. Min.


D1 D0 Sun. D21 D20
D3 D2 Mon. D23 D22
D5 D4 Tue. D25 D24 The time data of RTC:
D9019 0(Sun.)~6(Sat.)
D7 D6 Wed. D27 D26
D9014 Minute
D9 D8 Thu. D29 D28 D9015 Hour
D11 D10 Fri. D31 D30
D13 D12 Sat. D33 D32
Set ON time Set OFF time

M9000 Double the day of a week from the RTC and put the
A D D D 9 0 1 9 D 9 0 1 9 Z 0 result to the Z0, that becomes the index for the time
comparison
D= D9014 D0Z0 SET Y0 Compare with the “Set ON time” to drive the Y0 ON.

D= D9014 D20Z0 RST Y0 Compare with the “Set OFF time” to drive the Y0 OFF.

The simple program above can achieve the requirement easily, isn't it? In fact, dealing with a large number of regular
data, the most important thing is to select an appropriate data structure (method for data storage). Then, with the
characteristics of the index register, you can compile efficient programs.

34
2-10 Mark Pointer and Branch Pointer (P)
The purpose of the Mark Pointer and Branch Pointer (P) is to specify a specific point in the program. Usually they are
used to indicate the destination of the CJ instruction, or the start position of a subroutine of the CALL instruction.
In the past, the VB series PLC only had Branch Pointer P, which indicates a specific location with indication number, but
the program's readability was disadvantageous. Therefore, the VS series PLC newly enhances the Mark Pointer indicator
function to enable programmers use illustrative text to indicate a specific address, thus greatly increases the readability.
The ID numbers of Branch Pointer P in the VS1, VS2, VSM and VS3 series are exactly the same: P0~P1023, 1024
points in total.
The Branch Pointer P63 or P255 is equal to the position of END in the program.
The Mark Pointer is made up of 16 English characters or numbers, and its use is exactly the same as the Branch
Pointer P.
A maximum of 1024 Mark or Branch Pointers P in the program can be used.
The ID number at Branch Pointer P can be modified by the V, Z Index Register; texts in a Mark Pointer cannot use the
V, Z Index Register. By the characteristics, choose the suitable one at the program.
Among the exemplary programs are the Mark Pointer (left) and Branch Pointer P (right), the left one that uses the
Mark Pointer can acquire better readability.

CALL EMERGENCY_STOP CALL P0


˙˙˙˙˙˙˙˙˙˙

˙˙˙˙˙˙˙˙˙˙
FEND FEND

EMERGENCY_STOP P0

SRET SRET

END END

An example of using Branch Pointer P and combine with Index Registers V, Z.


M9000
Read the day of a week (D9019) from the Real-Time Clock as the index
MOV D9019 Z0
value.
M9000 Call the corresponding subroutine that according to the index value. One related
CALL P0Z0 subroutine will be executed at the day in a week.
˙˙˙˙˙˙˙˙˙˙˙˙˙

FEND

P0

When Z0=0 (Sunday),do the P0 subroutine.

SRET
˙˙˙˙˙˙˙˙˙˙˙˙˙

When Z0= 1~5 (Monday to Friday), do one of the subroutine P1~P5


respectively.

P6

When Z0= 6 (Saturday), do the P6 subroutine.

SRET

35
2-11 Table Nickname and Table Code (Q)
PLC users sometimes have to set up a lot of data in order to cope with needs such as formulas, control parameters and
communication commands.
In the past, people often set up the necessary reference materials through programming.
Not only a lot of program capacity and manpower were consumed, but also the data content established mostly had
poor readability, and were difficult to change and maintenance.
In order to meet the demands, the VS series PLC has provided the “Table” as a data source form. The table is a data set
by collecting data of relevant characteristics, such as data table, MBUS communication table, LINK communication
table. Each table has its own specific type and purpose. We use the computer programming software to provide the
tables' editing interfaces, so these tables are easy to establish and manage, furthermore can significantly improve
programming efficiency. The editing method of the table will be described in the programming software.
Those tables will occupy the memory space in the PLC. When the programming software writes a project to a PLC,
tables will be written into the memory with the program together. Besides, to read a project from a PLC, the tables are
read out from the its memory with the program together. The tables are a part of the PLC project.
At the VS series PLC, every table has its own Table Nickname or Table Code Q to identify. Then, the related application
instruction can use that Table Nickname or Table Code Q to get a particular table.
Table Codes Q0~Q31 are marked with index numbers; while the Table Nicknames are composed of 16 English
characters or numerals. The Table Nicknames have better readability. The drawback is that they cannot modify by Index
Register V, Z. In contrast, Table Codes Q0 to Q31 have less readability but they are irreplaceable when used with the
Index Register V, Z.
The ID numbers of Table Code in the VS1, VS2, VSM and VS3 series are exactly the same.

The Table Nicknames are made up of 16 English characters or numbers.

A maximum of 32 Tables in the program can be used.

Among the exemplary programs are making use of the Table Nickname and Table Code, the upper one that uses the
Table Nickname can acquire better readability.

X20 When X20= ON, CP1 executes the MODBUS


MBUS INVERTER_COM_1 D100 K1 communication of which the content is based on the
communication table of “INVERTER_COM_1”
˙˙˙˙˙˙˙˙˙˙

X21 When X21= ON, CP2 executes the MODBUS


MBUS THERMOSTAT_COM_1 D200 K2 communication of which the content is based on the
communication table of “THERMOSTAT_COM_1”

X20 When X20= ON, CP1 executes the MODBUS communication of which
MBUS Q0 D100 K1
the content is based on the communication table at the Q0.
˙˙˙˙˙˙˙˙˙˙

X21 When X21= ON, CP2 executes the MODBUS communication of which
MBUS Q1 D200 K2
the content is based on the communication table at the Q1.

Example of using Table Code Q and Index Register V, Z.


X0 When X0 = OFF, the following MBUS instruction s to execute the
MOV K0 Z0 communication table at the Q0;
X0 when X0 = ON, the following MBUS instruction is to execute the
MOV K1 Z0 communication table at the Q1.
X20 CP1 executes the MODBUS communication. With the index modify
M B U S Q 0 Z 0 D 1 0 0 K 1 function, it can choose an expected table to execute the
communication.

36
2-12 Interrupt Pointer (I)
In general, the PLC executes user program in the way of sequential scanning. Even the system itself also follows a
sequence of execution (receive external inputs → process the user program → output the computed results).
However, such an ordinary operation is occasionally unable to meet the needs for quick control responses. Therefore,
the interruption function is generated which meets the required of to cut-in a processing sequence immediate.
The interrupt, as the name suggests, is to break the sequentially executed program, and then insert a program section
to be processed immediately. In the VS series PLC, every Interrupt Pointer is bound up with its interrupt subroutine to
deal with the user's requirement for the insertion of interruption.

The purpose of the Interrupt Pointer is to specify the start position of interrupt subroutine in the program.

The ID numbers of Interrupt Pointer I in the VS1, VS2, VSM and VS3 series are exactly the same:

External Interrupt Timer Interrupt Software HSC Interrupt Hardware HSC Interrupt
External Input Interrupt Pointer Inhibit Flag Interrupt Pointer Inhibit Flag Interrupt Pointer Inhibit Flag Interrupt Pointer Inhibit Flag
X0 IX0 □ M9050 IHC0
X1 IX1 □ M9051 I TA □□ M9058 IHC1
IHHC1 M9062
X2 IX2 □ M9052 IHC2
X3 IX3 □ M9053 IHC3
I TB □□ M9059 M9061
X4 IX4 □ M9054 IHC4
X5 IX5 □ M9055 IHC5
IHHC2 M9063
X6 IX6 □ M9056 I TC □□ M9060 IHC6
X7 IX7 □ M9057 IHC7
□ =P means interrupt on the rising edge When the present value
□□=01~99 means The interrupt is processed reaches to the set value, the
□ =F means interrupt on the falling edge the interval time is 1~99ms with the DHSCS instruction. interrupt can be processed.

Each interrupt pointer has an inhibitory special relay to control the interrupt, the user can avoid the interrupt by
activating the corresponding special relay.

By the characteristics, those interrupt pointers can be divided into external interrupt, timer interrupt, software
high-speed counter interrupt and hardware high-speed counter interrupt.
① External Interrupt:
The rising or falling signal from the specific input point (X0 to X7) generates an interrupt signal to interrupt the
program in execution, jump to a designated interrupt pointer (IX0 □ to IX7 □ ) and execute a corresponding
interrupt subroutine. The External Interrupt at the VS series PLC also has the delay action function.
Please refer to “2-15-1 External Interrupt” for more details.
② Timer Interrupt:
When the timer interrupt pointer (ITA □□ , ITB □□ or ITC □□ ) is written into the program, the PLC will
automatically interrupt the program execution at a given time (as defined by the □□ in the interrupt pointer).
Its procedure jumps to the appointed interrupt pointer and executes the interrupt subroutine.
Timer interrupt is mainly used to generate a repeated interrupt that could execute fixed and rapid period timing
subroutine. When a certain section is requiring an execution cycle shorter than the PLC's scan time or a fixed time
cycle, the timer interrupt is considered.
For example, the HKY (FNC71) and SEGL (FNC74) instructions can use the PLC's scan time as the scan cycle of
the instructions. However, too long or too short scan time may cause fault. In this case, a timer interrupt
subroutine can be used to perform appropriate scan operation.
Additionally, the RAMP (FNC67) instruction generally depends the scan time of the program to bring the movement
of ramp steps forward. Usually, the scan time is unregulated, thus the generated ramp result will become irregular.
In this case, a subroutine of timer interrupt can be used for the RAMP instruction to depart it from the scan time,
that may stabilize the movement of step thus to produce the regular ramp result.
③ Software High Speed Counter Interrupt:
The result of a comparison instruction by the FNC53 (DHSCS) high-speed counter can be assigned to execute an
interrupt subroutine. When the DHSCS instruction is assigned to execute a certain interrupt subroutine
(IHC0~IHC7) and the comparison result is equal, then PLC will jump to the specified interrupt pointer and execute
the interrupt subroutine. Please refer to the FNC53 (DHSCS) Instruction for more details.
④ Hardware High Speed Counter Interrupt:
When the hardware high-speed counter HHSC1 reaches its set value by the external input, the IHHC1 interrupt can
be generated; also, the HHSC2 can generate the IHHC2 interrupt. Please refer to “2-15-4 Hardware High-Speed
Counter”.

The interrupt subroutine often needs to immediately read the external state or immediately drive the external load. In
this case, the I / O update instruction REF (FNC 50) should be used in the interrupt subroutine to update the I / O
status promptly.

In the interrupt subroutine, should use the Timer T192~T199 when a timer is necessary.

37
The interruption is a special mechanism for to break the rules of regular operation; an interrupt subroutine is not
regularly implemented. Therefore, special attention must be paid to the components that are driven in the interrupt
subroutine.
If a step relay is for to active a part of the SFC, it is not allowed to be driven in an interrupt subroutine.
The following example shows that the elements driven in the interrupt subroutine remain in their state.
X20 K100
C0 X0 interrupt signal

FEND X20 count signal

IX0P C0 cannot count accurately


2
M9000 C0 present value 1
RST C0
C0 is continuously being reset
RST C0
Y0
Y0 maintains ON status
Y0
IRET

The following example shows the modified program.


X20 K100
C0 X0 interrupt signal
X21
RST Y0 X20 count signal

2 2
FEND C0 present value 1 1

IX0P A RST enable B RST disable


RST C0
M9000
RST C0 A Y0
M9001
RST C0 B
X21
Y0

IRET

The applications of Interrupt Pointer and the concepts of interrupt subroutine are explained in detaile in the section of
Application Instructions IRET, EI and DI.

38
2-13 Numerical System
(1) Binary Number (BIN)
The value in PLC is operated and stored used the binary system. The binary number and relative
terminology are given as follows:
Bit: the basic of the binary number, each value of a Bit must be either “0” or “1”.

Nibble: composed of 4 sequential bits.


For example, b3 ~ b0 can express an one-Nibble hex value: 0 ~ F.
Byte: composed of 8 sequential bits.
For example, b7 ~ b0 can express a two-Nibble hex value: 00 ~ FF.

Word: composed of 2 sequential bytes or 16 sequential bits.


For example, b15 ~ b0 can express a four-Nibble hex value: 0000 ~ FFFF.

Double Word: composed of 2 sequential words, 4 sequential bytes or 32 sequential bits.


For example, b31 ~ b0 can express an eight-Nibble hex value: 00000000 ~ FFFFFFFF.

The relations between every binary Bit, Nibble, Byte, Word and Double Word:
DW Double Word
W1 W0 Word
BY3 BY2 BY1 BY0 Byte
NB7 NB6 NB5 NB4 NB3 NB2 NB1 NB0 Nibble
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16 b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 Bit

Expression of the value


For Word (16 bits) or Double Word (32 bits), the Most Significant Bit (MSB), e.g. The b15 of a
Word or the b31 of a Double Word, gives the value positive or negative bias, where “0” for
positive and “1” for negative. The rest bits, e.g. b14~b0 or b30 ~ b0, express the value size.
It is a 16-bit value shows below.
16384
8192
4096
2048
1024

0: positive bias
512
256
128
64
32
16
8
4
2
1

32767 7FFFH
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
(Decimal system) (Hexadecimal system)
b15 b0
16384+8192+4096+2048+1024+512+256+128+64+32+16+8+4+2+1=32767

1: Negative bias

–5 FFFBH
1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1
(Decimal system) (Hexadecimal system)
b15 b0

1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 2's complement
b14 b0
invert each bit (0 → 1; 1 → 0)

0 0 0 0 0 0 0 0 0 0 0 0 1 0 0

+1
16384
8192
4096
2048
1024
512
256
128
64
32
16
8
4
2
1

0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
4+1=5

⑧ Range of the value


The maximum range of the value expressed by 16 bits and 32 bits:

16 bits - 3 2 , 7 6 8〜3 2 , 7 6 7

32 bits -2,147,483,648~2,147,483,647

39
(2) Octal Number (OCT)
The assigned numbers of PLC’s external input and output terminals are displayed by the octal system.
For example,
The external input ports: X0 ~ X7, X10 ~ X17
The external output ports: Y0 ~ Y7, Y10 ~ Y17
(3) Decimal Number (DEC)
Decimal Number is the value system which people are familiar with. In PLC, a decimal number is always headed
with a “K” in front of the value. For example, K123 indicates a decimal number where the value is 123.
Application occasions of Decimal Number:
Used as the set value of the T and C, for example, K10
Used as the component number of the M, S, T or C, for example, M9, S10, etc.
Used as an Operand device in the applied instruction, for example, MOV K1 D1.
(4) Binary Code Decimal (BCD)
BCD is to express a Decimal digit unit with a Nibble or 4 bits. Sequential 16 bits can express 4 Decimal digits. BCD
is mainly used to read the input value of the Digital Switch (Thumbwheel input) or export the data to the
7-Segment Displayer for displaying the value.
(5) Hexadecimal Number (HEX)
In PLC, a Hex number is always headed with an “H”, for example, H123 represents a Hex number and is valued 123.
(6) Bits of the numerical system and the numerical conversion table:

OCT DEC HEX BIN BCD

0 0 00 0000 0000 0000 0000


1 1 01 0000 0001 0000 0001
2 2 02 0000 0010 0000 0010
3 3 03 0000 0011 0000 0011
4 4 04 0000 0100 0000 0100
5 5 05 0000 0101 0000 0101
6 6 06 0000 0110 0000 0110
7 7 07 0000 0111 0000 0111
10 8 08 0000 1000 0000 1000
11 9 09 0000 1001 0000 1001
12 10 0A 0000 1010 0001 0000
13 11 0B 0000 1011 0001 0001
14 12 0C 0000 1100 0001 0010
15 13 0D 0000 1101 0001 0011
16 14 0E 0000 1110 0001 0100
17 15 0F 0000 1111 0001 0101
20 16 10 0001 0000 0001 0110
..........

..........

..........

..........

..........

143 99 63 0110 0011 1001 1001

40
(7) Floating Point (Real number)
The PLC was provided with Floating Point instructions therefore the PLC can calculate decimal numbers.
The decimal numbers are storage and calculated in a PLC using two different pattern formats: Binary Floating Point
Number and Decimal Floating Point Number. The expositions are showed below.
Binary Floating Point Number
Inside of the PLC, the Floating Point calculates and decimal number storages are using Binary Floating Point
Numbers. A Binary Floating Point Number's value storage format is composed of 2 sequential registers. It is
an example, using (D1,D0) to explain a format of a Binary Floating Point Number.
D1( b15〜 b0) D0( b15〜 b0)

2 7
2 6
2 1
2 0
2 -1
2 -2
2 -7
2 -8
2 -9 2 -22 2 -23
S E7 E6 E1 E0 A22 A21 A16 A15 A14 A1 A0 (D1,D0)
b31 b30 b29 b24 b23 b22 b21 b16 b15 b14 b1 b0
Exponent Mantissa
(8 bits) (23 bits)
Mantissa Sing bit (1=Negative, 0=Positive)
Binary Floating Point Number's value
7 6 1 0
=±(20+A22×2-1+A21×2-2+.....+A1×2-22+A0×2-23)×2(E7×2 +E6×2 +.....+E1×2 +E0×2 )/2127

If S=0, A22=1, A21=1, A20~A0=0


E7=1, E6~E0=0
Therefor, the Binary Floating Point Number's value storage in the register (D1,D0) is equal to
7 6 0
(20+1×2-1+1×2-2+.....+0×2-23)×2(1×2 +0×2 +.....+0×2 )/2127
=1.75×2128/2127 =1.75×21
A Binary Floating Point Number’s value limit:
−1.0 × 2128 ~ −1.0 × 2-126, 0, 1.0 × 2-126 ~ 1.0 × 2128
Minimum modulus: 1.175×10-38 Maximum modulus: 3.402×1038
In the PLC program, the real constant value is usually preceded by the “E”. The effective range of real
constants is -3.402×1038 ~ 3.402×1038, which can be expressed by the decimal point or exponent.
By the decimal point: Directly use decimal point to express the value, for example, “E102.35” represents
“102.35”.
By the exponent: Use the mathematical exponent to express, for example, “E1.0235+2” represents “102.35”;
“+2” means to multiply by 10+2.

Decimal Floating Point Number


A Decimal Floating Point Number’s value storage format is also composed of 2 sequential registers. It is an
example, using (D3,D2) to explain a format of a Decimal Floating Point Number.

D3 D2

(D3,D2)
b15 b14 b13 b2 b1 b0 b15 b14 b13 b2 b1 b0

Exponent Mantissa
(16 bits) (16 bits)
Exponent Sing bit Mantissa Sing bit
(1=Negative, 0=Positive) MSB (1=Negative, 0=Positive) MSB
Decimal Floating Point Number’s value= (Mantissa) ×10(Exponent)
Mantissa =±(1000 ~ 9999) Exponent= -41 ~ +35

If D2=1234, D3=-1
Therefor, the Decimal Floating Point Number’s value storage in the register (D3,D2) is equal to
1234×10-1 =123.4
A Decimal Floating Point Number’s value limit:
Minimum modulus: 1175×10-41 Maximum modulus: 3402×1035
The Binary Floating Point Number and Decimal Floating Point Number can use the instructions to convert the
value:
FNC118 ( D EBCD ): To convert from a Binary Floating Point Number to a Decimal Floating Point Number.
FNC119 ( D EBIN ): To convert from a Decimal Floating Point Number to a Binary Floating Point Number.

41
2-14 Special Relay and Special Register
In the tables below, the symbol “ ■ ” represents that the component is not allowed to use an instruction in the program to
drive the relay or write data to the register. And if the special relay or the special register is not listed in this table, which
is reserved for the system and can not be used to drive the relay or write the data to the program either.

2-14-1 Table of Special Relay


Relay ID Description Series
No.
PLC Operation Status VS1 VS2 VSM VS3
■ M9000 An always “ON”, “a” Contact, M9000 is “ON” during the running PLC. ○ ○ ○ ○

■ M9001 An always “OFF”, “a” Contact, M9001 is “OFF” during the running PLC. ○ ○ ○ ○

■ M9002
Initial Pulse, “a” Contact, M9002 will be “ON” for a Scan Time when the moment PLC is ○ ○ ○ ○
STOP → RUN.
■ M9003
Initial Pulse, “b” Contact, M9003 will be “OFF” for a Scan Time when the moment PLC is ○ ○ ○ ○
STOP → RUN.
■ M9004 Error occurred. When either one of the error ag relay M9066, M9067 is “ON”, M9004=“ON” . ○ ○ ○ ○

Clock Pulse or RTC VS1 VS2 VSM VS3


■ M9011 Alternate pulse by the period of 10ms cycle time. “ON” 5ms/“OFF” 5ms Pulse ○ ○ ○ ○

■ M9012 Alternate pulse by the period of 100ms cycle time. “ON” 50ms/“OFF” 50ms Pulse ○ ○ ○ ○

■ M9013 Alternate pulse by the period of 1sec. cycle time. “ON” 0.5sec./“OFF” 0.5sec. Pulse ○ ○ ○ ○

■ M9014 Alternate pulse by the period of 1min. cycle time. “ON” 30sec./“OFF” 30sec. Pulse ○ ○ ○ ○

M9015 Pause the RTC and write the values in D9013~D9019 to the RTC ○ ○ ○ ○

M9016 Stop reading time data from the RTC ○ ○ ○ ○

M9017 Modify RTC ±30sec. ○ ○ ○ ○

■ M9018 M9018=“ON” when RTC is installed in the Main Unit. ○ ○ ○ ○

■ M9019 Write wrong data onto the RTC ○ ○ ○ ○

Flag VS1 VS2 VSM VS3


■ M9020 Zero Flag. M9020=“ON” if the result of an arithmetic instruction is “0”. (except the MUL and DIV) ○ ○ ○ ○

■ M9021 Borrow Flag. M9021=“ON” if any “Borrow” occurs by the addition or subtraction instruction. ○ ○ ○ ○

M9022 Carry Flag. M9022=“ON” if any “Carry” occurs by the arithmetic, rotary.... instruction. ○ ○ ○ ○

■ M9023 Zero Flag. M90023= “ON” if the result of multiplication (MUL) or division (DIV) is “0”. ○ ○ ○ ○

■ M9025 Overow Flag. M90025= “ON” if the result of division (DIV) is overowed. ○ ○ ○ ○

Instruction execution completed ag. M9029=“ON” when the executions of some applied
■ M9029 ○ ○ ○ ○
instructions are completed (please refer to the relevant instructions).
■ M9090 All bits “ON” ag at the result of a block data comparison BKCMP (FNC194~FNC199) instruction. ○

■ M9162 To indicate the completion of HSCT instruction. ○ ○ ○ ○

■ M9163 External Interrupt delay time set-up ag. Use this ag contact to active the interrupt delay function. ○ ○ ○ ○

PLC System Operation Mode VS1 VS2 VSM VS3


M9031 Clear the Non-Latched area memory. States and contents of devices are reset at the “END”.
All Coils Y, M, S, T, C turn “OFF” and present values of T, C, ○ ○ ○ ○
D become “0”; But, the Special M and D will not be
M9032 Clear the Latched area memory. changed.
M9033 When M9033=“ON” and RUN → STOP, the present value and statuses of T, C, D are retained. ○ ○ ○ ○

All the outputs are disable. When M9034=“ON”, all external outputs are forced to “OFF” but the Y
M9034 contacts for the program still operate normally. ○ ○ ○ ○

To x PLC's Scan Time duration. When M9039=“ON”, the PLC within a constant scan duration and
M9039 the period is allocated by the D9039. ○ ○ ○ ○

Assigning Specification of Applied Operation Instructions Mode VS1 VS2 VSM VS3
M9024 Assign the BMOV moving direction. When M9024= “OFF”, S → D; when M9024=“ON”, S ← D. ○ ○ ○ ○

Assign the RAMP operating mode. When M9026=“OFF”, a series of ramp process will be
M9026 executed; when M9026=“ON”, one trigger signal will ramp once only. ○ ○ ○ ○

M9027 Assign the PR operating mode. Please refer to PR (FNC 77) Instruction for details. ○ ○ ○ ○

To protect not to operate the FROM/TO instruction repeatedly.


M9028 When M9028 = “OFF”, disallows interrupt during FROM/TO is in operation. ○ ○ ○
When M9028 = “ON”, FROM/TO in an interrupt subroutine is ineffective.
Assign the PWM operating time base. When M9035=“OFF”, the parameters for the PWM are by
M9035 the unit of 1ms.; when M9035= “ON”, by the unit of 0.1ms. ○ ○ ○ ○

42
Relay ID Description Series
No.
Assigning Specification of Applied Operation Instructions Mode VS1 VS2 VSM VS3
Assign the BINDA operating mode.
16-bit instruction: If M9091= “OFF”, will add the end of string 0000H after the result.
M9091 If M9091=“ON”, will only convert the data without to add the end of string. ○
32-bit instruction: If M9091=“OFF”, will add the end of string 00H at the result's last upper 8 bits.
If M9091=“ON”, will add the end of string 20H at the result's last upper 8 bits.

M9160 Assign the XCH to execute the SWAP function. ○ ○ ○ ○

Assign the 8-bit or 16-bit operating mode for the related instructions. When M9161=“OFF”,
M9161 those instructions are processed by the 16-bit mode; when M9161=“ON”, are by the 8-bit mode. ○ ○ ○ ○

Assign the SORT2 instruction operating mode. When M9165=“OFF”, the sort is by ascending
M9165 order; when M9165= “ON”, by descending order. ○ ○ ○ ○

Assign the HKY instruction operating mode. When M9167=“OFF”, by the “DEC” numeric mode;
M9167 when M9167=“ON”, by the “HEX” numeric mode. ○ ○ ○ ○

Assign the SMOV instruction operating mode. When M9168=“OFF”, by the “DEC” numeric mode; ○ ○ ○ ○
M9168 when M9168=“ON”, by the “HEX” numeric mode.

Step Ladder Instruction Correlated Flags VS1 VS2 VSM VS3


M9040 To prevent the step transfer. When M9040=“ON”, the STL state transfer function is disabled. ○ ○ ○ ○

■ M9046 STL step is working. When M9047=“ON” and any relay of S0~S899=“ON” than M9046=“ON”. ○ ○ ○ ○

M9047 STL monitoring is enable. D9040~D9047 will be active only when M9047=“ON”. ○ ○ ○ ○

■ M9048
The annunciator monitoring has been enabled. When M9049=“ON” and any coil of S900~S999= ○ ○ ○ ○
“ON”, than M9048=“ON”.
M9049 Enable annunciator monitoring. D9049 will be effective only when M9049=“ON”. ○ ○ ○ ○

Interrupt Prohibit Flag VS1 VS2 VSM VS3


M9050 To prevent the external interrupt from IX0. The IX0P or IX0F is prohibited. ○ ○ ○ ○

M9051 To prevent the external interrupt from IX1. The IX1P or IX1F is prohibited. ○ ○ ○ ○

M9052 To prevent the external interrupt from IX2. The IX2P or IX2F is prohibited. ○ ○ ○ ○

M9053 To prevent the external interrupt from IX3. The IX3P or IX3F is prohibited. ○ ○ ○ ○

M9054 To prevent the external interrupt from IX4. The IX4P or IX4F is prohibited. ○ ○ ○ ○

M9055 To prevent the external interrupt from IX5. The IX5P or IX5F is prohibited. ○ ○ ○ ○

M9056 To prevent the external interrupt from IX6. The IX6P or IX6F is prohibited. ○ ○ ○ ○

M9057 To prevent the external interrupt from IX7. The IX7P or IX7F is prohibited. ○ ○ ○ ○

M9058 To prevent the timer interrupt ITA. The ITA □□ for timer interrupt is prohibited. ○ ○ ○ ○

M9059 To prevent the timer interrupt ITB. The ITB □□ for timer interrupt is prohibited. ○ ○ ○ ○

M9060 To prevent the timer interrupt ITC. The ITC □□ for timer interrupt is prohibited. ○ ○ ○ ○

M9061 To prevent the SHSCs' interrupt. Software High Speed Counter interrupts IHC0~7 are prohibited. ○ ○ ○ ○

M9062 To prevent the HHSC1's interrupt. Hardware High Speed Counter interrupt IHHC1 is prohibited. ○ ○ ○ ○

M9063 To prevent the HHSC2's interrupt. Hardware High Speed Counter interrupt IHHC2 is prohibited. ○ ○ ○ ○

Error Message VS1 VS2 VSM VS3


■ M9066 Program CHECK SUM error will cause the PLC stop, M9066=“ON” and “ERR” indicator ash (2Hz). ○ ○ ○ ○

Operation error. If operation error occurs during program execution, then M9067=“ON” but PLC
■ M9067 ○ ○ ○ ○
will keep running.
Operation error latch. When M9068=“ON” and operation error occurs, the step number where
M9068 operation error occur will be latched in D9068,D9069. ○ ○ ○ ○

Loop Counter VS1 VS2 VSM VS3


M9072 Start the 32-bit up-count loop counter 0~2,147,483,647. (unit: ms) ○ ○ ○ ○

M9099 Start the 16-bit high-speed-up-count loop counter 0~32,767. (unit: 0.1ms) ○ ○ ○ ○

Pulse Measurement VS1 VS2 VSM VS3


Pulse measurement setting-up ag. Use this ag contact to active the pulse width / period
■ M9075 ○ ○ ○ ○
measurement function at the X0, X1, X3 or X4.
M9076 To start the X0 for pulse measurement. ○ ○ ○ ○

M9077 To start the X1 for pulse measurement. ○ ○ ○ ○

M9078 To start the X3 for pulse measurement. ○ ○ ○ ○

M9079 To start the X4 for pulse measurement. ○ ○ ○ ○

To set the mode of X0's pulse measurement. “OFF”: pulse width measurement,
M9080 “ON”: pulse period measurement ○ ○ ○ ○

43
Relay ID Description Series
No.
Pulse Measurement VS1 VS2 VSM VS3
To set the mode of X1's pulse measurement. “OFF”: pulse width measurement,
M9081 “ON”: pulse period measurement ○ ○ ○ ○

To set the mode of X3's pulse measurement. “OFF”: pulse width measurement,
M9082 “ON”: pulse period measurement ○ ○ ○ ○

To set the mode of X4's pulse measurement. “OFF”: pulse width measurement,
M9083 “ON”: pulse period measurement ○ ○ ○ ○

CP1 Communication VS1 VS2 VSM VS3


M9100 CP1 RS instruction data sending out request ag. ○ ○ ○ ○

M9101 CP1 RS instruction data receive completed ag. ○ ○ ○ ○

M9102 CP1 RS instruction data receive time-out ag. ○ ○ ○ ○

M9103 CP1 RS / LINK / MBUS instruction on communication abnormal ag. ○ ○ ○ ○

■ M9104 CP1 LINK / MBUS instruction on execution table complete once ag. ○ ○ ○ ○

CP2 Communication VS1 VS2 VSM VS3


M9110 CP2 RS instruction data sending out request ag. ○ ○ ○ ○

M9111 CP2 RS instruction data receive completed ag. ○ ○ ○ ○

M9112 CP2 RS instruction data receive time-out ag. ○ ○ ○ ○

M9113 CP2 RS / LINK / MBUS instruction on communication abnormal ag. ○ ○ ○ ○

■ M9114 CP2 LINK / MBUS instruction on execution table complete once ag. ○ ○ ○ ○

CP3 Communication VS1 VS2 VSM VS3


M9120 CP3 RS instruction data sending out request ag. ○ ○ ○

M9121 CP3 RS instruction data receive completed ag. ○ ○ ○

M9122 CP3 RS instruction data receive time-out ag. ○ ○ ○

M9123 CP3 RS / LINK / MBUS instruction on communication abnormal ag. ○ ○ ○

■ M9124 CP3 LINK / MBUS instruction on execution table complete once ag. ○ ○ ○

CP4 Communication VS1 VS2 VSM VS3


M9130 CP4 RS instruction data sending out request ag. ○

M9131 CP4 RS instruction data receive completed ag. ○

M9132 CP4 RS instruction data receive time-out ag. ○

M9133 CP4 RS / LINK / MBUS instruction on communication abnormal ag. ○

■ M9134 CP4 LINK / MBUS instruction on execution table complete once ag. ○

CP5 Communication VS1 VS2 VSM VS3


M9140 CP5 RS instruction data sending out request ag. ○

M9141 CP5 RS instruction data receive completed ag. ○

M9142 CP5 RS instruction data receive time-out ag. ○

M9143 CP5 RS / LINK / MBUS instruction on communication abnormal ag. ○

■ M9144 CP5 LINK / MBUS instruction on execution table complete once ag. ○

Input Pulse Capture Flag VS1 VS2 VSM VS3


M9170 X0 input signal captured ag. ○ ○ ○ ○

M9171 X1 input signal captured ag. ○ ○ ○ ○

M9172 X2 input signal captured ag. ○ ○ ○ ○

M9173 X3 input signal captured ag. ○ ○ ○ ○

M9174 X4 input signal captured ag. ○ ○ ○ ○

M9175 X5 input signal captured ag. ○ ○ ○ ○

M9176 X6 input signal captured ag. ○ ○ ○ ○

M9177 X7 input signal captured ag. ○ ○ ○ ○

Hardware High Speed Counter VS1 VS2 VSM VS3


■ M9196 HHSC1's counting direction ag. When M9196=“OFF”, up counting; when “ON”, down counting. ○ ○ ○ ○

■ M9197 HHSC2's counting direction ag. When M9197=“OFF”, up counting; when “ON”, down counting. ○ ○ ○ ○

44
Relay ID Description Series
No.
The 32-bit Counter Count Direction Control VS1 VS2 VSM VS3
M9200 When M92 □□ =“OFF”, the C2 □□ is operated as a up counter.

○ ○ ○ ○
M9234 When M92 □□ =“ON”, the C2 □□ is operated as a down counter.
Controlling Flag of Software High Speed Counter Count Direction VS1 VS2 VSM VS3
M9235 When M92 □□ =“OFF”, the C2 □□ is operated as a up counter.

○ ○ ○ ○
M9245 When M92 □□ =“ON”, the C2 □□ is operated as a down counter.
Monitoring Flag of Software High Speed Counter Count Direction VS1 VS2 VSM VS3
■M9246 When C2 □□ is operated a up count, M92 □□ =“OFF”.

○ ○ ○ ○
■M9255 When C2 □□ is operated a down count, M92 □□ =“ON”.
Working Area of the EC1 Expansion Card VS1 VS2 VSM VS3
M9260 EC1 Expansion Card's working area. M9260~M9267= EC1X0~EC1X7;

○ ○ ○ ○
M9279 M9270~M9277=EC1Y0~EC1Y7.
Working Area of the EC2 Expansion Card VS1 VS2 VSM VS3
M9280 EC2 Expansion Card's working area. M9280~M9287= EC2X0~EC2X7;

○ ○ ○ ○
M9299 M9290~M9297=EC2Y0~EC2Y7.
Working Area of the EC3 Expansion Card VS1 VS2 VSM VS3
M9300 EC3 Expansion Card's working area. M9300~M9307= EC3X0~EC3X7;

○ ○ ○ ○
M9319 M9310~M9317=EC3Y0~EC3Y7.
DUTY Instruction Output VS1 VS2 VSM VS3
M9330 Destination #1 for the timing sequence pulse generative instruction DUTY (FNC186). ○

M9331 Destination #2 for the timing sequence pulse generative instruction DUTY (FNC186). ○

M9332 Destination #3 for the timing sequence pulse generative instruction DUTY (FNC186). ○

M9333 Destination #4 for the timing sequence pulse generative instruction DUTY (FNC186). ○

M9334 Destination #5 for the timing sequence pulse generative instruction DUTY (FNC186). ○

Y0 Axis's Positioning Control Flag VS1 VS2 VSM VS3


Y0 axis's status. “OFF” means the Y0 is in the READY status, it is available for a positioning
■ M9340 ○ ○ ○ ○
instruction; while “ON” = BUSY, the Y0 has been occupying.
■ M9341 Y0 axis's pulse output monitor. “ON” means pulse is generating. ○ ○ ○ ○

■ M9342 Y0 axis's positioning completed ag. ○ ○ ○ ○

■ M9343 Y0 axis's positioning abnormal stop ag. ○ ○ ○ ○

■ M9344 Y0 axis's zero home positioning has been completed. ○ ○ ○ ○

M9345 Y0 axis's stop ag (with gradually slow down). ○ ○ ○ ○

M9346 Y0 axis's immediately stop ag. ○ ○ ○ ○

M9347 Y0 axis's table positioning start signal. ○ ○ ○ ○

■ M9348 Y0 axis's M-code active ag. ○ ○ ○ ○

M9349 Y0 axis's M-code clear command. ○ ○ ○ ○

Y0 axis's external interrupt trigger type. When M9350= “OFF”, the interrupt is triggered by a rising
M9350 edge; when M9350= “ON”, that is triggered by a falling edge. ○ ○ ○ ○

Y1 Axis's Positioning Control Flag VS1 VS2 VSM VS3


■ M9360
Y1 axis's status. “OFF” means the Y1 is in the READY status, it is available for a positioning ○ ○ ○ ○
instruction; while “ON” = BUSY, the Y1 has been occupying.
■ M9361 Y1 axis's pulse output monitor. “ON” means pulse is generating. ○ ○ ○ ○

■ M9362 Y1 axis's positioning completed ag. ○ ○ ○ ○

■ M9363 Y1 axis's positioning abnormal stop ag. ○ ○ ○ ○

■ M9364 Y1 axis's zero home positioning has been completed. ○ ○ ○ ○

M9365 Y1 axis's stop ag (with gradually slow down). ○ ○ ○ ○

M9366 Y1 axis's immediately stop ag. ○ ○ ○ ○

M9367 Y1 axis's table positioning start signal. ○ ○ ○ ○

■ M9368 Y1 axis's M-code active ag. ○ ○ ○ ○

M9369 Y1 axis's M-code clear command. ○ ○ ○ ○

Y1 axis's external interrupt trigger type. When M9370= “OFF”, the interrupt is triggered by a rising
M9370 edge; when M9370= “ON”, that is triggered by a falling edge. ○ ○ ○ ○

45
Relay ID Description Series
No.
Y2 Axis's Positioning Control Flag VS1 VS2 VSM VS3
Y2 axis's status. “OFF” means the Y2 is in the READY status, it is available for a positioning
■ M9380 ○ ○ ○ ○
instruction; while “ON” = BUSY, the Y2 has been occupying.
■ M9381 Y2 axis's pulse output monitor. “ON” means pulse is generating. ○ ○ ○ ○

■ M9382 Y2 axis's positioning completed ag. ○ ○ ○ ○

■ M9383 Y2 axis's positioning abnormal stop ag. ○ ○ ○ ○

■ M9384 Y2 axis's zero home positioning has been completed. ○ ○ ○ ○

M9385 Y2 axis's stop ag (with gradually slow down). ○ ○ ○ ○

M9386 Y2 axis's immediately stop ag. ○ ○ ○ ○

M9387 Y2 axis's table positioning start signal. ○ ○ ○ ○

■ M9388 Y2 axis's M-code active ag. ○ ○ ○ ○

M9389 Y2 axis's M-code clear command. ○ ○ ○ ○

Y2 axis's external interrupt trigger type. When M9390=“OFF”, the interrupt is triggered by a rising
M9390 edge; when M9390= “ON”, that is triggered by a falling edge. ○ ○ ○ ○

Y3 Axis's Positioning Control Flag VS1 VS2 VSM VS3


■ M9400
Y3 axis's status. “OFF” means the Y3 is in the READY status, it is available for a positioning ○ ○ ○ ○
instruction; while “ON” = BUSY, the Y3 has been occupying.
■ M9401 Y3 axis's pulse output monitor. “ON” means pulse is generating. ○ ○ ○ ○

■ M9402 Y3 axis's positioning completed ag. ○ ○ ○ ○

■ M9403 Y3 axis's positioning abnormal stop ag. ○ ○ ○ ○

■ M9404 Y3 axis's zero home positioning has been completed. ○ ○ ○ ○

M9405 Y3 axis's stop ag (with gradually slow down). ○ ○ ○ ○

M9406 Y3 axis's immediately stop ag. ○ ○ ○ ○

M9407 Y3 axis's table positioning start signal. ○ ○ ○ ○

■ M9408 Y3 axis's M-code active ag. ○ ○ ○ ○

M9409 Y3 axis's M-code clear command. ○ ○ ○ ○

Y3 axis's external interrupt trigger type. When M9410=“OFF”, the interrupt is triggered by a rising
M9410 edge; when M9410=“ON”, that is triggered by a falling edge. ○ ○ ○ ○

46
2-14-2 Instruction Table of Special Register
Register Description
ID No. Series
PLC Operation Status VS1 VS2 VSM VS3
D9000 Time Setting of Watch Dog Timer. The WDT default value is 200ms (unit: 1ms) ○ ○ ○ ○

■ D9004
Error code. When M9004= “ON”, this content value will show an error report. Please refer to the ○ ○ ○ ○
“2-14-3 Error Code Description” for more detail.
D9010 Current operation scan time (unit: 0.1ms) ○ ○ ○ ○

D9011 Min. scan time (unit: 0.1ms) ○ ○ ○ ○

D9012 Max. scan time (unit: 0.1ms) ○ ○ ○ ○

System Status VS1 VS2 VSM VS3


VS1 Series:10
VS2 Series:11 1 0 1 0 0
■ D9001 ○ ○ ○ ○
The PLC’s model and version. VSM Series:12 Version: V1.00
VS3 Series:13
VSM-28ML Series:14
■ D9002 Capacity size of memory. “16” = 16K words, “32” = 32K words, “64” = 64K words. ○ ○ ○ ○

Type of Memory. 00H indicates using the built-in Flash Memory of PLC. 10H indicates using the
■ D9003 ○ ○ ○ ○
extend Flash Memory Card.
Input points (X0~X7) lter response time setting. (unit: 1ms) The default value is 10ms and the
D9020 available range is 0~60ms. ○ ○ ○ ○

D9039 To set the xed period of the PLC's Scan Time. The default value is 0ms (unit: 1ms). ○ ○ ○ ○

Time Data of Real Time Clock (RTC) VS1 VS2 VSM VS3
D9013 Seconds value. (0~59) ○ ○ ○ ○

D9014 Minute value. (0~59) ○ ○ ○ ○

D9015 Hour value. (0~23) ○ ○ ○ ○

D9016 Date value. (1~31) ○ ○ ○ ○

D9017 Month value. (1~12) ○ ○ ○ ○

D9018 Year value. (2000~20YY, 4 digits) ○ ○ ○ ○

D9019 Day of week. 0 (Sun.) ~ 6 (Sat.) ○ ○ ○ ○

VS-3AV-EC Voltage I/O Brief Expansion Card VS1 VS2 VSM VS3
■ D9030 The AD converted value of VI1 at the VS-3AV-EC, 0~10V = 0~4000 ○ ○ ○ ○

■ D9031 The AD converted value of VI2 at the VS-3AV-EC, 0~10V = 0~4000 ○ ○ ○ ○

D9032 The DA digital input value for the VO at the VS-3AV-EC, 0~1000 = 0~10V ○ ○ ○ ○

Step Ladder Instruction Correlated VS1 VS2 VSM VS3


■ D9040 1st active STL step
■ D9041 2nd active STL step
■ D9042 3rd active STL step
■ D9043 4th active STL step When M9047= “ON”, the active STL step ID numbers will be stored in
D9040~D9047, where the D9040 will store the lowest active ID number, ○ ○ ○ ○
■ D9044 th
5 active STL step the second lowest one will store in the D9041, and so forth.
■ D9045 6th active STL step
■ D9046 7th active STL step
■ D9047 8th active STL step
■ D9049 When M9049=“ON”, it stores the lowest currently active Annunciator in D9049. ○ ○ ○ ○

Error Message VS1 VS2 VSM VS3


■ D9067 Error code to identify the operation error. ○ ○ ○ ○

D9068 Lower 16 bits


Latched the step address number of the operation error. ○ ○ ○ ○
D9069 Upper 16 bits
D9070 Lower 16 bits
Step address number of the operation error. ○ ○ ○ ○
D9071 Upper 16 bits
Loop Counter VS1 VS2 VSM VS3
D9072 Lower 16 bits The present value of 32-bit up-count loop counter
○ ○ ○ ○
D9073 Upper 16 bits 0~2,147,483,647. (unit: ms)

D9099 The present value of 16-bit high-speed-up-count loop counter 0~32,767. (unit: 0.1ms) ○ ○ ○ ○

47
Register Description
ID No. Series
Pulse Measurement VS1 VS2 VSM VS3
D9074 Lower 16 bits The X0's rising edge to catch the present value of loop counter.
○ ○ ○ ○
D9075 Upper 16 bits (unit: 1/6 µs)

D9076 Lower 16 bits The X0's falling edge to catch the present value of loop counter.
○ ○ ○ ○
D9077 Upper 16 bits (unit: 1/6 µs)

D9078 Lower 16 bits The X0's Pulse Width/Period Measurement cached value. (unit: 10µs).
○ ○ ○ ○
D9079 Upper 16 bits The measurable range of Width: 10µs~100s, minimum Pulse Period: 20µs

D9080 Lower 16 bits The X1's rising edge to catch the present value of loop counter.
○ ○ ○ ○
D9081 Upper 16 bits (unit: 1/6 µs)

D9082 Lower 16 bits The X1's falling edge to catch the present value of loop counter.
○ ○ ○ ○
D9083 Upper 16 bits (unit: 1/6 µs)

D9084 Lower 16 bits The X4's Pulse Width/Period Measurement cached value. (unit: 10µs).
○ ○ ○ ○
D9085 Upper 16 bits The measurable range of Width: 10µs~100s, minimum Pulse Period: 20µs

D9086 Lower 16 bits The X3's rising edge to catch the present value of loop counter.
○ ○ ○ ○
D9087 Upper 16 bits (unit: 1/6 µs)

D9088 Lower 16 bits The X3's falling edge to catch the present value of loop counter.
○ ○ ○ ○
D9089 Upper 16 bits (unit: 1/6 µs)

D9090 Lower 16 bits The X4's Pulse Width/Period Measurement cached value. (unit: 10µs).
○ ○ ○ ○
D9091 Upper 16 bits The measurable range of Width: 10µs~100s, minimum Pulse Period: 20µs

D9092 Lower 16 bits The X4's rising edge to catch the present value of loop counter.
○ ○ ○ ○
D9093 Upper 16 bits (unit: 1/6 µs)

D9094 Lower 16 bits The X4's falling edge to catch the present value of loop counter.
○ ○ ○ ○
D9095 Upper 16 bits (unit: 1/6 µs)

D9096 Lower 16 bits The X4's Pulse Width/Period Measurement cached value. (unit: 10µs).
○ ○ ○ ○
D9097 Upper 16 bits The measurable range of Width: 10µs~100s, minimum Pulse Period: 20µs

CP1 Communication Port VS1 VS2 VSM VS3


D9100 The CP1's station number. ○ ○ ○ ○

■ D9101 The CP1's amount of residual data to be sent out by the instruction RS. ○ ○ ○ ○

■ D9102 The CP1's amount of the data already received by the instruction RS. ○ ○ ○ ○

CP2 Communication Port VS1 VS2 VSM VS3


D9110 The CP2's station number. ○ ○ ○ ○

■ D9111 The CP2's amount of residual data to be sent out by the instruction RS. ○ ○ ○ ○

■ D9112 The CP2's amount of the data already received by the instruction RS. ○ ○ ○ ○

CP3 Communication Port VS1 VS2 VSM VS3


D9120 The CP3's station number. ○ ○ ○

■ D9121 The CP3's amount of residual data to be sent out by the instruction RS. ○ ○ ○

■ D9122 The CP3's amount of the data already received by the instruction RS. ○ ○ ○

CP4 Communication Port VS1 VS2 VSM VS3


D9130 The CP4's station number. ○

■ D9131 The CP4's amount of residual data to be sent out by the instruction RS. ○

■ D9132 The CP4's amount of the data already received by the instruction RS. ○

CP5 Communication Port VS1 VS2 VSM VS3


D9140 The CP5's station number. ○

■ D9141 The CP5's amount of residual data to be sent out by the instruction RS. ○

■ D9142 The CP5's amount of the data already received by the instruction RS. ○

48
Register Description
ID No. Series
RND, HSCT, INT VS1 VS2 VSM VS3
D9160 Lower 16 bits Providing a number for the RND (FNC184) instruction to produce a ○ ○ ○ ○
D9161 Upper 16 bits random value. Initial value: K1
■ D9162 The number of count is activated at the table of HSCT instruction. ○ ○ ○ ○

D9163 External interrupt delay time set value ( Unit: ms). ○ ○ ○ ○

Index Register V, Z VS1 VS2 VSM VS3


D9180 Z0 Index Register ○ ○ ○ ○

D9181 V0 Index Register ○ ○ ○ ○

D9182 Z1 Index Register ○ ○ ○ ○

D9183 V1 Index Register ○ ○ ○ ○

D9184 Z2 Index Register ○ ○ ○ ○

D9185 V2 Index Register ○ ○ ○ ○

D9186 Z3 Index Register ○ ○ ○ ○

D9187 V3 Index Register ○ ○ ○ ○

D9188 Z4 Index Register ○ ○ ○ ○

D9189 V4 Index Register ○ ○ ○ ○

D9190 Z5 Index Register ○ ○ ○ ○

D9191 V5 Index Register ○ ○ ○ ○

D9192 Z6 Index Register ○ ○ ○ ○

D9193 V6 Index Register ○ ○ ○ ○

D9194 Z7 Index Register ○ ○ ○ ○

D9195 V7 Index Register ○ ○ ○ ○

Hardware High Speed Counter VS1 VS2 VSM VS3


D9224 HHSC1 counting mode selection. “0” is to disable the HHSC1; “1” ~ “6” represent different modes. ○ ○ ○ ○

D9225 HHSC2 counting mode selection. “0” is to disable the HHSC2; “1” ~ “6” represent different modes. ○ ○ ○ ○

D9226 Lower 16 bits


The present value of HHSC1. ○ ○ ○ ○
D9227 Upper 16 bits
D9228 Lower 16 bits
The present value of HHSC2. ○ ○ ○ ○
D9229 Upper 16 bits
D9230 Lower 16 bits
The set value of HHSC1. ○ ○ ○ ○
D9231 Upper 16 bits
D9232 Lower 16 bits
The set value of HHSC2. ○ ○ ○ ○
D9233 Upper 16 bits
Working Area of the EC1 Expansion Card VS1 VS2 VSM VS3
D9260
EC1 Expansion Card's working area. D9260~D9279=EC1D0~EC1D19.

○ ○ ○ ○
D9279
Working Area of the EC2 Expansion Card VS1 VS2 VSM VS3
D9280
EC2 Expansion Card's working area. D9280~D9299=EC2D0~EC2D19.

○ ○ ○ ○
D9299
Working Area of the EC3 Expansion Card VS1 VS2 VSM VS3
D9300
EC2 Expansion Card's working area. D9300~D9319=EC3D0~EC3D19.

○ ○ ○ ○
D9319
DUTY Instruction Output VS1 VS2 VSM VS3
■ D9330 Cycle counter #1 for the timing sequence pulse generative instruction DUTY (FNC186). ○

■ D9331 Cycle counter #2 for the timing sequence pulse generative instruction DUTY (FNC186). ○

■ D9332 Cycle counter #3 for the timing sequence pulse generative instruction DUTY (FNC186). ○

■ D9333 Cycle counter #4 for the timing sequence pulse generative instruction DUTY (FNC186). ○

■ D9334 Cycle counter #5 for the timing sequence pulse generative instruction DUTY (FNC186). ○

49
Register Description
ID No. Series
Y0 Axis's Positioning Control VS1 VS2 VSM VS3
D9340 Lower 16 bits The Y0's maximum speed (by user unit).
(Convert it to the real frequency that should appropriate to the PLC's range: ○ ○ ○ ○
D9341 Upper 16 bits VS1, VS2 is 1~50kHz; VSM, VS3 is 1~200kHz; VSM-28ML is 1~1MHz)
D 9 342 The Y0's bias speed (by user unit). (Convert it to the real frequency should between 0~20kHz). ○ ○ ○ ○

The Y0's acceleration time, range = 0~32,000ms.


D 9 343 If <0, then equal to 0; if >32,000, then equal to 32,000. ○ ○ ○ ○

The Y0's deceleration time, range = 0~32,000ms.


D 9 344 If <0, then equal to 0; if >32,000, then equal to 32,000. ○ ○ ○ ○

The Y0's number of PG0 input when to execute the ZRN instruction, range = 1~32,767.
D9345 If out of the range, then equal to 1. ○ ○ ○ ○

D9346 Lower 16 bits The Y0's preset value when the ZRN is nished (by user unit).
(Convert it to the number of pulse should between -2,147,483,648~ ○ ○ ○ ○
D9347 Upper 16 bits +2,147,483,647)
The Y0's pulse output speed multiple ratio, ranging from 1~30,000 = 0.1%~3,000.0%. ○ ○ ○ ○
D 9 348 If over the range, then equal to 1,000 (100.0%).

■ D 9 349 The Y0's M-code register. ○ ○ ○ ○

■ D9350 Lower 16 bits The Y0's current speed (by user unit). If used for the PLSY or PLSR
○ ○ ○ ○
■ D9351 Upper 16 bits instruction, that is the current speed by the unit of Hz.

D 9 352 Lower 16 bits The Y0's current location (by the number of pulse). The initial value is 0.
○ ○ ○ ○
D 9 353 Upper 16 bits If used for the PLSY or PLSR instruction, that is the pulse output amount.

D 9 354 Lower 16 bits The Y0's current location (present value, PV) of positioning (by user unit). ○ ○ ○ ○
D 9 355 Upper 16 bits The initial value is 0.

Y1 Axis's Positioning Control VS1 VS2 VSM VS3


D9360 Lower 16 bits The Y1's maximum speed (by user unit).
(Convert it to the real frequency that should appropriate to the PLC's range: ○ ○ ○ ○
D9361 Upper 16 bits VS1, VS2 is 1~50kHz; VSM, VS3 is 1~200kHz; VSM-28ML is 1~1MHz)

D 9 362 The Y1's bias speed (by user unit). (Convert it to the real frequency should between 0~20kHz). ○ ○ ○ ○

The Y1's acceleration time, range = 0~32,000ms.


D 9 363 If <0, then equal to 0; if >32,000, then equal to 32,000. ○ ○ ○ ○

The Y1's deceleration time, range = 0~32,000ms.


D 9 364 If <0, then equal to 0; if >32,000, then equal to 32,000. ○ ○ ○ ○

The Y1's number of PG0 input when to execute the ZRN instruction, range = 1~32,767.
D9365 If out of the range, then equal to 1. ○ ○ ○ ○

D9366 Lower 16 bits The Y1's preset value when the ZRN is nished (by user unit).
(Convert it to the number of pulse should between -2,147,483,648~ ○ ○ ○ ○
D9367 Upper 16 bits +2,147,483,647)
The Y1's pulse output speed multiple ratio, ranging from 1~30,000 = 0.1%~3,000.0%.
D 9 368 If over the range, then equal to 1,000 (100.0%). ○ ○ ○ ○

■ D 9 369 The Y1's M-code register. ○ ○ ○ ○

■ D9370 Lower 16 bits The Y0's current speed (by user unit). If used for the PLSY or PLSR
○ ○ ○ ○
■ D9371 Upper 16 bits instruction, that is the current speed by the unit of Hz.

D 9 372 Lower 16 bits The Y0's current location (by the number of pulse). The initial value is 0.
○ ○ ○ ○
D 9 373 Upper 16 bits If used for the PLSY or PLSR instruction, that is the pulse output amount.

D 9 374 Lower 16 bits The Y0's current location (present value, PV) of positioning (by user unit). ○ ○ ○ ○
D 9 375 Upper 16 bits The initial value is 0.

50
Register Description
ID No. Series
Y2 Axis's Positioning Control VS1 VS2 VSM VS3
D9380 Lower 16 bits The Y2's maximum speed (by user unit).
(Convert it to the real frequency that should appropriate to the PLC's range: ○ ○ ○ ○
D9381 Upper 16 bits VS1, VS2 is 1~50kHz; VSM, VS3 is 1~200kHz; VSM-28ML is 1~1MHz)
D 9 382 The Y2's bias speed (by user unit). (Convert it to the real frequency should between 0~20kHz). ○ ○ ○ ○

The Y2's acceleration time, range = 0~32,000ms.


D 9 383 If <0, then equal to 0; if >32,000, then equal to 32,000. ○ ○ ○ ○

The Y2's deceleration time, range = 0~32,000ms.


D 9 384 If <0, then equal to 0; if >32,000, then equal to 32,000. ○ ○ ○ ○

The Y2's number of PG0 input when to execute the ZRN instruction, range = 1~32,767.
D9385 If out of the range, then equal to 1. ○ ○ ○ ○

D9386 Lower 16 bits The Y2's preset value when the ZRN is nished (by user unit).
(Convert it to the number of pulse should between -2,147,483,648~ ○ ○ ○ ○
D9387 Upper 16 bits +2,147,483,647)
The Y2's pulse output speed multiple ratio, ranging from 1~30,000 = 0.1%~3,000.0%.
D 9 388 If over the range, then equal to 1,000 (100.0%). ○ ○ ○ ○

■ D 9 389 The Y2's M-code register. ○ ○ ○ ○

■ D9390 Lower 16 bits The Y2's current speed (by user unit). If used for the PLSY or PLSR
○ ○ ○ ○
■ D9391 Upper 16 bits instruction, that is the current speed by the unit of Hz.

D 9 392 Lower 16 bits The Y2's current location (by the number of pulse). The initial value is 0.
○ ○ ○ ○
D 9 393 Upper 16 bits If used for the PLSY or PLSR instruction, that is the pulse output amount.

D 9 394 Lower 16 bits The Y2's current location (present value, PV) of positioning (by user unit). ○ ○ ○ ○
D 9 395 Upper 16 bits The initial value is 0.

Y3 Axis's Positioning Control VS1 VS2 VSM VS3


D9400 Lower 16 bits The Y3's maximum speed (by user unit).
(Convert it to the real frequency that should appropriate to the PLC's range: ○ ○ ○ ○
D9401 Upper 16 bits VS1, VS2 is 1~50kHz; VSM, VS3 is 1~200kHz; VSM-28ML is 1~1MHz)
D 9 402 The Y3's bias speed (by user unit). (Convert it to the real frequency should between 0~20kHz). ○ ○ ○ ○

The Y3's acceleration time, range = 0~32,000ms.


D 9 403 If <0, then equal to 0; if >32,000, then equal to 32,000. ○ ○ ○ ○

The Y3's deceleration time, range = 0~32,000ms.


D 9 404 If <0, then equal to 0; if >32,000, then equal to 32,000. ○ ○ ○ ○

The Y3's number of PG0 input when to execute the ZRN instruction, range = 1~32,767.
D9405 If out of the range, then equal to 1. ○ ○ ○ ○

D9406 Lower 16 bits The Y3's preset value when the ZRN is nished (by user unit).
(Convert it to the number of pulse should between -2,147,483,648~ ○ ○ ○ ○
D9407 Upper 16 bits +2,147,483,647)
D 9 408 The Y3's pulse output speed multiple ratio, ranging from 1~30,000 = 0.1%~3,000.0%. ○ ○ ○ ○
If over the range, then equal to 1,000 (100.0%).
■ D 9 409 The Y3's M-code register. ○ ○ ○ ○

■ D9410 Lower 16 bits The Y3's current speed (by user unit). If used for the PLSY or PLSR
○ ○ ○ ○
■ D9411 Upper 16 bits instruction, that is the current speed by the unit of Hz.

D 9 412 Lower 16 bits The Y3's current location (by the number of pulse). The initial value is 0.
○ ○ ○ ○
If used for the PLSY or PLSR instruction, that is the pulse output amount.
D 9 413 Upper 16 bits
D 9 414 Lower 16 bits The Y3's current location (present value, PV) of positioning (by user unit). ○ ○ ○ ○
D 9 415 Upper 16 bits The initial value is 0.

51
2-14-3 Error Code Description
System error information (use the contents of D9004)

Error Code Error Cause Opportunity to Detect the Error PLC Status Status of the ERR Indicator
9064 PLC ID≠Project ID STOP → RUN STOP Twinkling by 1Hz
9065 PLC model is incorrect STOP → RUN STOP Twinkling by 1Hz
9066 Check Sum incorrect STOP → RUN STOP Twinkling by 1Hz
9067 Operation error During the program processing RUN OFF
6100 ROM access error Power OFF → ON STOP ON
6101 RAM access error Power OFF → ON STOP ON
6105 Watch Dog Timer exceeding During the program processing STOP Twinkling by 1Hz

Operation error information (use the contents of D9067)

Error Code Error Cause


0 Normal, no processing error
The destination pointer of the CJ or CALL instruction is not exist. Usually the pointer is modified by an incorrect index
6701 register.
6702 More than 5 Levels of the CALL instruction have been nested together.
6704 More than 5 Levels of the FOR / NEXT loop have been nested together.
6705 An incompatible device has been specified as an operand for an application instruction.
6706 Specified devices or contents at the operand has been exceeded the range for the application instruction.
6708 The source or destination for the FROM / TO instruction is not existed.
6710 The assigned parameter does not match with the application instruction.

The code below is for the PID instruction


Error Code Error Cause Effect to the Instruction
6730 The setting value of Sampling Time (Ts) is beyond the range (Ts < 1).
6732 The setting value of Input Filter constant ( α ) is beyond the range ( α < 0 or α ≥100).
6733 The setting value of Proportional Gain constant (KP) is beyond the range (KP < 1).
The PID instruction will stop
6734 The setting value of Integral Time constant (TI) is beyond the range (TI < 0) to operate
The setting value of Differential Gain constant (KD) is beyond the range (KD < 0 or
6735 KD > 100).
6736 The setting value of Derivative Time constant (TD) is beyond the range (TD < 0).
6740 The Sampling Time <= The Scan Time of PLC
The change of the measured Present Value is too large ( △ PV < –32768
6742 or △ PV > 32767).
6743 The variance of current Error Value is too large ( △ EV < –32768 or △ EV > 32767).
The PID instruction will
6744 The calculating value of Integral process exceeds –32768~32767. continue to operate
The value of Proportional Gain (KP) is too large, it cause the calculating value
6745 of proportion which exceeds the range.
6746 The calculating value of Differential process exceeds –32768~32767.
6747 The calculating result value of the PID instruction which exceeds -32768~32767.

52
2-15 The X0~X7 High Speed Input Function Description
The input points X0~X7 of the VS Series PLC have the abilities to respond to high-speed input and to execute many
high speed functions. The functions of these 8 output points are listed as follows.

External Input Point Ref.


Function Page
X0 X1 X2 X3 X4 X5 X6 X7
Common Input Use D9020 to adjust the lter time as 0~60ms. 179
Frequency Meter Use the SPD instruction to perform the speed detection function 186
Software High Speed Use C235~C255 1-phase/2-phase/AB phase counters, besides to generate IHC0~IHC7 interrupt 25
Counter
External Interrupt IX0P/ F IX1P/ F IX2P/ F IX3P/ F IX4P/ F IX5P/ F IX6P/ F IX7P/ F 54
Pulse Capture M9170 M9171 M9172 M9173 M9174 M9175 M9176 M9177 55
Hardware High Speed HHSC1, to make HHSC2, to make
the IHHC1 interrupt the IHHC2 interrupt 58
Counter
Pulse Measurement Width / Period Width / Period 56
measurement measurement
Positioning Control Can be the input points of the positioning control's DOG, PG0, INT signals or for the handwheel. 423

Common Input is available to work with an other advanced function.


When one of the X0~X7 performs a mentioned advanced function above, this input point is not reusable with another
function. However, External Interrupt could cooperate with Pulse Measurement function. (For details, please see the
specic function description.)
When a mentioned advanced function above performs, the lter time of this input point will be automatically adjusted
to 0 ms (deviates form D9020). To prevent noise interference, input points X0~X7 are also mounted with hardware RC
lters.
Thus, the lter time of 0 ms is not true 0 ms. In addition, the response time of input points X0~X7 is varied depending
on the series of VS1, VS2, VSM or VS3.
When the lter time is adjusted to 0 ms, the minimum ON or OFF signal width of each input point is listed as follows.

External Input Point


Series
X0 X1 X2 X3 X4 X5 X6 X7
VS1 50µs 50µs 50µs 50µs 50µs 50µs 50µs 50µs
VS2 10µs 10µs 10µs 10µs 10µs 10µs 10µs 10µs
VSM 2.5µs 2.5µs 10µs 2.5µs 2.5µs 10µs 10µs 10µs
VSM-28ML 0.5µs 0.5µs 10µs 0.5µs 0.5µs 10µs 10µs 10µs
VS3 2.5µs 2.5µs 10µs 2.5µs 2.5µs 10µs 10µs 10µs

When a multi-function input point is performing an advanced function, the reaction speed of the point should be very
fast. On the other hand, the consequence is relatively sensitive (higher frequency means more sensitive), which
makes the input vulnerability to noise interference. Therefore, it's necessary to pay special attention to the external
wiring. Keep away from interference sources, or even use isolation cables.

As the adjustable input lter time, speed detection and the functions of high-speed counters have been described
above, the sections below will describe the functions of external interrupt, pulse wave capture, hardware high speed
input and pulse measurement.

53
2-15-1 External Interrupt
The VS Series PLC has 8 external interrupt input points X0~X7. The External Interrupt function can be employed when
the external input signal that needs instant response, not to be affected by scan time or to read a narrow width pulse.
The External Interrupt signal works with its corresponding interrupt subroutine to execute an external interrupt.
The External Interrupt pointers are listed in the following table:

External Input Point Rising Edge Interrupt Pointer Falling Edge Interrupt Pointer Interrupt Prohibit Flag

X0 IX0P IX0F M9050


X1 IX1P IX1F M9051
X2 IX2P IX2F M9052
X3 IX3P IX3F M9053
X4 IX4P IX4F M9054
X5 IX5P IX5F M9055
X6 IX6P IX6F M9056
X7 IX7P IX7F M9057

※ One external input point only corresponds to one external interrupt pointer. Such as either the IX0P or IX0F can be
used in a program; either the IX1P or IX1F can be used in a program, and so forth.

Program example:
When the external input point X1 turns OFF, the IX1F interrupt subroutine is executed and Y0 is set to ON. And the
status of Y0 ON is immediately sent to the output port via the I / O refresh command REF (FNC 50).

The main program.

FEND The First End instruction. End of the main program.

IX1F The IX1F external interrupt pointer.


M9000
SET Y0 Set the Y0 ON.
The IX1F external interrupt subroutine.
Deliver the memory's status to the
R E F Y 0 K 8 outputs Y0~Y7 immediately.

IRET The end of interrupt subroutine and return.

The VS series PLC external interrupt has the function of delay interrupt. That delay time is by the unit of 1ms.
This feature allows the user to change the starting of the interrupt subroutine by the parameter adjustments, without
to change the external detector's location where the interrupt signal has occurred.
This interrupt delay time setting is by a series of particular pattern below the interrupt pointer. The pattern format of
this standard program can not be changed.

IX0P
The interrupt subroutine

M9163 Interrupt Input


MOV KXXX D9163 X0~X7
Delay time, unit: ms, The actual timing
can be assigned by a K, D or R. of the subroutine
is operated

Delay time IRET


IRET

The tables below list the special relay and register related to this function:
■ Represents that component is read only.

Relay ID No. Description


■ M9163 External Interrupt delay time set-up ag. Use this ag contact to active the interrupt delay function.

Register ID No. Description

D9163 External interrupt delay time set value ( Unit: ms).

54
2-15-2 Pulse Capture
The function of pulse capture is to get the input signal which the width of ON is narrow. If an input point X0~X7 is not to
use an input special function, its pulse capture is active automatically.
The pulse signals which X0~X7 input points capture will reect to the special relays M9170~M9177. For each captured
point, its special relay can only be cleared by using the RST instruction. And after the END instruction is executed, the
input point is able to capture the next signal.
Only one signal can be captured at a scan time. Therefore, if there is a demand for to capture more signals at a short
time, the external interrupt function can be used for this purpose.
The table below lists the special relays related to this function:

Relay ID No. Description

M9170 X0 input signal captured ag.


M9171 X1 input signal captured ag.
M9172 X2 input signal captured ag.
M9173 X3 input signal captured ag.
M9174 X4 input signal captured ag.
M9175 X5 input signal captured ag.
M9176 X6 input signal captured ag.
M9177 X7 input signal captured ag.

Program example:
During program operation, when the external input point X0 changes from OFF to ON, the M9170 is set to ON in an
interrupt manner. Subsequently, the M9170 will remain its ON status no matter the X0 changes OFF or ON.
After the X20 is turned ON to reset the M9170 to OFF, the M9170 is able to turned ON again by the next time that X0
changes from OFF to ON.

M9170 X0 Input Signal


Y0
......

M9170

X20 X20( Reset)


RST M9170

55
2-15-3 Pulse Measurement
With the pulse measurement function, the VS series PLC can measure X0, X1, X3, X4 input pulse signal's ON width or
cycle period.
The pulse measurement function uses an 1/6 µs loop counter to store the count value to the specic special registers at
the rising edge and falling edge of the input signal respectively. And then calculate the pulse width or pulse period of
the input signal according to the contents of the registers. The calculated width or cycle is stored in the corresponding
special registers in the unit of 10 µs.

The tables below list the special relays and registers related to this function:
■ Represents that component is read only.

Relay ID No. Description

■ M9075
Pulse measurement setting-up ag. Use this ag contact to active the pulse width / period measurement
function at the X0, X1, X3 or X4.
M9076 To start the X0 for pulse measurement.
M9077 To start the X1 for pulse measurement.
M9078 To start the X3 for pulse measurement.
M9079 To start the X4 for pulse measurement.
To set the mode of X0's pulse measurement. “OFF”: pulse width measurement,
M9080 “ON”: pulse period measurement
To set the mode of X1's pulse measurement. “OFF”: pulse width measurement,
M9081 “ON”: pulse period measurement
To set the mode of X3's pulse measurement. “OFF”: pulse width measurement,
M9082 “ON”: pulse period measurement
To set the mode of X4's pulse measurement. “OFF”: pulse width measurement,
M9083 “ON”: pulse period measurement

Register ID No. Description

D9074 Lower 16 bits


The X0's rising edge to catch the present value of loop counter. (unit: 1/6 µs)
D9075 Upper 16 bits
D9076 Lower 16 bits
The X0's falling edge to catch the present value of loop counter. (unit: 1/6 µs)
D9077 Upper 16 bits
D9078 Lower 16 bits The X0's Pulse Width/Period Measurement cached value. (unit: 10µs).
D9079 Upper 16 bits The measurable range of Width: 10µs~100s, minimum Pulse Period: 20µs

D9080 Lower 16 bits


The X1's rising edge to catch the present value of loop counter. (unit: 1/6 µs)
D9081 Upper 16 bits
D9082 Lower 16 bits
The X1's falling edge to catch the present value of loop counter. (unit: 1/6 µs)
D9083 Upper 16 bits
D9084 Lower 16 bits The X1's Pulse Width/Period Measurement cached value. (unit: 10µs).
D9085 Upper 16 bits The measurable range of Width: 10µs~100s, minimum Pulse Period: 20µs

D9086 Lower 16 bits


The X3's rising edge to catch the present value of loop counter. (unit: 1/6 µs)
D9087 Upper 16 bits
D9088 Lower 16 bits
The X3's falling edge to catch the present value of loop counter. (unit: 1/6 µs)
D9089 Upper 16 bits
D9090 Lower 16 bits The X3's Pulse Width/Period Measurement cached value. (unit: 10µs).
D9091 Upper 16 bits The measurable range of Width: 10µs~100s, minimum Pulse Period: 20µs

D9092 Lower 16 bits


The X4's rising edge to catch the present value of loop counter. (unit: 1/6 µs)
D9093 Upper 16 bits
D9094 Lower 16 bits
The X4's falling edge to catch the present value of loop counter. (unit: 1/6 µs)
D9095 Upper 16 bits
D9096 Lower 16 bits The X4's Pulse Width/Period Measurement cached value. (unit: 10µs).
D9097 Upper 16 bits The measurable range of Width: 10µs~100s, minimum Pulse Period: 20µs

Must use the M9075 to drive M9076~M9079 to activate the pulse measurement function at the corresponding input
point X0, X1, X3 or X4.

The pulse measurement and external interrupt functions can use an external input point at the same time.

56
Program example 1:
Pulse width measurement at the X0 input point.

X0 input signal

Measuring zone

M9075
...... M9076 Use the M9075 to drive the M9076 to activate the X0's pulse measurement function.

FEND The First End instruction. End of the main program.

IX0F The IX0F external interrupt pointer. When X0= ON → OFF, this subroutine executes once.
M9000 Since the M9080=OFF, it executes the pulse width measurement and moves the result
D M O V D 9 0 7 8 D 0 data from D9079, D9078 to D1, D0 registers.
......

IRET The end of interrupt subroutine and return.

Program example 2:
Pulse period measurement at the X1 input point.

X1 input signal

Measuring zone

M9075
M9077 Use the M9075 to drive the M9077 to activate the X1's pulse measurement function.
X20
M9081 Use the X20 to drive the M9081. If that is ON, executes the pulse period measurement function.
......

FEND The First End instruction. End of the main program.

IX1P The IX1P external interrupt pointer. When X1= OFF → ON, this subroutine executes once.
M9000 If the M9081=ON, it executes the pulse period measurement and moves the result
D M O V D 9 0 8 4 D 1 0 data from D9085, D9084 to D11, D10 registers.
......

IRET The end of interrupt subroutine and return.

This interval must ≥ one PLC's Scan Time

M9081

X1

D9085,D9084 D9085,D9084 D9085,D9084 D9085,D9084


will not be updated will be updated will not be updated will be updated

As shown in the figure above, after the period measurement mode (M9081= OFF → ON) is selected, the measured
value of the period in D9085 and D9084 will not be updated at the first rising edge until the next rising edge is
appeared.

57
2-15-4 Hardware High Speed Counter
The VS series PLC has two sets of Hardware High-Speed Counter: HHSC1 and HHSC2.
To reach the purposes of high-speed counting, the HHSC uses its hardware circuit to get high-speed pulse input.
Therefore, in the counting process, HHSC will not affect the efficiency of CPU implementation. When planning a control
system, one can make good use of HHSC function.
The HHSC is a 32-bit up/down count counter with a latched function. Also, with the function of set value comparison,
when a pulse input to make its present value and set value are equal, it starts the IHHC interrupt.
The figure below shows the configuration of HHSC:

PLC special registers and special relays (in the memory of CPU)

HHSC HHSC HHSC HHSC HHSC


mode select register present value register counting direction flag set value register interrupt prohibit flag
D9224 D9227 、D9226 M9196 D9231 、D9230 M9062
(D9225) (D9229 、D9228) (M9197) (D9233 、D9232) (M9063)

Mode Interrupt
select register prohibition
flag
Present value register

Up count
Mode select circuit

Set value register


X0
Comparator
(X3) Down
count

X1
(X4) Active

Values are equal

Hardware circuit of the HHSC

※The structures of HHSC1 and HHSC2 are identical. The upper components in the
figure indicate the corresponding components of HHSC1, and the components in Interrupt of HHSC1
brackets represent the corresponding components of HHSC2. (HHSC2)

From the figure above, HHSC possesses both CPU's memory registers and hardware circuit registers.
When executing the END instruction, the PLC system program automatically writes the HHSC's mode register, set
value register and interrupt prohibit flag to the hardware circuit. That also reads the HHSC's present value from the
hardware circuit and stores it in the CPU's present value register.
In order to meet the needs of fast and prompt process, the VS PLCs are also designed with the “Hardware high-speed
counter data move, HHCMV (FNC 189)” instruction. With the HHCMV instruction, the present value in the HHSC
hardware circuit can be read out immediately or the set value can be written to the HHSC hardware circuit.

Table of HHSC Working Modes:


HHSC Operating Mode
Input
HHSC No. Point 1-Phase 2-Phase AB-Phase ×1 AB-Phase × 2 AB-Phase × 4
1 2 3 4 5 6
X0 U U/D U A A A
HHSC1
X1 DIR D B B B
X3 U U/D U A A A
HHSC2
X4 DIR D B B B

U: Up Counter Input D: Down Counter Input A: A-Phase Counter Input B: B-Phase Counter Input
U/D: Up/Down Counter Pulse Input DIR: Up/Down Directional Selector Input

58
The operating modes of HHSC are illustrated by using the HHSC1.
Mode 1: 1-phase Up count Mode 2: 1-phase Up/Down count

DIR(X1) Up count Down count


U(X0)

U/D(X0)

HHSC1 HHSC1
Present value Present value

Mode 3: 2-phase Up/Down count Mode 4: AB-phase×1 count

The encoder is reversed here


U(X0)
A(X0)
D(X1)
B(X1)
HHSC1
Present value HHSC1
Present value

Mode 5: AB-phase×2 count Mode 6: AB-phase×4 count

The encoder is reversed here The encoder is reversed here

A(X0) A(X0)

B(X1) B(X1)

HHSC1 HHSC1
Present value Present value

The tables below list the special relays and registers related to the HHSCs:
■ Represents that component is read only.

Relay ID No. Description

M9062 To prevent the HHSC1's interrupt. Hardware High Speed Counter interrupt IHHC1 is prohibited.
M9063 To prevent the HHSC2's interrupt. Hardware High Speed Counter interrupt IHHC2 is prohibited.
■ M9196 HHSC1's counting direction ag. When M9196=“OFF”, up counting; when “ON”, down counting.
■ M9197 HHSC2's counting direction ag. When M9197=“OFF”, up counting; when “ON”, down counting.

Register ID No. Description

D9224 HHSC1 counting mode selection. “0” is to disable the HHSC1; “1” ~ “6” represent different modes.
D9225 HHSC2 counting mode selection. “0” is to disable the HHSC2; “1” ~ “6” represent different modes.
D9226 Lower 16 bits
The present value of HHSC1.
D9227 Upper 16 bits
D9228 Lower 16 bits
The present value of HHSC2.
D9229 Upper 16 bits
D9230 Lower 16 bits
The set value of HHSC1.
D9231 Upper 16 bits
D9232 Lower 16 bits
The set value of HHSC2.
D9233 Upper 16 bits

59
Program example:
This exemplary program is mainly used to describe the actual usage of the HHSC1 and HHSC2.
To use the HHSC, only need to set the counting mode at the special register, then the HHSC can start to count
obediently. When the PLC is executing the END instruction, the PLC system automatically reads the HHSC present
value from the hardware circuit, and store it in the present value register.
To get the most precise present value during the user program is in executing, can use the DHHCMV instruction to
read that from the hardware circuit immediately. When the DHHCMV instruction is executing, the PLC system rstly
reads out the HHSC hardware circuit's present value and stores it in the CPU's present value register, then transports
this value to the destination register of the DHHCMV instruction. Besides, to reset the present value of the HHSC
instantly, must use the DHHCMV instruction rather than use the RST instruction.
In addition, according to the quick response of the application requirement, can use its hardware comparison function
to immediately generate an interrupt, that could avoid the delay from the PLC's Scan Time.
X10
MOVP K0 D9224 The X10 is the HHSC1's start signal.
X10 When X10 is OFF, the HHSC1 is disabled.
MOVP K4 D9224 When X10 is ON, the HHSC1's counting mode is AB-Phase×1.
M9000
DHHCMV D9226 D0 Read the present value from the HHSC1 and store it to the D0.
M0
DHHCMVP K0 D9226 Set the present value of the HHSC1 to zero.
M9002 Set the HHSC1's set value to 1000.
DHHCMV K1000 D9230 When its present value = set value, the IHHC1's interrupt will occur.
X11
MOVP K0 D9225 The X11 is the HHSC2's start signal.
X11 When X11 is OFF, the HHSC2 is disabled.
MOVP K6 D9225 When X11 is ON, the HHSC2's counting mode is AB-Phase×4.
M9000
DHHCMV D9228 D2 Read the present value from the HHSC2 and store it to the D2.
M1
DHHCMVP K0 D9228 Set the present value of the HHSC2 to zero.
M9002 Set the HHSC2's set value to 2000.
DHHCMV K2000 D9232 When its present value = set value, the IHHC2's interrupt will occur.

FEND The First End instruction. End of the main program.

IHHC1 The pointer of the interrupt subroutine HHSC1.


Y0
Y0 Invert the output of the Y0.
M9000
REF Y0 K8 Output the statuses of Y0~Y7 immediately.

IRET The end of interrupt subroutine IHHC1 and return.

IHHC2 The pointer of the interrupt subroutine HHSC2.


Y1
Y1 Invert the output of the Y1.
M9000
REF Y0 K8 Output the statuses of Y0~Y7 immediately.

IRET The end of interrupt subroutine IHHC2 and return.

END End of the user program.

60
2-16 Expansion Card Related Components
The Expansion Card Sockets are designed for exible expansions, on the upper side of the VS Series PLC. Which are
available to install DIO expansion cards to increase a small number of control points in a cost effective way. Also can
install the communication port (CP) expansion card to expand communication capabilities for linking with external
accessories of communication control. In addition, the special function (SF) expansion card is capable to perform
various special controls, such as position inspection, speed control, temperature control, etc. to present a complicated,
high-level control system.
VS Series PLC Expansion Cards

Item Model Name Main Specification

VS -4XY ★ - EC DIO Expansion Card: 2 DI (DC 24V); 2 DO ★; I/O by screw-clamp terminal


VS -4X-EC DI Expansion Card: 4 DI (DC 24V); output by screw-clamp terminal
VS -4Y ★ - EC DO Expansion Card: 4 DO ★; output by screw-clamp terminal
DIO VS -8XY ★ - EC DIO Expansion Card: 4 DI (DC 24V); 4 DO ★; I/O by screw-clamp terminal
Expansion
Card VS -8X-EC DI Expansion Card: 8 DI (DC 24V); input by screw-clamp terminal
VS -8YT-EC DO Expansion Card: 8 DO (DC 24V, 300mA NPN transistor); output by screw-clamp terminal
VS -8XI-EC DI Expansion Card: 8 DI (DC 24V); input by IDC connector
VS -8YTI-EC DO Expansion Card: 8 DO (DC 24V, 100mA NPN transistor); output by IDC connector
VS-485-EC RS-485 Comm. Expansion Card: One non-isolated RS-485 port with TX / RX indicators; dist. 50m Max.
VS-485A-EC RS-485 Comm. Expansion Card: One isolated RS-485 port with TX / RX indicators; dist. 1000m Max.
VS-D485-EC RS-485 Comm. Expansion Card: Dual non-isolated RS-485 ports with TX / RX indicators; dist. 50m Max.

Comm. VS-D485A-EC RS-485 Comm. Expansion Card: Dual isolated RS-485 ports with TX / RX indicators; dist. 1000m Max.
Expansion RS-232C Communication Expansion Card: Dual non-isolated RS-232 ports with TX / RX indicators;
Card VS-D232-EC dist. 15m Max.; wiring by the RX / TX / SG terminals
RS-485 + RS-232C Communication Expansion Card: One isolated RS-485 port (1000m) &
VS-D52A-EC one non-isolated RS-232C port (15m), both with TX / RX indicators and wiring by terminals
Ethernet + RS-485 Communication Expansion Card: One Ethernet port (with additional non-isolated
VS-ENET-EC RS-485, dist. 50m) & one non-isolated RS-485 port (dist. 50m), both with TX / RX indicators
Brief Voltage I/O Card: 2 channel (0 ~ 10V, 12-bit) inputs; 1 channel (0 ~ 10V, 10-bit) output;
VS-3AV-EC with a calibrated DC 10V output; non-isolated
Analog Input Card: 4 channel (12-bit) inputs, each channel could output either –10 ~ +10V, 4 ~ 20mA or
VS-4AD-EC
–20 ~ +20mA; non-isolated
Analog Output Card: 2 channel (12-bit) outputs, each channel could input either –10 ~ +10V, 4 ~ 20mA
VS-2DA-EC or –20 ~ +20mA; non-isolated
Analog I/O Card: 2 channel (12-bit) inputs + 2 channel (12-bit) outputs, each channel could input/output
Special VS-4A-EC either –10 ~ +10V, 4 ~ 20mA or –20 ~ +20mA; non-isolated
Function
Card VS-3ISC-EC Inverter Speed Control Card: 3 channel (0.1% resolution) voltage outputs; totally isolated for each channel
Thermocouple Temperature Input Card: 2 channel (K, J, R, S, T, E, B or N type thermocouple, 0.2 ~ 0.3℃
VS-2TC-EC resolution) inputs; non-isolated
Thermocouple Temperature Input Card: 4 channel (K, J, R, S, T, E, B or N type thermocouple, 0.2 ~ 0.3℃
VS-4TC-EC resolution) inputs; non-isolated
VS-1PT-EC PT-100 Temperature Input Card: 1 channel (3-wire PT-100, 0.1℃ resolution) input; non-isolated
VS-2PT-EC PT-100 Temperature Input Card: 2 channel (3-wire PT-100, 0.1℃ resolution) inputs; non-isolated
★ Selectable output: R: 2A Relay; T: 0.3A NPN transistor
The VS Series PLCs are equipped with one to three Expansion Card Sockets depending on the model. There are
congured with 20 special relays and 20 special registers for each Expansion Card Socket as the work area of the card.
For helping memory and convenience in use, every special component of the Expansion Card at a socket is given a
corresponding “Simple Code”. Hereafter, the “Simple Code” will be used in the following documents.

Expansion Card Working Area Available Card Type for the Socket
Socket Special Component Simple Code DIO Card CP Card SF Card *
M9260 〜 M9269 EC1X0 〜 EC1X7
EC1 M9270 〜 M9279 EC1Y0 〜 EC1Y7 ○ ○ ○
D9260 〜 D9279 EC1D0 〜 EC1D19
M9280 〜 M9289 EC2X0 〜 EC2X7
EC2 M9290 〜 M9299 EC2Y0 〜 EC2Y7 ○ — ○
D9280 〜 D9299 EC2D0 〜 EC2D19
M9300 〜 M9309 EC3X0 〜 EC3X7
EC3 M9310 〜 M9319 EC3Y0 〜 EC3Y7 ○ ○ ○
(at the VS3 only)
D9300 〜 D9319 EC3D0 〜 EC3D19
* The VS-3AV-EC can ONLY be installed at the EC2 expansion socket otherwise it is ineffective. Except for the
VS-3AV-EC, the VS1 series can install one SF card only.

61
2-16-1 The DIO Expansion Card Related Components
When a DIO Expansion Card is installed in the Main Unit, those components' X/Y numbers at this card are correspond
to their Simple Codes respectively. (★ Selectable output: R: Relay; T: NPN transistor)
Simple Code at the DIO Card
Model Name of Expansion Card
Expansion Card Socket
X0 X1 X2 X3 Y0 Y1 Y2 Y3
EC1 EC1X0 EC1X1 EC1Y0 EC1Y1
VS -4XY ★ -EC EC2 EC2X0 EC2X1 EC2Y0 EC2Y1
EC3 EC3X0 EC3X1 EC3Y0 EC3Y1
EC1 EC1X0 EC1X1 EC1X2 EC1X3
VS -4X-EC EC2 EC2X0 EC2X1 EC2X2 EC2X3
EC3 EC3X0 EC3X1 EC3X2 EC3X3
EC1 EC1Y0 EC1Y1 EC1Y2 EC1Y3
VS -4Y ★ -EC EC2 EC2Y0 EC2Y1 EC2Y2 EC2Y3
EC3 EC3Y0 EC3Y1 EC3Y2 EC3Y3
EC1 EC1X0 EC1X1 EC1X2 EC1X3 EC1Y0 EC1Y1 EC1Y2 EC1Y3
VS -8XY ★ -EC EC2 EC2X0 EC2X1 EC2X2 EC2X3 EC2Y0 EC2Y1 EC2Y2 EC2Y3
EC3 EC3X0 EC3X1 EC3X2 EC3X3 EC3Y0 EC3Y1 EC3Y2 EC3Y3

Simple Code at the DIO Card


Model Name of Expansion Card
Expansion Card Socket
X0 X1 X2 X3 X4 X5 X6 X7
EC1 EC1X0 EC1X1 EC1X2 EC1X3 EC1X4 EC1X5 EC1X6 EC1X7
VS -8X-EC
EC2 EC2X0 EC2X1 EC2X2 EC2X3 EC2X4 EC2X5 EC2X6 EC2X7
VS -8XI-EC
EC3 EC3X0 EC3X1 EC3X2 EC3X3 EC3X4 EC3X5 EC3X6 EC3X7

Simple Code at the DIO Card


Model Name of Expansion Card
Expansion Card Socket
Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
EC1 EC1Y0 EC1Y1 EC1Y2 EC1Y3 EC1Y4 EC1Y5 EC1Y6 EC1Y7
VS -8YT-EC
EC2 EC2Y0 EC2Y1 EC2Y2 EC2Y3 EC2Y4 EC2Y5 EC2Y6 EC2Y7
VS -8YTI-EC
EC3 EC3Y0 EC3Y1 EC3Y2 EC3Y3 EC3Y4 EC3Y5 EC3Y6 EC3Y7

As shown on the left, a VS-8XYR-EC is installed in the


VS1-32MR D D SG TR TR VI1 VI2 S S X0 X1 X2 X3 EC3 Expansion Card Socket.
X0 1 2 3 4 5 6 7 485 3AV 8XYR
Those X0~X3 on the VS-8XYR-EC are correspond to EC3X0~EC3X3
10 11 12 13 14 15 16 17
20 21 22 23
and Y0~Y3 are correspond to EC3Y0~EC3Y3.
RX TX X0 1 2 3

PWR RUN ERR

Y0 1 2 3 4 5 6 7
Y0 1 2 3
EC3X0 Send the VS-8XYR-EC's X0 input status out via the
10 11 12 13
Y0 Y0 output point in the Main Unit.
VO
10V OUT
10V 0V C0 Y0 Y1 Y2 Y3 X0 Send the Main Unit's X0 input status out via the
EC3Y0 Y0 output point in the VS-8XYR-EC.
DC24V
INPUT

62
2-16-2 The Communication Expansion Card Related Components
At the VS1 series PLC, only one CP card can be installed at the EC1 socket. Since the VS1 series PLC has two
communication ports the built-in CP1 and the expandable CP2, thus the installed CP card is to provide the CP2.
At the VS2 or VSM series PLC, only one CP card can be installed at the EC1 socket. Also, the installed CP card is
available to provide the CP2 and CP3 if it is a dual port card. Therefore, the VS2 or VSM series PLC could have three
communication ports CP1~CP3.
At the VS3 series PLC, its EC1 can install a dual port card to provide the CP2 and CP3 and the EC3 can install a dual
port card to provide the CP4 and CP5. Thus the VS3 could have 5 communication ports CP1~CP5. However, if the
CP5 at a VS3 PLC is required, its EC2 socket may install a VS-3AV-EC card or not to use; any DIO or SF Card at EC2
will cause the CP5 at EC3 ineffective.
A communication port at CP card is not related to the working area of DIO expansion or SF card, to operate the port is
directly by the installed setting and program.
The special relays and registers related to the CP1: ( ■ means read only)
Component ID No. Description

M9100 CP1 RS instruction data sending out request ag.


M9101 CP1 RS instruction data receive completed ag.
M9102 CP1 RS instruction data receive time-out ag.
M9103 CP1 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9104 CP1 LINK / MBUS instruction on execution table complete once ag.
D9100 The CP1's station number.
■ D9101 The CP1's amount of residual data to be sent out by the instruction RS.
■ D9102 The CP1's amount of the data already received by the instruction RS.

The special relays and registers related to the CP2: ( ■ means read only)
Component ID No. Description

M9110 CP2 RS instruction data sending out request ag.


M9111 CP2 RS instruction data receive completed ag.
M9112 CP2 RS instruction data receive time-out ag.
M9113 CP2 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9114 CP2 LINK / MBUS instruction on execution table complete once ag.
D9110 The CP2's station number.
■ D9111 The CP2's amount of residual data to be sent out by the instruction RS.
■ D9112 The CP2's amount of the data already received by the instruction RS.

The special relays and registers related to the CP3: ( ■ means read only)
Component ID No. Description

M9120 CP3 RS instruction data sending out request ag.


M9121 CP3 RS instruction data receive completed ag.
M9122 CP3 RS instruction data receive time-out ag.
M9123 CP3 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9124 CP3 LINK / MBUS instruction on execution table complete once ag.
D9120 The CP3's station number.
■ D9121 The CP3's amount of residual data to be sent out by the instruction RS.
■ D9122 The CP3's amount of the data already received by the instruction RS.

The special relays and registers related to the CP4: ( ■ means read only)
Component ID No. Description

M9130 CP4 RS instruction data sending out request ag.


M9131 CP4 RS instruction data receive completed ag.
M9132 CP4 RS instruction data receive time-out ag.
M9133 CP4 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9134 CP4 LINK / MBUS instruction on execution table complete once ag.
D9130 The CP4's station number.
■ D9131 The CP4's amount of residual data to be sent out by the instruction RS.
■ D9132 The CP4's amount of the data already received by the instruction RS.

63
The special relays and registers related to the CP5: ( ■ means read only)

Component ID No. Description

M9140 CP5 RS instruction data sending out request ag.


M9141 CP5 RS instruction data receive completed ag.
M9142 CP5 RS instruction data receive time-out ag.
M9143 CP5 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9144 CP5 LINK / MBUS instruction on execution table complete once ag.
D9140 The CP5's station number.
■ D9141 The CP5's amount of residual data to be sent out by the instruction RS.
■ D9142 The CP5's amount of the data already received by the instruction RS.

64
2-16-3 The Special Function Expansion Card Related Components
For convenience, every EC1~EC3 expansion card socket at a VS series PLC will possess 20 special registers that is the
working area of the installed expansion card. When a special card is installed in the socket, the PLC can access related
data for the respective device on the card through its working area.
For easy memorize and convenient application, every special register of each Special Expansion Card is given a
“Simple Code”. The “Simple Code” will be used in the following documents.

Expansion Card Expansion Card Working Area


Socket Simple Code Special Register
EC1 EC1D0 〜 EC1D19 D9260 〜 D9279
EC2 EC2D0 〜 EC2D19 D9280 〜 D9299
EC3 EC3D0 〜 EC3D19 D9300 〜 D9319

The instruction diagram below will move the content value from the EC1D0 of special card to the register D100 of PLC.
(that card is installed at the EC1 socket)
M9000
MOV EC1D0 D100

The register D100 of the PLC


The EC1D0 of the SF card that is installed at the EC1 socket

The instruction diagram below will move the content value from the register D0 of PLC to the EC2D5 of special card.
(that card is installed at the EC2 socket)
M9000
MOV D0 EC2D5

The EC2D5 of the SF card that is installed at the EC2 socket


The register D0 of the PLC

Special Register related to the VS-3AV-EC (For this card the Simple Code EC2Dn are useless)
The VS-3AV-EC can ONLY be installed at the EC2 expansion socket otherwise it is ineffective. Also, to access this
expansion card is through 3 specific special registers below that instead of expansion card working area.
■ Represents that component is read only.

Register ID No. Description


■ D9030 The AD converted value of VI1 at the VS-3AV-EC, 0~10V = 0~4000
■ D9031 The AD converted value of VI2 at the VS-3AV-EC, 0~10V = 0~4000
D9032 The DA digital input value for the VO at the VS-3AV-EC, 0~1000 = 0~10V

EC Card Register (Simple Code) related to the VS-4AD-EC

EC1 EC2 EC3 Component Description

EC1D0 EC2D0 EC3D0 To assign the analog input modes of AI1~AI4.

EC1D1 EC2D1 EC3D1 Converted digital value of AI1, 0~4000 or 0~3200.

EC1D2 EC2D2 EC3D2 Converted digital value of AI2, 0~4000 or 0~3200.

EC1D3 EC2D3 EC3D3 Converted digital value of AI3, 0~4000 or 0~3200.

EC1D4 EC2D4 EC3D4 Converted digital value of AI4, 0~4000 or 0~3200.

EC1D18 EC2D18 EC3D18 Identication code: K101 (If code = K240, means connecting error between Main Unit and card)

EC1D19 EC2D19 EC3D19 The version number of this card. (the content value XX indicates Ver. X.X)

To appoint the modes of analog inputs: (the sliding switch should also consistent with the modes)
b15 b0 If the nibble = 0, the channel is assigned for (0~10V) voltage input.
Nibble #4 Nibble #3 Nibble #2 Nibble #1 If the nibble = 1, the channel is assigned for (4~20mA) current input.
AI4 AI3 AI2 AI1 If the nibble = 2, the channel is assigned for (0~20mA) current input.
To assign input modes: If the nibble is any number other than 0, 1 or 2, the channel is disabled.

Example: If VS- 4AD- EC is installed in EC1, and EC1D0 is set to be H3210, then
AI1: voltage input (0~10V) AI2: current input (4~20mA) AI3: current input (0~20mA) AI4: disabled

65
EC Card Register (Simple Code) Related to the VS-2DA-EC

EC1 EC2 EC3 Component Description

EC1D10 EC2D10 EC3D10 To assign the analog output modes of AO1~AO2.

EC1D11 EC2D11 EC3D11 Digital set value for AO1, 0~4000 or 0~3200.

EC1D12 EC2D12 EC3D12 Digital set value for AO2, 0~4000 or 0~3200.

EC1D18 EC2D18 EC3D18 Identication code: K102 (If code = K240, means connecting error between Main Unit and card)

EC1D19 EC2D19 EC3D19 The version number of this card. (the content value XX indicates Ver. X.X)

To appoint the modes of analog outputs:


b15 b0 If the nibble = 0, the channel is assigned for (0~10V) voltage output.
Nibble #4 Nibble #3 Nibble #2 Nibble #1 If the nibble = 1, the channel is assigned for (4~20mA) current output.
Null Null AO2 AO1 If the nibble = 2, the channel is assigned for (0~20mA) current output.
To assign If the nibble is any number other than 0, 1 or 2, the channel is disabled.
output modes:

Example: If a VS-2DA-EC is installed at the EC1, and its EC1D10 is set to be H10, then
AO1: voltage output (0~10V) AO2: current output (4~20mA)

EC Card Register (Simple Code) related to the VS-4A-EC

EC1 EC2 EC3 Component Description

EC1D0 EC2D0 EC3D0 To assign the input modes of AI1~AI2.

EC1D1 EC2D1 EC3D1 Read value of AI1, 0~4000 or 0~3200.


EC1D2 EC2D2 EC3D2 Read value of AI2, 0~4000 or 0~3200.
EC1D10 EC2D10 EC3D10 To assign the output modes of AO1~AO2.

EC1D11 EC2D11 EC3D11 Write value of AO1, 0~4000 or 0~3200.


EC1D12 EC2D12 EC3D12 Write value of AO2, 0~4000 or 0~3200.
EC1D18 EC2D18 EC3D18 Identication code: K103 (If code = K240, means connecting error between Main Unit and card)
EC1D19 EC2D19 EC3D19 The version number of this card. (the content value XX indicates Ver. X.X)

To appoint the modes of analog inputs: (the sliding switch should also consistent with the modes)
b15 b0 If the nibble = 0, the channel is assigned for (0~10V) voltage input.
Nibble #4 Nibble #3 Nibble #2 Nibble #1 If the nibble = 1, the channel is assigned for (4~20mA) current input.
Null Null AI2 AI1 If the nibble = 2, the channel is assigned for (0~20mA) current input.
To assign input modes: If the nibble is any number other than 0, 1 or 2, the channel is disabled.

Example: If a VS-4A-EC is installed at the EC1, and its EC1D0 is set to be H10, then
AI1: voltage input (0~10V) AI2: current input (4~20mA)

To appoint the modes of analog inputs:


b15 b0 If the nibble = 0, the channel is assigned for (0~10V) voltage output.
Nibble #4 Nibble #3 Nibble #2 Nibble #1 If the nibble = 1, the channel is assigned for (4~20mA) current output.
Null Null AO2 AO1 If the nibble = 2, the channel is assigned for (0~20mA) current output.
To assign output modes: If the nibble is any number other than 0, 1 or 2, the channel is disabled.

Example: If VS-4A-EC is installed in EC1, and EC1D10 is set to be H10, then


AO1: voltage output (0~10V) AO2: current output (4~20mA)

66
EC Card Register (Simple Code) Related to the VS-3ISC-EC

EC1 EC2 EC3 Component Description

EC1D0 EC2D0 EC3D0 VO set value of CH1, 0~1000 The output ratio at the VO terminal that connect to the
analog speed control point of inverter.
EC1D1 EC2D1 EC3D1 VO set value of CH2 ,0~1000 This VO set value is the percentage of 0 to “VO Max.”
If the set value <0, the output ratio = 0 (0 %).
EC1D2 EC2D2 EC3D2 VO set value of CH3 , 0~1000 If the set value >1000, the output ratio= 1000 (100.0 %).
EC1D3 EC2D3 EC3D3 V+ measured voltage value of CH1. Measure the external control use power from inverter by a
voltage meter and ll in the result value here. If the result is
EC1D4 EC2D4 EC3D4 V+ measured voltage value of CH2.
10V, then ll in 1000 (by unit of 0.01V). If the lled result is
EC1D5 EC2D5 EC3D5 V+ measured voltage value of CH3. not between 400 and 1200, then the VO point will output 0V.

EC1D6 EC2D6 EC3D6 VO Max. of CH1. Fill in the control input voltage of the maximum speed for
the inverter. If its effective range is 0~10V, then ll in 1000
EC1D7 EC2D7 EC3D7 VO Max. of CH2. (by unit of 0.01V). If the lled value is not in the range
between 0 to “V+ measured voltage”, then the VO point will
EC1D8 EC2D8 EC3D8 VO Max. of CH3. output 0V.
EC1D18 EC2D18 EC3D18 Identication code: K104 (If code = K240, means connecting error between Main Unit and card)
EC1D19 EC2D19 EC3D19 The version number of this card. (the content value XX indicates Ver. X.X)

EC Card Register (Simple Code) Related to the VS-2TC-EC

EC1 EC2 EC3 Component Description

EC1D0 EC2D0 EC3D0 To assign the thermocouple types for TC1~TC2.


EC1D1 EC2D1 EC3D1 To assign the unit of temperature measurement. 0:℃; 1:℉; other values: ℃.
EC1D2 EC2D2 EC3D2 Converted temperature value of TC1, with unit as 0.1 ℃ or 0.1 ℉.
EC1D3 EC2D3 EC3D3 Converted temperature value of TC2, with unit as 0.1 ℃ or 0.1 ℉.
EC1D6 EC2D6 EC3D6 To set the average times of TC1
Usable set value is 1~32767; other values =5.
EC1D7 EC2D7 EC3D7 To set the average times of TC2
EC1D17 EC2D17 EC3D17 Status and error ag
EC1D18 EC2D18 EC3D18 Identication code: K105 (If code = K240, means connecting error between Main Unit and card)
EC1D19 EC2D19 EC3D19 The version number of this card. (the content value XX indicates Ver. X.X)

Assign Thermocouple Type:


b15 b0
Value of Nibble 0 1 2 3 4 5 6 7 If Value of Nibble is not 0~7,
Nibble #4 Nibble #3 Nibble #2 Nibble #1
Thermocouple Type K J R S T E B N the channel is disabled.
Null Null TC2 TC1

Example: If a VS-2TC-EC is installed at the EC1, and its EC1D0 is set to be H0010, then
TC1: K Type of thermocouple input, TC2: J Type thermocouple input.

Status and Error Flag: b15~b5 b4 b3 b2 b1 b0

TC1 disconnected or converted value exceeds the range


TC2 disconnected or converted value exceeds the range
The hardware error ag of this card

67
EC Card Register (Simple Code) Related to the VS-4TC-EC

EC1 EC2 EC3 Component Description

EC1D0 EC2D0 EC3D0 To assign the thermocouple types for TC1~TC4.


EC1D1 EC2D1 EC3D1 To assign the unit of temperature measurement. 0:℃; 1:℉; other values:℃.
EC1D2 EC2D2 EC3D2 Converted temperature value of TC1, with unit as 0.1 ℃ or 0.1 ℉.
EC1D3 EC2D3 EC3D3 Converted temperature value of TC2, with unit as 0.1 ℃ or 0.1 ℉.
EC1D4 EC2D4 EC3D4 Converted temperature value of TC3, with unit as 0.1 ℃ or 0.1 ℉.
EC1D5 EC2D5 EC3D5 Converted temperature value of TC4, with unit as 0.1 ℃ or 0.1 ℉.
EC1D6 EC2D6 EC3D6 To set the average times of TC1
EC1D7 EC2D7 EC3D7 To set the average times of TC2
Usable set value is 1~32767; other values =5.
EC1D8 EC2D8 EC3D8 To set the average times of TC3
EC1D9 EC2D9 EC3D9 To set the average times of TC4
EC1D17 EC2D17 EC3D17 Status and error ag
EC1D18 EC2D18 EC3D18 Identication code: K106 (If code = K240, means connecting error between Main Unit and card)
EC1D19 EC2D19 EC3D19 The version number of this card. (the content value XX indicates Ver. X.X)

To appoint the types of thermocouples:


b15 b0
Value of Nibble 0 1 2 3 4 5 6 7 If Value of Nibble is not 0~7,
Nibble #4 Nibble #3 Nibble #2 Nibble #1
Thermocouple Type K J R S T E B N the channel is disabled.
TC4 TC3 TC2 TC1

Example: If a VS-4TC-EC is installed at the EC1, and its EC1D0 is set to be H8100, then
TC1 & TC2: K Type of thermocouple input, TC3: J Type thermocouple input, TC4: disabled

Status and Error Flag: b15~b5 b4 b3 b2 b1 b0 TC1 is disconnected or converted value exceeds the range

The hardware error ag of this card TC2 is disconnected or converted value exceeds the range
TC4 disconnected or converted TC3 is disconnected or converted value exceeds the range
value exceeds the range

EC Card Register (Simple Code) Related to the VS-1PT-EC

EC1 EC2 EC3 Component Description


To select the frequency of power noise to be ltered out. 0: 60Hz, 1: 50Hz; other values: 60H.
EC1D0 EC2D0 EC3D0 Reduce the inuence of noise from power lines. Always set the value as 1 for 50Hz AC system.
EC1D1 EC2D1 EC3D1 To assign the unit of temperature measurement. 0: ℃ ; 1: ℉ ; other values: ℃ .
EC1D2 EC2D2 EC3D2 Converted temperature value of PT1, with unit as 0.1 ℃ or 0.1 ℉ .
EC1D6 EC2D6 EC3D6 To set the average times of PT1. Usable set value is 1~32767; other values = 1.
EC1D17 EC2D17 EC3D17 Status and error ag
EC1D18 EC2D18 EC3D18 Identication code: K107 (If code = K240, means connecting error between Main Unit and card)
EC1D19 EC2D19 EC3D19 The version number of this card. (the content value XX indicates Ver. X.X)

Status and Error Flag: b15~b5 b4 b3 b2 b1 b0

TC1 is disconnected or converted value exceeds the range


The hardware error ag of this card

68
EC Card Register (Simple Code) Related to the VS-2PT-EC

EC1 EC2 EC3 Component Description


To select the frequency of power noise to be ltered out. 0: 60Hz, 1: 50Hz; other values: 60H.
EC1D0 EC2D0 EC3D0 Reduce the inuence of noise from power lines. Always set the value as 1 for 50Hz AC system.
EC1D1 EC2D1 EC3D1 To assign the unit of temperature measurement. 0: ℃ ; 1: ℉ ; other values: ℃ .
EC1D2 EC2D2 EC3D2 Converted temperature value of PT1, with unit as 0.1 ℃ or 0.1 ℉ .
EC1D3 EC2D3 EC3D3 Converted temperature value of PT2, with unit as 0.1 ℃ or 0.1 ℉ .
EC1D6 EC2D6 EC3D6 To set the average times of PT1.
Usable set value is 1~32767; other values = 1.
EC1D7 EC2D7 EC3D7 To set the average times of PT2.
EC1D17 EC2D17 EC3D17 Status and error ag.
EC1D18 EC2D18 EC3D18 Identication code: K108 (If code = K240, means connecting error between Main Unit and card)
EC1D19 EC2D19 EC3D19 The version number of this card. (the content value XX indicates Ver. X.X)

Status and Error Flag: b15~b5 b4 b3 b2 b1 b0

PT1 is disconnected or converted value exceeds the range


PT2 is disconnected or converted value exceeds the range
The hardware error ag of this card

69
2-17 Special Function Module
The VS Series PLC offers various Special Function Models, such as analog input/output and temperature input. The
following is the list of selectable special models.

Item Model Name Specifications


Analog Input Module: 4 channel (16-bit) inputs, each channel could input either –10 ~ +10V, 4 ~ 20mA
VS - 4AD or –20 ~ +20mA; isolated; with an accurate calibration DC 10V output
Analog Output Module: 2 channel (16-bit) outputs, each channel could output either –10 ~ 10V, 4 ~ 20mA or
VS - 2DA –20 ~ +20mA; isolated
Analog I/O Module: 2 channel (16-bit) inputs + 1 channel (16-bit) output, each channel could input/output
VS - 3A either –10 ~ +10V, 4 ~ 20mA or –20 ~ +20mA; isolated; with an accurate calibration DC 10V output
Special
Function Analog I/O Module: 4 channel (16-bit) inputs + 2 channel (16-bit) outputs, each channel could input/output
VS - 6A either –10 ~ +10V, 4 ~ 20mA or –20 ~ +20mA; isolated; with an accurate calibration DC 10V output
Module
Thermocouple Temperature Input Module: 4 channel thermocouple (K, J, R, S, T, E, B or N type) inputs,
VS - 4TC 0.1℃ / 0.1℉ resolution ; isolated
Thermocouple Temperature Input Module: 8 channel thermocouple (K, J, R, S, T, E, B or N type) inputs,
VS - 8TC 0.1℃ / 0.1℉ resolution ; isolated
VS - 2PT PT-100 Temperature Input Module: 2 channel (3-wire PT-100) inputs, 0.1℃ / 0.1℉ resolution ; isolated

VS - 4PT PT-100 Temperature Input Module: 4 channel (3-wire PT-100) inputs, 0.1℃ / 0.1℉ resolution ; isolated

All the Special and DIO Expansion Modules are serial connected on the right side of the Main Unit. The connecting
sequence is without reserve. The closest Special Module is designated as the 1st. Special Module. Then on its right
side, the following Special Module is the 2nd., and so on. But, the DIO Expansion Module or Power Module will not
interfere to the ranking. Please pay attention to the power consumption, appropriately add the VS-PSD power repeater
module is required as the picture below if the power is insufcient.
S S X0 X1 X2 X3 X4 X5 X6 X7 X10 X11 X12 X13 X14 X15 X16 X17 S S X0 X1 X2 X3 X4 X5 X6 X7 AI AI FG AI AI AI AI FG AI AI AI AI FG AI AI AI AI FG AI AI

INPUT X INPUT X AI1 AI2 AI3 AI4 AI1 AI2 AI3 AI4

VS2-32MT VS-16XYT VS-4AD VS-PSD VS-6A

X0 1 2 3 4 5 6 7
10 11 12 13 14 15 16 17 X0 1 2 3 4 5 6 7

PWR RUN ERR PWR PWR PWR PWR

Y0 1 2 3 4 5 6 7 Y0 1 2 3 4 5 6 7
10 11 12 13 14 15 16 17

DC24V DC24V 10V OUT DC24V DC24V 10V OUT


INPUT OUTPUT Y OUTPUT Y INPUT 60mA INPUT INPUT 60mA AO1 AO2

C0 Y0 Y1 Y2 Y3 C1 Y4 Y5 Y6 Y7 C2 Y10 Y11 Y12 Y13 C3 Y14 Y15 Y16 Y17 C0 Y0 Y1 Y2 Y3 C1 Y4 Y5 Y6 Y7 10V 0V 10V 0V V I VI V I

The 1st. The Power The 2nd.


Special Module Repeater Module Special Module

There are some Buffer Memories (BFM) built-in at every Special Function Module to store the related data.
The VS series Main Unit uses the FROM/TO instruction to read/write the data in the module's BFM thus can achieve the
purpose of data transfer across each other. The FROM instruction is used to read BFMs data from the designated
special module. The TO instruction is used to write data into the designated BFMs at the special module. For detailed
information about the FROM and TO instructions, please refer to the following pages.
Furthermore, can directly use the addressing operation to easily access the data in the special module's BFM.

Device
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D

Above is the example table of Operand devices for an instruction. The device type of UnG at the table is to indicate
the BFM at a Special Module could be used by the instruction directly. Thus, if the operand U1G3 is used in an
instruction, that means to access the data at the BFM #3 of the 1st. Special Module.
Since the Ladder Master S programming software can not get the real time status from a BFM of Special Module, it is
unavailable to monitor the data of operand at the UnG that is used in the instruction.
The program line below is to equally compare the data in the BFM #30 of the 1st. Special Module with the constant
value K201, and the comparison result is used to drive the coil of M0.
If the content value of U1G30 is equal to K201, the M0 will be turned ON. Due to the monitor mode of the Ladder
Master S that could not get the value from the U1G30, the in-line comparison symbol in the ladder diagram will not
show the ON result; but, the real output of the program line will not be affected by the display.

= U1G30 K201 M0

The program line below is to move the value H1100 into the BFM #0 of the 2nd. Special Module.
M9000
MOV H1100 U2G0

70
2-17-1 Buffer Memory BFM in the VS-4AD Module

BFM No. Component Description

#0 To assign the analog input modes of AI1~AI4. When the power is turned from OFF to ON, the default value is H0000.
#1 To set the average times of AI1.
#2 To set the average times of AI2. When the power is turned from OFF to ON, the default value is 10.
#3 To set the average times of AI3. The available range is 1~32,767, otherwise it is equivalent to 10.

#4 To set the average times of AI4.


#5 Converted digital value of AI1 (the average times is designated by BFM #1).
#6 Converted digital value of AI2 (the average times is designated by BFM #2).
#7 Converted digital value of AI3 (the average times is designated by BFM #3).
#8 Converted digital value of AI4 (the average times is designated by BFM #4).
#30 Identication code: VS-4AD = K201 (can use the FROM instruction to check whether the place is this module or not)
#31 The version number of this module. (the content value XX indicates Ver. X.X)

BFM#0 To appoint the modes of analog inputs: (the sliding switch should also consistent with the modes)
b15 BFM#0 b0 Value of Analog Input Mode
Nibble #4 Nibble #3 Nibble #2 Nibble #1 Nibble
0 Converted digital value:–32000~+32000
AI4 AI3 AI2 AI1 –10V~+10V voltage input
1 Converted digital value:–10000~+10000
To assign input modes
2 4mA~20mA current input Converted digital value:0~+16000
3 Converted digital value:–16000~+16000
–20mA~+20mA current input
4 Converted digital value:–20000~+20000
Other Disabled

Example: If the BFM #0 of a VS-4AD is set to be H5420, then


AI1: For –10V~+10V voltage input, that will be converted to the value –32,000~+32,000 at this mode.
AI2: For 4mA~20mA current input, that will be converted to the value 0~+16,000 at this mode.
AI3: For –20mA~+20mA current input, that will be converted to the value –20,000~+20,000 at this mode.
AI4: Disabled

71
2-17-2 Buffer Memory BFM in the VS-2DA Module

BFM No. Component Description

#20 To assign the analog output modes of AO1~AO2. When the power is turned from OFF to ON, the default value is H00.
#21 The digital set value of AO1.
When the power is turned from OFF to ON, the default value is 0.
#22 The digital set value of AO2.
#23 To assign the holding modes of AO1~AO2. When the power is turned from OFF to ON, the default value is H00.
#30 Identication code: VS-2DA = K202 (can use the FROM instruction to check whether the place is this module or not)
#31 The version number of this module. (the content value XX indicates Ver. X.X)

BFM#20 To appoint the modes of analog outputs:


b15 BFM#20 b0 Value of Analog Output Mode
Nibble #4 Nibble #3 Nibble #2 Nibble #1 Nibble
0 Digital set value: –32000~+32000
Null Null AO2 AO1 –10V~+10V voltage output
1 Digital set value: –10000~+10000
To assign
output modes 2 4mA~20mA current output Digital set value: 0~+32000
3 Digital set value: –32000~+32000
–20mA~+20mA current output
4 Digital set value: –20000~+20000
Other Disabled

Example: If the BFM #20 of a VS-2DA is set to be H20, then


AO1: For –10V~+10V voltage output, that will use the digital set value –32,000~+32,000 at this mode.
AO2: For 4mA~20mA current output, that will use the digital set value 0~+32,000 at this mode.

BFM#23 To appoint the output holding mode: (for the PLC status turns from RUN to STOP)
b15 BFM#23 b0 If the value in the nibble = 0, the channel will keep the last output, even PLC
Nibble #4 Nibble #3 Nibble #2 Nibble #1 is STOP.
Null Null AO2 AO1 If the value in the nibble ≠ 0, the channel will change its digital set value = 0
at STOP.

72
2-17-3 Buffer Memory BFM in the VS-3A Module

BFM No. Component Description

#0 To assign the analog input modes of AI1~AI2. When the power is turned from OFF to ON, the default value is H00.
#1 To set the average times of AI1. When the power is turned from OFF to ON, the default value is 10.
#2 To set the average times of AI2. The available range is 1~32,767, otherwise it is equivalent to 10.

#5 Converted digital value of AI1 (the average times is designated by BFM #1).
#6 Converted digital value of AI2 (the average times is designated by BFM #2).
#20 To assign the analog output mode of AO1. When the power is turned from OFF to ON, the default value is H0.
#21 The digital set value of AO1. When the power is turned from OFF to ON, the default value is 0.
#23 To assign the holding mode of AO1. When the power is turned from OFF to ON, the default value is H0.
#30 Identication code: VS-3A = K203 (can use the FROM instruction to check whether the place is this module or not)
#31 The version number of this module. (the content value XX indicates Ver. X.X)

BFM#0 To appoint the modes of analog inputs: (the sliding switch should also consistent with the modes)
b15 BFM#0 b0 Value of Analog Input Mode
Nibble #4 Nibble #3 Nibble #2 Nibble #1 Nibble
0 Converted digital value:–32000~+32000
Null Null AI2 AI1 –10V~+10V voltage input
1 Converted digital value:–10000~+10000
To assign
input modes 2 4mA~20mA current input Converted digital value:0~+16000
3 Converted digital value:–16000~+16000
–20mA~+20mA current input
4 Converted digital value:–20000~+20000
Other Disabled

Example: If the BFM #0 of a VS-3A is set to be H20, then


AI1: For –10V~+10V voltage input, that will be converted to the value –32,000~+32,000 at this mode.
AI2: For 4mA~20mA current input, that will be converted to the value 0~+16,000 at this mode.

BFM#20 To appoint the mode of analog output:


b15 BFM#20 b0 Value of Analog Output Mode
Nibble #4 Nibble #3 Nibble #2 Nibble #1 Nibble
0 Digital set value: –32000~+32000
Null Null Null AO1 –10V~+10V voltage output
1 Digital set value: –10000~+10000
2 4mA~20mA current output Digital set value: 0~+32000
3 Digital set value: –32000~+32000
–20mA~+20mA current output
4 Digital set value: –20000~+20000
Other Disabled

Example: If the BFM #20 of a VS-3A is set to be H2, then


AO1: For 4mA~20mA current output, that will use the digital set value 0~+32,000 at this mode.

BFM#23 To appoint the output holding mode: (for the PLC status turns from RUN to STOP)
b15 BFM#23 b0 If the value in the nibble = 0, the channel will keep the last output, even PLC
Nibble #4 Nibble #3 Nibble #2 Nibble #1 is STOP.
Null Null Null AO1 If the value in the nibble ≠ 0, the channel will change its digital set value = 0
at STOP.

73
2-17-4 Buffer Memory BFM in the VS-6A Module

BFM No. Component Description

#0 To assign the analog input modes of AI1~AI4. When the power is turned from OFF to ON, the default value is H0000.
#1 To set the average times of AI1.
#2 To set the average times of AI2. When the power is turned from OFF to ON, the default value is 10.
#3 To set the average times of AI3. The available range is 1~32,767, otherwise it is equivalent to 10.

#4 To set the average times of AI4.


#5 Converted digital value of AI1 (the average times is designated by BFM #1).
#6 Converted digital value of AI2 (the average times is designated by BFM #2).
#7 Converted digital value of AI3 (the average times is designated by BFM #3).
#8 Converted digital value of AI4 (the average times is designated by BFM #4).
#20 To assign the analog output modes of AO1~AO2. When the power is turned from OFF to ON, the default value is H00.
#21 The digital set value of AO1.
When the power is turned from OFF to ON, the default value is 0.
#21 The digital set value of AO2.
#23 To assign the holding modes of AO1~AO2. When the power is turned from OFF to ON, the default value is H00.
#30 Identication code: VS-6A = K204 (can use the FROM instruction to check whether the place is this module or not)
#31 The version number of this module. (the content value XX indicates Ver. X.X)

BFM#0 To appoint the modes of analog inputs: (the sliding switch should also consistent with the modes)
b15 BFM#0 b0 Value of Analog Input Mode
Nibble #4 Nibble #3 Nibble #2 Nibble #1 Nibble
0 Converted digital value:–32000~+32000
AI4 AI3 AI2 AI1 –10V~+10V voltage input
1 Converted digital value:–10000~+10000
To assign input modes
2 4mA~20mA current input Converted digital value:0~+16000
3 Converted digital value:–16000~+16000
–20mA~+20mA current input
4 Converted digital value:–20000~+20000
Other Disabled

Example: If the BFM #0 of a VS-6A is set to be H5420, then


AI1: For –10V~+10V voltage input, that will be converted to the value –32,000~+32,000 at this mode.
AI2: For 4mA~20mA current input, that will be converted to the value 0~+16,000 at this mode.
AI3: For -20mA~+20mA current input, that will be converted to the value -32,000~+32,000 at this mode.
AI4: Disabled

BFM#20 To appoint the mode of analog output:


b15 BFM#20 b0 Value of Analog Output Mode
Nibble #4 Nibble #3 Nibble #2 Nibble #1 Nibble
0 Digital set value: –32000~+32000
Null Null AO2 AO1 –10V~+10V voltage output
1 Digital set value: –10000~+10000
To assign
output modes 2 4mA~20mA current output Digital set value: 0~+32000
3 Digital set value: –32000~+32000
–20mA~+20mA current output
4 Digital set value: –20000~+20000
Other Disabled

Example: If the BFM #20 of a VS-6A is set to be H20, then


AO1: For -10V~+10V voltage output, that will use the digital set value -32,000~+32,000 at this mode.
AO2: For 4mA~20mA current output, that will use the digital set value 0~+32,000 at this mode.

BFM#23 To appoint the output holding mode: (for the PLC status turns from RUN to STOP)
b15 BFM#23 b0 If the value in the nibble = 0, the channel will keep the last output, even PLC
Nibble #4 Nibble #3 Nibble #2 Nibble #1 is STOP.
Null Null AO2 AO1 If the value in the nibble ≠ 0, the channel will change its digital set value = 0
at STOP.

74
2-17-5 Buffer Memory BFM in the VS-4TC Module

BFM No. Component Description

#0 To assign the thermocouple types for TC1~TC4. When the power is turned from OFF to ON, the default value is H0000.
To assign the scale of temperature measurement. 0: ℃ ; 1: ℉ ; other values: ℃ . When the power is turned from OFF to
#2
ON, the default value is 0.
#3 To set the average times of TC1.
#4 To set the average times of TC2. When the power is turned from OFF to ON, the default value is 1.
#5 To set the average times of TC3. The available range is 1~32,767, otherwise it is equivalent to 1.

#6 To set the average times of TC4.


#11 Converted temperature value of TC1, with unit as 0.1 ℃ or 0.1 ℉ .
#12 Converted temperature value of TC2, with unit as 0.1 ℃ or 0.1 ℉ .
#13 Converted temperature value of TC3, with unit as 0.1 ℃ or 0.1 ℉ .
#14 Converted temperature value of TC4, with unit as 0.1 ℃ or 0.1 ℉ .
#29 Status and error ag.
#30 Identication code: VS-4TC = K205 (can use the FROM instruction to check whether the place is this module or not)
#31 The version number of this module. (the content value XX indicates Ver. X.X)

BFM #0 To appoint the types of thermocouples:


b15 BFM#0 b0
Value of Nibble 0 1 2 3 4 5 6 7 If Value of Nibble is not 0~7,
Nibble #4 Nibble #3 Nibble #2 Nibble #1
Thermocouple Type K J R S T E B N the channel is disabled.
TC4 TC3 TC2 TC1
Example: If the BFM #0 of a VS-4TC is set to be H8100, then
TC1 & TC2: K Type thermocouple input;
TC3: J Type thermocouple input; TC4: disabled.

BFM #29 Status and Error Flag: (0: normal; 1: error)


b15 b14~b4 b3 b2 b1 b0
Module's external TC1 is disconnected or converted value exceeds the range
DC 24V supply is
missing or has a TC2 is disconnected or converted value exceeds the range
hardware error
TC3 is disconnected or converted value exceeds the range
TC4 is disconnected or converted value exceeds the range

75
2-17-6 Buffer Memory BFM in the VS-8TC Module

BFM No. Component Description

#0 To assign the thermocouple types for TC1~TC4. When the power is turned from OFF to ON, the default value is H0000.
#1 To assign the thermocouple types of TC5~TC8. When the power is turned from OFF to ON, the default value is H0000.
To assign the scale of temperature measurement. 0: ℃ ; 1: ℉ ; other values: ℃ . When the power is turned from OFF to
#2
ON, the default value is 0.
#3 To set the average times of TC1.
#4 To set the average times of TC2.
#5 To set the average times of TC3.
#6 To set the average times of TC4. When the power is turned from OFF to ON, the default value is 1.
#7 To set the average times of TC5. The available range is 1~32,767, otherwise it is equivalent to 1.

#8 To set the average times of TC6.


#9 To set the average times of TC7.
#10 To set the average times of TC8.
#11 Converted temperature value of TC1, with unit as 0.1 ℃ or 0.1 ℉ .
#12 Converted temperature value of TC2, with unit as 0.1 ℃ or 0.1 ℉ .
#13 Converted temperature value of TC3, with unit as 0.1 ℃ or 0.1 ℉ .
#14 Converted temperature value of TC4, with unit as 0.1 ℃ or 0.1 ℉ .
#15 Converted temperature value of TC5, with unit as 0.1 ℃ or 0.1 ℉ .
#16 Converted temperature value of TC6, with unit as 0.1 ℃ or 0.1 ℉ .
#17 Converted temperature value of TC7, with unit as 0.1 ℃ or 0.1 ℉ .
#18 Converted temperature value of TC8, with unit as 0.1 ℃ or 0.1 ℉ .
#29 Status and error ag.
#30 Identication code: VS-8TC = K206 (can use the FROM instruction to check whether the place is this module or not)
#31 The version number of this module. (the content value XX indicates Ver. X.X)

BFM #0 & BFM #1 To appoint the types of thermocouples:


b15 BFM#0 b0
Value of Nibble 0 1 2 3 4 5 6 7 If Value of Nibble is not 0~7,
Nibble #4 Nibble #3 Nibble #2 Nibble #1
Thermocouple Type K J R S T E B N the channel is disabled.
TC4 TC3 TC2 TC1

b15 BFM#1 b0
Nibble #4 Nibble #3 Nibble #2 Nibble #1

TC8 TC7 TC6 TC5


Example: If the BFM #0 of a VS-8TC is set to be H8100, then
TC1 & TC2: K Type thermocouple input;
TC3: J Type thermocouple input; TC4: disabled.

BFM #29 Status and Error Flag: (0: normal; 1: error)


b15 b14~b8 b7 b6 b5 b4 b3 b2 b1 b0
TC1 is disconnected or converted value
Module's external exceeds the range
DC 24V supply is
missing or has a TC2 is disconnected or converted value
hardware error exceeds the range
TC8 is disconnected or TC3 is disconnected or converted value
converted value exceeds the range exceeds the range
TC7 is disconnected or TC4 is disconnected or converted value
converted value exceeds the range exceeds the range
TC6 is disconnected or TC5 is disconnected or converted value
converted value exceeds the range exceeds the range

76
2-17-7 Buffer Memory BFM in the VS-2PT Module

BFM No. Component Description


To assign the scale of temperature measurement. 0: ℃ ; 1: ℉ ; other values: ℃ . When the power is turned from OFF to
#2
ON, the default value is 0.
#3 To set the average times of PT1. When the power is turned from OFF to ON, the default value is 1.
#4 To set the average times of PT2. The available range is 1~32,767, otherwise it is equivalent to 1.

#11 Converted temperature value of PT1, with unit as 0.1 ℃ or 0.1 ℉ .


#12 Converted temperature value of PT2, with unit as 0.1 ℃ or 0.1 ℉ .
#29 Status and error ag.
#30 Identication code: VS-2PT = K207 (can use the FROM instruction to check whether the place is this module or not)
#31 The version number of this module. (the content value XX indicates Ver. X.X)

BFM #29 Status and Error Flag: (0: normal; 1: error)


b15 b14~b2 b1 b0
Module's external PT1 is disconnected or converted value
DC 24V supply is exceeds the range
missing or has a
hardware error PT2 is disconnected or converted value
exceeds the range

77
2-17-8 Buffer Memory BFM in the VS-4PT Module

BFM No. Component Description


To assign the scale of temperature measurement. 0: ℃ ; 1: ℉ ; other values: ℃ . When the power is turned from OFF to
#2
ON, the default value is 0.
#3 To set the average times of PT1.
#4 To set the average times of PT2. When the power is turned from OFF to ON, the default value is 1.
#5 To set the average times of PT3. The available range is 1~32,767, otherwise it is equivalent to 1.

#6 To set the average times of PT4.


#11 Converted temperature value of PT1, with unit as 0.1 ℃ or 0.1 ℉ .
#12 Converted temperature value of PT2, with unit as 0.1 ℃ or 0.1 ℉ .
#13 Converted temperature value of PT3, with unit as 0.1 ℃ or 0.1 ℉ .
#14 Converted temperature value of PT4, with unit as 0.1 ℃ or 0.1 ℉ .
#29 Status and error ag.
#30 Identication code: VS-4PT = K208 (can use the FROM instruction to check whether the place is this module or not)
#31 The version number of this module. (the content value XX indicates Ver. X.X)

BFM #29 Status and Error Flag: (0: normal; 1: error)


b15 b14~b4 b3 b2 b1 b0
Module's external DC 24V PT1 is disconnected or converted value
supply is missing or has a exceeds the range
hardware error
PT2 is disconnected or converted value
exceeds the range
PT4 is disconnected or converted value PT3 is disconnected or converted value
exceeds the range exceeds the range

78
3. Basic Instruction
3-1 Basic Instruction Table
Mnemonic Format Devices Function
LD X, Y, M, S, T, C, D.b, R.b
Initial logical operation contact type NO
(LOAD) (Normally Open)
LDI X, Y, M, S, T, C, D.b, R.b
Initial logical operation contact type NC
(LOAD INVERSE) (Normally closed)
LDP X, Y, M, S, T, C, D.b, R.b Initial logical operation Rising edge pulse
(LOAD PULSE)
LDF X, Y, M, S, T, C, D.b, R.b Initial logical operation Falling edge pulse
(LOAD FALLING PULSE)
AND X, Y, M, S, T, C, D.b, R.b
Serial connection of NO
(AND) (Normally Open) contact
ANI X, Y, M, S, T, C, D.b, R.b
Serial connection of NC
(AND INVERSE) (Normally Closed) contact
ANDP X, Y, M, S, T, C, D.b, R.b Serial connection of Rising edge pulse
(AND PULSE)
ANDF X, Y, M, S, T, C, D.b, R.b Serial connection of Falling edge pulse
(AND FALLING PULSE)

OR X, Y, M, S, T, C, D.b, R.b
Parallel connection of NO
(OR) (Normally Open) contact

ORI X, Y, M, S, T, C, D.b, R.b


Parallel connection of NC
(OR INVERSE) (Normally Closed) contact

ORP X, Y, M, S, T, C, D.b, R.b Parallel connection of Rising edge pulse


(OR PULSE)

ORF X, Y, M, S, T, C, D.b, R.b Parallel connection of Falling edge pulse


(OR FALLING PULSE)

ANB Series connection of multiple parallel


(AND BLOCK) circuit blocks

ORB Parallel connection of multiple contact


(OR BLOCK) circuit blocks

MPS Store the current result of the internal


(POINT STORE) PLC operation
MPS
MRD Read the current result of the internal
(POINT READ) PLC operation
MRD
MPP Pop (recall and remove) the currently
(POINT POP) MPP stored result
INV Invert the current result of the internal
(INVERSE) PLC operation
Conversion of operation result to
MEP Rising edge pulse
Conversion of operation result to
MEF Falling edge pulse
OUT Y0 Y, M, S, T, C, D.b, R.b Final logical operation type coil drive
(OUT)
SET SET Y0 Y, M, S, D.b, R.b Set component permanently ON
(SET)
RST RST Y0 Y, M, S, D.b, R.b, T, C, D, R, V, Z Reset component permanently OFF
(RESET)
PLS PLS Y0 Y, M(Except for special M) Rising edge pulse
(PULSE)
PLF PLF Y0 Y, M(Except for special M) Falling edge pulse
(PULSE FALLING)

79
Mnemonic Format Devices Function
MC MC N0 N0〜 N7 Denote the start of a master control block
(MASTER CONTROL)
MCR MCR N0 N0〜 N7 Denote the end of a master control block
(MC RESET)
END END Force the current program scan to end
(END)
NOP No operation or null step
(NO OPERATION)

The related device table for the basic instruction

Devices
Instru-
ction 16-bit 32-bit V,Z
X Y M SM S T D.b R.b D R
C C
LD
LDI
LDP
LDF
AND
ANI
ANDP
ANDF
OR
ORI
ORP
ORF
OUT
SET
RST
PLS
PLF

Means it cannot use the V, Z Index Register to modify Means it could use the V, Z Index Register to modify
To establish the set value of OUT T or OUT C instruction can use the K, D or R, also which can use the Index Register V, Z to
modify.

The basic instructions of the VS series PLC provide the “Bitwise Operation” and the “Bit Index” function. That greatly improving
the convenience of programming, but also greatly enhances the overall performance.

Since a register has 16 bits and they are allocated to The “Bit Index” function is to let the bit operand in the basic
0~F (b0~b15) respectively, the “Bitwise Operation” instruction has V, Z modifiable capability, as shown in the
function is to treat the individual bit in a register example below:
D or R as a bit component to process, as shown in
the example below: X0Z0 X1Z0
Y0Z0 When the contents of the Z0
D0's b3 R1's b5 D0's b15 is 0, the self-holding circuit
Y0Z0 starts from the X0 and may
release by the X1, then gets
D0.3 R1.5 a new output to the Y0.
D0.F The left diagram shows
the self-holding circuit When the contents of the Z0
D0.F about the b15 of D0. is 5, the self-holding circuit
That starts from the b3 starts from the X5 and may
of D0 and may release release by the X6, then gets
by the b5 of R1, then a new output to the Y5.
D0's b15
gets a new output to
the b15 of D0.

80
3-2 The LD, LDI, AND, ANI, OR, ORI, INV, OUT and END Instructions
Mnemonic Format Devices Function
LD X, Y, M, S, T, C, D.b, R.b
Initial logical operation contact type NO
(LOAD) (Normally Open)
LDI X, Y, M, S, T, C, D.b, R.b
Initial logical operation contact type NC
(LOAD INVERSE) (Normally closed)
AND Serial connection of NO
(AND) X, Y, M, S, T, C, D.b, R.b (Normally Open) contact
ANI Serial connection of NC
(AND INVERSE) X, Y, M, S, T, C, D.b, R.b (Normally Closed) contact

OR X, Y, M, S, T, C, D.b, R.b
Parallel connection of NO
(OR) (Normally Open) contact

ORI X, Y, M, S, T, C, D.b, R.b


Parallel connection of NC
(OR INVERSE) (Normally Closed) contact

INV Invert the current result of the internal


(INVERSE) PLC operation
OUT Y0 Y, M, S, T, C, D.b, R.b Final logical operation type coil drive
(OUT)
END END Force the current program scan to end
(END)

Ladder Diagram Instruction List

X20 X21 LD X20 Initial logical operation contact type NO (Normally Open)
Y20 OR Y20 Parallel connection of NO (Normally Open) contact
Y20 Serial connection of NO (Normally Open) contact
AND X21
X22 X23 OUT Y20 Final logical operation type coil drive
Y21 LDI X22 Initial logical operation contact type NC (Normally Closed)
Y21 ORI Y21 Parallel connection of NC (Normally Closed) contact
ANI X23 Serial connection of NC (Normally Closed) contact
X24
Y22 OUT Y21 Final logical operation type coil drive
LD X24 Initial logical operation contact type NO (Normally Open)
END INV Invert the current result of the internal PLC operation
OUT Y22 Final logical operation type coil drive
END Force the current program scan to end

The OUT instruction for the coil of T or C will have an explicit explanation in the Section 3-9.

When the PLC executes the END instruction, that will force to terminate the current scan and process both output and
input component updates. All instructions in the program and subroutines after the END instruction will not be executed.
The END instruction can be inserted into the middle of the program, it can be used to do the programming debug.
The section after the END instruction is disabled and isolated from the whole program.

81
3-3 The LDP, LDF, ANDP, ANDF, ORP, OPF, MEP and MEF Instructions
Mnemonic Format Devices Function
LDP X, Y, M, S, T, C, D.b, R.b Initial logical operation Rising edge pulse
(LOAD PULSE)
LDF X, Y, M, S, T, C, D.b, R.b Initial logical operation Falling edge pulse
(LOAD FALLING PULSE)
ANDP Serial connection of Rising edge pulse
(AND PULSE) X, Y, M, S, T, C, D.b, R.b
ANDF Serial connection of Falling edge pulse
(AND FALLING PULSE) X, Y, M, S, T, C, D.b, R.b

ORP X, Y, M, S, T, C, D.b, R.b Parallel connection of Rising edge pulse


(OR PULSE)

ORF X, Y, M, S, T, C, D.b, R.b Parallel connection of Falling edge pulse


(OR FALLING PULSE)

Conversion of operation result to


MEP Rising edge pulse
Conversion of operation result to
MEF Falling edge pulse

Ladder Diagram Instruction List

X0 X2 LDP X0 Initial logical operation Rising edge pulse contact


Y0 ORP X1 Parallel connection of Rising edge pulse contact
X1 ANDP X2 Serial connection of Rising edge pulse contact
OUT Y0 Final logical operation type coil drive
X3 X5
Y1 LDF X3 Initial logical operation Falling edge pulse contact
X4 ORF X4 Parallel connection of Falling edge pulse contact
ANDF X5 Serial connection of Falling edge pulse contact
X6
Y2 OUT Y1 Final logical operation type coil drive
X7 LD X6 Initial logical operation contact type NO (Normally Open)
Y3 MEP Conversion of operation result to Rising edge pulse contact
OUT Y2 Final logical operation type coil drive
LD X7 Initial logical operation contact type NO (Normally Open)
MEF Conversion of operation result to Rising edge pulse contact
OUT Y3 Final logical operation type coil drive

The right gure takes the bit device M0 as an example


The state of M0
to illustrate the relationship between the initial logical
operation contact type NO, NC, the Raising and Falling The A type NO contact of M0
edge pulse contacts.
The B type NC contact of M0
The Rising edge contact will be active at the program
for one Scan Time when the associated device status The Raising edge pulse of M0
changes from “OFF” to “ON”.
The Falling edge pulse of M0
The Falling edge contact will be active at the program
for one Scan Time when the associated device status
changes from “ON” to “OFF”.
One Scan Time One Scan Time

82
3-4 The ANB and ORB Instructions
Mnemonic Format Devices Function

ANB Series connection of multiple


(AND BLOCK) parallel circuit blocks

ORB Parallel connection of multiple


(OR BLOCK) contact circuit blocks

Ladder Diagram Instruction List

X0 X2 LD X0 Initial logical operation contact type NO (Normally Open)


Y0 OR X1 Parallel connection of NO (Normally Open) contact
X1 X3 LD Initial (the starting point of another circuit block) logical
X2
operation contact type NO (Normally Open)
X4 X5
M0
OR X3 Parallel connection of NO (Normally Open) contact
X6 X7 ANB Series connection of multiple parallel circuit blocks
OUT Y0 Final logical operation type coil drive
LD X4 Initial logical operation contact type NO (Normally Open)
AND X5 Serial connection of NO (Normally Open) contact
LD X6 Initial (the starting point of another circuit block) logical
operation contact type NO (Normally Open)
AND X7 Serial connection of NO (Normally Open) contact
ORB Parallel connection of multiple contact circuit blocks
OUT M0 Final logical operation type coil drive

To declare the starting points of the circuit block, please use an LD, LDI, LDP or LDF instruction. After completing the
serial circuit block, to connect it to the preceding block by series/parallel connection should use the ANB/ORB instruction.
No more than 8 of the ANB and ORB instructions in a batch circuit.

Please refer to the following program example, it is used both the ANB and ORB instructions in a circuit block.

Ladder Diagram Instruction List

X20 X22 X23 LD X20


Y0 ORI X21
X21 X24 X25 LD X22

X26 AND X23


LDI X24
X27 ANI X25
ORB
OR X26
ANB
OR X27
OUT Y0

83
3-5 The MPS, MRD and MPP Instructions
Mnemonic Format Devices Function
MPS Store the current result of the internal
(POINT STORE) PLC operation
MPS
MRD Read the current result of the internal
(POINT READ) PLC operation
MRD
MPP Pop (recall and remove) the currently
(POINT POP) MPP stored result

Ladder Diagram Instruction List

X0 X1 LD X0 Initial logical operation contact type NO (Normally Open)


Y20 MPS Store the current result of the internal PLC operation
MPS X2 AND X1 Serial connection of NO (Normally Open) contact
Y21
OUT Y20 Final logical operation type coil drive
MRD X3
Y22 MRD Read the current result of the internal PLC operation
MPP AND X2 Serial connection of NO (Normally Open) contact
OUT Y21 Final logical operation type coil drive
MPP Pop (recall and remove) the currently stored result
AND X3 Serial connection of NO (Normally Open) contact
OUT Y22 Final logical operation type coil drive

The MPS instruction stores the state of a connection point of the ladder circuit so that further coil branched can recall the
value later.
The MRD instruction recalls or reads the previously stored connection point data and forces the next contact to connect to
it.
The MPP instruction pops (recalls and removes) the stored connection point data of the last array and removes the
connection point from the result. The last contact or coil circuit must connect to an MPP instruction.

In any continuous connection circuit block, the difference between the number of the active MPS instruction and the
number of the active MPP instruction shall be no greater than 11; when all connection circuit blocks are ended, the total
number of the MPS instruction and the total number of the MPP instruction have been used in the program must be the
same (there must has a MPP instruction corresponding to every signal MPS instruction).

The following diagram shows the program example block with three connections:

Ladder Diagram Instruction List

X20 X21 X22 LD X20


Y20 MPS
MPS MPS X23 AND X21
MPP Y21
X24 X25 MPS
Y22 AND X22
MPP MPS X26 OUT Y20
MPP Y23
MPP
AND X23
OUT Y21
MPP
AND X24
MPS
AND X25
OUT Y22
MPP
AND X26
OUT Y23

84
3-6 The MC and MCR Instructions
Mnemonic Format Devices Function
MC MC N0 N0〜 N7 Denote the start of a master control block
(MASTER CONTROL)
MCR MCR N0 N0〜 N7 Denote the end of a master control block
(MC RESET)

Ladder Diagram Instruction List


X0
LD X0 The X0 is the condition contact
MC N0
X1 Become a master control block which is controlled by the
Y20 MC N0
X0.
M10 LD X1
Status of Y20 = Status of X1
Y21 OUT Y20 If X0=ON then
Status of Y21 = Status of M10
LD M10
MCR N0 Y20=OFF
OUT Y21
If X0=OFF then
MCR N0 Y21=OFF

When the condition contact X0 is “ON”, all instructions between the MC and MCR instructions will be executed normally.

When the condition contact X0 is “OFF”, all instructions between the paired MC and MCR instructions will NOT be
executed, also all ordinary Timers and the coils which is driven by the OUT instruction will be reset; but the Retentive
Timers, Counters and the status of coils which is driven by the SET / RST instruction will be kept.

Use the MC instruction to shift the bus line (the Initial logical operation) to a point behind the conditional contact and then
use the paired MCR instruction to return to the original bus line.

A master control block allows to contain another master control block inside, which is to form a nest level. This structure
at the most can have 8 levels N0~N7. The top nest level shall be the N0, and followed by N1, N2..., so the most inner level
shall be the N7.

A program example with a multiple nest levels structure is shown below:

Ladder Diagram

X0
MC N0
X20
Y20
X1
MC N1
X21
Y21
X2
MC N2
X22
Y22
X3
MC N3
X23
Y23 4th level 3rd level 2nd level 1st level

MCR N3
X24
Y24

MCR N2
X25
Y25

MCR N1
X26
Y26

MCR N0

85
3-7 The SET and RST Instructions
Mnemonic Format Devices Function
SET SET Y0 Y, M, S, D.b, R.b Set component permanently ON
(SET)
RST RST Y0 Y, M, S, D.b, R.b, T, C, D, R, V, Z Reset component permanently OFF
(RESET)

Ladder Diagram Instruction List Active I/O duration time sheet

X0 LD X0 X0
Y20 OUT Y20
X0 LD X0 X1
SET Y21
SET Y21
X1 Y20
RST Y21 LD X1
RST Y21 Y21

The SET instruction sets the output coil permanently “ON” when it has been operated.

The RESET instruction resets the output coil permanently “OFF” or resets the current value of a Timer, Counter or Register
to zero.

The SET instruction and the RESET instruction can use the same output coil, and the number of times is unlimited.

The RST instruction for the device C will have an explicit explanation in the Section 3-9.

3-8 The PLS and PLF Instructions

Mnemonic Format Devices Function


PLS PLS Y0 Y, M (Except the Special M) Rising edge pulse
(PULSE)
PLF PLF Y0 Y, M (Except the Special M) Falling edge pulse
(PULSE FALLING)

Ladder Diagram Instruction List Active I/O duration time sheet

X0 LD X0
X0
PLS M0 PLS M0
X0 LD X0 M0
PLF M1
PLF M1
M1

One Scan Time One Scan Time

When X0=OFF → ON, the M0 will output a pulse for one Scan Time.

When X0=ON → OFF, the M1 will output a pulse for one Scan Time.

86
3-9 The OUT and RST Instructions for the Timer or Counter
If the OUT instruction is used for the coil of the component T or C, input a Set Value is required.

Timer

Ladder Diagram Instruction List Active I/O duration time sheet

X0 K20 LD X0
X0
T0 OUT T0
T0 K20 T0 coil
Y20
LD T0
T0 contact
OUT Y20
Y20
2 sec

The Set Value of a Timer can be set by either using a K (Constant) or a Data Register D, R (Parameter).
The available range of the Set Value:

Timer ID No. Timing Unit Type of Timer Available Range Real Setting Time
T0~T199 100ms 0.1~3276.7 sec.
General Timer
T200~T245 10ms 1~32,767 0.01~327.67 sec.
(non-retentive)
T256~T511 (The Set Value beyond this
1ms 0.001~32.767 sec.
range will be defaulted to 0)
T246~T249 1ms ※ 0.001~32.767 sec.
Retentive Timer
T250~T255 100ms 0.1~3276.7 sec.

To reset the contact or Present Value of a Retentive Timer T246~T255, must use the RST instruction.
※ If the timer's Set Value is 0, its contact will become activated at the next scan time after its coil is triggered.

Counter

Ladder Diagram Instruction List Action Description

X0 K5 LD X0 When the X0 is turned from “OFF” to “ON”,


C0 OUT C0 the C0 executes up count once, until the
C0 Present Value of the C0 is equal to 5 that will
K5
Y20 turn its output contact to “ON”, where the
LD C0 Present Value will not increase anymore and
X1
RST C0 OUT Y20 its contact will stay permanently “ON”.
LD X1
When X1= “ON”, the Present Value of C0 will
RST C0 be reset to “0” and the contact of C0 will
become “OFF”.
The Set Value of a Counter can be set by either using a K (Constant) or a Data Register D, R (Parameter).
The available range of the Set Value:

Counter ID No. Type of the Counter Available Range


C0~C99 General 16-bit 1~32,767
C100~C199 Latched Up count (The Set Value beyond this range will be defaulted to 1)

C200~C219 General
C220~C234 Latched 32-bit
–2,147,483,648~2,147,483,647
Up/Down count
Software High Speed Counter
C235~C255 (Latched)

When using High Speed Counters, please refer to the section 2-7 High Speed Counter.

87
3-10 Significant Notes for Programming
3-10-1 Convert the Ladder Diagram to the Instruction List
The rule to convert a program from the Ladder Diagram to the Instruction List format should follow the sequence that
from left to right and from top to bottom.
X0 X1 X5 X6 X21
Y20
X2 X3 X7 X20 X22
Y21
X4

LD X0
Serial connection Block
ANI X1
LD X2
Serial connection Block
AND X3
ORB Parallel connection circuit blocks
OR X4 Parallel connection of NO contact
LDI X5
Serial connection Block
AND X6
LD X7
Serial connection Block
AND X20
ORB Parallel connection circuit blocks
ANB Serial connection of multiple parallel blocks
ANI X21 Serial connection of NC contact
OUT Y20 Output
AND X22 Serial connection of NO contact
OUT Y21 Output

88
3-10-2 Programming Techniques
1. Put a section which with longer serial connections of contacts at the upper place of a Parallel Connection Circuit
Blocks. This way will make the programming simpler and easier.

Ladder Diagram Instruction List Ladder Diagram Instruction List

X0 LD X0 X1 X2 LD X1
Y0 LD X1 Y0 AND X2
X1 X2 X0
AND X2 OR X0
ORB OUT Y0
OUT Y0

2. It is recommended to place a circuit with more parallel connection of contacts on the left side.

Ladder Diagram Instruction List Ladder Diagram Instruction List

X0 X1 LD X0 LD X1
Y0 X1 X0
LD X1 Y0 OR X2
X2
OR X2 X2 AND X0
ANB OUT Y0
OUT Y0

3. Although it is not an incorrect syntax to repetitively use an output coil ID number or Double Coil, the last output
operation is the real effective coil. Therefore, the structure of conditional signal contacts should be modified or the
output coils of the same ID number should be avoided.
Ladder Diagram Instruction List Ladder Diagram Instruction List

X0 X1 LD X0 X0 X1 LD X0
Y0 AND X1 Y0 AND X1
X20 X21
˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙

OUT Y0 LD X20
X22 OR X22
˙˙˙˙˙˙˙˙˙˙˙

ANI X21
ORB
OUT Y0
X20 X21 LD X20 or
Y0 OR X22
X22
ANI X21
X0 X1 LD X0
OUT Y0 M0 AND X1
˙˙˙˙˙˙˙˙˙˙

OUT M0
˙˙˙˙˙˙˙

X20 X21 LD X20


M1 OR X22
X22
ANI X21
OUT M1
˙˙˙˙˙˙˙˙˙˙

˙˙˙˙˙˙˙

M0 LD M0
Y0 OR M1
M1
OUT Y0

89
90
4. Sequential Function Chart (SFC) and Step Ladder (STL)
In the universe of Automatic Control, the Electro-Control system should work closely with machine movements to get
the result of the Automatic Control, i.e. the synergistic integration technology of Mechatronics, which has become
popular in recent years. However, that is quite a difficult job to learn such a complicated sequential control design for
machinery engineers, therefor the SFC (Sequential Function Chart) is developed accordingly.

4-1 What is the Sequential Function Chart (SFC)


The SFC is designed to create an easy way to understand the machine's movements, which has the following features:
(1) It is not necessary to design the special sequence for stepladders of which state constantly changes, the PLC will
automatically execute interlocks and double coils under different states. Only need to simply design the sequence
function of every state.
(2) Even a person who is not a machine designer can easily learn all actions and conduct jobs such as trials,
adjustment, debug and maintenance.

4-1-1 The Framework of SFC


SFC Schematic Diagram The Actual SFC

Initial state S0

The transfer condition, to control the movement from


the Initial State to State 1 X20
The Ladder Diagram of Sequential Control
State 1 for State 1 S20
The transfer condition, to control the movement from the
State 1 to State 2 X21
The Ladder Diagram of Sequential Control
State 2 for State 2 S21
The transfer condition, to control the movement from the
2 to State 3 X22
X20, X21, X22,… X26, X27
Which are the transfer conditions for each
State.
The transfer condition, to control the movement from the
State (N-1) to State N X26
The Ladder Diagram of Sequential Control
State n for State N S30
The transfer condition, to control the movement
from the State N to Initial State X27

The left is a Schematic Diagram of SFC and the right diagram is the corresponding actual SFC. The PLC will execute to
start from the Initial State, then complete State 1 → State 2 → … → State N in the sequence based on states' transfer
conditions and achieve a cycle of control.

4-1-2 Basic Components of SFC


1. States
(1) Initial State
The rst state to execute after PLC runs. Ordinarily the Initial State is achieved by using the startup initial pulse.
The Initial State is represented by a frame with double sidelines.
(2) Effective State
The Effective State refers to a state which is executive or active during the PLC processing. Under an Effective
State PLC will execute the following actions in sequence:
Driving the coil of the output point, timer or counter relative to the state.
Resetting the last pasted action, i.e. turning the actions which are relative to the last state into “OFF”.
Transferring the machine action to the next state when the transfer condition is authorized. In generally there is
a connecting line to connect the states, and it indicates the direction of the signal.

2. Transfer Condition
There is a line segment to connect between states, and on the line segment put a perpendicular short line which is
used to express the related condition driving the states transfer.

91
4-1-3 State and Action of SFC
The VS series PLC uses step relay to indicate the state in the SFC. The diagrams below show the action of step relays
under various of situations.

S20 Y7 S20=OFF, the step is not active, Y7=OFF.

X1

1 S21 Y0
S21=ON, the step is active, Y0=ON, Y1=ON.
X0 SET Y1

S22 Y2 S22=OFF, the step is not active, Y2=OFF.

At the moment X0=OFF → ON, the active step will be transferred from the S21 to S22. The relay S22 truns
from OFF to ON, but S21 remains ON temporary.

S20 Y7 S20=OFF, the step is not active, Y7=OFF.

X1

2 S21 Y0
S21=ON, the step is still active, Y0=ON, Y1=ON.
X0 SET Y1

S22 Y2 S22=ON, the step is active, Y2=ON.

At the next scan time, the step S21 turns from ON to OFF (inactive), but S21 is still executed.

S20 Y7 S20=OFF, the step is not active, Y7=OFF.

X1

3 S21 Y0
S21=OFF, the step is executed but inactive, Y0 turns OFF;
Y1=ON because it was driven by the SET instruction.
X0 SET Y1

S22 Y2 S22=ON, the step is active, Y2=ON.

Then the next scan time, the step S21 will not be executed.

S20 Y7 S20=OFF, the step is not active, Y7=OFF.

X1

4 S21 Y0
S21=OFF, the step is not executed, Y0=OFF;
Y1=ON because it was driven by the SET instruction.
X0 SET Y1

S22 Y2 S22=ON, the step is active, Y2=ON.

92
In the process of SFC step transferring, there are some phenomena which need to pay special attention to, as the
following diagrams show.
The step S21 will be executed
at the region

will not be executed will not be executed


S21

will not be executed will be executed


S22

A :It is a Scan Time, the activated step is transferred at the scan time. Both S21 and S22 are ON at this scan time.

B :Another Scan Time, it is coming after the state transfer. Although the S21 has turned OFF, it will still execute the
program within the step; meanwhile, it turns Y0 from ON to OFF.

The devices driven by the OUT instruction in the step will turn OFF (OUT Y0 in the program) for the next scan time after
the state transfer; but the devices driven by the SET instruction will remain ON (SET Y1 in the program).

4-1-4 Types of SFC


Based on the flow control methods of SFC, SFC has five basic types:

S0 S5 S3 S8 S9

S20 S10 S10 S100 S200

S21 S20 S30 S20 S30 S101 S201

S22 S21 S31 S21 S31 S102 S202

S23 S22 S32 S22 S32 S103 S203

S24 S11 S11 S104 S204

Simple Flow Selective Simultaneously Parallel Jump Repeat


Branch / Merge Branch / Merge

93
4-2 Compiling the Sequential Function Chart (SFC)
The SFC has its special operating method. Through the step-by-step description of compiling the SFC program in this
chapter, designers can understand the methods of the SFC programming. Here, we use the application example of a
fountain in park to explain the design procedure of the SFC in sequence.
The description of the park fountain function:
There is a control panel next to the park fountain and a START button on the panel for people to start up the fountain
show, also a READY indicator to display whether it is under the standby state or not. When people press the start
button during the standby status, a cycle of the fountain lighting and spray show will start. After a while, it is back to the
standby status.
When the fountain show is activated, a series procedures will start to perform. First, the system turns to the busy status
(the READY indicator OFF) and illuminates the fountain's lights. 5 seconds later, the surrounding water nozzles begin to
spray. After 10 seconds, the central nozzle joins up. All the lights and water spraying will run for 20 seconds then stop,
the fountain returns to the standby status and the READY indicator turns ON again.

READY START

The operating procedures for the fountain control are as follows:


(1) When the power is ON, the PLC is in the standby status and the READY indicator is ON.
(2) If someone presses the START button, the fountain's lights are illuminated and a 5 second timer is activated.
(3) When the 5 second timer is reached, the surrounding water nozzles begin to spray and a 10 second timer is activated.
(4) When the 10 second timer is reached, the central nozzle begins to spray too, and a 20 second timer is activated.
(5) After the 20 second timer is reached, all the lights and nozzles are turned OFF and the PLC comes back to the
standby status.

4-2-1 Create the Flowchart of the Sequential Procedures


According to the description of the fountain control actions, we can draw the flowchart as below.
First of all, we divide those continuous actions to be completed into few individual steps. Then, insert a control condition
between every two steps that could transfer activating state of a step into next step. By this method, the following
procedure flowchart is produced.

The initial Turn the READY indicator ON at


step this standby step.

The START button

The step #1 Illuminate the lighting and activate


the coil of 5 second timer.
5 sec. timer is reached
Drive the valve of surrounding
The step #2 nozzles and activate the coil of 10
second timer.
10 sec. timer is reached
Drive the valve of central nozzle
The step #3 and activate the coil of 20 second
timer.
20 sec. timer is reached
Shut the lighting down and turn the
The step #4 valves of nozzles OFF.
All actions are nished

94
4-2-2 Convert the Flowchart to the SFC
In an actual application, the external input Turn the READY indicator ON at
signals and output loads must be wired to S0 Y0 this standby step.
the PLC's input and output terminals, therefore
it could receive the state of external signal and The START button
actually drive the load.
In this example, the START button connects to S10 SET Y1 Illuminate the lighting.
the input point X0, the output Y0 is for the
READY indicator, the Y1 is for the lighting, the Timer T0 is
K50 Activate the coil of 5 second
Y2 is for the valve of surrounding nozzles and reached T0 timer T0.
the Y3 is for the valve of central nozzle. Drive the valve of
The state of each Step Relay in the program S11 SET Y2 surrounding nozzles.
indicates which SFC procedure is active, and K100 Activate the coil of 10 second
uses the Transferring Condition under the step Timer T1 is
reached T1 timer T1.
to move the effective status to next Step Relay.
At the system, the General and Latched Step
Relays (S10~S899, S1000~S4095) can be S12 Y3 Drive the valve of central nozzle.
used without to notice about the order of the K200 Activate the coil of 20 second
Timer T2 is
component number, but the S0~S9 are reached T2 timer T2.
specially assigned to the Initial State. Besides,
should not reuse the same component number S13 RST Y1 Shut the lighting down.
for the steps.
According to the note above and the I/O All actions Turn the valves of nozzles
RST Y2 OFF.
control requirements, could convert the are nished
owchart to the right side SFC program.
Those components T0~T2 are the PLC
built-in timers, the characteristic of this timer
type is up counting by the unit of 0.1 seconds.

4-2-3 Use the Ladder Master S to Edit the SFC


The programming software Ladder Master S provides the function to construct the SFC. Thus, the SFC at the previous
section can use the Ladder Master S to compose at a computer, then load it to a PLC to test run and debug.
The programming of SFC with the Ladder Master S is illustrated as follows: The detail action of each single step

Y0
Use the Initial State to
activate the following SFC X0
Ladder Diagram

TRAN S10
M9002
SET S0 Expanded view of the
Expand SFC block's structure
SFC TEST S0 SET Y1
Expand
K50
The Ladder Master S makes use of the T0
SFC instruction to construct a SFC block
in the program, every block should give T0
an identication name (up to 16 characters) S10 T R A N S 11
Expand
after the SFC instruction. Also, the block
can be expanded to edit and view its SFC
structure and detail actions.
SET Y2
S11
Expand K100
T1
T1
TRAN S12
S12
Expand

Y3
S13 K200
Expand T2
T2
TRAN S13

S0
RST Y1

RST Y2
S13
TRAN S0

95
4-3 Description the Application Types of SFC
This section introduces various of processing flow modes about the SFC and the related precautions when to compile it.

4-3-1 Single Flow, Jump and Repeat Flow During the Flowchart Transfer
The Single Flow is the basic construction of a SFC and it is used in simple sequential controls.
In the actual layout of the SFC, the JUMP instruction (represented by ) is used to specify a jump or repeat about the
process of steps ow .
If the JUMP instruction at the Simple Flow is used to move back to an earlier step, that is called a Repeat Flow.
Simple Flow Repeat Flow

S0 S0
S20 S20

S10 S10
S21 S21

S11 S11
S22 S22

S12 S12
S23 S23
S21

Layout of a SFC S0
Layout of a SFC Pattern at the
Pattern at the Ladder Master S
Ladder Master S

If the JUMP instruction at the Simple Flow is used to move forward to a later step or to another SFC, that is called a
Jump Flow.

S100 S100 S1 S2 S1 S2

S101 S101 S10 S20 S10 S20


S103

S102 S102 S11 S21 S11 S21


S22

S103 S103 S12 S22 S12 S22

Layout of a SFC Pattern at the Layout of SFCs Pattern at the Ladder Master S
Ladder Master S (separately create two SFCs)

96
4-3-2 Selective Branch and Merge
Selective Branch : Select one of the branch ows to transfer the effective state.
Selective Merge : Merge a number of branch ows into a single ow.

S10 The number of available branch ows is 2~8. (no more then 8)

0 1 2 3 4 5 6 7

S20 S30 S40 S50 S60 S70 S80 S90

S21 S31 S41 S51 S61 S71 S81 S91

S22 S32 S42 S52 S62 S72 S82 S92

S11

When the step relay S10 is effective, its following eight transfer conditions are simultaneously used for to select and
move the effective state to either one of the S20, S30, S40, S50, S60, S70, S80 or S90.
Assume the S10 is effective and the transfer condition “0” is just turning ON, the activation will be transferred from the
S10 to the S20, then moved to the S21 after that to the S22. At this time, the transfer condition under the S22 turns ON,
the activation will move to the S11. Suppose the S10 is effective and the transfer condition “1” is ON, the activation will
be transferred from the S10 to the S30, and so on.
The entry transfer conditions of every Selective Branch must be particular and unique, that should avoid more than one
transfer condition is effective at the same time. If not, will lead to more than one ows executing at the same time and
result in errors.

4-3-3 Simultaneously Parallel Branch and Merge


Simultaneously Parallel Branch : When the foremost transfer condition is authorized, all the rst steps of branch ows
become effective.
Simultaneously Parallel Merge : When all the last steps of branch ows are effective and the merge transfer condition is
authorized, the branches are combined to a single ow.

S10

The number of available branch ows is 2~8. (no more then 8)

S20 S30 S40 S50 S60 S70 S80 S90

S21 S31 S41 S51 S61 S71 S81 S91

S22 S32 S42 S52 S62 S72 S82 S92

S11

When the step relay S10 is effective and its transfer condition is NO, the following S20, S30, S40, S50, S60, S70, S80
and S90 become active simultaneously. Each ow can do its own process and transfer. After a while, the S22, S32,
S42, S52, S62, S72, S82 and S92 are effective and waiting the transfer condition of merging. If all the requirements
above are authorized, the effective state will move to the S11.

97
4-3-4 Special Notices About the SFC
The SFC must use the Ladder Masters S (LMS) to compose and join that into the project, then could be loaded and
executed at the PLC. There are some rules about the state transfer. The merge operation must direct to a destination
step. Furthermore, any step must bind with one and only one transfer condition. Thus, it is necessary to modify an
unqualied SFC to meet the requirement.
In a SFC ow can be added with an empty step. Since the step is for connection only, it is called a Virtual Step.

S20 S30 S20 S30 S20 S30 S20 S30

X0 X1 X0 X0 X1 X0

X3 X4 X1 X2

S40 S50 S40 S50 S40 S50 S40 S50

S20 S30 S20 S30 S20 S30 S20 S30

X0 X1 X0 X0 X1 X0

S100 Virtual Step S100 Virtual Step S101 Virtual Step S200 Virtual Step

X3 X4 S100 S101 X1 X2

S40 S50 S40 S50 S40 S50 S40 S50

S10 S10 S10 S11 S10 S11

M0 M0•M1 M0•M2 T0 T1 T0•X0 T1•X0


M1 M2 X0
S11 S12 S12
S11 S12 S12

S10 S10

X0 X0 X0•X1 X0•X1 X0•X2 X0•X2


X1 X1 X2 X2
S20 S30 S40 S50
S20 S30 S40 S50
M0 M1 M2 M3
M0 M1 M2 M3
S21 S31 S41 S51
S21 S31 S41 S51
X6•T0 X6•T1 X7•T2 X7•T3
T0 T1 T2 T3
S11
X6 X7

S11

98
4-4 Precautions About the Composition of the SFC
To create an user program for the VS PLC, the Ladder Master S provides the SFC to combine with the original ladder
diagram. Be sure to understand its specications and restrictions, in order to use it smoothly and complete the control
program correctly.
1 The control process within a step can use a variety of serial / parallel links, outputs and application instructions.
X0 M10 T0 K50
T0
X20 M100
S10 MOV D0 D1
Y5

The transfer condition between two steps can be driven by serial / parallel links.

S105 T0 X0
TRAN S10
T1 X1

S10

3 The control outputs in a step may directly drive by the inner bus line. However, once a contact is inserted, the
subsequent outputs and application instructions cannot directly drive from the bus line.

Y0 Y0 Y0
Should be modied as
T2 T2
S10 Y1 Y2 or Y1
T2 M9000
Y2 Y1 Y2

4 When using the OUT instruction to drive a coil in the step, the coil will turn OFF after the effective state transferred.
When using the SET instruction to drive a coil ON in the step, the coil will retain ON after the effective state transferred.

Y0
S10 S10
SET Y1 X0
X0
S11
S11 Y0

Y1
One Scan Time

5 When the effective state is transferring between two sequential steps, both of the states are ON at this scan time.
Please refer to the above gure.
6 Since both the states of two sequential steps will ON at the scan time of transferring. It is necessary to add the output
interlock circuits.

Y1
S10 Y0 Motor rotates forward.

Interlock
Y0
S11 Y1 Motor rotates backward.

7 A SFC cannot be written in a subroutine.

8 Although the use of the jump (CJ) instruction is not prohibit inside of a SFC step, it makes the program process more
complicated and should be avoided.

9 When there is a SFC in the PLC program, do not use the SET or OUT instruction in the interrupt subroutine to drive
the step relay.

99
10 Two non sequential steps can share a timer with the same ID number. Also, it can be set with different set values
respectively.

K100
S10 T0

K5
S11 T0 Steps S10 and S11 are sequentially connected, the left side T0 is not allowed.

D0
S12 T0 Steps S10 and S12 are not sequentially connected, the left side T0 is allowed.

11 The MC and MCR instructions cannot be used in the SFC.


12 The SET, RST and OUT instructions cannot be used to do the state transfer in the SFC.

13 The same step relay ID number cannot be used repeatedly in the SFC.

14 When designing a SFC, the ID numbers of used step relays do not need to follow through a specic sequence.

15 In the SFC, the S0~S9 are the main initial step relays. However, a general step relay can also be used as an initial
step relay, at the beginning of a SFC ow.
S0 S10 S100

S10 S100 S500

16 Avoid using the pulse of rising/falling edge in a SFC. If necessary, can transfer the edge pulse to an auxiliary relay M
in the ladder diagram rst.
In the ladder diagram SFC Expanded view of the SFC
X0 X0 M0
SET Y0 M0 SET Y0
S10 X1 X1 S10 M1
M1

17 In the SFC, the sign “ ” represents the RESET instruction.

S20 S20 If the transfer condition is ON, the


If the transfer condition is ON, RESET is effected to the S30. Hence,
then RESET the S20. will not do status transfer (the S20 is
still ON).

S20 S30

18 For a selective or simultaneously parallel branch, the maximum limit is 8 branch ows.
If using the Ladder Master S to compose a SFC, one SFC diagram can have at most 32 columns.
S5

Up to 8 branch ows
1 2 8 Up to 8 branch ows

Max. 32 columns

100
19 When a signal is repeatedly used to transfer state at different steps, this signal must be a pulse signal. Also, since
the effective state transferring between two sequential steps will cause both of the states ON for a scan time,
therefore the prohibitive M1 signal should be added as shown below. That could avoid transferring from S100 to
S101 immediately.
M0
TRAN S100

PLS M1
S100

M0 M1
TRAN S101

PLS M2
S101

20 In the example of the following gure, when the state of S100 is changed from OFF to ON, it is expected that the Y1
motor rotates to drive the conveyor to move the “Bottle 2” to the position of bottle inspector X1.
When the S100 changes from OFF to ON and the X1 has been turned ON already by the “Bottle 1”, at the Fig. 1 that
will cause the state of S100 transfers to S101 immediately, thus the Y1 turned OFF at once. Therefore, it is necessary
to improve the SFC become the Fig. 2 in order to successfully achieve the purpose. This kind of application is
common in the automatic control, the user must understand the principle of its movements.

S100 Y1
X1
Fig.1 TRAN S101

S101
Bottle 3

Bottle 2

Bottle 1

Y1

S100 PLS M1
Bottle inspector X1 X1
PLS M0
Fig.2
M0 M1
Conveyor motor Y1
TRAN S101

S101

4-5 STL / SFC Relevant Special Components


In the tables below, the symbol “■” represents that the component is not allowed to use an instruction in the program
to drive the relay or write data to the register.
Relay ID No. Description

M9040 To prevent the step transfer. When M9040=“ON”, the STL state transfer function is disabled.
■ M9046 STL step is working. When M9047=“ON” and any relay of S0~S899=“ON” than M9046=“ON”.

M9047 STL monitoring is enable. D9040~D9047 will be active only when M9047=“ON”.

Register ID No. Description


■ D9040 st
1 active STL step
■ D9041 2nd active STL step
■ D9042 3rd active STL step
■ D9043 4th active STL step When M9047=“ON”, the active STL step ID numbers will be stored in
D9040~D9047, where the D9040 will be stored the lowest ID number,
■ D9044 th
5 active STL step the second lowest one will be stored in D9041 and so forth.
■ D9045 6th active STL step
■ D9046 7th active STL step
■ D9047 8th active STL step

101
4-6 The Relationship Between the SFC and STL
For to programming a step by step movement program, the VS series PLCs provide SFC and STL to choose from. The
relationship between these two methods is described below.

4-6-1 The Step Ladder Instruction (STL)

Mnemonic Staircase chart Devices Function

STL S Step ladder starts

Return to standard ladder, end of the


RET step ladder
RET

A series of steps is composed by the organized STL instructions and devices S. When an STL instruction appears in the
program and the PLC scans to it, that means to change the original sequential procedure into the Step Flow control by the
Step Ladder. While the RET instruction is scanned, that indicates the end of this Step Ladder, subsequently the vertical bus
bar is reset to an ordinary initial logical operation in the Ladder Diagram. However, after the framework of the Step Flow
control is completed, it should be converted into a Step Ladder, and the following important points should be noted during the
conversion:
(1) Output Driving Method
As in the left diagram referred below. If inside the Step Ladder has an LD, LDI, LDP or LDF instruction, an output coil can
not directly connected from the inner bus bar of the STL after one of those instructions had been used.
Please change the left diagram into the right one.
LD X23 Insert a permanently “ON” contact
S20 X21 S20 X21
Y20 Y20
X23 X23
The STL's Y21 Y21
inner bus M9000
bar
Y22 Y22
The permanently “ON” contact

(2) Location of Instructions MPS, MRD and MPP


The MPS, MRD and MPP instructions can not be directly used for the STL's inner bus bar, unless an LD, LDI, LDP or LDF
instruction has been used previously.
LD X20
S20 X20 X21
Y20
MPS X22
The STL's Y21
inner bus
bar MRD X23
Y22
MPP

(3) Transferring Method of STL


As in the diagram referred below, these two instructions SET S21 and OUT S40 are to drive and transfer to another step.
When the active state is transferred to another step, the previous step itself will be reset to “OFF” automatically.
The difference is that the SET instruction is used to drive an immediately following STL step, but the OUT instruction is used
for to distant jump and drive a step which is not immediately following or at the separate STL program ow.
S20 X20 To drive an immediately following STL step, which typically will have a larger STL
SET S21 state number than the current step.
Transfer
condition
X21
S40 To drive a step which is not immediately following or at the separate STL program flow.

(4) Function of Instruction RET


Since the RET instruction represents the end of a Step Flow the RET instruction will appear eventually after a series of steps.
A program may be written many Step Flows each Step Flow should put an instruction RET at the end. The instruction RET
can be used as many times as required.

102
4-6-2 Compare the Descriptive Methods Between the SFC and STL
Simple Flow at the SFC and STL
(a)SFC (b)STL
M9002
M9002 SET S0
S0 X0
S0 SET S20
S20
Y0
X0
X1
SET S21
S20 Y0
S21 M100
Y21
X1 X2
M100 SET S22
S21 Y21 S22 X24
Y22
X2 X26
X24
S22 Y22 X3
X26 SET S0
X3
RET

In diagram (a) SFC, each step has three functions and parts: to drive the output points for loaders to appoint transfer
destination devices and to assign the transition conditions. Such the left SFC by the format of STL is displayed as in
diagram (b), in which we adopt as the symbol for use of STL instructions. And those STL instructions are
provided with the state transfer and auto reset functions.

Selective Branch / Merge at the SFC and STL


(a)SFC (b)STL
S20
Y20
S20 Y20
X0
SET S21
X0 X3
X3
SET S24
S21 Y21 S24 Y24 S21
Y21
X1 X1
SET S22
S22 Y22 S22
Y22
X2 X4 X2
SET S23
S23 Y23 S24
Y24
X4
SET S23
S23
Y23

103
Simultaneously Parallel Branch / Merge at the SFC and STL
(a)SFC (b)STL
S20
Y0
S20 Y0
X0
SET S21
X0
SET S23
S21 M100 S23 M101 S21
M100
X1 X2 X1
SET S22
S22 Y20 S24 Y21 S22
Y20
X3 S23
M101
S25 Y22 X2
SET S24
S24
Y21
S22 S24 X3
SET S25
S25
Y22

Jump at the SFC and STL


(a)SFC (b)STL
S20
Y0
S20 Y0
X0
SET S21
X0
S21
M100
S21 M100 X3
SET S23
X3 X1 X1
SET S22
S22 Y1 S22
Y1
X2 X2
SET S23
S23 Y20 S23
Y20

Repeat at the SFC and STL


(a)SFC (b)STL
S20
Y0
S20 Y0
X0
SET S21
X0
S21
Y1
S21 Y1 X1
SET S22
X1 S22
Y2
S22 Y2 X2
SET S21
X2 X2 X2
SET S23
S23 Y3 S23
Y3

104
4-7 Examples of SFC Applications
4-7-1 Construct the Repeat / Single Run / Single Step Control Modes for a Park Fountain
This example is modied from the example of the Park Fountain in the Section 4-2. It is to demonstrate the controls of
Repeat / Single Run / Single Step.

Single Y0: READY indicator


Run

Si Ste
at

ng p
pe
Y1: The lighting for the fountain

le
Re

Y2: The valve of surrounding nozzles


READY START Y3: The valve of central nozzle

Y0 X1 ON : Repeat X0
X1 OFF : Single Run
X2 ON : Single Step

When the “Repeat” mode (X1=ON, X2=OFF) is selected, press the START button to execute the operation repeatedly.
When the “Single Run” mode (X1=OFF, X2=OFF) is selected, press the START button to execute a cycle of operation.
When the “Single Step” mode (X1=OFF, X2=ON) is selected, press the START button once can make the action to
forward one step.
This program uses the special relay M9040 (ag to prevent the step transfer) to meet the purpose of single-step control.
Users can make good use of this method after understanding it. The two drawings below display using the (a) SFC or
(b) STL in writing the program, in order to comparison reference.
(a) Programming by the SFC
X2 X0 Control the step transfer prevent special relay. It allows step transfer at the
Ladder M9040
Diagram moment X0=ON, to achieve the purpose of single-step control.
in the main M9002
program SET S0 Activate the step S0 in the SFC program

S F C Fountain The SFC is named “Fountain”.

S0 Y0 Turn the READY indicator ON.


X0
T R A N S 1 0 When X0=ON, the active step transfers to S10.

SET Y1 Illuminate the lighting.


S10 K50
T0 Activate the coil of 5 second timer.
T0
T R A N S 11 When the contact T0=ON, the active step transfers to S11.

SET Y2 Drive the valve of surrounding nozzles.


S11 K100
T1 Activate the coil of 10 second timer.
T1
T R A N S 1 2 When the contact T1=ON, the active step transfers to S12.

Y3 Drive the valve of central nozzle.


S12 K200
T2 Activate the coil of 20 second timer.
T2
T R A N S 1 3 When the contact T2=ON, the active step transfers to S13.

RST Y1 Shut the lighting down.


S13
RST Y2 Turn the valve of surrounding nozzles OFF.

X1 X1
TRAN S10 TRAN S0
When X1=ON, chosen to execute the When X1=OFF, chosen to execute the “Single Run”
S10 “Continuous” mode, the active step S0 mode, the active step transfers to S0.
transfers to S10.

105
(b) Programming by the STL
X2 X0 Control the step transfer prevent special relay. It allows step transfer at the moment
M9040 X0=ON, to achieve the purpose of single-step control.
M9002
SET S0 Activate the step S0.
S0
Y0 Turn the READY indicator ON.
X0
SET S10 When X0=ON, the active step transfers to S10.
S10
SET Y1 Illuminate the lighting.
K50
T0 Activate the coil of 5 second timer.
T0
SET S11 When the contact T0=ON, the active step transfers to S11.
S11
SET Y2 Drive the valve of surrounding nozzles.
K100
T1 Activate the coil of 10 second timer.
T1
SET S12 When the contact T1=ON, the active step transfers to S12.
S12
Y3 Drive the valve of central nozzle.
K200
T2 Activate the coil of 20 second timer.
T2
SET S13 When the contact T2=ON, the active step transfers to S13.
S13
RST Y1 Shut the lighting down.

RST Y2 Turn the valve of surrounding nozzles OFF.


X1
When X1=ON, chosen to execute the “Repeat” mode, the active step transfers to
SET S10
S10.
X1
SET S0 When X1=OFF, chosen to execute the “Single Run” mode, the active step
transfers to S0.
RET Returning to standard ladder, step ladder ends.

106
4-7-2 Filling Bottles

Si
ng
at
pe

le
Re

Ru
n
READY START

Y0 X2 X0
ON : Repeat
OFF : Single Run

The lifter of nozzle

Juice
is driven by Y2:
ON : Down
Nozzle valve Y3
OFF: UP
ON : Open valve to ll up
OFF : Close valve
Bottle

Conveyor motor Y1 Bottle inspector X1

Function Description of Bottle Filling:


There is a control panel next to the bottle lling machine. The READY indicator on the front of panel that indicates at the
standby status. Use the START button to activate the device and the mode selector switch to choose from a single run
or repeated operation.
(1) When the machine is ready to start operation, the READY indicator is ON.
(2) Press the START button and the conveyor motor starts to rotate. When the bottle inspector detects that the bottle
has reached the right position, the motor stops rotating.
(3) When the nozzle lifter is ON, the nozzle going down. It is determined that in 3 seconds the lling nozzle will reach the
position.
(4) The injection valve opens and starts lling. In 5 seconds, the lling will be completed and the valve will be closed.
(5) When the valve of the lling nozzle is OFF, the lling nozzle rises. It is determined that in 3 seconds the lling nozzle
will rise to reach the position.
(6) The lling process is completed. At this point, it returns to the state of standby if at the “Single Run” mode; it starts the
conveyor motor again and processes the next bottle ll up if at the “Repeat” mode.
The two drawings below display using the (a) SFC or (b) STL in writing the program, in order to comparison reference.

107
(a) Programming by the SFC
M9002
Ladder SET S0 Activate the step S0 in the SFC program
Diagram
in the main
program S F C Filling_Bottle The SFC is named Filling_Bottle.

S0 Y0 Turn the READY indicator ON.


X0
TRAN S10 When X0=ON, the active step transfers to S10.

Y1 Drive the conveyor motor to move forward

S10 PLS M1
X1 At the moment that the S10 turns from OFF to ON, the input signal
PLS M0 X1 has been already ON for a while. Thus, pay extra attention to
M0 the X1 signal in order to make the step transfer smooth.
M1
TRAN S11

SET Y2 Drive the nozzle lifter to move down.


S11 K30
T0 Activate the coil of 3 second timer.
T0
TRAN S12 When the contact T0=ON, the active step transfers to S12.

Y3 Drive the valve open to ll up the bottle.


S12 K50
T1 Activate the coil of 5 second timer.
T1
TRAN S13 When the contact T1=ON, the active step transfers to S13.

RST Y2 Drive the nozzle lifter to move up.


S13 K30
T2 Activate the coil of 3 second timer.

T2 X2 T2 X2
TRAN S10 TRAN S0
When X1=ON, chosen to execute the When X1=OFF, chosen to execute the “Single Run”
S10 “Repeat” mode, transfer the active S0 mode, the active step transfers to S0.
step transfers to S10.

108
(b) Programming by the STL
M9002
SET S0 Activate the step S0.
S0
Y0 Turn the READY indicator ON.
X0
SET S10 When X0=ON, the active step transfers to S10.
S10
Y1 Drive the conveyor motor to move forward.

PLS M1
X1 At the moment that the S10 turns from OFF to ON, the input signal X1
PLS M0 has been already ON for a while. Thus, pay extra attention to the X1
M0 M1 signal in order to make the step transfer smooth.
SET S11
S11
SET Y2 Drive the nozzle lifter to move down.
K30
T0 Activate the coil of 3 second timer.
T0
SET S12 When the contact T0=ON, the active step transfers to S12.
S12
Y3 Drive the valve open to ll up the bottle.
K50
T1 Activate the coil of 5 second timer.
T1
SET S13 When the contact T1=ON, the active step transfers to S13.
S13
RST Y2 Drive the nozzle lifter to move up.
K30
T2 Activate the coil of 3 second timer.
T2 X2 When X1=ON, chosen to execute the “Repeat” mode, the active step
SET S10
transfers to S10.
X2 When X1=OFF, chosen to execute the “Single Run” mode, the active step
SET S0
transfers to S0.
RET Returning to standard ladder, step ladder ends.

109
4-7-3 Traffic Lights
In this section, we choose the familiar trafc lights, as an example for the description of step-by-step movement.
There are two sets of trafc lights at the crossroads, hereby referred to as Group A lights and Group B lights as shown
below. When the start button X0 is pressed, the sequential control of trafc light is activated. First, the A red and B red
lights are lit. After 2 seconds, B red light goes OFF. Followed by B green light is lit for 8 seconds and ashes for 5
seconds. After that B yellow light is ON for 5 seconds, then shift to the B red ON. In 2 seconds later, Group A lights take
over the operation, following the same sequences of movements as Group B lights.
Red Yellow Green Red Yellow Green

Group A Group B
lights lights

Y0 Y1 Y2 Y3 Y4 Y5

Trafc lights active I/O duration time sheet:

Start X0

A red light Y0 2S

A yellow light Y1 5S

A green light Y2 10S


5S
B red light Y3 2S 2S

B yellow light Y4 5S

B green light Y5 8S
5S

The following demonstrates are compiling by some SFCs and STLs with different programming methods.

110
Below displays simple ow programming, individually using (a) SFC and (b) STL in writing the program, in order to
comparison reference.
(a) Programming by the SFC
M9002
Ladder SET S0 Activate the step S0 in the SFC program.
Diagram
in the main
program S F C Traffic_Light The SFC is named “Trafc_Light”.

S0
X0
TRAN S10 When X0=ON, the active step transfers to S10.

SET Y0 Set A red light ON.

S10 SET Y3 Set B red light ON.


K20
T0 Activate the coil of 2 Sec. timer.
T0
TRAN S11 When the contact T0=ON, the active step transfers to S11.

RST Y3 Reset B red light to OFF.

S11 Y5 B green light is lit.


K80 Activate the coil B green light is lit for 8 Sec.
T1 Repeat this loop to let
of 8 Sec. timer.
T1 the B green light ash
TRAN S12 When the contact T1=ON, the active for 5 times, by 1 Sec.
step transfers to S12. cycle.
K5
S12 T2 Activate the coil of 0.5 Sec. timer.
T2
TRAN S13 When the contact T2=ON, the active step transfers to S13.
K5
C0 Activate the coil of 5 times counter.

S13 Y5 B green light is lit.


K5 Activate the coil of B green light is lit for 0.5 Sec.
T3
0.5 Sec. timer.

T3 C0 When the contacts T3=ON T3 C0


TRAN S14 & C0=ON, the active step TRAN S12
transfers to S14.
When the contacts
RST C0 Reset C0. T3=ON & C0=OFF,
S12
the active step transfers
S14 Y4 B yellow light is lit. to S12.
K50 Activate the coil B yellow light is lit for 5 Sec.
T4
of 5 Sec. timer.
T4
TRAN S15 When the contact T4=ON, the active step transfers to S15.

SET Y3 B red light is lit.


The B red light is lit and kept, even the step will be
S15 K20 Activate the coil transferred after 2 Sec.
T5
of 2 Sec. timer.
T5
TRAN S16 When the contact T5=ON, the active step transfers to S16.

RST Y0 Reset A red light to OFF.

S16 Y2 A green light is lit.


K100 Activate the coil A green light is lit for 10 Sec.
T6
of 10 Sec. timer.
T6
TRAN S17 When the contact T6=ON, the active step transfers to S17.

Continue on next page

111
Repeat this loop to let the
K5 A green light ash for 5
S17 T7 Activate the coil of 0.5 Sec. timer. times, by 1 Sec. cycle.
T7
TRAN S18 When the contact T7=ON, the active step transfers to S18.
K5
C1 Activate the coil of 5 times counter.

S18 Y2 A green light is lit.


K5 Activate the coil of A green light is lit for 0.5 Sec.
T8
0.5 Sec. timer.

T8 C1 When the contacts T8=ON T8 C1


TRAN S19 & C1=ON, the active step TRAN S17
transfers to S19.
When the contacts
RST C1 Reset C1. T8=ON & C1=OFF,
S17
the active step transfers
S19 Y1 A yellow light is lit. to S17.
K50 Activate the coil of A yellow light is lit for 5 Sec.
T9
5 Sec. timer.
T9
TRAN S10 When the contact T9=ON, the active step transfers to S10.

S10

(b) Programming by the STL


M9002
SET S0 Activate the step S0.
S0 X0
SET S10 When X0=ON, the active step transfers to S10.
S10
SET Y0 Set A red light ON.

SET Y3 Set B red light ON.


K20
T0 Activate the coil of 2 Sec. timer.
T0
SET S11 When the contact T0=ON, the active step transfers to S11.
S11
RST Y3 Reset B red light to OFF.

Y5 B green light is lit.


K80 Activate the coil of B green light is lit for 8 Sec.
T1 8 Sec. timer.
T1
SET S12 When the contact T1=ON, the active step transfers to S12.
S12 K5
T2 Activate the coil of 0.5 Sec. timer.
T2 When the contact T2=ON, the active
SET S13 step transfers to S13.
S13 K5
C0 Activate the coil of 5 times counter. Repeat this loop to let the
B green light ash for 5
Y5 B green light is lit. times, by 1 Sec. cycle.
B green light is lit
K5 Activate the coil of for 0.5 Sec.
T3 0.5 Sec. timer.
T3 C0
SET S12 When the contacts T3=ON & C0=OFF,
the active step transfers to S12.
C0
SET S14 When the contacts T3=ON & C0=ON,
the active step transfers to S14.
Continue on next page

112
S14
RST C0 Reset C0.

Y4 B yellow light is lit.


K50 Activate the coil B yellow light is lit for 5 Sec.
T4 of 5 Sec. timer.
T4
SET S15 When the contact T4=ON, the active step transfers to S15.
S15
SET Y3 B red light is lit.
The B red light is lit and kept, even the step will be
K20 Activate the coil transferred after 2 Sec.
T5 of 2 Sec. timer.
T5
SET S16 When the contact T5=ON, the active step transfers to S16.
S16
RST Y0 Reset A red light to OFF.

Y2 A green light is lit.


K100 Activate the coil A green light is lit for 10 Sec.
T6 of 10 Sec. timer.
T6
SET S17 When the contact T6=ON, the active step transfers to S17.
S17 K5
T7 Activate the coil of 0.5 Sec. timer.
T7 When the contact T7=ON, transfer the
SET S18 active step to S18.
S18 K5
C1 Activate the coil of 5 times counter. Repeat this loop to let the
A green light ash for 5 times,
Y2 A green light is lit. by 1 Sec. cycle.
A green light is lit
K5 Activate the coil for 0.5 Sec.
T8 of 0.5 Sec. timer.
T8 C1 When the contacts T8=ON & C1=OFF,
SET S17 the active step transfers to S17.
C1 When the contacts T8=ON & C1=ON,
SET S19 the active step transfers to S19.
S19
RST C1 Reset C1.

Y1 A yellow light is lit.


K50 Activate the coil A yellow light is lit for 5 Sec.
T9 of 5 Sec. timer.
T9
SET S10 When the contact T9=ON, the active step transfers to S10.

RET Returning to standard ladder, step ladder ends.

113
Below displays Simultaneously Parallel Branch / Merge programming, individually using (a) SFC and
(b) STL in writing the program, in order to comparison reference.

(a) Programming by the SFC


M9002
Ladder SET S0 Activate the step S0 in the SFC program.
Diagram
in the main
program S F C Traffic_Light The SFC is named “Trafc_Light”.

S0
X0
TRAN S10 When X0=ON, transfer the active step to S10.

Y0 A red light is lit.

S10 Y3 B red light is lit.


K20
T0 Activate the coil of 2 Sec. timer.
T0
TRAN S20 S30 When the contact T0=ON, the active step transfers to both S20 and S30.

Y5
B green light A red light is lit.
S20 K80 is lit for 8 Sec. S30 Y0
T1 T5 When the contact
T1 TRAN S31 T5=ON, transfer to S31.
If contact T1=ON,
TRAN S21 transfer to S21.
T2 K5 Y2
A green light is lit
T2 S31 K100 for 10 Sec.
T2 The B green light T6
S21 ALT Y5 ash for 5 times, T6 When the contact
M9000 K50 by 1 Sec. cycle. TRAN S32 T6=ON, transfer to S32.
T3 T7 K5
T3 If contact T3=ON, T7
TRAN S22 transfer to S22. T7 The A green light
S32 ALT Y2 ash for 5 times,
by 1 Sec. cycle.
Y4 M9000 K50
B yellow light
S22 K50 is lit for 5 Sec. T8
T4 T8 When the contact
T4 If contact T4=ON, TRAN S33 T8=ON, transfer to S33.
TRAN S23 transfer to S23.
Y1
A yellow light is lit
Y3 B red light is S33 K50 for 5 Sec.
S23 K20 lit. T5's contact T9
T5 ON after 2 Sec.

T9
TRAN S10 When the contact T9=ON, the active step transfers to S10.

S10

114
(b) Programming by the STL
M9002
SET S0 Activate the step S0.
S0 X0
SET S10 When X0=ON, the active step transfers to S10.
S10
Y0 A red light is lit.

Y3 B red light is lit.


K20
T0 Activate the coil of 2 Sec. timer.
T0
SET S20
When the contact T0=ON, the active step transfers to both S20
and S30.
SET S30
S20
Y5 B green light is lit.
K80 B green light is lit for 8 Sec.
T1 Activate the coil of 8 Sec. timer.
T1
SET S21 When the contact T1=ON, the active step transfers to S21.
S21 T2 K5
T2 Activate the coil of 0.5 Sec. timer.
T2 When the contact T2=ON, alters The B green light ash for 5 times,
ALT Y5 the status of B green light. by 1 Sec. cycle.
M9000 K50
T3 Activate the coil of 5 Sec. timer.
T3
SET S22 When the contact T3=ON, the active step transfers to S22.
S22
Y4 B yellow light is lit.
K50 B yellow light is lit for 5 Sec.
T4 Activate the coil of 5 Sec. timer.
T4
SET S23 When the contact T4=ON, the active step transfers to S23.
S23
Y3 B red light is lit.
B red light is lit.
K20 T5's contact ON after 2 Sec.
T5 Activate the coil of 2 Sec. timer.
S30
Y0 A red light is lit.
T5
SET S31 When the contact T5=ON, the active step transfers to S31.
S31
Y2 A green light is lit.
K100 A green light is lit for 10 Sec.
T6 Activate the coil of 10 Sec. timer.
T6
SET S32 When the contact T6=ON, the active step transfers to S32.
S32 T7 K5
T7 Activate the coil of 0.5 Sec. timer.
T7 When the contact T7=ON, The A green light ash for 5 times,
ALT Y2 alters the status of A green light. by 1 Sec. cycle.
M9000 K50
T8 Activate the coil of 5 Sec. timer.
T8
SET S33 When the contacts T8=ON, the active step transfers to S33.
S33
Y1 A yellow light is lit.
K50 A yellow light is lit for 5 Sec.
T9 Activate the coil of 5 Sec. timer.
S23 S33 T9
SET S10 When the contact T9=ON, the active step transfers to S10.

RET Returning to standard ladder, step ladder ends.

115
Below displays Selective Parallel Branch / Merge programming, individually using (a) SFC and (b) STL in writing
the program, in order to comparison reference.

(a) Programming by the SFC


M9002
Ladder SET S0 Activate the step S0 in the SFC program.
Diagram
in the main
program S F C Traffic_Light The SFC is named “Trafc_Light”.

S0
X0
TRAN S10 When X0=ON, the active step transfers to S10.

SET Y0 Set A red light ON.

SET Y3 Set B red light ON.


S10 K20
T0 Activate the coil of 2 Sec. timer.
T0 When the contact T0=ON, alters the ON/OFF status of M0.
ALT M0 The active step transfers to either S20 (M0=ON, B group go) or
S30 (M0=OFF, A group go).
When
When T0=ON &
T0 M0 T0 M0 T0=ON &
M0=ON, transfer
TRAN S20 to S20. TRAN S30 M0=OFF,
transfer to S30.
Reset B red Reset A
RST Y3 light to OFF. RST Y0 red light
to OFF
S20 Y5 B green S30 Y2 A green
light is lit light is
K80 K100 lit for
T1 for 8 Sec. T1 10 Sec.

T1 When the contact T1 When the


TRAN S21 T1=ON, TRAN S31 contact
T1=ON,
transfer to S21. transfer to S31.
T2 K5 T2 K5
The B green The A
T2 T2
light ash green
T2 for T2 light ash
S21 ALT Y5 5 times, S31 ALT Y2 for 5 times,
M9000 K50 by 1 Sec. M9000 K50 by 1 Sec.
T3 cycle. T3 cycle.

T3 When the T3 When the


TRAN S22 contact T3=ON, TRAN S32 contact
T3=ON,
transfer to S22. transfer to S32.

Y4 B yellow Y1 A yellow
S22 K50 light is lit S32 K50 light is lit
T4 for 5 Sec. T4 for 5 Sec.

When the When the


T4 contact T4
TRAN S10 TRAN S10 contact
T4=ON,
T4=ON,
transfer to S10. transfer to S10.

S10

116
The example above via slightly modify that could execute the “general trafc light control” or “trafc light adds with
yellow ash control”. The select signal from a switch is to the X0 input.

S0 ZRST Y0 Y5 Clear all the outputs Y0~Y5 to OFF.

X0 X0 If X0=OFF, executes the


“trafc light adds with yellow
TRAN S10 TRAN S40 ash control”.
If X0=ON, executes the
S10 “general traffic light control”.
T2 K5 Switch the states of A and
T2
B yellow lights every 0.5
T2 Sec. Those instructions
S20 S30 S40 ALT Y1 achieve the purpose of 1
Sec. frequency yellow light
ALT Y4 ashing.

S21 S31

S22 S32
X0
TRAN S0 When X0=ON, transfer to S0.

S0

117
(b) Programming by the STL
M9002
SET S0 Activate the step S0.
S0 X0
SET S10 When X0=ON, the active step transfers to S10.
S10
SET Y0 Set A red light ON.

SET Y3 Set B red light ON.


K20
T0 Activate the coil of 2 Sec. timer.
T0 When the contact T0=ON, alters the ON/OFF status of M0.
ALT M0 This M0 is about to select either B group go (M0=ON) or A group go (M0=OFF).
T0 M0
SET S20 When the contact T0=ON & M0=ON, the active step transfers to S20.
M0
SET S30 When the contact T0=ON & M0=OFF, the active step transfers to S30.
S20
RST Y3 Reset B red light to OFF.

Y5 B green light is lit.


K80 Activate the coil of 8 Sec. timer. B green light is lit for 8 Sec.
T1
T1
SET S21 When the contact T1=ON, the active step transfers to S21.
S21 T2 K5
T2 Activate the coil of 0.5 second timer.
T2 When the contact T2=ON, alters The B green light ash for 5 times,
ALT Y5 the status of B green light. by 1 Sec. cycle.
M9000 K50
T3 Activate the coil of 5 Sec. timer.
T3
SET S22 When the contact T3=ON, the active step transfers to S22.
S22
Y4 B yellow light is lit.
K50 B yellow light is lit for 5 Sec.
T4 Activate the coil of 5 Sec. timer.
T4
SET S10 When the contact T4=ON, the active step transfers to S10.
S30
RST Y0 Reset A red light to OFF.

Y2 A green light is lit.


K100 A green light is lit for 10 Sec.
T1 Activate the coil of 10 Sec. timer.
T1
SET S31 When the contact T1=ON, the active step transfers to S31.
S31 T2 K5
T2 Activate the coil of 0.5 Sec. timer.
T2 When the contact T2=ON, alters The A green light ash for 5 times,
ALT Y2 the status of A green light. by 1 Sec. cycle.
M9000 K50
T3 Activate the coil of 5 Sec. timer.
T3
SET S32 When the contact T3=ON, the active step transfers to S32.
S32
Y1 A yellow light is lit.
K50 A yellow light is lit for 5 Sec.
T4 Activate the coil of 5 Sec. timer.
T4
SET S10 When the contact T4=ON, the active step transfers to S10.

RET Returning to standard ladder, step ladder ends.

118
4-7-4 Mechanical Double-Decked Parking Space

Y1 1 Y3 2 Y5 3

Y0 Y2 Y4

X0 X1 X2

4 5

Y6 Y7 Y10 Y11
X3 X4 X5

The Calling Panel

READY Y12

Car No.1 X10

Car No.2 X11

Car No.3 X12

The car parking in the lower level is usable, but the upper level is for storage only. When the READY indicator is ON and
press a No. button on the calling panel, the decks will start to move. The decks on the upper level (No.1, 2, 3 parking
spaces) can only move up or down, while the decks on the lower level (No.4, 5 parking spaces) can only move
horizontally. When the upper parking space moves to the lower level, the car picking-up action is completed, and the
READY indicator will be ON again.
As in the picture above, the No. 2 button is pressed in to pick the car up. Firstly the No. 5 deck should move to the
empty space at its right. When it reaches the position, the No. 2 decks begins to decline to the lower level, and then the
car picking-up action is completed.

The operation in this example is composed of the following three steps to complete the car picking-up action:
Step 1: Except for the target car, move all cars which belong to the upper parking spaces back to the upper level (if any
parked currently in the lower level). The S10, S20 or S30 executes the movement in this step.
Step 2: The deck below the target car should be removed in order to make a space for it. The S11, S21 or S31 executes
the movement in this step.
Step 3: The target car will descend to the lower level and the car picking-up action is complete. The S12, S22 or S32
executes the movement in this step.

The operation is by pressing the button to select a process ow and its following steps complete that sequentially. This
operation fully featured the SFC’s attributes of being easy to understand.
Below individually using (a) SFC and (b) STL in writing the program, in order to comparison reference.

119
(a) Programming by the SFC
M9002
Ladder SET S0 Activate the step S0 in the SFC program.
Diagram
in the main
program SFC DoubleDeckedPark The SFC is named “DoubleDeckedPark”.

S0 Y12

X10 X11 X12


TRAN S10 TRAN S20 TRAN S30
X1 X0 X0
Y3 Y1 Y1
S10 X2 S20 X2 S30 X1
Y5 Y5 Y3
X1 X2 X0 X2 X0 X1
TRAN S11 TRAN S21 TRAN S31
X4 X3 X3
Y7 Y6 Y6
S11 X5 S21 X5 S31 X4
Y11 Y11 Y10
X4 X5 X3 X5 X3 X4
TRAN S12 TRAN S22 TRAN S32

S12 Y0 S22 Y2 S32 Y4


X3 X4 X5
TRAN S0 TRAN S0 TRAN S0

S0

(b) Programming by the STL

M9002 S21 X3
SET S0 Y6
S0 X5
Y12 Y11
X10 X3 X5
SET S10 SET S22
X11 S22
SET S20 Y2
X12 X4
SET S30 SET S0
S10 X1 S30 X0
Y3 Y1
X2 X1
Y5 Y3
X1 X2 X0 X1
SET S11 SET S31
S11 X4 S31 X3
Y7 Y6
X5 X4
Y11 Y10
X4 X5 X3 X4
SET S12 SET S32
S12 S32
Y0 Y4
X3 X5
SET S0 SET S0
S20 X0
Y1 RET
X2
Y5
X0 X2
SET S21
Continue to
the right.

120
5 General Rules of Application Instructions
5-1 The Formats of Application Instructions
Instruction and Operand

Each application instruction has its unique instruction mnemonic, e.g. ADD, CMP..... , etc.

Some application instructions are purely made up of themselves:

WDT

Instruction

Most of the application instructions are constituted by instruction themselves and several “Operands”:

SMOV S m1 m2 D n

Instruction Operand

As shown above S , m 1 , m 2 , D , n are Operands. There are many types of Operand in application instructions,
their symbolic meanings are:
S : Source Operand (device). It usually refers to the Operand with unchanged contents after executed.
S 1 , S 2 ...represent multiple source Operands for an instruction.

D : Destination Operand (device). It usually refers to the Operand in which instruction execution outcomes are stored.
D 1 , D 2 ...represent multiple destination Operands for an instruction.

m , n : Those Operands used to specify operational constants. But some m , n of instruction can use
Register D or R to execute indirect specification. m 1 , m 2 , n1 , n 2 ... represent multiple m , n .

For programming software such as the Ladder Master S, a space is needed between the instruction and each operand
to separate them.

Devices for Operand


Based on the needs, each application instruction owns different number of Operands. And each application instruction
has different device types. The available types of each Operand device are shown as in the following table:

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D

The “ ” in the table above indicates the operand which can be modified by an Index Register V, Z; while the “ ”
means not modifiable.
In the application instructions, if a D.b, R.b or V, Z is specied as the device of the operand, using V or Z for
modication is prohibited.
After organized, continuous bit devices are displayed as KnX, KnY, KnM, KnS to store data. That “n” behind K is to
represent how many continuous “Nibbles” will be used.
Those T and C in the table above refer the present value registers of Timer (T) and Counter (C).
All of T0~T511, C0~C199, D and R are 16-bit registers. When the instruction species the process of 32-bit data,
two consecutive 16-bit registers will be occupied. For example, if a 32-bit instruction species to use the D100 as its
Operand, then a 32-bit register (which is composed of D101 and D100) will be occupied. While the D101 will assign
to the upper 16 bits and the D100 is the lower 16 bits. The same rule is also applied to the T, C and R.
The 32-bit Counter (C200~C255) can be used as the Operand of a 32-bit instruction only.
The UnG in the table refers to the BFM in the special module. For example, U1G3 indicates the operand of this
instruction is specied to the BFM #3 in the special module No. 1. Since the programming software Ladder Master
S at the monitoring mode could not to read the status at the special module's BFM directly, the operand in the
instruction which is appointed to the UnG will not have the correct value to display.
The letter E in the table refers to a real number constant.
The “$” in the table refers to a string that is composed of ASCII code.

121
16-bit or 32-bit Instructions
Because of different Operand value sizes, some of the application instruction can be organized into 16-bit instruction
or 32-bit instruction.
S D
MOV D0 D10 A 16-bit instruction, the content of D0 is transferred to D10.

S D
DMOV D0 D10 A 32-bit instruction, the contents of (D1, D0) are transferred to (D11, D10).

A 32-bit instruction is displayed with a “D” (to be added directly BEFORE the instruction mnemonic), e.g. MOV
represents a 16-bit instruction, while DMOV represents a 32-bit instruction.
The device ID. number specied by an Operant of a 32-bit instruction can be an even or odd number. In order not to
get confusion, it is recommended to use an even number, if it is possible.
The 32-bit Counter (C200~C255) can be used as the Operand of a 32-bit instruction only.
At the instruction list, if a sign is marked on the left side of the instruction mnemonic, the explanation is below:
1 There is no other extra sign on the left of instruction, this indicates it can be executed by the way of 16-bit only.
For example, BMOVP S D n
2 There is a reverse out D on the left, this indicates that it can be either 16 or 32-bit instruction. For example:
DMOVP S D

3 There is a framed D on the left, this indicates that the instruction is only 32-bit instruction. For example:
D H S C S S1 S2 D

Pulse Execution Instructions

Based on requires, some application instruction can be organized into continuous execution instruction or pulse
execution instruction.
X20
Sequential execution instruction: When X20=”ON”, the instruction will be executed once
MOV D0 D1 in each scan cycle.

X20
Pulse execution instruction: The instruction is only executed once when
MOVP D0 D1
X20=“OFF” → “ON”.

A pulse instruction displayed with a “P” (to be added directly AFTER the instruction mnemonic), e.g. MOV represents
a sequential execution instruction, while MOVP represents a pulse execution instruction.
Suitable using pulse execution instructions to replace sequential execution instructions in a program, can cut down
unnecessary execution time.
When X20=“OFF”, both MOV and MOVP instuctions are not executed.
At the instruction list, if a sign is marked on the right side of the instruction mnemonic, the explanation is below:
1 There is no other extra sign on the right of instruction, this indicates that the instruction is sequential execution
instruction only. For example, I N C D S1 S2 D n

2 There is a reverse out P on the right, this indicates that it can be either a sequential execution instruction or pulse
execution instruction. For example: DMOVP S D

122
5-2 Data Process of Application Instructions
The X, Y, M and S are called bit devices, because they have only two different status (“ON” or “OFF”). But the T, C
D and R are called word devices because they are specially used to store data. Some bit devices can be a group
together as a word device pattern, shown in the form of Kn X, Kn Y, Kn M and Kn S. This organized bits become a word
device, that can be used in an application instruction for storage of data.
When bit devices are organized as a word device, each digit of a hexadecimal word is composed by 4 bit devices
(a Nibble). The Kn portion of the statement identifies the range of devices included. The “n ” can be a number from
the range 1 to 8 and it actual represents 4×n bit devices (n digits hexadecimal word or n Nibbles). Thence, the bit
devices to be used as a word component that number of organized bits is the multiple of 4.
K1M0 refers to a one-digit of hexadecimal word device, that is composed of M0~M3.
K2M0 refers to a two-digit of hexadecimal word device, that is composed of M0~M7.
K4M0 refers to a four-digit of hexadecimal word device, that is composed of M0~M15.
K5M0 refers to a five-digit of hexadecimal word device, that is composed of M0~M19.
K8M0 refers to an eight-digit of hexadecimal word device, that is composed of M0~M31.
Data transference between registers and word devices which are composed of bit devices, the change should study
up by the example below.
b15 b0
0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 D0

The unused bits will not


changed, keep the status Execution MOV D0 K2M0
as before

1 0 1 0 1 0 1 0 K2M0
M15 M14 M13 M12 M11 M10 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0

Execution MOV K2M0 D1


Added with “0”

0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 D1
b15 b0

When bit devices are organized as a word device, the header ID number of bit device can be specified as any legally
device. But recommend to specify the Kn X or Kn Y is by the ID number ended with “0”, such as the X0, X20, Y20,
Y30..., while to specify the ID number of the Kn M or Kn S is the multiple of “8”, such as the M0, M8, M16... The
recommendations can improve system efficiency.
When the Operand of an application instruction is transformed to several sequential devices, the sequential ID
number at different types are referred as below:
1 Word device (16 bits)
D0,D1,D2,D3 ............
R0,R1,R2,R3 .............
T0,T1,T2 .....................
C0,C1,C2 ....................
2 Double-word device (32 bits)
D0(D1,D0),D2(D3,D2),D4(D5,D4)............
R0(R1,R0),R2(R3,R2),R4(R5,R4).............
T0(T1,T0),T2(T3,T2),T4(T5,T4) ................
C200,C201,C202 ................
3 Word device which is composed of bit devices
K1X20,K1X24,K1X30,K1X34 ............
K2Y20,K2Y30,K2Y40,K2Y50 ............
K3M0,K3M12,K3M24,K3M36 .........
K4S0,K4S16,K4S32,K4S48 .............

123
5-3 Precautions of Using Application Instruction

Flags
The execution result is related to the Application Instruction and that will cause some change to the corresponding
flags:
M9020 : Addition / Subtraction Zero Flag
M9021 : Borrow Flag
M9022 : Carry Flag
M9023 : Multiplication / Division Zero Flag
M9025 : Division Overow Flag
M9029 : Instruction Execution Completed Flag
When processing an Application Instruction, the status (ON/OFF) of corresponding flags will be changed according
to the result; but when the Application Instruction is not executed, the status of corresponding flags will be kept.
Since there are so many instructions in the program will change and cover the status of same flags, to plan a program
must notice about this.

Floating Point Instructions


The list of relative Application Instructions for processing floating point values.
FLT(FNC49) DECMP(FNC110) DEZCP(FNC111) DEMOV(FNC112)
DESTR ( FNC116 ) DEVAL ( FNC117 ) DEBCD(FNC118) DEBIN(FNC119)
DEADD(FNC120) DESUB(FNC121) DEMUL(FNC122) DEDIV(FNC123)
DEXP ( FNC124 ) DLOGE ( FNC125 ) DLOG10(FNC126) DESQR(FNC127)
DENEG ( FNC128 ) INT(FNC129) DSIN(FNC130) DCOS(FNC131)
DATAN P (FNC135)
DTAN(FNC132) DAS I N ( FNC133 ) DACOS(FNC134)
D RAD( FNC136 ) DDEG ( FNC137 )

Every oating point number will occupy two registers.


The format of oating point number store in registers, please refer to the section 2-13 “Numerical System”.
If the source operand of a oating point operation instruction is a constant number K or H, the instruction will
automatically transform this constant number to a BIN oating point number during the processing.
When a oating point function is used, please pay attention to the format of its operands.

124
6.Application Instructions
The VS Series PLC has many application instructions, each instruction has its specific function. The PLC will easily
achieve a complicated control system also diminish programming codes and programming development time
effectively by cleverly using these instructions. We hope readers will have an in-depth understanding of the application
instructions and make the best use of them.

6-1 Application Instruction Table


Series
FNC No. Mnemonic Brief Function Introduction Page
VS1 VS2 VSM VS3
Program Flow Instructions
00 CJ P Conditional Jump ○ ○ ○ ○ 132
01 CALL P Call Subroutine ○ ○ ○ ○ 133
02 SRET Subroutine Return ○ ○ ○ ○ 133
03 IRET Interrupt Return ○ ○ ○ ○ 134
04 EI Enable Interrupt ○ ○ ○ ○ 134
05 DI Disable Interrupt ○ ○ ○ ○ 134
06 FEND First End ○ ○ ○ ○ 135
07 WDT P Watch Dog Timer Refresh ○ ○ ○ ○ 136
08 FOR Start of a FOR-NEXT Loop ○ ○ ○ ○ 137
09 NEXT End of a FOR-NEXT Loop ○ ○ ○ ○ 137
Comparison Instructions
10 D CMP P Compare ○ ○ ○ ○ 140
11 D ZCP P Zone Compare ○ ○ ○ ○ 141
224 D LD= Initial In-line Compare, (S1) = (S2) ○ ○ ○ ○ 342
225 D LD> Initial In-line Compare, (S1) > (S2) ○ ○ ○ ○ 342
226 D LD< Initial In-line Compare, (S1) < (S2) ○ ○ ○ ○ 342
228 D LD<> Initial In-line Compare, (S1) ≠ (S2) ○ ○ ○ ○ 342
229 D LD<= Initial In-line Compare, (S1) ≤ (S2) ○ ○ ○ ○ 342
230 D LD>= Initial In-line Compare, (S1) ≥ (S2) ○ ○ ○ ○ 342
232 D AND= Serial In-line Compare, (S1) = (S2) ○ ○ ○ ○ 342
233 D AND> Serial In-line Compare, (S1) > (S2) ○ ○ ○ ○ 342
234 D AND< Serial In-line Compare, (S1) < (S2) ○ ○ ○ ○ 342
236 D AND<> Serial In-line Compare, (S1) ≠ (S2) ○ ○ ○ ○ 342
237 D AND<= Serial In-line Compare, (S1) ≤ (S2) ○ ○ ○ ○ 342
238 D AND>= Serial In-line Compare, (S1) ≥ (S2) ○ ○ ○ ○ 342
240 D OR= Parallel In-line Compare, (S1) = (S2) ○ ○ ○ ○ 342
241 D OR> Parallel In-line Compare, (S1) > (S2) ○ ○ ○ ○ 342
242 D OR< Parallel In-line Compare, (S1) < (S2) ○ ○ ○ ○ 342
244 D OR<> Parallel In-line Compare, (S1) ≠ (S2) ○ ○ ○ ○ 342
245 D OR<= Parallel In-line Compare, (S1) ≤ (S2) ○ ○ ○ ○ 342
246 D OR>= Parallel In-line Compare, (S1) ≥ (S2) ○ ○ ○ ○ 342
Move Instructions
12 D MOV P Move ○ ○ ○ ○ 142
13 SMOV P Shift Move ○ ○ ○ ○ 143
14 D CML P Complement ○ ○ ○ ○ 144
15 BMOV P n → n Block Move ○ ○ ○ ○ 145
16 D FMOV P 1 → n Fill Move ○ ○ ○ ○ 146
17 D XCH P Exchange ○ ○ ○ ○ 147
Code Exchange Instructions
18 D BCD P Convert BIN to BCD ○ ○ ○ ○ 148
19 D BIN P Convert BCD to BIN ○ ○ ○ ○ 148
170 D GRY P Convert BIN to Gray Code ○ ○ ○ ○ 305

125
Series
FNC No. Mnemonic Brief Function Introduction Page
VS1 VS2 VSM VS3
Code Exchange Instructions
171 D GBIN P Convert Gray Code to BIN ○ ○ ○ ○ 306
260 D DABIN P Convert Decimal ASCII String to BIN Number ○ 349
261 D B I NDA P Convert BIN Number to Decimal ASCII String ○ 350
Arithmetic Insructions
20 D ADD P Addition (S1) + (S2) → (D) ○ ○ ○ ○ 150
21 D SUB P Subtraction (S1) – (S2) → (D) ○ ○ ○ ○ 151
22 D MUL P Multiplication (S1) × (S2) → (D + 1,D) ○ ○ ○ ○ 152
23 D DIV P Division (S1) ÷ (S2) → (D),(D + 1) ○ ○ ○ ○ 153
24 D INC P Increment (D) + 1 → (D) ○ ○ ○ ○ 154
25 D DEC P Decrement (D) – 1 → (D) ○ ○ ○ ○ 154
29 D NEG P Negation (D) + 1 → (D) ○ ○ ○ ○ 156
45 D MEAN P Mean ○ ○ ○ ○ 171
48 D SQR P Square Root ○ ○ ○ ○ 174
Logical Operation Instructions
26 D WAND P Logic Word AND ○ ○ ○ ○ 155
27 D WOR P Logic Word OR ○ ○ ○ ○ 155
28 D WXOR P Logic Word Exclusive OR ○ ○ ○ ○ 155
44 D BON P Check Specified Bit Status ○ ○ ○ ○ 170
Rotary Instructions
30 D ROR P Rotation Right ○ ○ ○ ○ 158
31 D ROL P Rotation Left ○ ○ ○ ○ 158
32 D RCR P Rotation Right with Carry ○ ○ ○ ○ 159
33 D RCL P Rotation Left with Carry ○ ○ ○ ○ 159
Shift Instructions
34 SFTR P Bit Shift Right ○ ○ ○ ○ 160
35 SFTL P Bit Shift Left ○ ○ ○ ○ 160
36 WSFR P Word Shift Right ○ ○ ○ ○ 161
37 WSFL P Word Shift Left ○ ○ ○ ○ 162
213 SFR P Shift n Bit Right in 16-bit Word Data with Carry ○ 339
214 SFL P Shift n Bit Left in 16-bit Word Data with Carry ○ 339
Data Table Handling Instructions
38 SFWR P Shift Register Write (FIFO Write) ○ ○ ○ ○ 163
39 SFRD P Shift Register Read (FIFO Read) ○ ○ ○ ○ 164
210 FDEL P Delete Data from Specific Location of Table ○ 336
211 FINS P Insert Data into Specific Location of Table ○ 337
212 POP P Shift the Last Register Read (FIFO Last Read) ○ 338
Data Processing Instructions
40 ZRST P Zone Reset ○ ○ ○ ○ 166
41 DECO P Decode ○ ○ ○ ○ 167
42 ENCO P Encode ○ ○ ○ ○ 168
43 D SUM P The Sum of Active Bits ○ ○ ○ ○ 169
61 D SER P Search a Data Stack ○ ○ ○ ○ 194
69 SORT Sort Tabulated Data ○ ○ ○ ○ 203
140 D WSUM P Sum of Word Data ○ 282
141 WTOB P Split Word to Byte ○ 283
142 BTOW P Combine Byte to Word ○ 284
143 UNI P Combine 4-bit Nibble to Word ○ 285
144 DIS P Separate Word to 4-bit Nibble ○ 286

126
Series
FNC No. Mnemonic Brief Function Introduction Page
VS1 VS2 VSM VS3
Data Processing Instructions
147 D SWAP P Swap High / Low Byte ○ ○ ○ ○ 287
148 D SORT2 Sort Tabulated Data 2 ○ ○ ○ ○ 288
Floating Point Arithmetic Instructions
49 D FLT P BIN Integer → BIN Floating Point Format ○ ○ ○ ○ 175
110 D ECMP P Compare Two BIN Floating Point Numbers ○ ○ ○ ○ 256
111 D EZCP P Compare a BIN Float No. to BIN Float Zone ○ ○ ○ ○ 257
112 D EMOV P Move Floating Point Data ○ ○ ○ ○ 258
116 D ESTR P Convert BIN Floating Point to Character String ○ 259
117 D EVAL P Convert Character String to BIN Floating Point ○ 261
118 D EBCD P Convert BIN to DEC Floating Point Format ○ ○ ○ ○ 262
119 D EBIN P Convert DEC to BIN Floating Point Format ○ ○ ○ ○ 262
120 D EADD P BIN Floating Point Addition ○ ○ ○ ○ 263
121 D ESUB P BIN Floating Point Subtraction ○ ○ ○ ○ 264
122 D EMUL P BIN Floating Point Multiplication ○ ○ ○ ○ 265
123 D EDIV P BIN Floating Point Division ○ ○ ○ ○ 266
124 D EXP P BIN Floating Point Number Exponent ○ ○ ○ ○ 267
125 D LOGE P BIN Floating Point Nature Logarithm ○ ○ ○ ○ 268
126 D LOG10 P BIN Floating Point Common Logarithm ○ ○ ○ ○ 269
127 D ESQR P BIN Floating Point Square Root ○ ○ ○ ○ 270
128 D ENEG P BIN Floating Point Negation ○ ○ ○ ○ 271
129 D INT P BIN Floating Point → BIN Integer Format ○ ○ ○ ○ 272
130 D SIN P Calculate Sine ○ ○ ○ ○ 273
131 D COS P Calculate Cosine ○ ○ ○ ○ 274
132 D TAN P Calculate Tangent ○ ○ ○ ○ 275
133 D ASIN P Calculate Arc Sine ○ ○ ○ ○ 276
134 D ACOS P Calculate Arc Cosine ○ ○ ○ ○ 277
135 D ATAN P Calculate Arc Tangent ○ ○ ○ ○ 278
136 D RAD P Convert Angle From Degrees to Radians ○ ○ ○ ○ 279
137 D DEG P Convert Angle From Radians to Degrees ○ ○ ○ ○ 280
High Speed Processing Instructions
50 REF P I/O Refresh ○ ○ ○ ○ 178
51 REFF P I/O Refresh and Filter Adjust ○ ○ ○ ○ 179
52 MTR Input Matrix ○ ○ ○ ○ 180
53 D HSCS Software High Speed Counter Set ○ ○ ○ ○ 181
54 D HSCR Software High Speed Counter Reset ○ ○ ○ ○ 183
55 D HSZ Software High Speed Counter Zone Compare ○ ○ ○ ○ 184
56 D SPD Speed Detection ○ ○ ○ ○ 186
57 D PLSY Pulse Y Output ○ ○ ○ ○ 187
58 PWM Pulse Width Modulation ○ ○ ○ ○ 189
59 D PLSR Pulse Ramp ○ ○ ○ ○ 190
189 D HHCMV P Hardware High Speed Counter Data Move ○ ○ ○ ○ 315
280 D HSCT Software High Speed Counter Table Compare ○ ○ ○ ○ 351
Handy Instructions
62 D ABSD Absolute Drum Sequencer ○ ○ ○ ○ 195
63 INCD Incremental Drum Sequencer ○ ○ ○ ○ 197
64 TTMR Teaching Timer ○ ○ ○ ○ 198
65 STMR Special Timer ○ ○ ○ ○ 199
66 ALT P Alternate State ○ ○ ○ ○ 200

127
Series
FNC No. Mnemonic Brief Function Introduction Page
VS1 VS2 VSM VS3
Handy Instructions
67 RAMP Ramp Variable Value ○ ○ ○ ○ 201
88 PID PID Control Loop ○ ○ ○ ○ 229
90 DBRD P Read Data From Data Bank ○ ○ ○ ○ 244
91 DBWR P Write Data Into Data Bank ○ ○ ○ ○ 245
92 TPID Temperature PID Control ○ ○ ○ ○ 246
93 DTRD P Read Data From Data Table ○ ○ ○ ○ 253
102 ZPUSH P Batch Store of All Index Register ○ 254
103 ZPOP P Batch Recover of All Index Register ○ 254
256 D LIMIT P Limit Control ○ 344
257 D BAND P Dead Band Control ○ 345
258 D ZONE P Zone Shift Control ○ 346
259 D SCL P Scaling ○ ○ ○ ○ 347
269 D SCL2 P Scaling 2 ○ ○ ○ ○ 347
External Setting and Display Instructions
70 D TKY Ten Key Input ○ ○ ○ ○ 206
71 D HKY Hexadecimal Key Input ○ ○ ○ ○ 207
72 DSW Digital Switch (Thumbwheel) Input ○ ○ ○ ○ 209
73 SEGD P Seven Segment Decoder ○ ○ ○ ○ 210
74 SEGL Seven Segment with Latch ○ ○ ○ ○ 211
76 ASC Convert Letters to ASCII Code ○ ○ ○ ○ 212
77 PR Print ASCII Code ○ ○ ○ ○ 213
78 D FROM P Read From Special Module ○ ○ ○ 214
79 D TO P Write To Special Module ○ ○ ○ 215
Serial Port Communication Instructions
80 RS Receive/Send Communication ○ ○ ○ ○ 218
81 D PRUN P Parallel Run (Octal Mode) ○ ○ ○ ○ 223
82 ASCI P Convert HEX to ASCII ○ ○ ○ ○ 224
83 HEX P Convert ASCII to HEX ○ ○ ○ ○ 225
84 CCD P Check Code ○ ○ ○ ○ 226
○ ○ ○ ○
87 CPUL CPU Link Communication 227
89 LINK Easy Link Communication ○ ○ ○ ○ 240
149 MBUS MODBUS Communication ○ ○ ○ ○ 290
Real Time Clock Related Instructions
160 TCMP P Time Compare ○ ○ ○ ○ 294
161 TZCP P Time Zone Compare ○ ○ ○ ○ 295
162 TADD P Time Addition ○ ○ ○ ○ 296
163 TSUB P Time Subtraction ○ ○ ○ ○ 297
164 D HTOS P Convert Hour to Second ○ ○ ○ ○ 298
165 D STOH P Convert Second to Hour ○ ○ ○ ○ 299
166 TRD P Read RTC Data ○ ○ ○ ○ 300
167 TWR P Set RTC Data ○ ○ ○ ○ 301
Timer Instructions
169 D HOUR Hour Meter ○ ○ ○ ○ 304
176 TFT Timer (10 ms.) ○ ○ ○ ○ 307
177 TFH Timer (100 ms.) ○ ○ ○ ○ 308
178 TFK Timer (1 s.) ○ ○ ○ ○ 309
Block Data Handling Instructions
192 D BK P Block Data Subtraction ○ 318

128
Series
FNC No. Mnemonic Brief Function Introduction Page
VS1 VS2 VSM VS3
Block Data Handling Instructions
193 D BK P Block Data Subtraction ○ 319
194 D BKCMP= P Block Data Compare (S1) = (S2) ○ 320
195 D BKCMP> P Block Data Compare (S1) > (S2) ○ 320
196 D BKCMP< P Block Data Compare (S1) < (S2) ○ 320
197 D BKCMP<> P Block Data Compare (S1) ≠ (S2) ○ 320
198 D BKCMP<= P Block Data Compare (S1) ≤ (S2) ○ 320
199 D BKCMP>= P Block Data Compare (S1) ≥ (S2) ○ 320
Character String Handling Instructions
200 D STR P BIN to Character String Conversion ○ 322
201 D VAL P Character String to BIN Conversion ○ 324
202 $ P Join Up Two Character Strings ○ 326
203 LEN P Character String Length Detection ○ 327
204 R I GHT P Read Character from the Right of String ○ 328
205 LEFT P Read Character from the Left of String ○ 329
206 M I DR P Read Character from Specific Place of String ○ 330
207 M I DW P Write Character to Specific Place of String ○ 331
208 I NS TR P Search Character String from another String ○ 333
209 $ MOV P Transfer Character String ○ 334
Positioning Control Instructions
300 D ZRN Zero Return ○ ○ ○ ○ 430
301 D JOGF Jog Forward ○ ○ ○ ○ 432
302 D JOGR Jog Reverse ○ ○ ○ ○ 432
303 D DRVR Drive to Relative Position ○ ○ ○ ○ 434
304 D DRVA Drive to Absolute Position ○ ○ ○ ○ 436
305 D DV2R Drive to Relative Position by 2 Stages ○ ○ ○ ○ 438
306 D DV2A Drive to Absolute Position by 2 Stages ○ ○ ○ ○ 440
307 D DVIT Interrupt Constant Quantity Positioning ○ ○ ○ ○ 442
308 D DV2I 2 Stages Interrupt Constant Quantity Position ○ ○ ○ ○ 444
309 D DVSR IngInterrupt to Stop or Drive to Relative Position ○ ○ ○ ○ 446
310 D DVSA Interrupt to Stop or Drive to Absolute Position ○ ○ ○ ○ 448
311 D PLSV Variable Speed Pulse Output ○ ○ ○ ○ 450
312 DTBL Data Table Positioning ○ ○ ○ ○ 452
313 D ABS Absolute Current Value Read ○ ○ ○ ○ 458
314 MPG Handwheel Positioning ○ ○ ○ ○ 459
315 D LIR Relatively Linear Interpolation ○ ○ ○ ○ 462
316 D LIA Absolutely Linear Interpolation ○ ○ ○ ○ 465
Other Instructions
46 ANS Timed Annunciator Set ○ ○ ○ ○ 172
47 ANR P Annunciator Reset ○ ○ ○ ○ 172
184 RND P Generate Random Number ○ ○ ○ ○ 312
186 DUTY Timing Pulse Generation ○ 313
188 CRC P Cyclic Redundancy Check - 16 ○ ○ ○ ○ 314

129
130
6-2 Program Flow Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3

00 CJP S Conditional Jump ○ ○ ○ ○

01 CALLP S Call Subroutine ○ ○ ○ ○

02 SRET Subroutine Return ○ ○ ○ ○

03 IRET Interrupt Return ○ ○ ○ ○

04 EI Enable Interrupt ○ ○ ○ ○

05 DI Disable Interrupt ○ ○ ○ ○

06 FEND First End ○ ○ ○ ○

07 WDTP Watch Dog Timer Refresh ○ ○ ○ ○

08 FOR n Start of a FOR-NEXT Loop ○ ○ ○ ○

09 NEXT End of a FOR-NEXT Loop ○ ○ ○ ○

131
FNC Conditional Jump
1 2 M 3
00 CJP S
○ ○ ○ ○

Devices
Operand
P By a numeric pointer or an user-dened 16 English characters pointer
S
Numeric pointer: P0~P1023 The total amount of Mark / Branch and numeric pointers is 1024.

S S : the destination Pointer of the Conditional Jump instruction


X20
CJ SKIP_ A
When the conditional contact for the CJ instruction is “OFF” ( CJ is
not active), the segment in the program between the CJ instruction
The A segment in program
and its pointer will execute normally.
When the conditional contact for the CJ instruction is “ON” ( CJ is
SKIP_A active), the system will execute the Jump action to the destination
point of CJ, then executes the following program after the pointer.
X20
CJ SKIP_ B When X20=“OFF”, the “CJ SKIP_B” instruction will execute the
Jump action, then the B segment will not be executed.
The B segment in program When X20=“ON”, the “CJ SKIP_A” instruction will execute the Jump
action then the A segment will not be executed.
SKIP_B If the CJ instruction is not executed, the program segment enclosed
will be executed as normal programs.

When the CJ instruction executes Jump action, every device of the skipped segment will as follows:
The action of every device in the related segment during the Jump is executed

The status of Y, M and S will remain as same as before the Jump.


The 10 ms. or 100 ms. timer will pause counting time.
The 1 ms. timer will continue to count time, but its output contact will not function normally until the
Jump nishes.
T192~T199 will continue to count time and its output contact will also effective.
High Speed Counter will continue to count and its output contact will also effective.
A normal counter will stop counting.
If the Reset instruction for a Retentive timer or counter is driven before Jump, the device will still be reset during
the Jump.
Applied instruction will not be executed.

Using the CJ instruction can skip unnecessary program segment directly, so the program Scan Time can be saved.
The CJ instruction can be used to solve the problem of double coil outputs.
A numeric pointer or the name of a pointer can only appear once in a program; If the Pointer is specied more than
once, errors will be incurred.
As the Pointer P63 or P255 is equal to the END address in the program, to execute the “CJ P63” or “CJ P255” is
equal to jump to the END of program.

132
FNC 1 2 M 3
01 CALLP S Call Subroutine
○ ○ ○ ○
FNC 1 2 M 3
SRET Subroutine Return
02 ○ ○ ○ ○

Devices
Operand
P By a numeric pointer or an user-dened 16 English characters pointer
S
Numeric pointer: P0~P1023 The total amount of Mark / Branch and numeric pointers is 1024.

S S : the Pointer of the subroutine


X20
CALL EMERGENCY_STOP
When the conditional contact X20 for the CALL
instruction is “ON”, the system will execute the CALL
action to jump to the pointer of “EMERGENCY_STOP”
and then executes the subroutine. Until the SRET
instruction in the subroutine executes, the system jumps

back the line immediately following the original CALL


instruction and then keeps running.
Subroutines should be written after the FEND instruction.
FEND
If the CJ instruction and the CALL instruction are used in
The EMERGENCY_STOP

EMERGENCY_STOP a program, the same Pointer is not allowed to assign for


both.
A same subroutine can be called in a program as many
subroutine

times as required.
In a subroutine, a second CALL instruction is available

for calling other subroutine, while subroutines can be


SRET nested for 5 levels at most.
The Timers used in the subroutine must be selected
END from T192~T199.

2-Level Nest Subroutine Call (5 levels at the most)

CALL P0

FEND

P0
〜 〜

P0
CALL P20 subroutine

SRET

P20
P20

subroutine
SRET

END

133
FNC Interrupt Return
1 2 M 3
03 IRET ○ ○ ○ ○
FNC Enable Interrupt
1 2 M 3
04 EI
○ ○ ○ ○
FNC Disable Interrupt
1 2 M 3
05 DI
〜 ○ ○ ○ ○

X20 Generally a program is under Enable Interrupt status. Except for the
M9050 program ow is during the area between the DI and EI instructions,
where interruption is prevented.

DI Interrupt in Assume that programs are under Enable Interrupt status:


this area

is not When X0= “OFF” → “ON”, the IX0P Interrupt Subroutine will be
EI allowed. executed until when the IRET instruction is encountered, then the ow
returns to the main program and keep running.

The First END


FEND of the Main When X1=“ON” → “OFF”, the IX1F Interrupt Subroutine will be
Program executed until when the IRET instruction is encountered, then the ow
returns to the main program and keep running.
IX0P The IX0P
Interrupt When X20=“ON”, the Interrupt Disable Special Relay M9050 is active

IRET Subroutine and then “X0” is driven to disable Interrupt, the interrupt from the
external input X0 is blocked.
IX1F The IX1F Please write the Interrupt Pointer “IX □□ ”, “IHC □□ ”, “IHHC □ ” or
Interrupt “IT □□□ ” after the FEND instruction.

IRET Subroutine When the program ow executing an interrupt subroutine, all
other interrupts are not allowed.
END

The Timers used in general subroutines and interrupt subroutines must be selected from the T192~T199.
When the program ow is worked between the DI and EI instructions, instructions, an interrupt demand cannot be
executed immediately. The demand will be memorized and executed when the interrupt function is allowed again.
For the pulse width of the external interrupt signal, please refer to the input reaction time varies with the series of PLC.
If the interrupt subroutine’s I/O needs processed instantly, please use the FNC50 REF immediate I/O refresh
instruction.

134
FNC 1 2 M 3
FEND First End
06 ○ ○ ○ ○


X20
CALL P1 An FEND instruction indicates the rst end of the main program
block.
〜 An FEND instruction placed before the CALL instruction or after
The First END of the
FEND Main Program the SRET instruction will be treated as an error.

P1 The Interrupt Pointer “I” (including all the “IX □□ ”, “IHC □□ ”,


The P1 “IHHC □ ”, “IT □□□ ”) and the Mark / Branch Point “P” (which
is specied by the CALL instruction) should be written behind the

Subroutine
SRET FEND instruction.
If two or more FEND instructions are used, the subroutine should
IX0P be placed between the last FEND instruction and the END
The IX0P Interrupt instruction.

Subroutine
IRET

END

135
FNC 1 2 M 3
WDTP Watch Dog Timer Refresh
07 ○ ○ ○ ○

A PLC is provided with the WDT (Watch Dog Timer), which is used to monitor operation condition of the PLC system.
By way of the WDT to monitor the process, when the PLC's CPU runs abnormally, that will command the PLC to stop
operation and turn all external output “OFF”. This system achieves the protection purpose.
The explanation of the WDT (Watch Dog Timer):
The WDT is a hardware timer with 200 ms. set value. When PLC=“STOP” → “RUN”, the value of WDT will reload from
the content value of Special Register D9000 and while the initial value of D9000 is “200”.
This timer is counting downward by a timing unit of 1 ms. If the current value reaches “0”, the WDT will determine
that there is a system trouble. It forces the PLC to stop operation and turn all external output “OFF” to achieve the
protection purpose.
When the system operates normally, PLC will revert its WDT timer before it executes the beginning of program
(STEP 0).

There are two reasons to activate WTD (Watch Dog Timer) function:
1. Any trouble is happened in the PLC system and WDT performs the protection function.
2. If the time of program execution is too long, the program's Scan Time more than the content value of D9000,
it will trigger the protection function of WDT. Below are two approaches to improve the foregoing situation and
make the system operate normally.
For the second cause, here provide two solutions:
(1) Insert WDT instruction into the program, because WDT instruction will revert the current value of WDT.

M9000
The WDT instruction reverts the current value of the WDT timer to the content value of D9000
WDT in the middle of the program.

END

(2) Use the MOV instruction to change the content value of D9000.
M9002
MOV K300 D9000 MOV K300 D9000Set the WDT to be a timer of 300 ms

To adopt this approach, it should be noted that at the first Scan Time of the PLC (from “STOP” to “RUN”),
the value of WDT timer is still 200 ms. The program below can be used for the solution where necessary.
M9002
MOV K300 D9000

WDT

136
FNC 1 2 M 3
FOR S Start of a FOR-NEXT Loop
08 ○ ○ ○ ○
FNC 1 2 M 3
NEXT End of a FOR-NEXT Loop
09 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
S =1~32,767 (beyond the range, the set value S is regarded as 1)

S S : the number of times to be repeated in the FOR-NEXT loop.


FOR K5
The program segment in the FOR-NEXT loop will be executed
The LOOPING segment S times.
in program
As in the left diagram, the LOOPING segment in program is
executed 5 times sequentially.
NEXT

In a FOR-NEXT loop, the CJ instruction can be used to jump out of the loop.
At most 5 levels can be used for a nest FOR~NEXT loop. Be sure to note that the loops will cause the currently
Scan Time extended. The Scan Time should be taken not to exceed WDT’s default value, otherwise an error will
occur.
Errors will occur under the following circumstances:
1 The NEXT instruction is placed in front of the FOR instruction.
2 The NEXT instruction is placed behind the FEND or END instruction.
3 The FOR instruction and the NEXT instruction are not programmed as a pair.

Multiple-level Loop Program

FOR K3

FOR D0

FOR K1X20

3-Level Loop
NEXT

NEXT

NEXT

Use the FOR-NEXT Loop instructions to combine with the Pointer Register V, Z that will make the program more
exible. The program below will add up the content value of D0~D9 and store the result in D10.

M9000
RST Z0

RST D10

FOR K10
M9000
ADD D10 D0Z0 D10

INC Z0

NEXT

137
138
6-3 Comparison, Move and Code Exchange Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3

10 D C M P P S1 S2 D Compare ○ ○ ○ ○

11 D Z C P P S1 S2 S D Zone Compare ○ ○ ○ ○

12 DMOVP S D Move ○ ○ ○ ○

13 SMOVP S m1 m2 D n Shift Move ○ ○ ○ ○

14 DCMLP S D Complement ○ ○ ○ ○

15 BMOVP S D n n → n Block Move ○ ○ ○ ○

16 DFMOVP S D n 1 → n Fill Move ○ ○ ○ ○

17 D X C H P D1 D2 Exchange ○ ○ ○ ○

18 DBCDP S D Convert BIN to BCD ○ ○ ○ ○

19 DBINP S D Convert BCD to BIN ○ ○ ○ ○

139
FNC 1 2 M 3
D C M P P S1 S2 D Compare
10 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D
D occupies 3 consecutive devices

S1 S2 D S1 : the compare value #1


X20
CMP K100 D100 M100 S2 : the compare value #2
D : the compare result; occupying 3 consecutive points

Compare the content value of S 1 (Compare Value #1) with the value of S 2 (Compare Value #2), and save the
result in D (Compare Result).

The CMP instruction will be enabled when X20 = “ON”.


If S 1 > S 2 ( K100 > D100 ), then M100 = “ON”
If S 1 = S 2 ( K100 = D100 ), then M101 = “ON”
If S 1 < S 2 ( K100 < D100 ), then M102 = “ON”.

When X20=“OFF”, the instruction is inactive, the “ON”/“OFF” statuses of M100, M101 and M102 will remain as
same as the statuses before it is disabled.

Please use serial or parallel links of M100~M102 to generate the result as “≥”, “≤” or “≠”.

140
FNC 1 2 M 3
D Z C P P S1 S2 S D Zone Compare
11 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
S
D
D occupies 3 consecutive devices S 1 ≤S 2

S1 S2 S D S1 : the lower limit of zone compare


X20
ZCP K100 K200 D100 M100 S2 : the upper limit of zone compare
S : the compare value
D : the compare result; occupying 3 consecutive points

Compare the content value of S (Compare Value) with the values of S 1 (lower limit of zone compare) and S 2
(upper limit of zone compare), then save the result in D (compare result).

The ZCP instruction will be enabled when X20 = “ON”.


If S < S 1 (D100 < K100, the compare value is less than the lower limit), then M100 = “ON”;
If S 1 ≤ S ≤ S 2 (K100 ≤ D100 ≤ K200, the content value of D100 is between the upper and lower limit), then
M101 = “ON”;
If S > S 2 (D100 > K200, the compare value is bigger than the upper limit), then M102 = “ON”.

When X20 = “OFF”, the instruction is inactive, the “ON”/“OFF” statuses of M100, M101 and M102 will remain as
same as the statuses before it is disabled.

When S 1 > S 2 , the content value of S 1 will become both upper/lower limits to be compared with the S .

141
FNC 1 2 M 3
DMOVP S D Move
12 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the source device to be transferred


X20
MOV D100 D200 D : the destination device

To copy the designated value from S to D .

The content value of D100 will be copied to D200 when X20=“ON”.

When X20 turns from “ON” to “OFF”, the instruction is inactive besides the content value of D200 will remain as
same as the value before it is disabled.

Bit Data Transfer


To perform the program of left diagram, which can be achieved by the right side.
X0
Y20
X1
Y21 M9000
X2 MOV K1X0 K1Y20
Y22
X3
Y23

32-bit Data Transfer


The instruction should be headed with a “D” when a 32-bit instruction is used.
X20
DMOV D0 D100 When X20=“ON”, move the content value (D1, D0) to (D101, D100).

If the transfer source or destination device is a 32-bit counter, the instruction should be headed with a “D”.
X21
DMOV C200 D10 When X21=“ON”, move the present value of C200 (32 bits) to (D11, D10).

Data Transfer Between Word and Bits


When using the MOV instruction to transfer data between words and bits, those bits should be organized by
the unit of “Nibble”. For example, (that K2 in the program means 2 Nibbles)
b15 b0
0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 D0

Execute MOV D0 K2M0


The status of bit data remains

1 0 1 0 1 0 1 0 K2M0
M15 M14 M13 M12 M11 M10 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0

Execute MOV K2M0 D1


Fill up with “0”

0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 D1
b15 b0

142
FNC m1 m2 n
1 2 M 3
SMOVP S D Shift Move
13 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
m1
m2
D
n
m 1 =1~4 m 2= 1 ~ m 1 n = m 2~ 4

S m1 m2 D n S : the source device of transfer


X20
SMOV D0 K3 K2 D1 K2 m1 : the source position of the rst digit to be moved
m2 : the number of source digits to be moved
D : the destination device
n : the destination position for the rst digit

This instruction can be used to reorganize data.

The instruction can select different operation modes, it is based on the status of Special Relay M9168.

When the M9168 = “OFF”

D0 (BIN 16-bit Value) D1 (BIN 16-bit Value)


b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0

Convert D0 into a BCD number. The PLC will identify Convert D1 into a BCD number. The PLC will identify
it as an operational error when the BCD’s value it as an operational error when the BCD's value
exceeds 9999 or D0’s value is negative. exceeds 9999 or D1's value is negative.
10 3 10 2 10 1 10 0 10 3 10 2 10 1 10 0

Move the designated digits of D0 to the specified 10 3 10 2 10 1 10 0


position and combine the digits with D1.
Convert the combined value into a BIN value
and move it to D1.

b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0


D1 (BIN 16-bit Value)

When the M9168 = “ON”


D0 D1
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0

4th. Nibble 3rd. Nibble 2nd. Nibble 1st. Nibble 4th. Nibble 3rd. Nibble 2nd. Nibble 1st. Nibble

b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0

4th. Nibble 3rd. Nibble 2nd. Nibble 1st. Nibble


D1

143
FNC 1 2 M 3
DCMLP S D Complement
14 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the source device of transfer


X20
CML D0 D1 D : the destination device

Invert all the content bits from the designated S (status of each bit, “0” inverts to “1” or “1” inverts to “0”) and
copy the result to D .

When X20 = “ON”, all of contents of D0 are inverted and copied to D1.

When X20 turns from “ON” to “OFF”, the instruction is inactive besides the content value of D1 will remain as same
as the value before it is disabled.

b15 b0
1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 D0

X20= ON
b15 b0
0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 D1

144
FNC n
1 2 M 3
BMOVP S D n → n Block Move
15 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
The S and D occupies n consecutive devices respectively n=1~512

S D n S : the head ID of source device


X20
BMOVP D100 D200 K4 D : the head ID of destination device
n : the length of the block to be moved

D100 D200 BMOV executes data transfer of n consecutive devices from


D101 D201 S to D .
n=4
D102 D202 When X20 = “OFF” → “ON”, the content value of D100~D103
D103 D203 will be moved to D200~D203 orderly.

When a block transfer of organized bit devices is executed, the number of nibbles of S and D should
correspond.
S D n
X20
BMOV K1M0 K1Y20 K2

M0 Y20 When X20 = “ON”, two nibbles in the K1M0 and K1M4
M1 Y21 will be copied to the K1Y20 and K1Y24 (that equals to
K1M0 K1Y20 move the block M0~M7 to Y20~Y27).
M2 Y22
M3 Y23
n=2
M4 Y24
M5 Y25
K1M4 K1Y24
M6 Y26
M7 Y27

To prevent data writing errors during the transfer, the transfer will be processed in different orders when S > D
or S < D .
The transfer order when S > D The transfer order when S < D
X0 X0
BMOV D1 D0 K3 BMOV D0 D1 K3

1 3
D1 D0 D0 D1
2 2
D2 D1 D1 D2
3 1
D3 D2 D2 D3

The Special Relay M9024 is assigned as the move direction control flag for the BMOV instruction. The “ON”/“OFF”
status of M9024 can determine the data move direction of the BMOV instruction.

S D n
X0
When M9024 = “OFF” (S → D), D0~D99 → D100~D199.
BMOVP D0 D100 K100 When M9024 = “ON” (S ← D), D0~D99 ← D100~D199.

145
FNC n
1 2 M 3
DFMOVP S D 1 → n Fill Move
16 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
For 16-bit instruction, D occupies n devices For 32-bit instruction, D occupies n×2 devices n = 1~512

S D n S : the source device of transfer


X20
FMOV K0 D100 K5 D : the head ID of destination device
n : the length of the block to be moved

Move the content value of S to n registers which headed with D .

When X20 = “ON”, the value of K0 will be copied to 5 continuous registers that headed with D100 (D100~D104).

If a part of destination devices which is over the available range of the device (usually caused by a big n ), then
only the available destination devices will be copied to.

When the X20=“ON”


K0 D100 0
D101 0
D102 0
D103 0
D104 0

146
FNC 1 2 M 3
D X C H P D1 D2 Exchange
17 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
D1
D2

D1 D2 D1 : the data #1 to be exchanged


X20
XCHP D100 D200 D2 : the data #2 to be exchanged

Exchange (swap) the content values of the appointed devices D 1 and D 2 .

When X20 = “OFF” → “ON”, the content values of (D100) and (D200) will be exchanged.

Before Execution After Execution


When X20 =
123 D100 “OFF” → “ON” 60 D100
60 D200 123 D200

D1 D2
X21
DXCHP D0 D100

When X21 = “OFF” → “ON”, the content values of (D1, D0) and (D101, D100) will be exchanged.

Before Execution After Execution


5 D0 15 D0
When X21 =
10 D1 “OFF” → “ON” 20 D1

15 D100 5 D100

20 D101 10 D101

147
FNC 1 2 M 3
DBCDP S D Convert BIN to BCD
18 ○ ○ ○ ○
FNC 1 2 M 3
DBINP S D Convert BCD to BIN
19 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the source (BIN) of the conversion


X20
BCD D0 K4Y20 D : the converted result destination (BCD)

When X20 = “ON”, the BIN value at D0 will be converted into a BCD value. And then, moved to K4Y20 (Y20~Y37).

For a 16-bit instruction, PLC will identify an error when the value in S exceeds the available range (0~9,999).

For a 32-bit instruction, PLC will identify an error when the value in S exceeds the available range
(0~99,999,999).

S D S : the source (BCD) of the conversion


X21
BIN K4X20 D1 D : the converted result destination (BIN)

When X21 = “ON”, the BCD value from K4X20 (X20~X37) will be converted into a BIN value and then moved to D1.

If the source data is not provided in a BCD code format, the PLC will regard that as an operational error.

Application of the BCD and BIN Instructions

M9000
Convert the BCD value from K4X20 into an equivalent BIN value
BIN K4X20 D100
and move it to D100.
Convert the BIN value at D100 into an equivalent BCD value
BCD D100 K4Y20
and move it to K4X20.

4-digit BCD-based
Thumbwheel Switch

X37 X20 Usually the data in a PLC is stored in a BIN format, and
applied instructions (arithmetic and logical operations, etc.)
A 4-digit BCD value are also executed based on BIN values.
The BIN Instruction When a PLC is reading a BCD-based thumbwheel switche
data, which is required to use the BIN instruction to convert
Convert into a BIN value the data into a BIN value and store it in the PLC.
and store in D100
If a PLC is used to output inner stored data to a seven
D100 segment display (BCD format), please use the BCD
instruction to convert inner data into a BCD value and move
The BCD Instruction it to the display.

Convert into a 4-digit BCD value


Y37 〜 Y20

4-digit BCD-based
Seven segment display

148
6-4 Arithmetic and Logical Operation Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3

20 D A D D P S1 S2 D Addition (S1)+(S2) → (D) ○ ○ ○ ○

21 D S U B P S1 S2 D Subtraction (S1) – (S2) → (D) ○ ○ ○ ○

22 D M U L P S1 S2 D Multiplication (S1)×(S2) → (D+1,D) ○ ○ ○ ○

23 D D I V P S1 S2 D Division (S1)÷(S2) → (D),(D+1) ○ ○ ○ ○

24 DINCP D Increment (D)+1 → (D) ○ ○ ○ ○

25 DDECP D Decrement (D) – 1 → (D) ○ ○ ○ ○

D W A N D P S1

ˇ
26 S2 D Logic Word AND (S1) (S2) → (D) ○ ○ ○ ○

27 D W O R P S1 S2 D Logic Word OR (S1)ˇ(S2) → (D) ○ ○ ○ ○

Logic Word Exclusive OR


28 D W X O R P S1 S2 D ○ ○ ○ ○
(S1)ˇ(S2) → (D)

29 DNEGP D Negation ( D)+1 → ( D) ○ ○ ○ ○

149
FNC 1 2 M 3
D A D D P S1 S2 D Addition (S1)+(S2) → (D)
20 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D

S1 S2 D S1 : the summand
X20
ADDP D0 D1 D2 S2 : the addend
D : the sum

When X20= “OFF” → “ON” , the summand (D0) will be added to the addend (D1), and the sum will be
stored at the specified destination device (D2).

10 D0
5 D1

15 D2

16-bit Operation
When the result of an operation stores in the D and it is equal to “0”, the Addition / Subtraction Zero Flag M9020
turns “ON”.
When the result of an operation exceeds 32,767, the Carry Flag M9022 turns “ON”.
When the result of an operation is less than -32,768, the Borrow Flag M9021 turns “ON”.

S1 S2 D
X20
DADD D0 D2 D4

When X20 = “ON”, the instruction will add the data in (D1, D0) and (D3, D2) together and store the total
in (D5, D4).
100,000 ( D1, D0 )
100 ( D3, D2 )
99,900 ( D5, D4 )

32-bit Operation
When the result of an operation stores in the D and it is equal to “0”, the Addition / Subtraction Zero Flag M9020
turns “ON”.
When the result of an operation exceeds 2,147,483,647, the Carry Flag M9022 turns “ON”.
When the result of an operation is less than -2,147,483,648, the Borrow Flag M9021 turns “ON”.

150
FNC 1 2 M 3
D S U B P S1 S2 D Subtraction (S1) – (S2) → (D)
21 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D

S1 S2 D S1 : the minuend
X20
SUBP D0 D1 D2 S2 : the subtrahend
D : the difference

When X20 = “OFF” → “ON”, the subtrahend (D1) will be subtracted from the minuend (D0), and the difference will
be stored at the destination device (D2).

10 D0
5 D1

5 D2

16-bit Operation
When the result of an operation stores in the D and it is equal to “0”, the Addition / Subtraction Zero Flag M9020
turns “ON”.
When the result of an operation exceeds 32,767, the Carry Flag M9022 turns “ON”.
When the result of an operation is less than -32,768, the Borrow Flag M9021 turns“ON”.

S1 S2 D
X20
DSUBP D0 D2 D4

When X20 = “ON”, the instruction will subtract (D3, D2) from (D1, D0) and store the difference in (D5, D4).

100,000 ( D1, D0 )
100 ( D3, D2 )
100,100 ( D5, D4 )

32-bit Operation
When the result of an operation stores in the D and it is equal to “0”, the Addition / Subtraction Zero Flag M9020
turns “ON”.
When the result of an operation exceeds 2,147,483,647, the Carry Flag M9022 turns “ON”.
When the result of an operation is less than -2,147,483,648, the Borrow Flag M9021 turns “ON”.

151
FNC 1 2 M 3
D M U L P S1 S2 D Multiplication (S1)×(S2) → (D+1,D)
22 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D

S1 S2 D S1 : the multiplicand
X20
MUL D0 D1 D2 S2 : the multiplier
D : the product (of a multiplication)

When X20 = “ON”, the multiplicand (D0) will be multiplied by the multiplier (D1), and the product will be stored at
the destination device (D3, D2).

10 D0
5 D1

50 ( D3, D2 )

Two 16-bit data sources multiplied together will produce a 32-bit product.

The Most Signicant Bit (MSB) of a 32-bit product indicates a positive or negative (“0” represents it is positive; “1”
negative).

When the product of an operation stores in the D and it is equal to “0”, the Multiplication / Division Zero Flag
M9023 turns “ON”.

S1 S2 D
X20
DMULP D0 D2 D4

When X20 = “OFF” → “ON”, the instruction will multiply (D1, D0) by (D3, D2) and store the product in (D7, D6, D5,
D4).

100,000 ( D1, D0 )
10 ( D3, D2 )
1,000,000 ( D7, D6, D5, D4 )

Two 32-bit data sources multiplied together will create a 64-bit product.

The Most Significant Bit (MSB) of a 64-bit product indicates a positive or negative (“0” represents it is positive; “1”
negative).

When the product of an operation stores in the D and it is equal to “0”, the Multiplication / Division Zero Flag
M9023 turns “ON”.

152
FNC 1 2 M 3
D D I V P S1 S2 D Division (S1)÷(S2) → (D),(D+1)
23 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D

S1 S2 D S1 : the dividend
X20
DIVP D0 D1 D2 S2 : the divisor
D : the quotient and remainder

When X20= “OFF” → “ON” , the dividend (D0) will be divided by the divisor (D1), and the quotient will be stored at
the destination device (D2) while the remainder will be stored in (D3).

10 D0
÷ 3 D1

Quotient 3 D2
Remainder 1 D3

In case of the 16-bit instruction, a 16-bit quotient and a 16-bit remainder are produced. The Most Signicant Bit of
a component will indicate a positive or negative (“0” represents it is positive; “1” negative).

When the quotient of an operation stores in the D and it is equal to “0”, the Multiplication / Division Zero Flag
M9023 turns “ON”.
When the quotient of an operation exceeds 32,767, the Division Overow Flag M9025 turns “ON”.

S1 S2 D
X20
DDIVP D0 D2 D4

When X20 = “OFF” → “ON”, the dividend (D1, D0) will be divided by the divisor (D3, D2), and the quotient will be
stored at the destination device (D5, D4) while the remainder will be stored in (D7, D6).

300 ( D1, D0 )
÷ 11 ( D3, D2 )
Quotient 27 ( D5, D4 )
Remainder 3 ( D7, D6 )

In case of the 32-bit instruction is used, a 32-bit quotient and a 32-bit remainder are produced. The Most
Significant Bit of a component will indicate a positive or negative (“0” represents it is positive; “1” negative).

When the quotient of an operation stores in the D and it is equal to “0”, the Multiplication / Division Zero Flag
M9023 turns “ON”.
When the quotient of an operation exceeds 2,147,483,647, the Division Overflow Flag M9025 turns “ON”.

Note

If the divisor S 2 is equal to “0”, the PLC will regard that as an operational error.
The quotient will automatically be positive when it is the result of operating a positive dividend and a positive
divisor, or a negative dividend and a negative divisor; If either of a dividend or divisor is positive and the other
is negative, the quotient will automatically be a negative.
A positive dividend produces a positive remainder, while a negative dividend produces a negative remainder.

153
FNC 1 2 M 3
DINCP D Increment (D)+1 → (D)
24 ○ ○ ○ ○
FNC 1 2 M 3
DDECP D Decrement (D) – 1 → (D)
25 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
D

D D : the destination device


X20
INCP D100

When X20 = “OFF” → “ON”, the content value of destination (D100) will be increased by one.

If the instruction is not a pulse (P) instruction, the destination (D100) will increase its value in every scan cycle.

In a 16-bit operation, when a value of “+32,767” is reached, the next increment of “1” will write a value of “-32,768”
to the destination device.

In a 32-bit operation, when a value of “+2,147,483,647” is reached, the next increment of “1” will write
a value of “-2,147,483,648” to the destination device.

The instruction operation result will never lead to any change of a ag.

D D : the destination device


X20
DECP D101

When X20 = “OFF” → “ON”, the content value of destination (D100) will be decreased by one.

If the instruction is not a pulse (P) instruction, the destination (D100) will decrease its value in every scan cycle.

In a 16-bit operation, when a value of “-32,768” is reached, the next decrement of “1” will write a value of “+32,767”
to the destination device.

In a 32-bit operation, when a value of “-2,147,483,648” is reached, the next increment of “1” will write a value of
“+2,147,483,647” to the destination device.

The instruction operation result will never lead to any change of a ag.

154
FNC 1 2 M 3
D W A N D P S1

ˇ
S2 D Logic Word AND (S1) (S2) → (D)
26 ○ ○ ○ ○
FNC 1 2 M 3
D W O R P S1 S2 D Logic Word OR (S1)ˇ(S2) → (D)
27 ○ ○ ○ ○
FNC Logic Word Exclusive OR 1 2 M 3
D W X O R P S1 S2 D
28 (S1)ˇ(S2) → (D) ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D

S1 S2 D S1 : the source device #1


X20
WAND D0 D1 D2 S2 : the source device #2
D : the operation result

When X20 = “ON”, two 16-bit content data in the (D0) and (D1) execute the logic AND operation and restore the
result in (D2).
The logic AND operation result for each bit is: 0 0 = 0, 0 1 = 0, 1 0 = 0 or 1 1 = 1; any “0” at the parallel bits
will cause a result of “0”.
0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 D0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 D1
X20= ON
0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 D2

S1 S2 D S1 : the source device #1


X21
WOR D3 D4 D5 S2 : the source device #2
D : the operation result

When X21 = “ON”, two 16-bit content data in the (D3) and (D4) execute the logic OR operation and restore the
result in (D5).
The logic OR operation result for each bit is: 0 ˇ 0 = 0, 0 ˇ 1 = 1, 1 0 = 1 or 1 ˇ 1 = 1; any “1” at the parallel
bits will cause a result of “1” .
0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 D3
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 D4
X21= ON
0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 D5

S1 S2 D S1 : the source device #1


X22
WXOR D6 D7 D8 S2 : the source device #2
D : the operation result

When X22 = “ON”, two 16-bit content data in the (D6) and (D7) execute the logic XOR operation and restore the
result in (D8).
The logic XOR operation result for each bit is: 0 ˇ 0 = 0, 0 ˇ 1 = 1, ˇ 0 = 1 or 1 ˇ 1 = 0; the same statuses at
the parallel bits will cause a result of “1”.
0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 D6
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 D7
X22= ON
0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 D8

155
FNC 1 2 M 3
DNEGP D Negation ( D)+1 → ( D)
29 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
D

D D : the selected device to be inverted


X20
NEGP D0

When X20 = “OFF” → “ON”, each single bit pattern of (D0) will be inverted (“0” inverted into “1” and vice versa)
and then added with “1”. The result will be stored in (D0). The instruction selects the complement of “2” for the
value of D . The operation changes the positive or negative symbol of a value. For example,

Before Execution 10 D0 Before Execution -100 D 0

X20=OFF → ON X20=OFF → ON

After Execution -10 D0 After Execution 100 D0

The absolute value of D100 can be generated with the following program.
M9000 If the 15th. bit (MSB) of D100 is equal to “1”, it indicates that the content
BON D100 M0 K15 value of D100 is negative, where M0 = “ON”; otherwise, M0 = “OFF”.
M0 When M0 = “OFF” → “ON”, we will take a negative value for D100, where the
NEGP D100 value of D100 will be inverted into a positive from a negative.

The absolute value of D0 can be generated with the following program.


D0.F If the 15th. bit (MSB) of D0 is equal to “1”, it indicates that the content value of D0 is
NEGP D0 negative. Therefore, the absolute value of D0 can be generated through opposite.

156
6-5 Rotary and Shift Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3

30 DRORP D n Rotation Right ○ ○ ○ ○

31 DROLP D n Rotation Left ○ ○ ○ ○

32 DRCRP D n Rotation Right with Carry ○ ○ ○ ○

33 DRCLP D n Rotation Left with Carry ○ ○ ○ ○

34 SFTRP S D n1 n2 Bit Shift Right ○ ○ ○ ○

35 SFTLP S D n1 n2 Bit Shift Left ○ ○ ○ ○

36 WSFRP S D n1 n2 Word Shift Right ○ ○ ○ ○

37 WSFLP S D n1 n2 Word Shift Left ○ ○ ○ ○

38 SFWRP S D n Shift Register Write (FIFO Write) ○ ○ ○ ○

39 SFRDP S D n Shift Register Read (FIFO Read) ○ ○ ○ ○

157
FNC n
1 2 M 3
DRORP D Rotation Right
30 ○ ○ ○ ○
FNC n
1 2 M 3
DROLP D Rotation Left
31 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
D
n
The 16-bit instruction, n=1 ~ 16 The 32-bit instruction, n=1 ~ 32
When D is designated as KnY, KnM and KnS, the 16-bit instruction can only designate K4Y, K4M and K4S, while the
32-bit instruction can only designate K8Y, K8M and K8S

D n D : the selected device to be rotated


X20
RORP D0 K4 n : the number of the bits to be rotated

The bit format of the designated device D executes to rotate to the right by the number of n bits.
When X20 = “OFF” → “ON”, the 16-bit data of (D0) will be rotated by 4 bits to the right, and the status of the
highest bit that rotated out will be copied to the Carry Flag M9022.

b15 Rotation right b0


1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1
D0 M9022

After execution of a rotation

0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0
D0 M9022

D n D : the selected device to be rotated


X21
ROLP D1 K4 n : the number of the bits to be rotated

The bit format of the designated device D executes to rotate to the left by the number of n bits.
When X21 = “OFF” → “ON”, the 16-bit data of (D1) will be rotated by 4 bits to the left , and the status of the
lowest bit that rotated out will be copied to the Carry Flag M9022.

b15 Rotation left b0


0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
M9022 D1

After execution of a rotation

1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1
M9022 D1

158
FNC n
1 2 M 3
DRCRP D Rotation Right with Carry
32 ○ ○ ○ ○
FNC n
1 2 M 3
DRCLP D Rotation Left with Carry
33 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
D
n
The 16-bit instruction, n=1 ~ 16 The 32-bit instruction, n=1 ~ 32
When D is designated as KnY, KnM and KnS, the 16-bit instruction can only designate K4Y, K4M and K4S, while the
32-bit instruction can only designate K8Y, K8M and K8S

D n D : the selected device to be rotated


X20
RCRP D0 K4 n : the number of the bits to be rotated

The bit format of the designated device D join with the Carry Flag M9022 that executes to rotate to the right by
the number of n bits.
When X20 =“OFF” → “ON”, the 16-bit data of (D0) combine with the Carry Flag M9022 that will be rotated by 4 bits
to the right.
b15 Rotation right b0
1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1
D0 M9022

After execution of a rotation

0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0
D0 M9022

D n D : the selected device to be rotated


X21
RCLP D1 K4 n : the number of the bits to be rotated

The bit format of the designated device D join with the Carry Flag M9022 that executes to rotate to the left by the
number of n bits.
When X21 =“OFF” → “ON”, the 16-bit data of (D1) combine with the Carry Flag M9022 that will be rotated by 4 bits
to the left.
b15 Rotation left b0
0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
M9022 D1

After execution of a rotation

1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1
M9022 D1

159
FNC n1 n2
1 2 M 3
SFTRP S D Bit Shift Right
34 ○ ○ ○ ○
FNC n1 n2
1 2 M 3
SFTLP S D Bit Shift Left
35 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n1
n2
S occupies n2 components D occupies n1 components n1 = 1~1024 n2 = 1~n1

S D n1 n2 S : the device ID number of source header to be


X20 moved in
SFTRP X0 M0 K16 K4
D : the device ID number of the destination header
to be shifted
n1: data length to be shifted at the destination
n2: number of the bits in a shift

Pick the continuous n 1 length bit devices destination which headed by D and shift the destination to the right by
the length of n 2 , then use the number of n 2 source bit devices which headed by S to ll in the vacancy.

When X20 = “OFF” → “ON”, the devices composed of M0~M15 (16 bits) will be moved 4 bits to the right, also the
status of X0~X3 will be moved into M12~M15 to ll in the vacancy of exceeding bits.

Length designated by n 1
X3 X2 X1 X0 M15 M14 M13 M12 M11 M10 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0
Components
which are
5 4 3 2 1 exceeding
the space of
Move n 2 bits to the right n1

S D n1 n2
X21
SFTLP X0 M0 K16 K4

Pick the continuous n 1 length bit devices destination which headed by D and shift the destination to the left by
the length of n 2 , then use the number of n 2 source bit devices which headed by S to ll in the vacancy.

When X21 = “OFF” → “ON”, the devices composed of M0~M15 (16 bits) will be moved 4 bits to the left, also the
status of X0~X3 will be moved into M0~M3 to ll in the vacancy of exceeding bits.

Length designated by n 1
M15 M14 M13 M12 M11 M10 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0 X3 X2 X1 X0
Components
which are
exceeding 1 2 3 4 5
the space of
n1 Move n 2 bits to the left

160
FNC n1 n2
1 2 M 3
WSFRP S D Word Shift Right
36 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n1
n2
S occupies n2 components D occupies n1 components n1 = 1~512 n2 = 1~n1

S D n1 n2 S : the device ID number of source header to be


X20 moved in
WSFRP D100 D0 K12 K3
D : the device ID number of the destination header
to be shifted
n1: data length to be shifted at the destination
n2: number of the words in a shift

Pick the continuous n 1 length word stack destination which headed by D and shift the destination to the right by
the length of n 2 , then use the number of n 2 source word stack which headed by S to ll in the vacancy.

When X20 = “OFF” → “ON”, the word stack which is composed of D0~D11 (12 words) will be moved 3 words to
the right, also the contents of D100~D102 will be moved into D9~D11 to fill in the vacancy of exceeding words.

Length designated by n 1 (word)


D102 D101 D100 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
Components
which are
5 4 3 2 1 exceeding
the space of
Move n 2 words to the right n1

Note

The properties of devices specified by S and D must be the same (both are word devices or bit devices).

When S and D are designated to organized bit devices, the number of nibbles at the Kn must be the
same.
S D n1 n2
X20
WSFRP K1X0 K1Y20 K4 K2

the number of Kn designated by S and D must be the same

Length designated by n 1
X7~X4 X3~X0 Y37~Y34 Y33~Y30 Y27~Y24 Y23~Y20
Components
which are
3 2 1 exceeding
the space of n 1

161
FNC n1 n2
1 2 M 3
WSFLP S D Word Shift Left
37 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n1
n2
S occupies n2 components D occupies n1 components n1 = 1~512 n2 = 1~n1

S D n1 n2 S : the device ID number of source header to be


X21 moved in
WSFLP D100 D0 K12 K3
D : the device ID number of the destination header
to be shifted
n1: data length to be shifted at the destination
n2: number of the words in a shift

Pick the continuous n 1 length word stack destination which headed by D and shift the destination to the left by
the length of n 2 , then use the number of n 2 source word stack which headed by S to ll in the vacancy.

When X21 = “OFF” → “ON”, the word stack which is composed of D0~D11 (12 words) will be moved 3 words to
the left, also the contents of D100~D102 will be moved into D0~D2 to fill in the vacancy of exceeding words.

Length designated by n 1 (word)


D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 D102 D101 D100
Components
which are
exceeding 1 2 3 4 5
the space of
n1 Move n 2 words to the left

Note

The properties of devices specified by S and D must be the same (both are word devices or bit devices).

When S and D are designated to organized bit devices, the number of nibbles at the Kn must be the
same.
S D n1 n2
X0
WSFLP K1X20 K1Y20 K4 K1

the number of Kn designated by S and D must be the same

Length designated by n 1
Y37~Y34 Y33~Y30 Y27~Y24 Y23~Y20 X23~X20
Components
which are
exceeding 1 2 3 4 5
the space of n 1

162
FNC n
1 2 M 3
SFWRP S D Shift Register Write (FIFO Write)
38 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
D occupies n components n = 2~512

S D n S : the source device to be written to a FIFO data stack


X20
SFWRP D100 D0 K10 D : the header ID number of the FIFO data stack
n : the length of the FIFO data stack

A series of word data can be used for the FIFO (First In, First Out) data stack access. The FIFO data stack is
headed by D , the size is assigned by n and the stack's rst device is designated to be the indicator. When
each time this instruction is enabled, the content value of the indicator will be added with “1” rstly, and then the
content value of the designated device S will be moved to the position that is designated by the indicator in the
FIFO data stack.
The source device is
designated by S Length is designated by n
D100 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 The FIFO data stack is composed by
D0~ D9, where the D0 is the indicator
Indicator
D0=4

D0=3

D0=2

D0=1

Suppose at the very beginning that D0 = 0. At the rst time X20 = “OFF” → “ON”, the content value of D0 will
become “1” and the content value of D100 will be moved to the D1. At the second time X20 = “OFF” → “ON”, the
content value of D0 will become “2” and the content value of D100 will be moved to the D2, and so forth.
The D0 records the position where it is written to the FIFO data stack at the last time. If the content value of D0 is
≥ ( n -1) and the instruction is active again, it will not to write data into the stack any more and the value of D0 will
remain the previous value also the Carry Flag M9022 = “ON”.

This SFWR instruction is usually used jointly with the SFRD instruction (refer to the next page) to achieve the write /
read control of the FIFO data stack.

This SFWR instruction can be used jointly with the FNC212 POP instruction to achieve the write / read control of the
FILO (First In, Last Out) data stack.

163
FNC n
1 2 M 3
SFRDP S D Shift Register Read (FIFO Read)
39 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
S occupies n components n = 2~512

S D n S : the header ID number of the FIFO data stack


X21
SFRDP D0 D101 K10 D : the destination device for storing read data from
a FIFO data stack
n : the length of the FIFO data stack

A series of word data can be used for the FIFO (First In, First Out) data stack access. The FIFO data stack is
headed by S , the size is assigned by n and the stack's rst device is designated to be the indicator. When
each time this instruction is enabled, it moves the content value of the second device in the FIFO data stack to the
destination device D rstly, then the rest data in the stack (without the moved out device and the indicator) will be
shifted one word position to the right, furthermore subtracts “1” from the indicator’s content value.

The source device is


Length is designated by n designated by D
The FIFO data stack is composed by
D0~ D9, where the D0 is the indicator D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 D101
Indicator
2 Batch shift by one word position
to the right
1 Read data
3 Subtracts “1” from the content
value of the indicator D0

Suppose at the very beginning that D0 = 5. At the rst time X21 = “OFF” → “ON”, the content value of D1 will be
moved to the D101 then the content values at D2~D9 will be shifted one word position to the D1~D8 also the content
value of D0 will subtract “1” become “4”. At the second time X21 = “OFF” → “ON”, again the content value of D1
will be moved to the D101 then the content values at D2~D9 will be shifted one word position to D1~D8 also the
content value of D0 will become “3”, and so forth.

When the content value of D0 is equal to “0” and the instruction is active again, it will not execute to read data,
decrease the indicator or shift process any more. So the value of (D101) will remain the previous value, and furthermore
the Zero Flag M9020 = “ON”.

This SFRD instruction is usually used jointly with the SFWR instruction (refer to the previous page) to achieve the
write / read control of the FIFO data stack.

164
6-6 Data Processing Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3

40 Z R S T P D1 D2 Zone Reset ○ ○ ○ ○

41 DECOP S D n Decode ○ ○ ○ ○

42 ENCOP S D n Encode ○ ○ ○ ○

43 DSUMP S D The Sum of Active Bits ○ ○ ○ ○

44 DBONP S D n Check Specified Bit Status ○ ○ ○ ○

45 DMEANP S D n Mean ○ ○ ○ ○

46 ANS S m D Timed Annunciator Set ○ ○ ○ ○

47 ANRP Annunciator Reset ○ ○ ○ ○

48 DSQRP S D Square Root ○ ○ ○ ○

BIN Integer → Binary Floating Point


49 DFLTP S D ○ ○ ○ ○
Format

165
FNC 1 2 M 3
Z R S T P D1 D2 Zone Reset
40 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
D1
D2
The ID number of device D1 must be less than or equal to (≤) the device D2.
The D1 and D2 must use the same device type.

D1 D2 D1 : the starting device for the zone reset operation


M9002
ZRST M2000 M2499 D2 : the ending device for the zone reset operation
Permanent “ON”
(Initial Pulse, “a” contact)

When the PLC is performing “STOP” → “RUN”, the M9002 will be “ON” for a Scan Time; All the status of the coils
between M2000 to M2499 will be reset to “OFF”.

M9002
ZRST S500 S599

ZRST D7000 D7100

ZRST C100 C110

ZRST C200 C255

The ZRST instruction can be used to reset various devices that include bit devices and word devices.

The D 1 and D 2 must use the same device type. Also, the ID number of the device D 1 must be less
then or equal to (≤) the number of D 2 . Only the device which is designated by D 1 will be reset if the D 1 's ID
number is greater than the D 2 's.

This instruction can reset a 32-bit counter. It’s prohibited if that D 1 designates to a 16-bit counter while D 2
designates to a 32-bit counter.

166
FNC n
1 2 M 3
DECOP S D Decode
41 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
If S is a bit device, it occupies n bits
If D is a bit device, n = 1~8 and D occupies 2n bits If D is a word device, n = 1~4

S D n S : the source device to decode


X20
DECOP X0 M0 K3 D : the destination device where the decoded result
is stored
n : the length of bits to decode
In this example, D is designated to a group of bit devices, so the instruction will occupy consecutive 2n bit
devices that are headed by D for to store the decoded results.

Suppose the content value of X0~X2 is 2. Suppose the content value of X0~X2 is 5.
When X20= “OFF” → “ON”, the DECO When X20= “OFF” → “ON”, the DECO
instruction will decode the content value of instruction will decode the content value of
X0~X2 and move the results to M0~M7, X0~X2 and move the results to M0~M7,
where is only to set the M2=“ON”. where is only to set the M5=“ON”.
X2 X1 X0 X2 X1 X0
0 1 0 Content value=2 1 0 1 Content value=5
4 2 1 4 2 1

7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0
M7 M6 M5 M4 M3 M2 M1 M0 M7 M6 M5 M4 M3 M2 M1 M0

In this example, D is designated to a bit device, therefore n=1~8. When n=8, D will occupy 256 bit devices.

S D n
X20
DECOP D0 D1 K3

In this example, D is designated to a word device, therefore the range of n = 1~4.

When X20= “OFF” → “ON”, the DECO instruction will decode the content value of (b0 ~ b2) of D0 and move the
results to (b0 ~ b7) of D1. All unused data bits (b8 ~ b15) will be reset to “0”.

b15 b0
0 0 1 1 0 0 1 1 0 0 1 1 1 0 1 1 D0
4 2 1

All reset to “0”


7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 D1
b15 b8 b7 b0

167
FNC n
1 2 M 3
ENCOP S D Encode
42 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
If S is a bit device, n = 1~8 and S occupies 2n bits If S is a word device, n = 1~4

S D n S : the source device to encode


X20
ENCOP M0 D0 K3 D : the destination device where the encoded result
is stored
n : the length of bits to encode

When X20= “OFF” → “ON”, the ENCO instruction will encode the contents of M0 ~ M7 and move the results to
(b0 ~ b2) of D0. All unused bits (b3 ~ b15) of D0 will be reset to “0”.

In this example, S is a group of bit devices, therefore n=1~8. When n=8, the effective range of S covers 256
bit devices.
M7 M0 M7 M0
0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0

All reset to “0” All reset to “0”


4 2 1 4 2 1
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 D0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 D0
b15 b2 b0 b15 b2 b0

S D n S D n
X20 X20
ENCOP D0 D1 K3 ENCOP D0 D1 K4

b15 b7 b0 b15 b7 b0
0 0 1 0 0 1 1 0 0 0 0 0 1 0 0 0 D0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 D0
7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The ignored bits

All reset to “0” All reset to “0”


4 2 1 8 4 2 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 D1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 D1
b15 b2 b0 b15 b3 b0

Note

If the status of content bits of S that have more than one are equal to “1”, the instruction will only focus on
the largest ID number.

If the status of content bits of S are all equal to “0”, the PLC will regard that as an operational error.

When the conditional contact turns “OFF”, the encoded results (statuses at D ) will remain as same as the
statuses before it is disabled.

168
FNC 1 2 M 3
DSUMP S D The Sum of Active Bits
43 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the source device to be count


X20
SUM D0 D10 D : the destination device to store processed data

When X20 = “ON”, the instruction is to count the number of active bits within the 16 bits of D0, and the amount will
be stored in D10. If all of the 16 bits of D0 are inactive (equal to “0”), then the Zero Flag M9020 = “ON”.

X20=ON
0 1 1 1 0 0 0 1 0 1 0 0 0 1 1 1 8
D0 D10

When a 32-bit instruction DSUM is used, D will still occupy 2 registers.

169
FNC n
1 2 M 3
DBONP S D Check Specified Bit Status
44 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
The 16-bit instruction, n=1 ~ 15 The 32-bit instruction, n=1 ~ 31

S D n S : the source device


X20
BON D0 M0 K5 D : the destination device where specied results are
stored
n : the designated position bit to be specied
Copy the status of the n th. bit at the designated source device S to the destination device D .

When X20 = “ON”, the status of b5 at the D0 will be copied to M0.

When X20 = “OFF”, the status of M0 will remain as same as the status before it is disabled.

b15 b5 b0
X20=ON
0 0 1 1 0 0 1 1 0 0 0 0 1 1 1 1 D0 M0=OFF

b15 b5 b0
X20=ON
0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 D0 M0=ON

170
FNC n
1 2 M 3
DMEANP S D Mean
45 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
The 16-bit instruction, S occupies n components The 32-bit instruction, S occupies (n×2) components n = 1~64

S D n S : the head ID of source devices to be generated a


X20 mean
MEAN D0 D10 K5
D : the destination device where the mean is stored
n : the number of consecutive devices to be
generated a mean

The instruction sums up the content values of consecutive n devices which headed with S , then generates a
mean value and stores it to a designated device D .

When X20=“ON”, it will generate a mean of content values of the 5 consecutive registers (D0~D4) and store it in
D10.

( D0) +( D1) +( D2) +(D3)+(D4) X20=ON


(D10)
5

100 D0
150 D1
200 D2 X20=ON The remainder of the calculated mean
127 D10 is ignored. (Remainder=3)
88 D3
100 D4

Ignore the remainder if any remainder appears during the operation process.

If the some of the consecutive source devices exceed the available range, only the devices within the prescribed
range will be processed.

171
FNC m
1 2 M 3
ANS S D Timed Annunciator Set
46 ○ ○ ○ ○
FNC 1 2 M 3
ANRP Annunciator Reset
47 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
m
D
S = T0~T199 m = 1~32767 D = S900~S999

S m D S : the timer is used to be detected and cause alarm


X20 X21
ANS T0 K15 S900 m : the set value of timer configuration
D : the annunciator

The instruction ANS is used exclusively to drive the output of an annunciator step relay.

When X20 and X21 turn “ON” for more than 1.5 seconds simultaneously, the annunciator S900 is driven “ON”.
After S900= “ON” and when X20 or X21 turns “OFF”, the contact of the non-retentive T0 becomes “OFF” and its
present value is returned as “0” , but the S900 will remain “ON”.

When both X20 and X21 are “ON” but this duration is less than 1.5 seconds, then either one of them turns “OFF”,
the present value of T0 will be returned as “0”.

Do not use a timer which has been assigned to this instruction.

X0
ANRP

The instruction ANR is used exclusively to reset the annunciator step relay. When each time the ANR
instructinon is operated, annunciators which had been activated are sequentially reset one-by-one.

When X0= “OFF” → “ON”, the instruction ANR will be executed and an active annunciator will be reset to “OFF”.

If the instruction ANR is executed and if there are more than one active annunciator, the active annunciator with
smallest ID number will be reset. When the instruction ANR is executed once again, at this moment the active
annunciator with the smallest ID number (that was the second smallest at the last time) will be reset. And so forth
to reset other active annunciators one-by-one.

172
Application Example of Timed Annunciator Set

When the special auxiliary relay M9049= “ON” and any assigned annunciator of S900 ~ S999 is activated, then
M9048= “ON” and D9049 will display an activated annunciator number. If there is more than one annunciator
being activated simultaneously, D9049 will display the smallest active annunciator ID number.

The following chart is an ANS (Timed Annunciator Set) / ANR (Annunciator Reset) application
X20: Forward Switch Y20: Forward Device S900: Forward Annunciator
X21: Backward Switch Y21: Backward Device S901: Backward Annunciator
X22: Front End Position Switch Y27: Alarm Indicator
X23: Back End Position Switch
X27: Annunciator Reset Button
X20 X22 When the forward switch contact X20= “ON”, the forward device Y20= “ON”
Y20 and remain. Y20 will become “OFF” when the object reaches the front end
Y20 position (X22= “ON”).

X21 X23 When the backward switch contact X21= “ON”, the backward device
Y21 Y21= “ON” and remain. Y21 will become “OFF” when the object reaches
Y21 the back end position (X23= “ON”).

M9000
When M9049= “ON”, the alarm monitor will be activated,
M9049
where M9048 and D9049 are effective.
Y20 X22
ANS T0 K60 S900 If Y20= “ON” for more than 6 seconds and does not reach the
front end position, then S900= “ON”.
Y21 X23
ANS T1 K60 S901 Y21= “ON” for more than 6 seconds and does not reach the
If
back end position, then S901= “ON”.
M9048
Y27 The alarm indicator Y27= “ON” if any one of annunciator is “ON”.
X27
ANRP After the problem is cleared, press X27 once to reset the annunciator.

END

173
FNC 1 2 M 3
DSQRP S D Square Root
48 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
The 16-bit instruction, S = 0~32,767 The 32-bit instruction, S = 0~2,147,483,647

S D S : the source device for performing mathematical


X20 square root
SQR D0 D1
D : the destination device to store the result
This instruction performs a square root operation on the content value of device S and stores the result to the
destination device D .

It performs a square root operation on the content value of D0 and stores the result at D1 when X20=“ON”.

For the result, only the integer part will be taken, while the decimal part will be ignored; when any decimal is
ignored, M9021=“ON”.

The Zero Flag M9020=“ON” when the operation result is equal to “0”.

S must be a positive; a negative will be determined an error operation by PLC and the M9067 will be set “ON”.

174
FNC BIN Integer → Binary Floating Point 1 2 M 3
DFLTP S D
49 Format ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
The 16-bit instruction, S occupies 1 and D occupies 2 components
The 32-bit instruction, S occupies 2 and D occupies 2 components

S D S : the source data to be converted


X0
FLT D0 D10 D : the destination device to store the equivalent
float format value
When X0=“ON”, it performs the convert operation from the content value of 16 bits register D0 (which is a BIN
integer) to a binary floating point number, and the converted result is copied to the destination devices (D11, D10).

S D
X1
DFLT D2 D12

When X1=“ON”, it performs the convert operation from the content value of 32 bits registers (D2,D3) (which is a
BIN integer) to a binary floating point number, and the converted result is copied to the destination devices (D13,
D12).

There is not required to use this instruction to convert a constant K or H at a oating calculation, because the constant
will convert to binary oating point format automatically when the oating calculation is in operation.

A oating point number in the system should occupy two consecutive registers, for the storage format of a oating
point number in registers, please refere to the section 2-13 “Numerical System”.

Floating point calculation example:


Use the PLC instruction to calculate the result of circumference
2 × 3.14 × ( D0 ) ( D11, D10 )
BIN integer Binary floating point
format number
M9000
DEDIV K314 K100 D20 3.14 → (D21,D20) Binary floating point format number

DEMUL K2 D20 D22 2×3.14 → (D23,D22) Binary floating point format number

FLT D0 D24 (D0) BIN integer → (D25,D24) Binary floating point format number

DEMUL D22 D24 D10 2×3.14×(D0) → (D11,D10) Binary floating point format number

175
176
6-7 High Speed Processing Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3

50 REFP D n I/O Refresh ○ ○ ○ ○

51 REFFP n I/O Refresh and Filter Adjust ○ ○ ○ ○

52 MTR S D1 D2 n Input Matrix ○ ○ ○ ○

53 D H S C S S1 S2 D Software High Speed Counter Set ○ ○ ○ ○

54 D H S C R S1 S2 D Software High Speed Counter Reset ○ ○ ○ ○

Software High Speed Counter


55 D H S Z S1 S2 S D Zone Compare
○ ○ ○ ○

56 D S P D S1 S2 D Speed Detection ○ ○ ○ ○

57 D P L S Y S1 S2 D Pulse Y Output ○ ○ ○ ○

58 P W M S1 S2 D Pulse Width Modulation ○ ○ ○ ○

59 D P L S R S1 S2 S3 D Pulse Ramp ○ ○ ○ ○

177
FNC n
1 2 M 3
REFP D I/O Refresh
50 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
D
n
The D should designate as X0, X10 or Y0 When D=X0, n=8 or 16. When D = X10 or Y0, n = 8.

D n D : the head address of I/O device to be refreshed


M0
REF X0 K8 n : the number of I/O devices to be refreshed

Since the PLC is by the Cyclic Operation, the CPU will read and store "ON"/ "OFF" status of all external inputs to its
input data memory once at the beginning of the user program (every time when the PLC processes the step 0).
Then until the END instruction is executed, all the “ON”/ “OFF” status in its output data memory will be sent to
output components to drive external loadings. However, when there is a need to read “ON”/ “OFF” status of the
input X during the execution of the program or to deliver the operation result to the output Y immediately, please
use this REF instruction.

D n
M0
REF X0 K8 Refresh input signals to the input data memory
M1
REF Y0 K8 Deliver the output data memory to output components

When M0=“ON”, the input signal statuses of X0~X7 will be reloaded to PLC’s status data memory. The PLC can
immediately read the external statuses of X0~ X7 while performing this instruction, but there is still an approximately
10ms input delay on the input circuit and lter.

When M1=“ON”, the output statuses of Y0~Y7 will be sent to the output components from the PLC’s status data
memory. Therefor PLC can immediately send the statuses of Y0~Y7 while performing this instruction, but there still
has some delay on the output components ((e.g., relay has10ms delay approximately).

Usually use the REF instruction in interrupt subroutines to acquire real-time input/output statuses.

178
FNC n
1 2 M 3
REFFP I/O Refresh and Filter Adjust
51 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
n
n=0~60

n n: the setting for response time (unit = ms)


X20
REFF K1

When X20=“ON”, response time of external inputs X0~X7 will be changed into 1ms and the “ON”/“OFF” statuses
of X0~X7 will be reloaded into the input data memory.

To avoid noise intervention, usually there will be a lter with response time of approximately 10ms on the PLC’s
input point to lter out noise; Therefore, it is unable to capture a rapid input signal that width is less than 10ms.

The external inputs X0~X7 are equipped with software digital lters on, which we can use the REFF instruction to
adjust response time. The following gure shows the input conguration of X0~X7:
Digital Filter
Input Point Buffere To select and renew
0 the status from one When the REFF instruction is performed, the set time n
X0 0ms digital filter buffer for the instruction will be loaded.
which corresponds
1 to the response set When the PLC’s power
1ms When the PLC’s power
time. is turned form “OFF” to is turned “OFF”→“ON”,
“ON” or the END D9020=10 (default).
instruction is performed.
10 D9020 Can use the MOV
X7 10ms Input data memory instruction to set the
value.
11
11ms

60
60mS

As shown in the gure above, the external inputs X0~X7 have built-in digital lters with 0~60 ms adjustable range.
The rules to set the response time of input contacts X0~X7 are described as follows:
1 When the PLC’s power is turned form “OFF” to “ON”, the content value of D9020 will be set to 10 and response
time will be set to 10ms.
2 Could adjust the response time by using the MOV instruction to load a new value to the D9020.
3 Use the REFF instruction to adjust the response time during the program is in execution.

Program’s step 0

Response time of the external inputs X0~X7 is set up by the content value of D9020;

could use the MOV instruction to load a new response time to the D9020.

M9000
REFF K0 By the data at the buffer of 0 ms response time digital lter to renew the external
inputs X0~X7 and store that to the input data memory.

Even the response time of the external input X0~X7 digital filter is adjusted to 0 ms,

actually there is still having a few to dozens of µs response time delay.

M9000
REFF K20 By the data at the buffer of 20 ms response time digital lter to renew the
external inputs X0~X7 and store that to the input data memory.

The response time of the external input X0~X7 is adjusted to 20 ms.

END

When the interrupt function, the high speed counter or the SPD (FNC56) instruction is used in the program, the
response time of the corresponding input terminal will be automatically adjusted to 0 µs. However, there is still
having a few to dozens of µs response time delay.

179
FNC n
1 2 M 3
MTR S D1 D2 Input Matrix
52 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D1
D2
n
S should designate to an X with the last digit of the ID is “0” (e.g. X0, X10), S occupies consecutive 8 points.
D1 should designate to a Y with the last digit of the ID is “0”(e.g. Y0, Y10), D1 occupies consecutive n points.
D2 should designate a Y, M or S with the last digit of the ID is “0”(e.g. Y0, M10, S20), D2 occupies consecutive (8×n) points.
n=2~8

S D1 D2 n S : the head point for the matrix scan inputs


X0
MTR X20 Y20 M0 K2 D1 : the head point for the matrix scan outputs
D2 : the head point of the result matrix-table
(storage components)
n : the number of array rows of the matrix scan

This instruction reads the status of switches through the matrix scan technique. It needs to use consecutive 8
inputs (which are headed by S ) and n outputs (which are headed by D 1 ). By the sequential outputs to scan
and read the status of inputs, then the result is reflected in the storage components which are headed by D 2 .
Therefore, total 8× n of the external “ON”/“OFF” status are received.

External Wiring Diagram of the Input Matrix


Y21
M10 M11 M12 M13 M14 M15 M16 M17

A 0.1 A/ 50 V
diode should be
serially connected Y20
here M0 M1 M2 M3 M4 M5 M6 M7
COM
DC24V

X20 X23 X25 X26 S/S


PLC’s transistor
X21 X22 X24 X27
output points
PLC’s input points

From the diagram above, X20~X27 and Y20~Y21 constitute two rows of array matrix input circuit. When X0=“ON”,
the instruction is ready for execution then 16 (8×2) “ON”/ “OFF” statuses at the array matrix will be read and stored
in the components of M0~M7 and M10~M17.

When X0=“OFF”, the instruction is inactive and the statuses of M0~M7 and M10~M17 will remain as same as the
statuses before it is disabled.

Using the MTR instruction to read one row of the external array switches will take two Scan Times. If the PLC’s
Scan Time is less than 10ms, then one row in the array will spend 20ms to read the “ON”/ “OFF” status of external
inputs. Since this instruction can connect at most 8 of array rows to read 64 (8×8=64) external switches, to reload
that once will take 16 Scan Time or 160ms. Therefore, the coordination between the response rate of external
switches and the loading time of the instruction should be considered when this instruction is used.

Usually, the instruction’s conditional contact uses the M9000 (permanently “ON”, “a” contact).

When this instruction performs to scan and reload status once, it will let the Execution Completed Flag
M9029=“ON” for one Scan Time.
The MTR instruction can only be used once in the program and should appoint to a transistor output unit.

180
FNC 1 2 M 3
D H S C S S1 S2 D Software High Speed Counter Set
53 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D
S2 = C235~C255 If D designates to Y, should use Y0~Y7 D can also designate to IHC0~IHC7

S1 S2 D S1 : the set value of comparison


X20
DHSCS K200 C235 Y0 S2 : the ID No. of the software high speed counter to be used
D : the destination of the comparison result output

The DHSCS instruction is used to give an immediate output that is by way of a Softwear High Speed Counter
(SHSC). The SHSC receives a pulse stream from corresponding external input and counts by using the interrupt
function (for more details about the SHSC, please refer to the section “2-7 Software High Speed Counter”).
When a SHSC is selected by the DHSCS instruction’s S 2 and the present value of the SHSC changes
(increased/decreased by “1”) by the input, the DHSCS instruction will immediately perform the “Compare”
operation. If the present value of the SHSC is equal to the set value of comparison S 1 , the status of result output
D will turn “ON”. After that, the D remains the same status (“ON”) even the comparison is not equal.
Generally, the D in this instruction is designed to an output point Y. When the output point Y is designated, the
status “ON” will be carried out immediately to the output component Y.

As the example above, the DHSCS will be enabled if X20=“ON”. When the present value of C235 changes from
199 to 200 or from 201 to 200, the status of Y0 becomes “ON” and immediately sent it to the external output point,
then the Y0 will remain its “ON” status.

Common Output V.S. DHSCS Instruction Output

M9000 K200
C235
The action of the external output Y0 will be affected to the PLC's Scan
C235 Time. Therefore, its response is slower.
Y0

M9000 K5000
C235 The instruction is by the function of interrupt so the status of Y0 is
immediately output to external output, regardless of the PLC Scan Time.
Please notice that: There is still an output delay from the relay or
DHSCS K200 C235 Y0 transistor output component.

Note
This instruction is a 32-bit instruction; the DHSCR should be always entered when uses this instruction.
There is no limitation on the number of using times about the DHSCS, DHSCR and DHSZ instructions, while
the DHSCT can only be used once in the program. However, the total of these instructions performed at the
same time should not exceed “8”.
Both the Software High Speed Counter and the DHSCS, DHSCR, DHSZ, DHSCT instructions are only
performed to compare when there is an external signal to the input of the counter. The compare action shall
not be performed if the present value of Software High Speed Counter is changed by a transferring
instructions, because there is no counter input signals. Thus, there is not have the compare action, of course
not has the compare output.

181
Software High Speed Counter Interrupt

M9000 K2147483647
C254
The comparison result output D of the DHSCS instruction can
DHSCS K100 C254 IHC0 also designate to an Interrupt Pointer of the Software High
Speed Counter that serviceable name is IHC0~IHC7. By way
〜 of the pointer to perform the interrupt subroutine immediately.
In the example, when the present value of C254 = 100, CPU
FEND will jump to the interrupt Pointer IHC0 once to perform the
interrupt subroutine.
IHC0
When the M9061=“ON”, the Software High Speed Counter
The IHC0 interrupt IHC0~IHC7, will be prohibited.

interrupt subroutine

IRET

END

182
FNC 1 2 M 3
D H S C R S1 S2 D Software High Speed Counter Reset
54 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D
S2 = C235~C255 If D designates to Y, should use Y0~Y7
D can also designate to a Software High Speed Counter but the D and S2 must use the same SHSC

S1 S2 D S1 : the set value of comparison


X20
DHSCR K200 C235 Y0 S2 : the ID No. of the software high speed counter
to be used
D: the destination will be reset by the compare result

The DHSCR instruction is used to give an immediate reset output that is by way of a Software High Speed Counter
(SHSC).

When X20=“ON” and the present value of C235 changes from 199 to 200 or from 201 to 200, the status of Y0
becomes “OFF” and immediately sent it to the external output point, then the Y0 will remain its “OFF” status.

The Counter Self-Reset

M9000 K100 When the S 2 and D of the DHSCR instruction are


C235 designated to a same Software High Speed Counter,
the counter will perform the action of Self-Reset if its
DHSCR K200 C235 C235 input makes the present value equal to the S 1 .

When the counted present value of C235 = 200, the


200 C235 will be reset immediately (its present value will be
reset to “0” and the output contact will become “OFF”).
100
The present
value of C235

The output
contact of C235

Note
This instruction is a 32-bit instruction; the DHSCR should be always entered when uses this instruction.
There is no limitation on the number of using times about the DHSCS, DHSCR and DHSZ instructions, while
the DHSCT can only be used once in the program. However, the total of these instructions performed at the
same time should not exceed “8”.
Both the Software High Speed Counter and the DHSCS, DHSCR, DHSZ, DHSCT instructions are only
performed to compare when there is an external signal to the input of the counter. The compare action shall
not be performed if the present value of Software High Speed Counter is changed by a transferring
instructions, because there is no counter input signals. Thus, there is not have the compare action, of course
not has the compare result.

183
FNC Software High Speed Counter 1 2 M 3
D H S Z S1 S2 S D
55 Zone Compare ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
S
D
S=C235~C255 D occupies 3 consecutive components, should use Y0~Y5 if the D designates to a Y

S1 S2 S D S1 : the set value of the lower limit at the zone compare


M9000
DHSZ K100 K200 C255 Y0 S2 : the set value of the upper limit at the zone compare
S : the ID No. of the software high speed counter to be
used
D : the destination of the comparison result outputs

All of the counting value and result outputs of this instruction are processed with interrupt insertion, the Y0~Y2 will
output immediately and irrespective to the Scan Time. The results of the zone comparison are shown as follows:
When K100 > the present value of C255, then Y0=“ON”.
When K100 ≤ the present value of C255 ≤ K200, then Y1=“ON”.
When K200 < the present value of C255, then Y2=“ON”.

If S 1 > S 2 , then the value of S 1 will become both of the Upper/Lower limits to be compared with the S .

Note
This instruction is a 32-bit instruction; the DHSZ should be always entered when uses this instruction.
There is no limitation on the number of using times about the DHSCS, DHSCR and DHSZ instructions, while
the DHSCT can only be used once in the program. However, the total of these instructions performed at the
same time should not exceed “8”.
Both the Software High Speed Counter and the DHSCS, DHSCR, DHSZ, DHSCT instructions are only
performed to compare when there is an external signal to the input of the counter. The compare action shall
not be performed if the present value of Software High Speed Counter is changed by a transferring
instructions, because there is no counter input signals. Thus, there is not have the compare action, of course
not has the compare outputs.

184
Use the HSZ instruction to perform high speed, low speed and stop control

X20 C251 is an A/B phase high speed counter, X0 is an


RST C251 A-phase pulse input, and X1 is a B-phase pulse input.

ZRST Y0 Y2 X20 is the signal input point for activation.


M9000 K9000 The DHSZ will generate the outputs only when the external
C251 pulses are entering to the C251. For that reason, when
X20 X20 = “OFF” → “ON” (the initial active signal of the left
PLS M0 program), it must to activate the motor operation
M0 Initial active (let Y0 = “ON”). Afterwards, the move will produce the
SET Y0 pulses to the Software High Speed Counter, so the
instruction can perform the corresponding comparison
X20 and use the results to drive the outputs Y0~Y2
DHSZ K2000 K2200 C251 Y0 immediately.

The speed curve of


variable speed device

Activate Input X20

High-speed Forward Y0

Low-speed Forward Y1

Stop Y2
2200
2000

Present value of C251


Software High Speed Counter

185
FNC 1 2 M 3
D S P D S1 S2 D Speed Detection
56 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D
S1 = X0~X7 D occupies 3 consecutive components

S1 S2 D S1 : the external pulse input point


X20
SPD X0 K1000 D0 S2 : the sampling time for to count pulses (unit: ms)
D : the detection result

Within the designated S 2 sampling time (unit = ms), this instruction calculates the number of pulses coming from
the external S 1 input and stores the result into the register D .

When X20=“ON”, the instruction started up and uses the register D1 to accumulate the number of input pulses
from the external input point X0. After 1000ms a period of the sampling time, it stores the D1’s accumulated result
to D0 then clears the current count value of D1 as “0”. And once again, it recalculates the number of input pulses
from the X0.
The D2 displays the remaining time of countdown timer (unit = ms).

The main purpose of the instruction is to acquire the rotation rate of the rotation device. The rotation rate can be
easily acquired from using the content value of D0 with the following equation:
60× (the count value of D0) N : Rotation rate
N= × 10 3 ( rpm)
n×t n : Number of pulses is generated by each turn of the
rotation device
t : Content value of S 2
As in the equation referred above, suppose that
n = 100 and (D0) = 3000, then we will have
60×3000
N= × 10 3 =1800 ( rpm)
100×1000(ms)

The exterior input designated by the S 1 in the instruction cannot be reused for any other high speed input function.

Since this instruction is by the Software High Speed Counter to get the pulse, please refer to the section
“2-15 The X0~X7 High Speed Input Function Description” to get the specication about external input.

X20

X0

D1: Accumulate value D0 : Detection


Result
Value

D1
Content value
D2 : Remaining time (ms)
1000

D2
Content value 0

186
FNC 1 2 M 3
D P L S Y S1 S2 D Pulse Y Output
57 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D
VS1 / VS2 series S1 = 1~50,000 VS2 / VS3 series S1 = 1~200,000 VSM-28ML S1 = 1~1,000,000
16-bit instruction S2 = 1~32,767 32-bit instruction S2 = 1~2,147,483,647 D = Y0~Y3

S1 S2 D S1 : the frequency of pulses to be output


X20
PLSY K500 D100 Y0 S2 : the number of pulses to be output
D : the pulse output point

When X20=“ON”, the Y0 uses 500 Hz frequency rate (i.e. 500 pulses per second) to produce the specied quantity
of pulses that number is assigned by the content value of D100.
S 1 designates the output pulse frequency the available range of the PLC:
The VS1 or VS2 series is from 1 to 50,000Hz; VSM or VS3 series is from 1 to 200,000Hz; VSM-28ML is from 1
to 1,000,000Hz.
If the value of S 1 is less than 1, regards it as 1.
If the value of S 1 is exceeding the upper limit of the range, regards it as the maximum value.
S 2 designates the number of output pulses, the available range is 0~2,147,483,647.
If the value of S 2 is equal to 0, the quantity of pulses is unlimited for continuous outputs.
If the value of S 2 is less than 0, the PLC will regard that as an operating error and the M9067 will be “ON”.
D designates the pulse output point. It can only designate to the point Y0~Y3 to be the pulse output device and
must use a transistor main unit.

When the conditional contact X20 becomes “OFF” during the pulse output, pulse outputs will be stopped and the
pulse output point will also turns “OFF”; When the X20 becomes “ON” again, it will restore to generate pulses from
the rst one.
Since the pulse output function at the Y0~Y3 are the same, below we use the Y0 as an example to describe the
related special devices.
The M9340 displays the status of the Y0 axis.
Any instruction which is related to the axis Y0 and is executed successfully, will continuously occupy the axis Y0,
until the condition contact becomes “OFF”.
Therefore, before to activate this instruction, should pay attention to the status of the M9340.
If the M9340 is already “ON”, it indicates that axis Y0 is occupied by other relevant instruction to generate pulse or
positioning. So, this instruction will not be executed even though the condition contact is “ON”.
When the M9340 is “OFF”, it indicates that axis Y0 is READY to accept and execute this instruction.
The M9341 is a pulse output monitor ag of the axis Y0.
When the axis Y0 is outputting pulse, the M9341 turns “ON”.
The M9342 is a positioning completed ag of the axis Y0.
When the number of pulse outputs assigned by S 2 is arrived, the M9342 turns “ON”.
When the condition contact is “OFF”, the M9342 will also turn “OFF”.
The M9343 is a ag for abnormal stop at the axis Y0.
The stop ag turns “ON” at the moment that the Y0 is generating pulses and the number of pulses assigned by S 2
is not arrived yet, the pulse outputting will be stopped promptly. The M9343 will turn “ON” to indicate the stop is
abnormal.
When the condition contact is “OFF”, the M9343 will also turn “OFF”.
The M9345 or M9346 is the stop signal of the axis Y0.
When either one of the signals is “ON”, the Y0’s pulse outputting at this instruction will be stopped promptly. After
the stop signal is clear, this instruction must be reactivated to enable pulse outputting again.
The (D9351, D9350) display the current speed of axis Y0.
When the instruction is executed, that will display the current pulse frequency of the axis Y0's output.
The (D9353, D9352) display the number of pulses that the axis Y0 has been output.
When the power switches “ON”, the initial value is 0. Afterwards, that will display the accumulated number of the
axis Y0’s output pulses.

187
The related special devices are summarized below: ( ■ : Means read only.)
Relay ID No. Description

■ M9340
Y0 axis's status. “OFF” means the Y0 is in the READY status, it is available for a positioning instruction;
while “ON” = BUSY, the Y0 has been occupying.
■ M9341 Y0 axis's pulse output monitor. “ON” means pulse is generating.
■ M9342 Y0 axis's positioning completed ag.
■ M9343 Y0 axis's positioning abnormal stop ag.
M9345 Y0 axis's stop ag (with gradually slow down).
M9346 Y0 axis's immediately stop ag.

■ M9360
Y1 axis's status. “OFF” means the Y0 is in the READY status, it is available for a positioning instruction;
while “ON” = BUSY, the Y1 has been occupying.
■ M9361 Y1 axis's pulse output monitor. “ON” means pulse is generating.
■ M9362 Y1 axis's positioning completed ag.
■ M9363 Y1 axis's positioning abnormal stop ag.
M9365 Y1 axis's stop ag (with gradually slow down).
M9366 Y1 axis's immediately stop ag.

■ M9380
Y2 axis's status. “OFF” means the Y0 is in the READY status, it is available for a positioning instruction;
while “ON” = BUSY, the Y2 has been occupying.
■ M9381 Y2 axis's pulse output monitor. “ON” means pulse is generating.
■ M9382 Y2 axis's positioning completed ag.
■ M9383 Y2 axis's positioning abnormal stop ag.
M9385 Y2 axis's stop ag (with gradually slow down).
M9386 Y2 axis's immediately stop ag.
Y3 axis's status. “OFF” means the Y0 is in the READY status, it is available for a positioning instruction;
■ M9400
while “ON” = BUSY, the Y3 has been occupying.
■ M9401 Y3 axis's pulse output monitor. “ON” means pulse is generating.
■ M9402 Y3 axis's positioning completed ag.
■ M9403 Y3 axis's positioning abnormal stop ag.
M9405 Y3 axis's stop ag (with gradually slow down).
M9406 Y3 axis's immediately stop ag.

Register ID No. Description


■ D9350 Lower 16 bits The Y0’s current speed (by user unit). If used for the PLSY or PLSR instruction,
■ D9351 Upper 16 bits that is the current speed by the unit of Hz.

D9352 Lower 16 bits The Y0’s current location (by the number of pulse). The initial value is 0.
D9353 Upper 16 bits If used for the PLSY or PLSR instruction, that is the pulse output amount.

■ D9370 Lower 16 bits The Y0’s current speed (by user unit). If used for the PLSY or PLSR instruction,
■ D9371 Upper 16 bits that is the current speed by the unit of Hz.

D9372 Lower 16 bits The Y0’s current location (by the number of pulse). The initial value is 0.
D9373 Upper 16 bits If used for the PLSY or PLSR instruction, that is the pulse output amount.

■ D9390 Lower 16 bits The Y2’s current speed (by user unit). If used for the PLSY or PLSR instruction,
■ D9391 Upper 16 bits that is the current speed by the unit of Hz.

D9392 Lower 16 bits The Y2’s current location (by the number of pulse). The initial value is 0.
D9393 Upper 16 bits If used for the PLSY or PLSR instruction, that is the pulse output amount.

■ D9410 Lower 16 bits The Y3’s current speed (by user unit). If used for the PLSY or PLSR instruction,
■ D9411 Upper 16 bits that is the current speed by the unit of Hz.

D9412 Lower 16 bits The Y3’s current location (by the number of pulse). The initial value is 0.
D9413 Upper 16 bits If used for the PLSY or PLSR instruction, that is the pulse output amount.

During this instruction is being executed, any modify to the content value of S 2 will be treated as invalid, but the
value of S 1 can be altered by the program to change the frequency.

There is no limitation on the using number of this instruction in a program, and the output points Y0~Y3 can
generate pulses at the same time.

188
FNC 1 2 M 3
P W M S1 S2 D Pulse Width Modulation
58 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D
S 1 =0~32767 S 2 =1~32767 D=Y0~Y3

S1 S2 D S1 : the width of “ON” at an output pulse, t = 0~32,767 × time base


X20
PWM D0 K100 Y0 S2 : the entire period of an output pulse, T = 1~32,767 × time base
D : the pulse output point

The PWM instruction is operated to generate pulse width modulation, the t/T time ratio characteristics of the
diagram which is shown below.
Besides, the time base is defined by the M9035.
When the M9035 = "OFF", the time base is 1ms; otherwise when the M9035 = "ON" the time base is 0.1ms.
S1
t

T
S2

When the conditional contact is “ON”, the consecutive pulses will be generated at the designated component D .
That each one of the entire period with a “T” cycle period (designated by S 2 ) and the “t” width of “ON” duration
(designated by S 1 ).

When X20 = “ON”, M9035 = “OFF” and suppose the D0 = 50, then Y0 will output the following pulses.
50ms

100ms

When X20 = “ON”, M9035 = “ON” and suppose the D0 = 20, then Y0 will output the following pulses.
2mS

10mS

If X20 becomes “OFF”, Y0 will also become “OFF”.

If the value of “t” is larger than the “T”, the PLC will regard that as an operational error.

Each output point of Y0~Y3 in the program can only be applied once for the PWM instruction. That is, two PWM
instructions cannot assign the same Y output point in the program.
The specied pulse output point of this instruction cannot be reused to the output which is specied by the PLSY,
PLSR or any other positioning instruction.
The related special devices are summarized below:

Relay ID No. Description


Assign the PWM operating time base. When M9035=“OFF”, the parameters for the PWM are by the unit
M9035 of 1ms.; when M9035= “ON”, by the unit of 0.1ms.

189
FNC Pulse Ramp
1 2 M 3
D P L S R S1 S2 S3 D
59 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
S3
D
VS1 / VS2 series S1 = 1~50,000 VS2 / VS3 series S1 = 1~200,000 VSM-28ML S1 = 1~1,000,000
S 2 =1~2,147,483,647 S 3 =0~5,000 D=Y0~Y3

S1 S2 S3 D S1 : the target frequency of output pulses


X20
PLSR K1000 D100 K1000 Y0 S2 : the number of total output pulses
S3 : the ramp time for acceleration or deceleration
(unit: ms)
D : the pulse output point

Pulse
frequency The acceleration / The acceleration /
(Hz) deceleration time deceleration time
S3 the target frequency S3
S 1 of output pulses

the number of total


S 2 output pulses

Time

X20

M9340

M9341

M9342
When X20 = “ON”, Y0 will output the specied pulses by the content value of D100 as the diagram above.
S 1 designates the target frequency of output pulses.
At the VS1 & VS2 series, the available target output frequency is from 1 to 50,000Hz.
At the VSM & VS3 series, the available target output frequency is from 1 to 200,000Hz.
At the VSM-28ML, the available target output frequency is from 1 to 1,000,000Hz.
When the value of S 1 is less than 1, it will be treated as 1.
When the value of S 1 is larger than the range, it will be treated as the maximum value.
S 2 designates the number of total output pulses.
It can specify the range from 1 to 2,147,483,647 pulses.
When the value of S 2 is less than or equal to 0, the PLC will regard it as an operating error and the M9067
will be “ON”.
S 3 designates the ramp time for acceleration or deceleration (unit = ms).
The available range is from 0 to 32,000. If the value of S 3 is less than 0, it will be treated as 0; if the value of
S 3 is larger than 32,000, it will be treated as 32,000.
D designates the pulse output point.
It can only designate to the point Y0~Y3 to be the pulse output device and must use a transistor main unit.

When the condition contact X20 turns “OFF” during pulse output, the output frequency will gradually slow down
then stop.
During this instruction is being executed, the content value of S 1 can be altered by the program to change the
frequency; Changes in other parameters will be treated as invalid.

190
There is no limitation on the using number of this instruction in a program, and the different output points Y0~Y3
can generate pulses at the same time.

Since the pulse output function of Y0~Y3 are the same, below we use the Y0 as an example to describe the related
special devices.
The M9340 displays the status of the Y0 axis.
Any instruction which is related to the axis Y0 and is executed successfully, will continuously occupy the axis Y0,
until the condition contact becomes “OFF”.
Therefore, before to activate this instruction, should pay attention to the status of the M9340.
If the M9340 is already “ON”, it indicates that axis Y0 is occupied by other relevant instruction to generate pulse or
positioning. So, this instruction will not be executed even though the condition contact is “ON”.
When the M9340 is “OFF”, it indicates that axis Y0 is READY to accept and execute this instruction.

The M9341 is a pulse output monitor ag of the axis Y0.


When the axis Y0 is outputting pulse, the M9341 turns “ON”.

The M9342 is a positioning completed ag of the axis Y0.


When the number of pulse outputs assigned by S 2 is arrived, the M9342 turns “ON”.
When the condition contact is “OFF”, the M9342 will also turn “OFF”.

The M9343 is a ag for abnormal stop at the axis Y0.


The stop ag turns “ON” at the moment that the Y0 is generating pulses and the number of pulses assigned by S 2
is not arrived yet, the pulse outputting will be stopped promptly. The M9343 will turn “ON” to indicate the stop is
abnormal.
When the condition contact is “OFF”, the M9343 will also turn “OFF”.

The M9345 is the stop signal of the axis Y0.


When the signal is “ON”, the pulse output frequency of this instruction at Y0 will slow down then stop After the stop
signal is clear, this instruction must be reactivated to enable pulse outputting again.

The M9346 is the immediately stop signal of the axis Y0.


When the signal is “ON”, the Y0’s pulse outputting will be stopped promptly. After the stop signal is clear, this
instruction must be reactivated to enable pulse outputting again.

The (D9351, D9350) display the current speed of axis Y0.


When the instruction is executed, that will display the current pulse frequency of the axis Y0’s output.

The (D9353, D9352) display the number of pulses that the axis Y0 has been output.
When the power switches “ON”, the initial value is 0. Afterwards, that will display the accumulated number of the
axis Y0’s output pulses.

191
The related special devices are summarized below: ( ■ : Means read only.)
Relay ID No. Description

■ M9340
Y0 axis's status. “OFF” means the Y0 is in the READY status, it is available for a positioning instruction;
while “ON” = BUSY, the Y0 has been occupying.
■ M9341 Y0 axis's pulse output monitor. “ON” means pulse is generating.
■ M9342 Y0 axis's positioning completed ag.
■ M9343 Y0 axis's positioning abnormal stop ag.
M9345 Y0 axis's stop ag (with gradually slow down).
M9346 Y0 axis's immediately stop ag.

■ M9360
Y1 axis's status. “OFF” means the Y0 is in the READY status, it is available for a positioning instruction;
while “ON” = BUSY, the Y1 has been occupying.
■ M9361 Y1 axis's pulse output monitor. “ON” means pulse is generating.
■ M9362 Y1 axis's positioning completed ag.
■ M9363 Y1 axis's positioning abnormal stop ag.
M9365 Y1 axis's stop ag (with gradually slow down).
M9366 Y1 axis's immediately stop ag.

■ M9380
Y2 axis's status. “OFF” means the Y0 is in the READY status, it is available for a positioning instruction;
while “ON” = BUSY, the Y2 has been occupying.
■ M9381 Y2 axis's pulse output monitor. “ON” means pulse is generating.
■ M9382 Y2 axis's positioning completed ag.
■ M9383 Y2 axis's positioning abnormal stop ag.
M9385 Y2 axis's stop ag (with gradually slow down).
M9386 Y2 axis's immediately stop ag.

■ M9400
Y3 axis's status. “OFF” means the Y0 is in the READY status, it is available for a positioning instruction;
while “ON” = BUSY, the Y3 has been occupying.
■ M9401 Y3 axis's pulse output monitor. “ON” means pulse is generating.
■ M9402 Y3 axis's positioning completed ag.
■ M9403 Y3 axis's positioning abnormal stop ag.
M9405 Y3 axis's stop ag (with gradually slow down).
M9406 Y3 axis's immediately stop ag.

Register ID No. Description


■ D9350 Lower 16 bits The Y0’s current speed (by user unit). If used for the PLSY or PLSR
■ D9351 Upper 16 bits instruction, that is the current speed by the unit of Hz.

D9352 Lower 16 bits The Y0’s current location (by the number of pulse). The initial value is 0.
D9353 Upper 16 bits If used for the PLSY or PLSR instruction, that is the pulse output amount.
■ D9370 Lower 16 bits The Y0’s current speed (by user unit). If used for the PLSY or PLSR
■ D9371 Upper 16 bits instruction, that is the current speed by the unit of Hz.

D9372 Lower 16 bits The Y0’s current location (by the number of pulse). The initial value is 0.
D9373 Upper 16 bits If used for the PLSY or PLSR instruction, that is the pulse output amount.
■ D9390 Lower 16 bits The Y2’s current speed (by user unit). If used for the PLSY or PLSR
■ D9391 Upper 16 bits instruction, that is the current speed by the unit of Hz.

D9392 Lower 16 bits The Y2’s current location (by the number of pulse). The initial value is 0.
D9393 Upper 16 bits If used for the PLSY or PLSR instruction, that is the pulse output amount.
■ D9410 Lower 16 bits The Y3’s current speed (by user unit). If used for the PLSY or PLSR
■ D9411 Upper 16 bits instruction, that is the current speed by the unit of Hz.

D9412 Lower 16 bits The Y3’s current location (by the number of pulse). The initial value is 0.
D9413 Upper 16 bits If used for the PLSY or PLSR instruction, that is the pulse output amount.

192
6-8 Handy Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3

61 D S E R P S1 S2 D n Search a Data Stack ○ ○ ○ ○

62 D A B S D S1 S2 D n Absolute Drum Sequencer ○ ○ ○ ○

63 I N C D S1 S2 D n Incremental Drum Sequencer ○ ○ ○ ○

64 TTMR D n Teaching Timer ○ ○ ○ ○

65 STMR S m D Special Timer ○ ○ ○ ○

66 ALTP D Alternate State ○ ○ ○ ○

67 R A M P S1 S2 D n Ramp Variable Value ○ ○ ○ ○

69 SORT S m1 m2 D n Sort Tabulated Data ○ ○ ○ ○

193
FNC n
1 2 M 3
D S E R P S1 S2 D Search a Data Stack
61 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D
n
The 16-bit instruction, n = 1~256, S1 occupies n components, D occupies 5 components.
The 32-bit instruction, n = 1~128, S1 occupies (2×n) components, D occupies 10 components

S1 S2 D n S1 : the head device ID number of a defined data stack


X20 to be searched
SER D0 D10 D20 K10
S2 : the compare data source at the searching
D : the search result's storage head device ID number
n : the search stack length of the searched data

The data stack is assigned by n consecutive devices which headed with S 1 . This instruction will compare the
content value at the specified S 2 to each device in the data stack, and store the comparison result into 5
consecutive devices headed with D .

For a search data stack formed by D0 ~ D9. When X20= “ON”, this instruction uses the D10 to compare with the
stack D0~D9 and store the result into D20 ~ D24. (Assune the content value of parameter D10=100.)
The result of the search
Data Data Content Compare Result
Position Stack for Value of Data Compare Storage Content Description
Number Searching D0 ~ D9 Source Decision Device Value
0 S 1 D0 100 Equal value D Total number of the equal
4 comparison result
1 D1 120 D20
2 D2 100 Equal Value Data position number of the
D21 0 first equal value
3 D3 85 S2
n 4 D4 125 D10 Data position number of the
D22 8 last equal value
5 D5 60 100 Min. Value
6 D6 100 Equal Value The Min. value data position
D23 5 number
7 D7 95
8 D8 100 Equal Value The Max. value data position
D24 9 number
9 D9 210 Max. Value

The content value at the D +3 and D +4 will record the larger data position number when there’s more than
one minimum or maximum value in the data stack.

All the content values of D20 ~ D22 will be “0” when there’s no equal value.

For a 32-bit instruction, S 1 , S 2 and D will designate a 32-bit register while n will designate a 16-bit register.

194
FNC n
1 2 M 3
D A B S D S1 S2 D Absolute Drum Sequencer
62 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D
n
The 16-bit instruction, S1 occupies (2×n) components, D occupies n components.
When S1 designates to Kn X, Kn Y, Kn M or Kn S, that Kn must be K4 and the ID number of the X, Y, M or S must be a multiples
of 8
The 32-bit instruction, S1 occupies (4×n) components, D occupies (2×n) components.
When S1 designates to Kn X, Kn Y, Kn M or Kn S, that Kn must be K8 and the ID number of the X, Y, M or S must be a multiples
of 8
The 16-bit instruction, S2=C0~C199 The 32-bit instruction, S2=C200~C255 n=1~64

S1 S2 D n S1 : the head device ID number of the comparison table


X20
ABSD D0 C0 M0 K4 S2 : the ID number of the counter for the comparison
D : the number device ID number of the comparison result
n : the number of comparison section groups

The instruction is a Multi-Section Compare instruction and generally is operated for multi-section absolute drum
sequencer.

Lower Limit Upper Limit Comparison Value Comparison Result


S 1 D0=50 D1=200 D M0=1
D2=0 D3=50 S2 M1=0
n
D4=80 D5=120 C0=100 M2=1
D6=120 D7=300 M3=0

When X20= “ON”, the current value of the selected counter C0 is compared against a user defined data table
[(D0, D1), (D2, D3), (D4, D5) and (D6, D7), there are 4 groups of upper/lower limit], and the results are stored on
M0 ~ M3 respectively.
At each group, if the condition is met [Lower Limit ≤ Comparison Value ≤ Upper Limit], the corresponding output
point will be turned “ON”; Otherwise, the comparison value is not placed between Upper Limit and Lower Limit, the
corresponding output point will be turned “OFF”.

When X20= “OFF”, the “ON”/ “OFF” statuses at M0~M3 will remain as same as before it is disabled.

195
A Program Example
Suppose that a drum-controlled rotor sends a pulse to the input terminal X0 when it rotates by one degree,
then the following program will perform the checkup and control actions of the drum degree.
X1
ABSD D100 C0 M100 K5 When X1= “ON”, it activate the Multi-Section Compare
C0 X0
RST C0
X0 K360
This section of program that enables the C0 to be the counter of rotor
C0 which is depending on counting the rotation degree of the rotor.

Lower Limit Upper Limit Comparison Value Comparison Result


D100=60 D101=300 M100
D102=90 D103=150 M101
D104=120 D105=180 C0 M102
D106=90 D107=240 M103
D108=240 D109=270 M104

M100

M101

M102

M103

M104

0 30 60 90 120 150 180 210 240 270 300 330 360

196
FNC n
1 2 M 3
63 I N C D S1 S2 D Incremental Drum Sequencer
○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D
n
S1 occupies n components S2 = C0~C198 D occupies n components n = 1~64
When S1 designates to Kn X, Kn Y, Kn M or Kn S, that Kn must be K4 and the ID number of the X, Y, M or S must be a multiples
of 8

S1 S2 D n S1 : the head device ID number of the comparison table


X20
INCD D0 C0 M0 K5 S2 : the ID number of the counter for the comparison
D : the head device ID number of the comparison result
n : the number of comparison section groups

The INCD instruction is a multi-section incremental drum-controlled instruction.

If the S 1 is designated to the D0, n =5 and D is designated to the M0, then the comparison values are stored
in the table D0~D4, while M0~M4 are served as the outputs. Suppose that (D0)=30, (D1)=40, (D2)=10 and
(D4)=20.

For detailed actions of the INCD instruction, please refer to the following sequence diagram.

X20 ( D3)
( D1) 50
( D0) 40 ( D0) ( D0)
30 30 30
( D4)
( D2) 20
10
Current value of C0
4
3
2
1 1 1
Current value of C1 0 0 0

M0

M1

M2

M3

M4

M9029

S 2 will occupies two consecutive ID number counters.

For a multi-section incremental comparison output, the instruction's Execution Completed Flag M9029 will turn
“ON” for a Scan Time while a circulation is completed.

When X20= “ON” → “OFF”, the current values of C0 and C1 will be reset to “0” and M0~M4 will be turned “OFF”.

197
FNC n
1 2 M 3
TTMR D Teaching Timer
64 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
D
n
D occupies 2 components n = 0~2

D n D : the ID number of the register which can store the


X20 timed data of “ON” duration ((e.g., From a push
TTMR D0 K1 button switch)
n : the setting for multiplier

Suppose X20 is the external push button switch.

When X20 = “ON” (it is pressed), the content value of D1 (by the unit of second) will respond to the duration of
X20 = “ON”.
If X20 =“ON” for 5 seconds, then D1=5. Because of the n =1, the D0=50.
If X20 =“ON” for 10 seconds, then D1=10. Because of the n =1, the D0=100.

X20 5 10
Sec. Sec.
10
D1 5
Content value

The content value of D0 is determined by the content value of D1 and n ; their correlation is:

n Content value of D1 Content value of D0


0 10×1=10 When n =0, (D0)=(D1)×1
10
1 (Supposed Value) 10×10=100 When n =1, (D0)=(D1)×10
2 10×100=1000 When n =2, (D0)=(D1)×100

Accordingly, it is easily to use the content value of D0 become the setting value of a Timer T via a proper setting
value of n .
n =1 can be applied to a 100 ms unit Timer
n =2 can be applied to a 10 ms unit Timer

When X20= “ON” → “OFF”, the current value of D1 will be reset to “0” but the content value of D0 will remain as
same as the value before it is disabled.

198
FNC m
1 2 M 3
STMR S D Special Timer
65 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
m
D
S=T0~T199 m=1~32,767 D occupies 4 components

S m D S : the ID number of designated Timer


X20
STMR T0 K20 Y20 m : the setting value of the Timer (unit=100ms)
D : the head ID number of the output device

The STMR instruction is operated exclusively to produce the OFF-delay, the delay trigger and a flashing circuit.

When X20= “ON”, the STMR instruction starts to be performed. Since the m =20, the T0 become a 2 seconds
setting value Timer.

X20
The Y20 is an OFF-delay output.
The Y21 will have one delay output
2 Sec. 2 Sec. when that input signal turned from
Y20
“ON” to “OFF”.
2 Sec. 2 Sec. The Y22 and Y23 are designed for
Y21
output signals those are exclusively to
2 Sec. compose the flashing circuit. The
Y22 following example is an applied method
for the flashing circuit.
Y23

In the program, do not reuse the Timer ID number which has been used by this instruction.

Flashing Circuit
X20 M3
STMR T0 K10 M0 Perform a serial link “b” contact of M3 after X20,
then the M1 and M2 will perform the flashing circuit.
X20

M1
1
1 Sec.
M2 Sec.

199
FNC 1 2 M 3
ALTP D Alternate State
66 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
D

D D : the destination device


X20
ALTP M0

When X20= “OFF “ → “ON” for the first time, M0= “ON”; while X20= “OFF” → “ON” for the second time,
M0= “OFF”. Hence when X20= “OFF” → “ON” for an odd time, M0= “ON”, and for an even time, M0= “OFF”.

X20

M0

Control Start / Stop by One Push Button

X20
ALTP M100 When X20= “OFF” → “ON” for the first time, M100= “ON”;
Y20= “ON”, Y21= “OFF” and the operation will be activated.
M100
Y20 Start
When X20= “OFF” → “ON” for the second time, M100= “OFF”;
M100
Y20= “OFF”, Y21= “ON” and the operation will be stopped.
Y21 Stop

Produce the Flashing State


X20 T0 K10
T0 When X20= “ON”, T0 will produce a pulse every other second.
T0 Every time when T0 produces a pulse, the state of Y0 will be
ALT Y0 changed once.

X20
1 1 1 1 1 1
T0 sec sec sec sec sec sec

Y0

Traditional or Instruction to Make the Function of the First Trigger "ON"


and Second Trigger "OFF"

X20 M1
M0 X20
X20 PLS M0
M1 M0 Y0 X20
M0 Y0 = Y0 = ALTP Y0
Y0 M0 Y0
M0 Y0

200
FNC n
1 2 M 3
R A M P S1 S2 D Ramp Variable Value
67 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D
n
D occupies 2 components n = 1~32,767

S1 S2 D n S1 : the initial value of the ramp variation


X20
RAMP D0 D1 D2 K500 S2 : the destination value of the ramp variation
D : the value of the course of the ramp variation
n : to assign the using number of times that ramp
action is completed

Write the initial point value of the ramp variation to D0 and write the destination value of the ramp variation to D1.
When X20=“ON” and (D0)<(D1), then the current value of D2 will increase from the smaller set value of D0 to the
bigger set value of D1.
When X20=“ON” and (D0)>(D1), then the current value of D2 will decrease from the bigger set value of D0 to the
smaller set value of D1.
It takes 500 of PLC’s Scan Times for the current value shifted from the set value of D0 to the set value of D1.
( D0)<(D1) ( D0)>( D1)
S1
D S2 D When the instruction is activated,
( D0)
( D2) ( D1) ( D2)
the “course” value of the ramp
variation will be reflected on (D2)
S2 while the number of the scanned
S1
(D0) ( D1) times will be reflected on (D3).

500 Program Scans 500 Program Scans


n n

As shown in the diagram above, whether the continuous curve of D2, appears to be in Linear Gradient is closely
correlated to the Scan Time of PLC. Generally PLC does not always take the same Scan Time.
Thus, if the wanted characteristic of the RAMP instruction's result is a Linear Gradient, the interval of the RAMP
instruction is performed must be equal at each time. In terms of this purpose, it’s suggested to use the constant
Scan Time setting function or the interrupt function. (Please reference to the program examples in next page.)

When X20= “ON” → “OFF”, the instruction will be disabled and D3 will be cleared as “0”; And if X20 is set “ON”
again, the instruction will restart from the beginning.

When the execution of the instruction is completed, M9029= “ON” and the content value of D2 will be restored to
the setting value of D0.

The instruction can work with the analog output to incorporate the action of the buffered start/stop.

If X20= “ON” and PLC turns from STOP to RUN, please clear D3 as “0” at the beginning of the program.

201
Operation Modes (Swappable by Flag M9026)
When the RAMP instruction is performed, the operation mode will depend on the status of Special Relay M9026.
If M9026 = “OFF”, it will generate contiguous If M9026 = “ON” , it will generate only one
ramp results. (Repeat Mode) ramp results. (Hold Mode)

X20 X20
( D1) ( D1)
( D2) ( D2)

(D0) ( D0)

M9029 M9029

“ON” for a Scan Time

A Program Model that Uses the Constant Scan Time Function


M9000
M9039
Settle the Scan Time at 10ms.
MOV K10 D9039

MOV K10 D0
Set the initial value of the ramp variation at 10 and the
destination at 110.
MOV K110 D1
X20 Time of the entire process of the RAMP instruction (the current value
RAMP D0 D1 D2 K500 of D2 changes from the set value of D0 to the set value of D1) will be
10ms × 500 = 5,000ms = 5 Sec.

Since the PLC's Scan Time is settled at 10ms (each Scan Time is consistent) the ramp variation is like a Linear
Gradient. However, in the program model referred above, it should be noted that the set value of the constant
Scan Time is larger than the maximum value of the actual Scan Time a little. Otherwise, the constant Scan Time
function would be useless. To oversee the D9012 register will get the maximum value of the actual Scan Time.

A Program Model that Uses the Time Interrupt Function

M9000
MOV K100 D10
Set the initial value of the ramp variation at 100 and the destination at 1000.
MOV K1000 D11

FEND

ITA10 ITA10 is the interrupt pointer of the time interrupt at 10ms.


X20
RAMP D10 D11 D20 K1000 Time of the entire process of the RAMP instruction (the current
value of D20 changes from the set value of D10 to the set value
of D11) will be 10ms × 1,000 = 10,000ms = 10 Sec.
IRET

END

202
FNC m1 m2 n
1 2 M 3
SORT S D Sort Tabulated Data
69 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
m1
m2
D
n
Each of the S and D respectively occupie (m1×m2) components m 1 = 1~32 m 2= 1 ~ 6 n= 1~m2

S m1 m2 D n S : the head register ID number of the original data array


X20
SORT D0 K5 K4 D100 D200 m1 : the number of data record sets to be sorted
m2 : the number of data at an arrangement for each set
D : the head register ID number of the data array where
to store the sorted results
n : to assign the nth data in an arrangement as the sort
basis

Original Data Array The SORT instruction is used to sort an data array that
(Starting from the appointed register S ) has a serial of data record sets (the number of sets is
Data Arrangement designated by m 1 ). Each set has a grouped
arrangement (the number of grouped data at each
1 2 3 4 arrangement set is designated by m 2 ) while n is
Student ID Philology Mathematics History used to assign the nth arrangement as the routing basis
to sort the data array.
(D0) ( D5) ( D10) ( D15)
1 80 70 75 The S is to designate the head register ID number of
the original data array to be sorted and the D is to
(D1) ( D6) ( D11) ( D16) designate the head register ID number of the data array
2 65 70 90
where to store the sorted results.
m1 (D2) ( D7) ( D12) ( D17)
3 90 65 80 When X20= “ON”, the SORT instruction is starting to
perform. This instruction needs take 4 (the content of
(D3) ( D8) ( D13) ( D18) m 1 ) scan cycles to complete the sort action. When the
4 75 90 65 sort process is completed, the instruction's Execution
(D4) ( D9) ( D14) ( D19) Completed Flag M9029=“ON” for a Scan Time and the
5 80 85 95 sort action will be stopped.

m2 Both of the arrays S and D will separately occupy


m 1 × m 2 consecutive registers.

The SORT instruction can be used once only in the


program.

Sorted Data Result Array Sorted Data Result Array


(Starting from the appointed register D ) (Starting from the appointed register D )
when D200=2 when D200=4
Data Arrangement Data Arrangement
1 2 3 4 1 2 3 4
Student ID Philology Mathematics History Student ID Philology Mathematics History
(D100) ( D105) ( D110) ( D115) ( D100) ( D105) ( D110) ( D115)
2 65 70 90 4 75 90 65
(D101) ( D106) ( D111) ( D116) ( D101) ( D106) ( D111) ( D116)
4 75 90 65 1 80 70 75

m1 (D102) ( D107) ( D112) ( D117) m1 ( D102) ( D107) ( D112) ( D117)


1 80 70 75 3 90 65 80
(D103) ( D108) ( D113) ( D118) ( D103) ( D108) ( D113) ( D118)
5 80 85 95 2 65 70 90
(D104) ( D109) ( D114) ( D119) ( D104) ( D109) ( D114) ( D119)
3 90 65 80 5 80 85 95

m2 m2

203
204
6-9 External Setting and Display Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3

70 DTKY S D1 D2 Ten Key Input ○ ○ ○ ○

71 DHKY S D1 D2 D3 Hexadecimal Key Input ○ ○ ○ ○

72 DSW S D1 D2 n Digital Switch (Thumbwheel) Input ○ ○ ○ ○

73 SEGDP S D Seven Segment Decoder ○ ○ ○ ○

74 SEGL S D n Seven Segment with Latch ○ ○ ○ ○

76 ASC S D Convert Letters to ASCII Code ○ ○ ○ ○

77 PR S D Print ASCII Code ○ ○ ○ ○

78 D F R O M P m1 m2 D n Read FROM a Special Module ○ ○ ○

79 D T O P m1 m2 S n Write TO a Special Module ○ ○ ○

205
FNC 1 2 M 3
DTKY S D1 D2 Ten Key Input
70 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D1
D2
S occupies 10 components D2 occupies 11 components

S D1 D2 S : the initial device of the key input


X0
TKY X20 D0 M0 D1 : to place where the key input value is stored
D2 : the initial destination device of the keys' status outputs

The instruction designates consecutive ten input devices and those are starting from S , therefore each one of
the input is to represent a decimal number 0~9 in order. Since these 10 external input devices are connected to
10 keys and these are pressed in sequence, a four-digit decimal number 0~9,999 (a 16-bit instruction) or an
eight-digit decimal number 0~99,999,999 (a 32-bit instruction) can be input, then the input value will be placed in
D 1 . Also the instruction occupies 11 consecutive devices which starting from D 2 will be used to store the status
of the keys.

As in the left diagram, the input points X20~X31 are received the
signals from keys 0~9. When X0= “ON”, the instruction starts to
Key 0 X20 be performed. The value input by the number keys is placed in D0
(by format of BIN) and the statuses of the keys are restored in
M0~M9 and M10.
1 X21
9 2 1 0 Number Keys
2 X22
Input BCD Value One-Digit of BCD Code
points
of a PLC 3 2 1 0
Overflow 10 10 10 10

BCD
9 X31

S/S BIN
DC24V
BIN Value D0

X20 4 As shown in the left sequence diagram, the number keys


Key Input Signals

and the related X20~X31 are input in order ① ② ③ ④


X21 2 then the result 9,120 is stored in D0.
X22 3
When X31 is triggered (key #9 is pressed), M9 will turn
“ON” and remain “ON”, until the next key is pressed
(when the X21=“ON” → M9=“OFF”). The same
X31 1 situation applies to other keys.

If any of the keys for the X20~X31 is pressed,


M0 M10=“ON” at the moment and the corresponding
Keys' status outputs

device M0~M9 will be turned “ON”.


M1
When the status of X0 “ON” → “OFF”, the value of D0
M2 will remain but the M0~M10 will all turn “OFF”.

M9

M10 1 2 3 4

206
FNC 1 2 M 3
DHKY S D1 D2 D3 Hexadecimal Key Input
71 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D1
D2
D3
S occupies 4 components D1 occupies 4 components D3 occupies 8 components

S D1 D2 D3 S : multiplex scanning initial point of the inputs from the keyboard


X0
HKY X20 Y20 D0 M0 D1 : multiplex scanning initial point of the outputs to the keyboard
D2 : to place where the keyboard input value is stored
D3 : the initial destination device of the keys' status outputs

The instruction creates the Hexadecimal Keyboard Input by matrix scan of 4 consecutive external input points
initiating from S and 4 consecutive external output points initiating from D 1 . The value input by the keyboard is
stored in D 2 . And the instruction uses 8 consecutive devices which starting from D 3 to store the status of the
keys.

Hexadecimal Keyboard In the left diagram, the Hexadecimal Keyboard is


Circuit Diagram connected with X20~X23 and Y20~Y23. When
X20= “ON”, the instruction is active.
Y23 The value input by the keyboard is placed in D0 and
C D E F
the status of those keys are restored in M0~M7.
Y22
M9029 will turn “ON” for a Scan Time when the
8 9 A B instruction is performed for a scan.
Y21
If there are several keys being pressed at the same
4 5 6 7
Y20 time, only the first key activated is effective.

0 1 2 3 If the special coil M9167 is already ”ON”, the HKY


COM instruction can be used for input a hexadecimal
DC24V value 0 ~ F.
Transistor The HKY instruction can be used once only in the
X20 X21 X22 X23 S/S output program.
points
Input points of the PLC of the PLC This instruction is only recommended for use with
transistor output model.

Number Input

The value input by the number keys is placed in


9 2 1 0 Number Keys D0 (by format of BIN).

BCD Value One-Digit of BCD Code For a 16-bit instruction, the available maximum
input value will be 9,999. If an input value has
more than 4 digits, the previous digit will be
3 2 1 0 overflowed.
Overflow 10 10 10 10
For a 32-bit instruction, the available maximum
BCD input value will be 99,999,999.
If an input value has more than 8 digits, the
previous digit will be overflowed.
BIN
BIN Value D0

207
Function Key Input

Function Keys The A~F keys are defined as function keys.

If a function key is pressed, the corresponding key's


status output will turn “ON” and remain the same status,
M5 M4 M3 M2 M1 M0 Keys' Status Outputs until other function key has been pressed then the
previous output will change ”ON” → “OFF”.
For example, when is pressed, M0 will turn and

remain “ON”. And if is pressed after that, M5 will turn


turn and remain “ON” while M0= “OFF”.

Status Outputs of the Keys

If the keys ~ are pressed, the corresponding key's status output M0 ~ M5 will turn “ON”.

During the period when any one of the function keys ~ is pressed, M6= “ON”; And M6= “OFF”
when all the function keys are released.
During the period when any one of the number keys ~ is pressed, M7= “ON”; And M7=“OFF”
when all the number keys are released.
When the conditional contact X0=“OFF”, the input value will remain as same as the statuses before it is
disabled; However, M0~M7 will all turn “OFF”.

Notice
When the instruction is performed, it should take 8 PLC's Scan Times to effectively capture a key. When the
PLC's Scan Time is too long or too short, it may affect to read the key input signal incorrectly. The solution is
shown as follows:
If the PLC's Scan Time is too short, this may possibly does not have enough time to pick the status from input
points then it will cause to read the keyboard incorrect. Please use the constant Scan Time function to fix the
Scan Time at 20ms.
M9000
M9039
To fix the PLC's Scan Time at 20ms
MOV K20 D9039

HKY X20 Y20 D0 M0

If the PLC's Scan Time is too long, this will cause the keyboard's reading response slow down. Please use the
timer interrupt function to do the keyboard scan function at every 20 ms.

Main program

FEND

ITA20 ITA20 : is the time interrupt pointer, this interrupt section will be executed every 20ms.
M9000
REF X0 K8 The refresh instruction for input points X0 ~ X7

HKY X0 Y0 D0 M0

REF Y0 K8 The refresh instruction for output points Y0 ~ Y7

IRET

END

208
FNC n
1 2 M 3
DSW S D1 D2 Digital Switch (Thumbwheel) Input
72 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D1
D2
n
n=1~2
When n = 1, S occupies 4 components and D1 occupies 4 components, D2 occupies 1 components
When n = 2, S occupies 8 components and D1 occupies 4 components, D2 occupies 2 components

S D1 D2 n S : the initial input point of multiple scans from the digital switch
X0
DSW X20 Y20 D0 K1 D1 : the initial output point of multiple scans to the digital switch
D2 : to place where the switches' input value is stored
n : the number of digital switch sets is connected

The instruction reads one set (or two sets) of four-digit thumbwheel switches by 4 (or 8) consecutive input points,
those consecutive inputs are starting from S . Also, it uses 4 output points to scan which are starting from D 1 .
If the n = K1, it reads up one set of digital switch and puts a four-digit value to D 2 ; besides, If the n = K2, it
reads up two sets of digital switches and puts two four-digit values to D 2 and D 2 +1.

Digital Switch (thumbwheels) input circuit diagram


Y23
3 2 1 0
10 10 10 10
Y22

Y21

Y20
Here must have COM
serial connected
diodes DC24V
(0.1A 50V) 8 4 2 1 8 4 2 1 Transistor
X23 X22 X21 X20 X27 X26 X25 X24 S/S output
points
PLC's inputs for the set #1 PLC's inputs for the set #2 of the PLC

The diagram shown above is a circuit of a multiplexed 4 thumbwheels switch which is composed by X20~X23 and
Y20~Y23. When X0= “ON”, the instruction will start to be performed, the value of the thumbwheels will be read
and converted into a BIN format then the value will be stored in D0. If n =K2 and input points X24~X27 are
nd
connected with another set of the thumbwheels then the value of the 2 set of the thumbwheels will be stored in D1.

The left diagram is the DSW's scan


X0 sequence. When X0= “ON”, Y20~Y23
Y20 0.1 Sec 0.1 Sec 0.1 Sec will automatically cycle the scan. If each
0.1 Sec
cycle is completed, the Execution
Y21 Completed Flag M9029 will “ON” for a
0.1 Sec Scan Time.
Y22
Better use a transistor output unit for the
Y23 0.1 Sec multiplex scan outputs Y20~Y23.

M9029
The instruction can only be used once in
the program.

The Method of Using the Relay Output Unit for the Scan

X0 X0 uses the push-button switch.


SET M0
M0 The DSW instruction will read the value of the thumbwheel switch
DSW X20 Y20 D0 K1 once when X0 is triggered. At the rest time, the DSW instruction is
inactive and not to scan. Therefore, could reduce the scan
M9029
problem at the relay output.
RST M0

209
FNC 1 2 M 3
SEGDP S D Seven Segment Decoder
73 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the source device to be decoded


X20
SEGD D0 K2Y20 D : devices of decoded outputs

When X20=“ON”, decode the content value (nibble format 0~F) of D0's lowest four bits (b0~b3) into a code for a
seven-segment display and output it through Y20~Y27.

The output structure of SEGD is shown in the following table.

S D
Composition of the Data Displayed
Hexadecimal seven segment display b7 b6 b5 b4 b3 b2
Number Bit Format b1 b0

0 0000 0 0 1 1 1 1 1 1
1 0001 0 0 0 0 0 1 1 0
2 0010 0 1 0 1 1 0 1 1
3 0011 0 1 0 0 1 1 1 1
4 0100 0 1 1 0 0 1 1 0
b0
5 0101 0 1 1 0 1 1 0 1
6 0110 b5 b1 0 1 1 1 1 1 0 1
b6
7 0111 0 0 1 0 0 1 1 1
8 1000 b4 0 1 1 1 1 1 1 1
b2
9 1001 0 1 1 0 1 1 1 1
A 1010 b3 0 1 1 1 0 1 1 1
B 1011 0 1 1 1 1 1 0 0
C 1100 0 0 1 1 1 0 0 1
D 1101 0 1 0 1 1 1 1 0
E 1110 0 1 1 1 1 0 0 1
F 1111 0 1 1 1 0 0 0 1

210
FNC n
1 2 M 3
SEGL S D Seven Segment with Latch
74 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
n = 0~7 When n = 0~3, S occupies 1 component and D occupies 8 components
When n = 4~7, S occupies 2 components and D occupies 12 components

S D n S : the source decimal value to be shown in the seven segment display


X20
SEGL D0 Y20 K0 D : the initial point for the scan outputs of the seven segment display
n : the polarity designated for data signals and latch signals

This instruction scan outputs to one (two) set(s) of four-digit seven segment display will occupy 8 (12) consecutive
output points initiating from D and demonstrates the content value of S on the seven segment display. The
content of n is not only to assign one or two sets of four-digit display for the scan outputs, but also to designate
the polarity combination for the terminal of PLC's outputs and the displayer's inputs.
Scan Output Circuit for Seven Segment Display
Display Set #1 ★ Display Set #2 ★
8 8
4 4
2 2
1 1
3 2 1 0 3 2 1 0
10 10 10 10 10 10 10 10

0 1 2 3
1 2 4 8 10 10 10 10 1 2 4 8 DC24V
Y20 Y21 Y22 Y23 Y24 Y25 Y26 Y27 Y30 Y31 Y32 Y33 COM

★ The display must have


latch function.
Transistor output points of the PLC

The diagram shown above is the circuits of a seven segment display composed of Y20~Y27. When X20= “ON”,
the instruction will start to be performed. The value of D0 will be converted into a BCD code then transferred and
displayed on the Display Set #1. If the value of D0 exceeds 9,999, an operation error will occur. If Display Set #2
is also connected with the circuit and the n value is set properly, the content value of D1 will be demonstrated on
the Display Set #2.
When X20= “ON”, Y24~Y27 will cycle the output scan automatically. It takes 12 PLC's Scan Time for a display
cycle and M9029 will turn “ON” for a PLC's Scan Time when each cycle is completed.

Set Value about n


A correct setting of n value is not only can be used to match the logic polarity of the PLC transistor output
terminal with the input terminal of the seven segment module, but also to demonstrate there is one or two sets
of display to be used.
Number of Display Sets One set Two sets
Polarity of the PLC's output terminal
and the displayer's data input Same Different Same Different
terminal
Polarity of the PLC output terminal
and the displayer's data input Same Different Same Different Same Different Same Different
terminal
n 0 1 2 3 4 5 6 7

The output will relate to the table above. If the displayer's character is unsure, can orderly insert a number
0~3 or 4~7 to n until the seven segment display can demonstrate correctly.

Notice
M9000
M9039 When the instruction is performed, each output scan will need 10ms at
least. If the PLC's Scan Time is less than 10ms, please use the constant
Scan Time function to fix the Scan Time at 10ms.
MOV K10 D9039

The SEGL instruction can be used once only in the program.


This instruction is only recommended for use with transistor output modules.

211
FNC 1 2 M 3
ASC S D Convert Letters to ASCII Code
76 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S Key-in eight English letters from computer
D
D occupies (the inputted numbers of English letters in S ÷ 2) components

S D S : the source of English letters will be converted to ASCII codes


X20
ASC ABCDEFGH D0 D : the device where ASCII codes are stored

When X20= “ON”, English letters A ~ H will be converted into ASCII codes and stored in D0 ~ D3.

b15 b0
42H(B) 41H(A) D0
44H(D) 43H(C) D1
46H(F) 45H(E) D2
48H(H) 47H(G) D3

Higher 8 bits Lower 8 bits

If M9161= “ON”, each English letter will take a whole register for to store a converted ASCII code, where the lower
8 bits (b7~b0) of the register is to store the ASCII code and higher 8 bits (b15~b8) will all fill with "0".

b15 b0
00H 41H(A) D0
00H 42H(B) D1
00H 43H(C) D2
00H 44H(D) D3
00H 45H(E) D4
00H 46H(F) D5
00H 47H(G) D6
00H 48H(H) D7

Higher 8 bits Lower 8 bits

If the English letters contents in S is less than 8 characters, the difference is made up with “Space Key” Char
(ASCII code 20H).

212
FNC 1 2 M 3
PR S D Print ASCII Code
77 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
S occupies 4 components D occupies 10 components

S D S : the source devices where ASCII codes are stored


X20
PR D0 Y20 D : the output points to export the ASCII codes

The instruction will read ASCII codes of 4 (or 8) source registers (started from S and each coed will take a byte).
And then, orderly output the ASCII codes to the designated consecutive 8 output points (started from D ).
The process referred above designates 8 points from Y27 (the first bit) to Y20 (the last bit), those are the data
output points. It also designates Y30 as the scan signal and Y31 as the monitoring signal.
There are two operation modes for the PR instruction, depending on the status “ON”/“OFF” of M9027.

M9027= “OFF”
To generate the 8 words of sequence outputs. The operation sequence diagram is shown below:

Activation
signal X20 S Up 8 bits Down 8 bits

D0 2nd word 1st word


Y27~Y20 1st word 2nd word 3rt word 8th word

D1 4 word
th
3rd word
T T T T : The period of one PLC's Scan Time
D2 6th word 5th word
Scan
signal Y30
〜 〜

D3 8th word 7th word


Monitoring
signal Y31

If X20 turns “OFF” during the instruction is performed, the instruction is disabled then the data output will be
discontinued. When X20 turns “ON” again, data will be transferred from the first letter.

M9027= “ON”
To generate the 16 words of sequence outputs. The operation sequence diagram is shown below:
Activation
signal X20
〜 〜

The activation signal


does not have to be


Y27~Y20 1 word
st
2 word
nd
last word active all the time.

T T T T : The period of one PLC's Scan Time


Scan
signal Y30
〜 〜
〜 〜

Monitoring
signal Y31

Execution Completed
Flag M9029

The code “00H” (NUL) represents the end of the string and the following words will not be processed.
If X20 always stays “ON”, the output will be stopped automatically when all data export is finished.
Meanwhile M9029 will not be activated until X20 turns “OFF”.

Please use a transistor output unit for the output points designated by the instruction.
The PR instruction can be used once only in the program.
When performing the instruction, please use the constant Scan Time function to fix the PLC's Scan Time or place
the instruction in a subroutine of the timer interrupt function, they will fix the time value of “T” which shown in the
diagram above.

213
FNC n
1 2 M 3
D F R O M P m1 m2 D Read FROM a Special Module
78 ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
m1
m2
D
n
For the VS2 or VSM series, m1 = 1~8; for the VS3 series, m1 = 1~16 m2 = 0~32,767
The 16-bit instruction, D occupies n components The 32-bit instruction, D occupies ( 2×n ) components n = 1~32,767

m1 m2 D n m1 : the position number of the specied special module


X20
FROM K2 K5 D0 K4 m2 : the initial number of the BFMs to be read
D : the initial device of storage space for reading up BFMs
n : the number of BFMs to be read from the special module

The Main Unit of the VS Series PLC uses this instruction to read BFMs data of the Special Module.

Since the m 1 = K2, m 2 = K5, n = K4 and when X20=“ON”, 4 word data at the BFM #5~BFM #8 in the
specied No. 2 Special Module will be read and store into D0~D3.

The m 1 is to appoint a Special Module, the available number is from K1 to K16. For the Main Unit, K1 represents
to access the closest Special Module, and so on.
When X20 is “OFF”, the instruction will not be performed but the data which had read previously will still remain.

The BFM Number m 2


The VS series Special Module has the components of BFMs (Buffer Memory) which are used to store the
setting values and various operation statuses about the module. Each BFM is a 16-bit space. The different
type of special module has a different number of BFM registers. The ID number of BFM registers is coded in
a decimal method, such as #0, #1,.... #9, #10,...
If a Main Unit is through the BFM to manage the module, this module is called the Special Module.

The Number of Data Groups n to be Transferred


The 16-bit instruction The 32-bit instruction
n n
FROM K1 K0 D0 K4 DFROM K1 K4 D100 K2

D0 BFM #0 D100 BFM #4


D1 BFM #1 D101 BFM #5
D2 BFM #2 D102 BFM #6
D3 BFM #3 D103 BFM #7

The number of the data groups to be transferred is determined by the n . n = 4 in the 16-bit instruction
has the same meaning with n = 2 in the 32-bit instruction.

The related special device for this instruction:

Relay ID No. Description


Preventing to operate the FROM/TO repeatedly.
M9028 When M9028 is “OFF”, disallows interrupt during FROM/TO is in operation.
When M9028 is “ON”, FROM/TO in an interrupt subroutine is ineffective.

214
FNC n
1 2 M 3
D T O P m1 m2 S Write TO a Special Module
79 ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
m1
m2
S
n
For the VS2 or VSM series, m1 = 1~8; for the VS3 series, m1 = 1~16 m2 = 0~32,767
The 16-bit instruction, S occupies n components The 32-bit instruction, S occupies ( 2×n ) components n = 1~32,767

m1 m2 S n m1 : the position number of the specied special module


X20
TO K2 K0 D0 K1 m2 : the initial number of the BFMs to be written
S : the initial device of data source storage space
n : the number of BFMs to be written to the special module

The Main Unit of the VS Series PLC uses this instruction to write data into BFMs at the Special Module.

Since the m 1 = K2, m 2 = K0, n = K1 and when X20 = “ON”, an 1 word data at the D0 of the Main Unit will be
written into specied No. 2 Special Module's BFM #0.

The m 1 is to appoint a Special Module, the available number is from K1 to K16. For the Main Unit, K1 represents
to access the closest Special Module, and so on.
When X20 is “OFF”, the instruction will not be performed but the BFMs' data which had written previously will still
remain.

The BFM Number m 2


The VS series Special Module has the components of BFMs (Buffer Memory) which are used to store the
setting values and various operation statuses about the module. Each BFM is a 16-bit space. The different
type of special module has a different number of BFM registers. The ID number of BFM registers is coded in
a decimal method, such as #0, #1,.... #9, #10,...
If a Main Unit is through the BFM to manage the module, this module is called the Special Module.

The Number of Data Groups n to be Transferred


The 16-bit instruction The 32-bit instruction
n n
FROM K1 K0 D0 K4 DFROM K1 K4 D100 K2

D0 BFM #0 D100 BFM #4


D1 BFM #1 D101 BFM #5
D2 BFM #2 D102 BFM #6
D3 BFM #3 D103 BFM #7

The number of the data groups to be transferred is determined by the n . n = 4 in the 16-bit instruction
has the same meaning with n = 2 in the 32-bit instruction.

The related special device for this instruction:

Relay ID No. Description


Preventing to operate the FROM/TO repeatedly.
M9028 When M9028 is “OFF”, disallows interrupt during FROM/TO is in operation.
When M9028 is “ON”, FROM/TO in an interrupt subroutine is ineffective.

215
216
6-10 Serial Communication Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3
m n n1 Receive/Send Communication
80 RS S D ○ ○ ○ ○
Instruction

81 DPRUNP S D Parallel Run (Octal Mode) ○ ○ ○ ○

82 ASCIP S D n Convert HEX to ASCII ○ ○ ○ ○

83 HEXP S D n Convert ASCII to HEX ○ ○ ○ ○

84 CCDP S D n Check Code ○ ○ ○ ○

87 C P U L S1 S2 n CPU Link Communication Instruction ○ ○ ○ ○

88 P I D S1 S2 S3 D PID Control Loop ○ ○ ○ ○

89 L I N K S1 S2 n Easy Link Communication Instruction ○ ○ ○ ○

217
FNC m n n1 Receive/Send Communication 1 2 M 3
RS S D
80 Instruction ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
m
D
n
n1
m, n = 0~4096 For the VS1 series, n1=1~2; for the VS2 or VSM series, n1 = 1~3; for the VS3 series, n1 = 1~5

S m D n n1 S : the head register ID number for the data to be sent


X20
RS D0 D200 D100 D201 K1 m : the length of the data to be sent
D : the head register ID number for the receiving data
n : the length of the data want to receive
n1 : to appoint the communication port, 1~5 = CP1~CP5

The VS Series PLC uses this instruction to send out or receive the data via its Communication Port CP1~CP5, and
that is by the serial communication interface to communicate with external peripheral equipment.

As many peripheral equipments in the market (e.g. inverters, barcode readers, card readers, electronic displays,
etc.) are equipped with serial communications interfaces and have their own protocols. In order to transfer data
between the PLC and those peripherals, a PLC user need to write the program with communicable function
therefor this RS instruction is to adapt with these communication protocols.

The CP1~CP5 are multi-functional communication ports. Each port can choose an appropriate communication
type from its various functions. When this instruction is using a port, should choose the “Application type:” become
the “Non Protocol”. Regarding the application type selection and related parameter setting, please specify it from
the programming software Ladder Master S and at the “Project” -- “COM Port Setting”.

As shown in the gure below, use the Ladder Master S to set the communication port's “Application type:” of the
VS Series PLC as the “Non Protocol” and at the same page to set other relevant parameters. Set the station No.
and related parameters for each peripheral. Next, in the VS Series PLC, according to the communication protocol
of the peripheral equipments, compile the program with relevant communication.

A variety of peripheral equipment in the market


VS Series PLC
RS- 232
RS- 485
Application type: Non Protocol

Edit the communication


program for corresponding
equipments
Inverter Temperature Controller Barcode Reader

Designate m to be K0 when there is not need to send out data and designate n to be K0 when there is not
need to receive data.

The data transmissions can be divided into the 16-bit mode (M9161 = “OFF”) or 8-bit mode (M9161 = “ON”)
when the RS instruction is performed. Also, the mode ag M9161 should be set before the RS instruction is started.

218
The related special devices are summarized below: ( ■ : Means read only.)
Relay ID No. Description

M9100 CP1 RS instruction data sending out request ag.


M9101 CP1 RS instruction data receive completed ag.
M9102 CP1 RS instruction data receive time-out ag.
M9103 CP1 RS / LINK / MBUS instruction on communication abnormal ag.
M9110 CP2 RS instruction data sending out request ag.
M9111 CP2 RS instruction data receive completed ag.
M9112 CP2 RS instruction data receive time-out ag.
M9113 CP2 RS / LINK / MBUS instruction on communication abnormal ag.
M9120 CP3 RS instruction data sending out request ag.
M9121 CP3 RS instruction data receive completed ag.
M9122 CP3 RS instruction data receive time-out ag.
M9123 CP3 RS / LINK / MBUS instruction on communication abnormal ag.
M9130 CP4 RS instruction data sending out request ag.
M9131 CP4 RS instruction data receive completed ag.
M9132 CP4 RS instruction data receive time-out ag.
M9133 CP4 RS / LINK / MBUS instruction on communication abnormal ag.
M9140 CP5 RS instruction data sending out request ag.
M9141 CP5 RS instruction data receive completed ag.
M9142 CP5 RS instruction data receive time-out ag.
M9143 CP5 RS / LINK / MBUS instruction on communication abnormal ag.

Register ID No. Description


■ D9101 The CP1's amount of residual data to be sent out by the instruction RS.
■ D9102 The CP1's amount of the data already received by the instruction RS.
■ D9111 The CP2's amount of residual data to be sent out by the instruction RS.
■ D9112 The CP2's amount of the data already received by the instruction RS.
■ D9121 The CP3's amount of residual data to be sent out by the instruction RS.
■ D9122 The CP3's amount of the data already received by the instruction RS.
■ D9131 The CP4's amount of residual data to be sent out by the instruction RS.
■ D9132 The CP4's amount of the data already received by the instruction RS.
■ D9141 The CP5's amount of residual data to be sent out by the instruction RS.
■ D9142 The CP5's amount of the data already received by the instruction RS.

219
Sequence of Data Sending and Receiving (Using the CP1 as an example)

X20
RS D0 D200 D100 D201 K1
Edit the data string which is beginning from the D0 to be sent and the
Fill the data string to be sent
length of data string is specified by the D200.
A trigger
pulse for The M9100 will turn “OFF” automatically when that data sending out is completed.
SET M9100 Do not use the RST instruction to reset the M9100.
to send
data Set the data sending
out request flag once
M9101
Move the received data string which is beginning from
Move the received data to the data storage area
the D100 to the data storage area.
The data
receiving is Reset the data receive completed flag M9101 for preparing to receive the next data
RST M9101 string set. Do not reset the M9101 consecutively in the program.
completed
Reset the data receive
completed flag

The Related Flags and Data Registers


1 The Data Sending Out Flag M9100:
When the conditional contact X20 = “ON”, the RS instruction is performed. At this time, if a pulse signal
forces the status of M9100 to be “ON”, the content values of the registers which are beginning from D0
will be sent out via the serial communication port CP1. After the data sending is completed, the M9100
will be reset to “OFF” automatically.
2 The Receive Completed Flag M9101:
When the conditional contact X20 = “ON”, the RS instruction is performed. The CP1 of PLC is ready to
receive communication data.
When the data receiving is completed, the M9101 = “ON”. At this moment, the received data in the buffer
should be moved to the data storage area, and then M9101 could be reset to “OFF”. Afterwards, PLC will
be ready for the status of receiving immediately.
3 The Receive Time-out Flag M9102:
When the data of receiving is paused and the waiting time exceeds the Time-out duration (designated by the
“COM Port Setting”), the M9102 will turn “ON” to represent the happening of Time-out also the Receive
Completed ag M9101 will be forced “ON” to terminate the data receiving action.
The M9102 will not reset automatically, must use an instruction in the program to reset the status of M9101
then the M9102 will be reset too.
By using the function of the Time-out ag, the PLC could receive the data of transferring from peripheral
equipments which without the particular length or “End of Text”.
The Time-out duration is specied by using the programming software Ladder Master S – “Project” –
“COM Port Setting”.
Receiving data

Receiving data Data


The time-out duration

M9102
Reset by program
M9101

4 The Communication Abnormal Flag M9103:


When the RS instruction occurs Parity error or Framing error, the Communication Abnormal Flag M9103
will turn ON. The M9103 must use an instruction in the program to reset the status of M9103

220
Description of Data Sending / Receiving (by the CP1): 16-bit Mode (M9161 = "OFF")

S m D n n1 A 16-bit data Divide the 16-bit data into two


X20
RS D0 K5 D100 K10 K1 Upper 8 bits Lower 8 bits Bytes of data: Upper 8 bits
data and Lower 8 bits data.

Conditional contact
X20 to active the
instruction

Data sending out


request ag M9100
5
4
3
2
D9101 the number 1
of data remaining
to be transferred 0

Data sending out


D0 D0 D1 D1 D2
(TXD) STX Upper 8 Bits Upper 8 Bits ETX
Lower 8 Bits Lower 8 Bits Lower 8 Bits
PLC→ Peripheral
Start Number of sending out data Bytes is designated by m End
of Text of Text

Start Number of received Bytes is designated by n End


of Text of Text

Data received
D100 D100 D101 D101
(RXD) STX Upper 8 Bits Upper 8 Bits ETX
Lower 8 Bits Lower 8 Bits
PLC ← Peripheral
Ready for Ready for
receiving receiving

4
3
2
1
D9102 the number
of received data 0
The data receive
completed ag M9101

Reset by the program Not reset by the


program

Either one of the condition below is completed will cause the receive completed ag M9101 “ON” and stop to
receive.
1 The number of assigned n bytes is satised.

2 The End of Text is received.


3 The occurrence of Time-out.

221
Description of Data Sending / Receiving (by the CP1): 8-bit Mode (M9161 = "ON")

S m D n n1 A 16-bit data The Lower 8 bits of the 16-bit


X20
RS D0 K5 D100 K10 K1 Useless Lower 8 bits data is treated as one Byte data.
(the Upper 8 bits data are useless)

Conditional contact
X20 to active the
instruction

Data sending out


request ag M9100
5
4
3
2
D9101 the number 1
of data remaining
to be transferred 0

Data sending out


(TXD) D0 D1 D2 D3 D4
STX
Lower 8 Bits Lower 8 Bits Lower 8 Bits Lower 8 Bits Lower 8 Bits ETX
PLC→ Peripheral
Start Number of sending out data Bytes is designated by m End
of Text of Text

Start Number of received Bytes is designated by n End


of Text of Text

Data received
(RXD) D100 D101 D102 D103
STX ETX
Lower 8 Bits Lower 8 Bits Lower 8 Bits Lower 8 Bits
PLC ← Peripheral
Ready for Ready for
receiving receiving

4
3
2
1
D9102 the number
of received data 0
The data receive
completed ag M9101

Reset by the program Not reset by the


program

Either one of the condition below is completed will cause the receive completed ag M9101 “ON” and stop to
receive.
1 The number of assigned n bytes is satised.

2 The End of Text is received.


3 The occurrence of Time-out.

222
FNC 1 2 M 3
DPRUNP S D Parallel Run (Octal Mode)
81 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
The ID number of the X, Y or M in the Kn X, Kn Y or Kn M must assign to a number which the last digit is a zero “0”.
When S = Kn X, D must be Kn M; when S = Kn M, D must be Kn Y.

S D S : the transmission source devices


X0
PRUN K4X20 K4M0 D : the transmission destination devices

Transfer the source devices those are designated by S to the destination devices D , the operation is by the
octal number system format.

When X0=“ON”, transfer the content of K4X20 to K4M0 in the octal number system format.

X37 X36 X35 X34 X33 X32 X31 X30 X27 X26 X25 X24 X23 X22 X21 X20

No variation

M17 M16 M15 M14 M13 M12 M11 M10 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0

S D
X1
PRUNP K4M0 K4Y20

When X1 turns from “OFF” to “ON”, the content of K4M0 is transferred to K4Y20 in the octal number system format.

M17 M16 M15 M14 M13 M12 M11 M10 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0

Y37 Y36 Y35 Y34 Y33 Y32 Y31 Y30 Y27 Y26 Y25 Y24 Y23 Y22 Y21 Y20

223
FNC n
1 2 M 3
ASCIP S D Convert HEX to ASCII
82 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
When S or D is designated to the Kn X, Kn Y, Kn M or Kn S, that Kn has to be K4 n = 1~256

S D n S : the head ID of data source


X20
ASCI D0 D100 K8 D : the head ID of the device where conversion results are stored
n : the number of hexadecimal data characters is selected

When the instruction is performed, it converts a series of HEX characters at the source devices (starting from S )
into a series of ASCII codes and transfers the result to the designated devices D . The number of the converted
characters is determined by n .

To convert each 0~F HEX value to a corresponding ASCII code is according to the table below:

HEX Value 0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
ASCII Code 30H 31H 32H 33H 34H 35H 36H 37H 38H 39H 41H 42H 43H 44H 45H 46H

When X20= “ON”, the instruction converts the 8-digit HEX value in D0 and D1 to 8 ASCII codes, and transfers to
the designated registers which are headed by D100.

The instruction has two operation modes, depending on the status of M9161:
Assume S
(D0)=4567H
(D1)=89ABH

M9161=“OFF” (16-bit Conversion Mode)

This mode will divide each designated device starting from D into Upper 8 bits and Lower 8 bits, where two
ASCII codes are stored respectively in a register.
D n=8 n=7 n=6 n=5 n=4 n=3 n=2 n=1 n
D100 Lower 8 Bits 38H 39H 41H 42H 34H 35H 36H 37H
D100 Upper 8 Bits 39H 41H 42H 34H 35H 36H 37H
D101 Lower 8 Bits 41H 42H 34H 35H 36H 37H
D101 Upper 8 Bits 42H 34H 35H 36H 37H
D102 Lower 8 Bits 34H 35H 36H 37H
D102 Upper 8 Bits 35H 36H 37H
D103 Lower 8 Bits 36H 37H
D103 Upper 8 Bits 37H

M9161=“ON” (8-bit Conversion Mode)

This mode will divide each designated device starting from D into Upper 8 bits and Lower 8 bits, while the
used registers' Upper 8 bits are filled with zero (“0”) and Lower 8 bits are to store ASCII codes, each register
stores an ASCII code only.
D n=8 n=7 n=6 n=5 n=4 n=3 n=2 n=1 n
D100 38H 39H 41H 42H 34H 35H 36H 37H
D101 39H 41H 42H 34H 35H 36H 37H
D102 41H 42H 34H 35H 36H 37H
D103 42H 34H 35H 36H 37H
D104 34H 35H 36H 37H
D105 35H 36H 37H
D106 36H 37H
D107 37H

224
FNC n
1 2 M 3
HEXP S D Convert ASCII to HEX
83 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
When S or D is designated to the Kn X, Kn Y, Kn M or Kn S, that Kn has to be K4 n = 1~256

S D n S : the head ID number of data source


X21
HEX D100 D0 K8 D : the head ID number of the position where conversion
results are stored
n : the number of ASCII codes converted

When the instruction is performed, it converts a series of HEX characters at the source devices (starting from S )
into a serial of HEX values and transfers the result to the designated devices D . The number of ASCII codes
converted is determined by n .
into a serial of HEX values and transfers the result to the designated devices
ASCII Code 30H 31H 32H 33H 34H 35H 36H 37H 38H 39H 41H 42H 43H 44H 45H 46H
HEX Value 0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH

When X21= “ON”, the instruction converts 8 ASCII codes which are starting from D100 into a series of HEX values,
and transfers the result to (D0) and (D1).
If one of the content designated by the data source S is not an ASCII code in the table above (0H~FH), PLC will
regard it as an operation error and disable the instruction.
The instruction has two operation modes, depending on the status of M9161:
M9161=“OFF” (16-bit Conversion Mode)
This mode will convert the ASCII codes (stored in Upper 8 bits and Lower 8 bits) at each designated device
S into HEX values.
A nibble
S D n
D100 Lower 8 Bits 38H 0H 0H 0H 8H n=1
D100 Upper 8 Bits 39H 0H 0H 8H 9H n=2
D101 Lower 8 Bits 41H 0H 8H 9H AH n=3
D101 Upper 8 Bits 42H 8H 9H AH BH n=4
D102 Lower 8 Bits 34H 0H 0H 0H 8H 9H AH BH 4H n=5
D102 Upper 8 Bits 35H 0H 0H 8H 9H AH BH 4H 5H n=6
D103 Lower 8 Bits 36H 0H 8H 9H AH BH 4H 5H 6H n=7
D103 Upper 8 Bits 37H 8H 9H AH BH 4H 5H 6H 7H n=8
b15 b0 b15 b0

D1 D0

M9161=“ON” (8-bit Conversion Mode)


This mode will convert the ASCII codes at each Lower 8 bits of designated devices starting from S into HEX
values.
S D n
D100 Lower 8 Bits 38H 0H 0H 0H 8H n=1
D101 Lower 8 Bits 39H 0H 0H 8H 9H n=2
D102 Lower 8 Bits 41H 0H 8H 9H AH n=3
D103 Lower 8 Bits 42H 8H 9H AH BH n=4
D104 Lower 8 Bits 34H 0H 0H 0H 8H 9H AH BH 4H n=5
D105 Lower 8 Bits 35H 0H 0H 8H 9H AH BH 4H 5H n=6
D106 Lower 8 Bits 36H 0H 8H 9H AH BH 4H 5H 6H n=7
D107 Lower 8 Bits 37H 8H 9H AH BH 4H 5H 6H 7H n=8
b15 b0 b15 b0

D1 D0

225
FNC n
1 2 M 3
CCDP S D Check Code
84 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
When S or D is designated to the Kn X, Kn Y, Kn M or Kn S, that Kn has to be K4 n = 1~256 D occupies 2 components

S D n S : the head ID of continuous data source


X20
CCD D0 D100 K8 D : the device where the result of SumCheck is stored
n : the number of source data to be checked

Sum up the content of n bytes (by the unit of 8-bit) data headed with S , the total of the sum is stored in the
designated device D while the Parity bits are stored in the next register.

When the instruction is used for the communication, the data’s “SumCheck” (or “error detect code”) applied to
ensure the accuracy of the data transmission.

When X20= “ON”, sum up 8 consecutive 8-bit data headed with D0, the total of the sum is stored in D100 while
the Parity bits are stored D101.

The instruction has two operation modes depending on the status of M9161:

M9161= “OFF” (16-bit Mode)


This mode will make use of both the Upper 8 bits and Lower 8 bits at every related device (started from S )
become a series of 8-bit data source to do the aggregate operation and generate the Parity data.

Data Content value MSB Content value in Binary LSB


D0 Lower 8 Bits 255 1 1 1 1 1 1 1 1
S D0 Upper 8 Bits 80 0 1 0 1 0 0 0 0
D1 Lower 8 Bits 135 1 0 0 0 0 1 1 1
D1 Upper 8 Bits 28 0 0 0 1 1 1 0 0
D2 Lower 8 Bits 100 0 1 1 0 0 1 0 0
D2 Upper 8 Bits 73 0 1 0 0 1 0 0 1
D3 Lower 8 Bits 210 1 1 0 1 0 0 1 0
When there is an odd number of “1”,
D3 Upper 8 Bits 5 0 0 0 0 0 1 0 1 the bit corresponding to D101 = 1.
D D100 886 When there is an even number of “1”,
D101 1 1 0 0 1 1 1 0 the bit corresponding to D101 = 0.

M9161=“ON” (8-bit Mode)

This mode will only make use of the Lower 8 bits (ignore the Upper 8 bits) at every related device (started from
S ) become a series of 8-bit data source to do the aggregate operation and generate the Parity data.

Data Content value MSB Content value in Binary LSB


S D0 Lower 8 Bits 255 1 1 1 1 1 1 1 1
D1 Lower 8 Bits 80 0 1 0 1 0 0 0 0
D2 Lower 8 Bits 135 1 0 0 0 0 1 1 1
D3 Lower 8 Bits 28 0 0 0 1 1 1 0 0
D4 Lower 8 Bits 100 0 1 1 0 0 1 0 0
D5 Lower 8 Bits 73 0 1 0 0 1 0 0 1
D6 Lower 8 Bits 210 1 1 0 1 0 0 1 0
When there is an odd number of “1”,
D7 Lower 8 Bits 5 0 0 0 0 0 1 0 1 the bit corresponding to D101 = 1.
D D100 886 When there is an even number of “1”,
D101 1 1 0 0 1 1 1 0 the bit corresponding to D101 = 0.

226
FNC n
1 2 M 3
C P U L S1 S2 CPU Link Communication Instruction
87 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1 Using a Table Code Q0~Q31 (V, Z index modiable) or a Table Nickname (by user-dened 16 English characters)
S2
n
S2 occupies 4 components For the VS1 series, n1=1~2; for the VS2 or VSM series, n1=1~3; for the VS3 series, n1=1~5

S1 S2 n S1 : the communication table that describes the data


X20 receiving and transmitting
CPUL DISTRIBUTED_CTRL D100 K1
S2 : the working area for the instruction that occupies
4 registers
n : to designate the communication port, 1~5 =
CP1~CP5

The VS Series PLC uses this instruction to share the particular data via its Communication Port CP1~CP5 with
other VS PLCs, that achieved the purpose of distributed control.

The main character of the CPU LINK is to share instant data.


What we call “Instant” means all the communication work is dealt with instantly without being affected by the PLC
scan time. Other communication method, such as Easy LINK, MODBUS communication and Non Protocol
communication, will follow the PLC's executive cycle and thus is affected by the PLC scan time.
What we call “share” means the way of the CPU LINK communication work is that each station in the
communication network automatically transfers a part of data orderly to other stations in the network. This way the
operation of the whole communication network can be understood through each station in the communication
network.
Through the function of CPU LINK that instantly sharing data with other PLCs, a distributed control system can be
established.

The CP1~CP5 are multi-functional communication ports. Each port can choose an appropriate communication
type from its various functions. When this instruction is using a port, should choose the “Application type:” become
the “CPU Link”. Regarding the application type selection and related parameter setting, please specify it from the
programming software Ladder Master S and at the “Project” -- “COM Port Setting”.

This instruction could be used to transfer for various devices that is including all the Y, M, S, T, C, D and R (except
for special M and special D).

As shown in the gure below, rst use the Ladder Master S to orderly open every PLC's project and set its
“Application type:”as the “CPU Link” then to set an unique station No. (ranging from 0~254) hereafter connect to
the programming port of every PLC to load the project to each PLC.
Afterward, write this instruction in one of the PLC's program then edit the CPUL communication table to designate
data sharing actions, hereafter to load this project to the specic PLC. Following these procedures, the purpose of
sharing instant data between the PLCs is reached.

VS series VS series VS series VS series VS series


PLC PLC PLC PLC PLC

CPU LINK CPU LINK CPU LINK CPU LINK CPU LINK
St. #1 St. #2 St. #1 St. #2 St. #n

RS- 232 RS- 485

When X20 = “ON”, the CPUL instruction starts execution. According to the contents described in the
“DISTRIBUTED_CTRL” communication table, it will arrange sharing particular data between stations, while the
D100~D103 will be occupied to store the state of instruction execution.

When the contents of the communication table specied by the S 1 are execution completed from beginning to
end, it will start over again from the rst item set of the table.

When the X20 turns from “ON” to “OFF”, this instruction stops and the data sharing immediately stop but data
which has transferred previously will still remain.

227
The communication table is assigned by the S 1 of the instruction.
An example of the “CPU Link” provided by programming tool the Ladder Master S is shown below.

Item No. Station No. Device Range Word/Bit Disable Contact


1 0 D0 – D9 M1
2 1 D10 – D19 M1
3 2 D20 – D29 M2
4 3 D30 – D39
※ When the device is selected to be the bit device (Y, M, S or the contact of T, C), the initially ID number at the
device range must be a multiplier of 8, such as Y0, Y10, Y20, M0, M24 or T8. Also, the length must be a
multiplier of 8 as well, such as M0~M23 (24 devices), T8~T15 (8 devices), Y10~Y27 (16 devices), M24~M63
(40 devices).
The rst item set in the table means that Station #0 transmits its D0~D9 to the D0~D9 of other stations in the
communication network.
The second item set in the table means that Station #1 transmits its D10~D19 to the D10~D19 of other stations in
the communication network.
The third item set in the table means that Station #2 transmits its D20~D29 to the D20~D29 of other stations in the
communication network.
The fourth item set in the table means that Station #3 transmits its D30~D39 to the D30~D39 of other stations in
the communication network.
The last column of the table is for the Disable Contact. If that specied contact is “ON”, the communication item
set will be ignored. For example, if M1 = “ON”, the rst and second item sets in the table will skip. This is the new
function of the VS series, which can help designers effectively manage the operation of the communication table.
A communication item set does not need to specify a Disabled Contact (such as the fourth item set), so that the
command of the set does not have the disable control function.

The working area of the executive instruction is starting from the S 2 (using D100~D103 as the example).

S2 Description
Lower 8 bits The record of the station number when the rst communication error is occurred

Instruction working status


D100 0: Normal data transmitting / receiving
Upper 8 bits
A: The communication setting is normal but no response from the Slave station (Time-out occurs)
B: Abnormal communication

D101
The working area is required for the system when this instruction is performed

D103

If any communication error occurs during the execution of the instruction, a code will be recorded in D100. Only
when the content value of D100 is 0, the recording action can be executed.
Therefor, when there are possibilities of several errors, users can use the program to move out the content value of
D100 then reset it to 0. This way allows the D100 to record the next error.

To edit a communication table


Use the Ladder Master S to set up a CPUL communication table and through its interactive window can set up and
edit a communication table easily.
In the structure of VS Series PLC, the communication tables are a part of the project. When the programmer to copy
or access the project, those tables will be duplicated automatically with the program.

228
FNC 1 2 M 3
P I D S1 S2 S3 D PID Control Loop
88 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
S3
D
S3 occupies 25 components

S1 S2 S3 D S1 : the set point value (SV)


X0
PID D0 D1 D100 D200 S2 : the measured present value (PV)
S3 : the initial register ID of the parameters
D : the control output value (MV)

This instruction takes a current value from S 2 and compares it to a predefined set value S 1 , then uses the
parameters (initiated with S 3 ) to process the PID operation. The calculate result will be stored to destination
register D .

When X0= “ON”, this instruction will start to perform; When X0= “OFF”, this process will stop but the content
value of D200 will remain as same as the value before it is disabled.

The PID instruction’s parameters are headed from S 3 , which require occupy 25 consecutive registers.

When the control parametesr S 1 or S 3 +3~ S 3 +6 of setting values are changed, can rerun the PID instruction
for the instant response of output value D .

There’s no limitation on the times used of the PID instruction.

This instruction provide the “Auto-tuning” function, it can help users to decide three of parameters in the PID
instruction. (Please refer to follow pages.)

Since the Sampling time of the PID instruction is by way of to accumulate the number of scanned times of this
instruction. Therefore, to plan the PID instruction in the program must pay attention on two following points:
1 This PID instruction allows to be used in a subroutine, interrupted subroutine, step ladder diagram or related to
the conditional jump instruction. However, at the time that the PID instruction is active, must make sure this
instruction can be processed once and only once at every Scan Time. If this instruction has been processed
more than once or had not been executed, that will cause the sampling error or imprecise operation.
2 When the sampling time is shorter than a Scan Time, it would make a PID process error. Then the PLC
will automatically treat the (Sampling time) = (Scan Time) to execute the PID process.
All the parameters must finished the settings before the PID instruction executes.

229
The Equations of the PID Instruction

This instruction is according to the differential of speed, to operation the PID instruction, the equations are
shown in the table below:

Direction of Operation The Equations of the PID Instruction

Ts
△ MV=K P { (EVn — EVn- 1 ) + EVn + Dn }
TI
EVn=PVn f — SV
Forward
PVnf > SV PVn f = α PVn f - 1 + (1 — α )PVn

TD KD TD
Dn= ( — 2PVn f - 1 + PVn f + PVn f - 2 ) + Dn- 1
Ts+K D T D Ts+K D T D

MVn= Σ △ MV

Ts
△ MV=K P { (EVn - EVn- 1 )+ EVn+Dn }
TI
EVn=SV — PVn f
Reverse PVn f = α PVn f - 1 +(1 — α )PVn
SV > PVn f
TD KD TD
Dn= ( 2PVn f - 1 — PVn f — PVn f - 2 ) + Dn- 1
Ts+K D T D Ts+K D T D

MVn= Σ △ MV

EVn : The current error value Dn : The derivation value


EVn- 1 : The previous error value Dn- 1 : The previous derivation value
SV : The set point value S 1 KP : The proportion constant

PVn : The current process value S 2 α : The constant of input filter

PVn f : The calculated process value TS : The sampling time


PVnf- 1 : The previous process value TI : The integral time constant

PVnf- 2 : The second previous process value TD : The time derivative constant

△ MV : The change in the output manipulation values KD : The derivative filter constant

MVn : The current output manipulation value D

230
The description of the parameter block ( S 3 ~ S 3 +24)
Para- Parameter Description Available Range
meter Name/Function
The time interval should longer than the PLC’s Scan Time
S3 Sampling time (Ts) 1 ~ 32767ms
and the update period of the measuring system
0 : Forward operation
b0
1 : Reverse operation
0 : Disable the Process Value (PVnf) input deviation
alarm
b1
1 : Enable the Process Value (PVnf) input deviation
alarm
0 : Disable the Output Value (MV) deviation alarm
b2
Direction of the PID 1 : Enable the Output Value (MV) deviation alarm
S 3 +1
operation and alarm control
b3 Reserved
0 : The Auto-Tuning function is not active
b4 1 : To start the Auto-Tuning function, the flag will
return to 0 after the Auto-Tuning is finished
0 : Disable the range limit of the Output Value
b5
1 : Enable the range limit of the Output Value
b6 ~ b15 Reserved

Input filter (α) Modify the parameter of input filter to smooth the huge
S 3 +2 0 ~ 99%
changes from the measured current value
S 3 +3 Proportional gain (KP) This is the P (Proportional) part of the PID loop 1 ~ 32767%
This is the I (Integral) part of the PID loop, (0 ~ 32767)
S 3 +4 Integral time constant (TI)
(this parameter disables the I effect if it is set to “0”) ×100ms
To adjust the proportion between the derivative output and the
S 3 +5 Derivative gain (KD) 0 ~ 100%
change of the Process Value (PVnf)
This is the D (Derivative) part of the PID loop, (0 ~ 32767)
S 3 +6 Derivative time constant (TD)
(this parameter disables the D effect if it is set to “0”) ×10ms
S 3 +7
Working space Reserved for the internal processing of the PID instruction
~

S 3 +19
Set point of positive deviation To set the trigger point of positive deviation alarm (upper limit);
S 3 +20 alarm for Process Value (PVnf)
Active when S3+1’s b1= “ON”(1)
0 ~ 32767
Set point of negative deviation To set the trigger point of negative deviation alarm (lower limit);
S 3 +21 alarm for Process Value (PVnf) Active when S3+1’s b1= “ON”(1)
Set point of positive deviation To set the trigger point of positive deviation alarm (upper limit);
alarm for the Output Value (MV) Active when S3+1's b2 = “ON”(1) 0 ~ 32767
S 3 +22
The maximum limit of The maximum limit of Output Value (MV) is effective when
Output Value (MV) – 32768 ~ 32767
S3+1’s b5= “ON”(1)
Set point of negative deviation To set the trigger point of negative deviation alarm (lower limit);
alarm for the Output Value (MV) Active when S3+1’s b2 = “ON”(1) 0 ~ 32767
S 3 +23
The minimum limit of The minimum limit of Output Value (MV) is effective when
Output Value (MV) – 32768 ~ 32767
S3+1’s b5 = “ON”(1)
The positive deviation alarm for Process Value (PVnf)
b0
is arrived
The negative deviation alarm for Process Value (PVnf)
b1
is arrived
S 3 +24 Alarm flags (for read only)
The positive deviation alarm for Output Value (MV)
b2
is arrived
The negative deviation alarm for Output Value (MV)
b3
is arrived

S 3 +1’s b2 and b5 should not be active at the same time.

When any one of the S 3 +1’s b1, b2 or b5 is “ON”, the parameters' block for the PID at S 3 will occupy S 3
~ S 3 +24 total 25 consecutive registers.

When all of the S 3 +1’s b1, b2 and b5 are “OFF”, the parameters' block for the PID at S 3 will occupy S 3 ~
S 3 +19 total 20 consecutive registers.

231
The Description of the Forward or Reverse Operation
If the parameter of S 3 +1’s b0= “OFF” then the PID instruction will process the forward operation;
If the parameter of S 3 +1’s b0=”ON” then the PID instruction will process the reverse operation.
When the measured input Process Value (PVnf) > the Set Point Value (SV), it will generate a positive deviation
then the change to increase the effect is called forward operation.
For example, An air conditioning system: before the system turns on, usually the indoor temperature is higher than
the set point value. (PVnf) > (SV), this is a typical forward operation control sample.

When the measured input Process Value (PVnf) < the Set Point Value (SV), it will generate a negative deviation
then the change to increase the effect is called reverse operation.
For example, An oven: before the heater of the oven turns on, usually the temperature of the oven is lower than the
set point value. (PVnf) < (SV), this is a typical reverse operation control sample.

The Description of the Process Value (PVnf) and Output Value (MV) Deviation Alarm Functions
If the of S 3 +1’s b1= “ON”, PID instruction provides the Process Value (PVnf) deviation alarm. The
parameters setting of the Process Value’s deviation alarm are stored in S 3 +20 and S 3 +21 then the results
will put in S 3 +24’s b0 and b1. The content of S 3 +21 is used as a negative value.
If the S 3 +1’s b2= “ON”, PID instruction provides the Output Value (MV) changing alarm. The parameters
setting of the Output Value's changing alarm are stored in S 3 +22 and S 3 +23 then the results will put in
S 3 +24’s b2 and b3. The content of S 3 +23 is used as a negative value.
The definition of the deviation in Manipulation Values: Deviation = (Current value) – (Previous current value)
The Process Value (PVnf) deviation alarm function: The Output Value (MV) deviation alarm function:
Deviation in Deviation in
Process Value (PVnf) Output Value (MV)
Positive Positive
deviation deviation
alarm alarm

0 Sampling Time 0 Sampling Time

Negative Negative
deviation deviation
alarm alarm
S 3 +24 S 3 +24
ON ON
bit0 bit2

S 3 +24 S 3 +24
ON ON
bit1 bit3

The Description of the Output Value (MV) Limit Function


If the parameter of S 3 +1’s b5= “ON”, the PID instruction provides the range limit function at the Output Value
(MV). The parameters about the settings of the Output Value limits are stored in the S 3 +22 and S 3 +23.
Since both of the limit and alarm functions are occupying to the same parameter registers S 3 +22 and S 3 +23,
therefore only one of the function can be selected and the control bits in the S 3 +1’s b2 and b5 should not be
“ON” at the same time.
This function is very useful for to limit the accumulative raise of the PID derivative value.
The diagram of the Output Value (MV) Limit Function:

Output Value (MV)

With out the range limit function


S 3 +22
Maximum limit

S 3 +23
Minimum limit
With the range limit function

Time

232
The Error Information of the PID Instruction
If a setting value of parameter is not correct or the operation of a PID instruction occurs error, the
Special Relay M9067 will be turned “ON”. And the Special Register D9067 will store the error code.

Error Code Error Cause Effect to the Instruction

6730 The setting value of Sampling Time (Ts) is beyond the range (Ts <1)

6732 The setting value of Input Filter (α) is beyond the range (α<0 or α>=100)

6733 The setting value of Proportion Gain constant (KP) is beyond the range (KP<1)
The PID instruction
will stop to operate
6734 The setting value of Integral Time constant (TI) is beyond the range (TI<0)

6735 The setting value of Derivative Filter Constant (KD) is beyond the range
(KD<0 or KD>100)

6736 The setting value of Derivative Time Constant (TD) is beyond the range (TD<0)

6740 The Sampling Time <= The Scan Time of PLC

The change of the measured Present Value is too large (△ PV < –32768 or
6742 △PV>32767)

6743 The change of current Error Value is too large (△EV < –32768 or △EV > 32767)

The PID instruction will


6744 The calculating value of Integral process exceeds –32768 ~ 32767
continue to operate
The value of Proportion Gain (KP) is too large, it cause the calculating
6745 value of proportion which exceeds the range

6746 The calculating value of Derivative process exceeds –32768 ~ 32767

6747 The calculating result value of the PID instruction which exceeds –32768 ~ 32767

233
The Method to Get The Parameters of a PID Instruction
For a better control result of a PID instruction, we should get the correct parameters of the PID operation. It means
we need to find the apropos values of Proportion Gain (KP), Integral Time Constant (TI) and Derivative Time
Constant (TD).
To get those three parameters, we have many different ways, usually the method of Process / Feedback Loop will
be used. The following is the reference.
The method of Process / Feedback Loop to get the parameters is through to control the output rate became either
0 or 100% a few times. And then, observes the variation between processes and feedbacks, by those dynamic
characteristics to get those parameters of PID.
Output Rate

100%
Output value (MV)
0% Time
Feedback

Max. Slope
= R =R R
1

Time

Lag Time 1
L (Sec) (Sec)

Use the curve to get the PID’s parameters


Integral Time Constant Derivative Time Constant
Control Method Proportion Gain KP(%)
TI (× 100ms) TD (× 10 ms)
1 × Output value (MV)
P
R×L
0.9 × Output value (MV)
PI 33×L
R×L
1.2 × Output value (MV)
PID 20×L 50×L
R×L

Auto-Tuning Function

The VS series provided the Auto-Tuning function which can uses some PID correlative parameters from user
(such as: the operational direction at S 3 +1, Sampling Time Ts, Input Filter (α), Derivative Filter Gain KD and
Set Point Value S 1 ) then via the PID instruction executes the Auto-Tuning function, the system will get three
important parameters of PID.
The Auto-Tuning function can help user to get those three important parameters of the PID then to simplify the
operation of PID instruction.
This instruction is using relay “ON”/“OFF” to execute the Auto-Tuning function, then evaluates three important
parameters of the PID: Proportional gain (KP), Integral time constant (TI), Derivative time constant (TD).
The steps to execute the Auto-Tuning function:
1 Input those 5 basic parameters: the operational direction at the b0 of S 3 +1, Sampling Time Ts S 3 ,
Input Filter (α) S 3 +2, Derivative Gain KD S 3 +5 and Set Point Value S 1 .
2 Fill in the parameters S 3 +14 and S 3 +15.

Parameters Parameter Name/Function Description


S 3 +14 The Max. Output Value The output when the AT is at 100% output rate

S 3 +15 The Mini. Output Value The output when the AT is at 0% output rate

3 Let the parameter of S 3 +1’s b4= “ON”, then it will start to execute the Auto-Tuning operation.
4 When the Auto-Tuning operation is finished, the parameters at S 3 +1’s b4 will turn “OFF” also the
contents of S 3 +14 and S 3 +15 will reset to zero automatically.

234
The General Idea of Thermal Control
Usually use the PID instruction contain in a PLC control system is for the thermal control. The following pages are
the brief expositions about the thermal control.
The construct of a thermal control system
Thermal probe
Thermal controller The controlled object
Temperature Thermo Couple (TC) or
Use the electricity signal Signal Platinum Resistance Thermometer (PT)
of thermal probe and
compare with the setting, Executor
then output the
controlling signal to the Control Signal According to the signal,
executor. use equipments (ex:
Relay output, by control the switch
At the VS series PLC, can use current output or
of heater or the valve
the Main Unit + Temperature potential output
Expansion Card or Temperature of cooling water) to
Module to get the temperature warm up or cool down
signal from the sensor, and then the container of object.
to execute the temperature control
function.

The brief explanation of the thermal control


To set up the value of set point in the temperature controller and let it operates. The object may not steady
changing the temperature immediately to the target temperature because the characteristic of the object.
In general, to expedite the responsive speed, it may cause overheat or waved temperature control. If want to
reduce the strong reaction, should make the response slow.
Some of the perform is like the Chart (1), which wants to control the temperature to the set point value as soon as
possible. Under this condition, the temperature of object may overshooting the set point value, so it can be used
only at the object is not concerned about overheat.
Some of the perform is like the Chart (2), which spends more time to get the smoothly thermal control. It is required
the suppression of overshooting, so the longer time is required for stabilize temperature.
The Chart (3) is showing a compromise curve. That has an ideal responsive value, so it is the most popular type.
Temperature

Temperature

Temperature

Time Time Time


Chart (1), the Overshooting Chart (2), the Inert Response Chart (3), the Ideal Response
and Waving Response

The brief explanation of the thermal control


For the purpose of an ideal thermal control, when choose a thermal sensor and pick the controlling parameters,
it is necessary to fully understand the characteristics of controlled object.
(1) Heat Capacity : How difficult to change the temperature, it may relate to the size of object.
(2) Heating Static Characteristics : It is indicate the capability of heating, which depends on the output capacity of
heater.
(3) Initially Dynamic Characteristic : At the beginning of heating, the characteristic of temperature changing which is
complicated relationship with container and heater.
(4) External Disturbances : Some of the interference changes the temperature. For example, a door of the constant
temperature furnace is opened.

235
The PID Parametric Explanations
(1) P (Proportional Control) Action
The control action is used for obtaining the output in proportion to the input.
This control operation is to generate an output rate that is related to the difference between the set point and the
measured temperature, by way of the multiplication product of the difference and the proportional gain.
Therefore, the control operation rate related to the difference and the gain is called the proportional control.
Output Rate Output Rate Temperature
A small proportional A large proportional
The effective gain is set. gain is set. Offset

Set point
range of the
proportional A large proportional
100% gain is set.
control

A small proportional
0% gain is set.

Set point Temperature Set point Temperature Time

(2) I (Integral Control) Action


The I (integral) action is the output rate adjustment by the content value of Integral time constant (TI)
The P action will cause an offset definitely. Therefore, if proportional control action and integral control action
are used in combination, the offset will be reduced as the time goes by until finally the control temperature will
coincide with the set point and the offset will be reduced.
Temperature Output Rate Temperature

Offset The offset will


A short integral time is set.
A short integral time is set.
Set point

Set point
be reduced
100 %
PI (proportional and A long integral time is set.
integral control) action 50 %

P (proportional A long integral time is set.


control) action only 0%

Time Time Time

(3) D (Derivative Control) Action


The D (derivative) action is the output rate adjustment by the content value of Derivative time constant (TD).
It provides a rapid output rate response when the measured temperature is changed.
The action of the proportional control and the integral control are by way of to correct the control result.
Therefore, the response of proportional and integral control actions are slow when the temperature change is
quick, which is why derivative control action is required. Derivative control action corrects the result of control
by adding the control output in proportion to the slope of temperature change.
A large quantity of control output is added for a radical external disturbance so that the temperature can be
quickly in control.
Temperature Output Rate Temperature
PD (proportional and
derivative control) action A long derivative time is set.
A long derivative time is set.
Set point

Set point

100 % A short derivative


time is set.
External
disturbance 50 %
P (proportional A short derivative
control) action only 0% time is set.

Time Time Time

236
(4) PID Control
PID control is a combination of P(proportional), I (integral) and D (derivative) control actions, in which the
temperature is controlled smoothly by proportional control action without hunting, automatic offset adjustment
is made by integral control action, and quick response to an external disturbance is made possible by
derivative control action.

PID Control

Control Cycle and Time-Proportioning Control Action


When the temperature control is used with a relay or SSR to control the output, it will follow the designated cycle
time to intermittently turn “ON” or “OFF” in a specified period. This preset cycle is called control cycle and this
control method is called time-proportioning control action. A PLC system in the main unit is always using this
method to procure temperature control.

The Definition of Integral Time The Definition of Derivative Time


Integral time is the period required for a step-type Derivative time is the period required for a ramp-type
deviation in integral control (e.g., the deviation deviation in derivative control (e.g., the deviation shown
shown in the following graph) to coincide with in the following graph) to coincide with the control output
the control output in proportional control action. in proportional control action. The longer the derivative
The shorter the integral time will cause the stronger time will cause the stronger derivative control action.
integral control action. If the integral time is too short,
it will cause a quick and huge correction then may
have the temperature waving.
Deviation
Deviation

0 0

PD action
(With a short derivative time)
PI action
(With a short integral time)
PD action
Control output rate

Control output rate

(With a long derivative time)


PI action
(With a long integral time)

P action

D2 action

P action
D1 action

T I1 TI : integral time T D1 TD : derivative time


(With a short integral time) (With a shor t derivative time)

T I2 T D2
(With a long integral time) (With a long derivative time)

237
Auto-Tuning
All PID process/temperature controllers require the adjustment of the P, I, D and other parameters in order to allow
accurate control of the load. There have been a variety of conventional methods but the Auto-Tuning methods make
it possible to obtain PID constants suitable to a variety of objects automatically.

Adjust the PID Parameters


It is convenient while the PID constants calculated via the Auto-Tuning operation and normally they are more correct
than tuning by manual. Usually, the Auto-Tuning do not cause problems and we will suggest using it to set up the
parameters. Except for some particular applications if the more accurate constants is necessary. In which case,
refer to the following to readjust the PID constants.
Response to Change in Proportional Gain
Set point

It is possible to suppress overshooting although a


Narrower comparatively long startup time and reaction time
will be required.

The process value reaches the set point within a


Set point

comparatively short time and keeps the


Wider temperature stable although overshooting and
waving will result until the temperature becomes
stable.

Response to Change in Integral Time


Set point

It is possible to reduce waving, overshooting and


Wider undershooting although a comparatively long
startup time and set time will be required.
Set point

The process temperature reaches the set point


within a comparatively short time although
Narrower
overshooting, undershooting and waving will
result.

Response to Change in Derivative Time


The process value reaches the set point within a
Set point

comparatively short time with comparatively small


Wider amounts of overshooting and undershooting
although fine-cycle waving will result due to the
change in process value.
Set point

It will take a comparatively long time for the


Narrower process value to reach the set point with heavy
overshooting and undershooting.

The Definition of the Forward Operation The Definition of the Reverse operation
To increase the control output rate when the To increase the control output rate when the
temperature of the object is higher than the temperature of the object is lower than the set point
set point (positive deviation). Usually using (negative deviation). Usually using in a heating
in a cooling control. control.
Output Rate Output Rate

100 % 100 %

0% 0%
Temperature Temperature
Set point Set point

238
The Example of PID Temperature Control
When design a PID temperature control program, the method below is the recommendable procedure to perform
the PID instruction.
Start using the To correct the PID
control system parameters No
Executes the Auto-Tuning According to the PID Is it an Yes The PID instruction is
Controlled object (AT) function to get the expected
changes parameters to execute functioning and gets a
correct PID parameters the PID control result? well control

Controlled object
doesn’t change

The System Structure of Temperature Control


Isolated K-type

Soldering Pot
VS-2TC-EC Thermocouple
VS-PLC Set point =245°C
Temperature
Main Unit EC1 Expansion
Card
C0 Y0 Y1
Heater

Error indicator
Magnetic contactor

Program Example
When X0=”ON”, it will executes Auto-Tuning function, and then starts the PID control; Otherwise, when X0=“OFF”,
it will executes the PID function directly.
This program is to control the “ON”/“OFF” length percentage in a specific time-span (5 seconds).
When this program starts at the first time, must let X0= “ON”, then by the Auto-Tuning to get parameters of PID.
Otherwise, the PID control will occur error because the related parameters aren’t ready yet.
M9002
MOV K2450 D100 Let the set point = 245°C, unit= 0.1°C.

MOV K2000 D200 Set the Sampling Time of the PID’s Ts = 2 sec.

MOV H0001 D201 Set the PID instruction to do the Reverse operation.
X0
PLS M0 When X0 = “OFF” → “ON”, it will start to execute the Auto-Tuning (AT).
M0 To set the value of D when the AT is ececuting and the output is = 100%
MOV K1000 D214 (parameter S 3 +14). Since the T200 dominates the control output cycle and its
set value is K1000, thus D214 is set to be K1000.
MOV K0 D215 To set the value of D when the AT is ececuting and the output is = 0% (parameter
S 3 +15).
MOV H0011 D201 Set the PID instruction to do the Reverse operation and start to execute the
Auto-Tuning.
= EC1D18 K105 M10 Ensure the expansion card in EC1 is the VS-2TC-EC.
M10
MOV H0 EC1D0 Set the external thermocouple to be the K Type.

MOV K10 EC1D6 Set the average of the TC1 to be 10 times.

MOV EC1D2 D101 Read the temperature value of the TC1 and copy it to the D101, unit = 0.1 ℃ .
M10
PID D100 D101 D200 D102 To operate the PID instruction.
T200 K1000
T200 To assign the period of repeating cycle to be 10 seconds.

< T200 D102 Y1 According to the result of the PID calculation to drive the heater.
M9067
Y0 The output of PID control loop error alarm.

239
FNC n
1 2 M 3
L I N K S1 S2 Easy Link Communication Instruction
89 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1 Using a Table Code Q0~Q31 (V, Z index modiable) or a Table Nickname (by user-dened 16 English characters)
S2
n
For the VS1 series, n = 1~2; for the VS2 or VSM series, n = 1~3; for the VS3 series, n = 1~5

S1 S2 n S1 : the communication table that describes the data


X20 receiving and transmitting
LINK CP1_DATA_TRANS D100 K1
S2 : the working area for the instruction that occupies
4 registers
n : to designate the communication port, 1~5=CP1~CP5

The VS Series PLC uses this instruction to transmit or get the designated data via its Communication Port CP1~
CP5 with other VS PLCs.
The CP1~CP5 are multi-functional communication ports. Each port can choose an appropriate communication
type from its various functions. When this instruction is using a port, should choose the “Application type:”
become the “VS Computer Link Master”. Regarding the application type selection and related parameter setting,
please specify it from the programming software Ladder Master S and at the “Project” -- “COM Port Setting”.
This instruction could be used to transfer for various devices that is including all the Y, M, S, T, C, D and R (except
for special M and special D).
As shown in the gure below, select one of these linked PLCs as the Master station and the rest as the Slave
stations. First, use the Ladder Master S to orderly open every Slave PLC's project and set its “Application type:” as
the “VS Computer Link Slave” then to set an unique station No. (ranging from 0~254). After that, connect to the
programming port of every PLC to load the project to each Slave PLC.
Next, write this instruction in the Master PLC's program and set its “Application type:” as the “VS Computer Link
Master”, then edit the LINK communication table to designate data transferring actions. After that, to load this
project to the Master PLC. Following these procedures, the purpose of data delivery between the PLCs can be
reached.

VS series VS series VS series VS series VS series


PLC PLC PLC PLC PLC

VS LINK VS LINK VS LINK VS LINK VS LINK


Master Slave Master Slave Slave

RS- 232 RS- 485

When X20=“ON”, the LINK instruction starts execution. According to the contents described in the
“CP1_DATA_TRANS” communication table, it proceeds data write or read actions to the appointed Slave PLC
stations, while the D100~D103 will be occupied to store the state of instruction execution.
When the contents of the communication table specied by the S 1 are execution completed from beginning to end,
the M9104 will be “ON” for a scan time then the procedure will start over again from the rst item set of the table.
When the X20 turns from “ON” to “OFF”, this instruction stops and the data sharing immediately stop but data
which has transferred previously will still remain.
The related special devices are summarized below: ( ■ : Means read only.)
Relay ID No. Description

M9103 CP1 RS / LINK / MBUS instruction on communication abnormal ag.


■ M9104 CP1 LINK / MBUS instruction on execution table complete once ag.
M9113 CP2 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9114 CP2 LINK / MBUS instruction on execution table complete once ag.
M9123 CP3 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9124 CP3 LINK / MBUS instruction on execution table complete once ag.
M9133 CP4 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9134 CP4 LINK / MBUS instruction on execution table complete once ag.
M9143 CP5 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9144 CP5 LINK / MBUS instruction on execution table complete once ag.

240
The communication table is assigned by the S 1 of the instruction.
An example of the “LINK” provided by programming tool the Ladder Master S is shown below.

Item Command Device at Direction Slave St. Device at Length Word / Bit Disable
No. Master No. Slave Contact
1 Read D0 1 D0 10 M1
2 Write D10 1 D10 5 M1
3 Read D20 2 D0 10 M2
4 Write D30 2 D10 5
5 Write D40 255 D40 20 M0

The rst item set in the table means that the Master reads the data D0~D9 from the Slave #1 and stores them at
the D0~D9 of the Master.
The second item set in the table means that the Master writes its data at D10~D14 to the D10~D14 of the Slave #1.
The third item set in the table means that the Master reads the data D0~D9 from the Slave #2 and stores them at
the D20~D29 of the Master.
The fourth item set in the table means that the Master writes its data at D30~D34 to the D10~D14 of the Slave #2.
The fth item set in the table means that the Master writes its data at D40~D59 to all the D40~D59 of the Slaves.
To set the Slave station #255 means that the Master writes the data to all of the Slaves. Note that Read Command
cannot be used in this application.
The last column of the table is for the Disable Contact. If that specied contact is “ON”, the communication item
set will be ignored. For example, if M1 = “ON”, the rst and second item sets in the table will skip. This is the new
function of the VS series, which can help designers effectively manage the operation of the communication table.
A communication item set does not need to specify a Disabled Contact (such as the fourth item set), so that the
command of the set does not have the disable control function.

The working area of the executive instruction is starting from the S 2 (using D100~D103 as the example).

S2 Description

Lower 8 bits The record of the Slave's station number when the rst communication error is occurred
Instruction working status
0: Normal data transmitting / receiving
D100 4: The error is caused by the assigned device is inappropriate
Upper 8 bits 7: The error is caused by the communication command is incorrect
A: The communication setting is normal but no response from the Slave station
(Time-out occurs)
B: Abnormal communication
D101

The working area is required for the system when this instruction is performed
D103

The LINK instruction will reset the D100 to be 0 before the rst item set at the table is executed.
If any communication error occurs during the execution of the instruction, a code will be recorded in D100. Only when
the content value of D100 is 0, the recording action can be executed. Therefor, when there are possibilities of several
errors, users can use the program to move out the content value of D100 then reset it to 0. This way allows the D100
to record the next error.

To edit a communication table


Use the Ladder Master S to set up a LINK communication table and through its interactive window can set up and
edit a communication table easily.
In the structure of VS Series PLC, the communication tables are a part of the project. When the programmer to copy
or access the project, those tables will be duplicated automatically with the program.

241
242
6-11 Handy Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3

90 DBRDP S D Read Data From Data Bank ○ ○ ○ ○

91 DBWRP S D Write Data Into Data Bank ○ ○ ○ ○

92 T P I D S1 S2 S3 S4 n Temperature PID Control ○ ○ ○ ○

93 D T R D P S1 S2 D n Read Data From Data Table ○ ○ ○ ○

102 ZPUSHP D Batch Store of All Index Register ○

103 ZPOPP D Batch Recover of All Index Register ○

243
FNC n
1 2 M 3
DBRDP S D Read Data From Data Bank
90 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
S is a 32-bit component, S = 0~655,359
When S designates to D or R as the object, that occupies 2 registers.
When S uses K or H and modies by V, Z index, that occupies a pair of V, Z index registers.
D is a 16-bit component, but when uses V, Z index to modify, that occupies a pair of V, Z index registers.
n = 1~32,767

S D n S : the initial address number at the Data Bank to be read


X20
DBRDP D0 D1000 K100 D : the initial register ID number to store the read data
n : the length of the data to be read

Then X20 = “OFF” → “ON” and (D1,D0) = 100, it will execute to read a group of data at the addresses 100~199 in
the Data Bank and put the data in D1000~D1099. Due to the n = 100, it will read a group data that contents
with 100 words.
When a Main Unit is equipped with a VS-MC or VS-MCR memory card, it will be provided with the Data Bank. After
that, for the application which need to store or get a large number of data is convenient.
The Data Bank in the VS-MC or VS-MCR card is stored in the component of Flash ROM. It can store 655,360
words of data and there has no limit on the number of reading times.
When X20 = “OFF”, the instruction will not be performed but the data (which has read previously) will still remain.

244
FNC n
1 2 M 3
DBWRP S D Write Data Into Data Bank
91 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
S is a 16-bit component, but when uses V, Z index to modify, that occupies a pair of V, Z index registers.
D is a 32-bit component, D = 0~655,359
When D designates to D or R as the object, that occupies 2 registers.
When D uses K or H and modies by V, Z index, that occupies a pair of V, Z index registers.
n = 1~32,767

S D n S : the initial register ID number for a group of data


X20 that writes to the Data Bank
DBWRP D1000 D0 K100
D : the initial address number at the Data Bank to be
write
n : the length of the data to be write

When X20 = “OFF” → “ON” and (D1,D0) = 100, it will execute to read a group of data at the Main Unit's D1000~
D1099 and store the data into the addresses 100~199 in the Data Bank. Due to the n = 100, it will write a group
data that contents with 100 words.
When a Main Unit is equipped with a VS-MC or VS-MCR memory card, it will be provided with the Data Bank. After
that, for the application which need to store or get a large number of data is convenient.
The Data Bank in the VS-MC or VS-MCR card is stored in the component of Flash ROM. Even though, in every
section of the memory, the rewrite operate is available to be used more than 10,000 times. But, it still has the limit.
So, when the program using this DBWR instruction to rewrite data into the card, better change it to the DBWRP
instruction. The DBWRP can avoid useless operate of rewrite, and then extend the lifespan of the Flash ROM.
When the instruction rewrites data to the memory card, every section (128 words) needs 15ms to execute the
function. The CPU will wait for the execution to complete and then continuously perform the rest of the program.
At that moment, the current value of the Watch Dog Timer will be automatically extended. Thus, when using this
instruction to store a large amount of data, should pay attention to the effect which write action may cause.

245
FNC n
1 2 M 3
T P I D S1 S2 S3 S4 Temperature PID Control
92 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
S3
S4
n
S1 and S2 individually occupie n consecutive registers S3 occupies (10×n)+10 consecutive registers
S4 occupies 6×n consecutive registers n = 1~16

S1 S2 S3 S4 n S1 : the initial register ID of the Set Value (SV) block


X0
TPID D7000 D0 D100 D7100 K16 S2 : the initial register ID of the Present Values (PV)
block
S3 : the initial register ID of the parameters of
instruction & outputs
S4 : the initial register ID of the parameters of PID &
other Set values
n : Number of object channels need to control by
this instruction
This TPID instruction is especially for temperature application at the multi-object (1~16) PID control.
The instruction provides temperature PID control, Auto-Tuning (AT), Auto/Manual control functions and alarms.
So, the instruction can easily procure a smooth temperature control.
The instruction uses the difference between S 1 (one in the set value block) and S 2 (correlated one in the present
value block), then via the content values of parameters in S 3 and S 4 to process the PID operate.
The control result signal of coil ON/OFF will effect relative bit at S 3 +5. If the analog control output is required, the
result value of PID will appear at correlated register of S 3 .
When X0= “ON”, this instruction starts to perform; When X0=“OFF”, this process stops and all the output
contacts at S 3 +5 will be turned “OFF” also all the analog output values in the S 3 will be reseted to “0”.
There's no limitation on the times used of the TPID instruction.
This instruction provided with the “Auto-Tuning (AT)” function, it can help users to decide the parameters of P (KP),
I (TI) and D (TD) at the TPID instruction. (Please refer to following pages.)
This instruction accumulates the values of difference between S 1 & S 2 block at every PLC Scan Time, those with
parameters become parts of operand then effect the control output cycles. So, to use this instruction must pay
attention to the suggestion below:
This TPID instruction allows to be used in a subroutine, interrupted subroutine, step ladder diagram or related to
the conditional jump instruction. However, at the time that the PID instruction is active, must make sure this
instruction can be processed once and only once at every Scan Time. If this instruction has been processed more
than once or had not been executed, that will cause the sampling error or imprecise operation.

The specification of Set Value (SV) S 1 block


By the content value of parameter n to establish the number of object channels then the S 1 block will occupy n
registers.
The content value of S 1 is the Set Value (SV) for the first object channel; the content value of S 1 +1 is the
Set Value (SV) for the second object channel; and so on.
The specification of the measured Present Values (PV) S 2 block
By the content value of parameter n to establish the number of object channels then the S 2 block will occupy n
registers.
The Present Value (PV) in S 2 is from the sensor of the first object channel; the Present Value (PV) in S 2 +1 is
from the sensor of the second object channel; and so on.

246
The description of the parameter block S 3
Para- Parameter Description Available Range
meter Name/Function
To assign the outputs period interval (the length of one ON/OFF
S3 Control Cycle Setting
cycle) 10~32767 × 10ms

To assign the responsive level of the instruction which is for all


S 3 +1 Responsive Sensitivity 0~3
channels (“0”: Fast / .. / “3”: Slow
By relative bits at this register to assign the reacted direction of H0000~HFFFF
S 3 +2 Operational Directions
channels ( “0”: “Reverse” / “1”: “Forward” )
By relative bits at this register to assign the control method of
S 3 +3 Auto/Manual Select bits channels ( “0”: Automatic / “1”: Manual ) H0000~HFFFF

By relative bits at this register to start the Auto-Tuning (AT) function


S 3 +4 AT Command bits of channels ( “1”: start AT; reset to “0” when AT has been finished ) H0000~HFFFF

S 3 +5 Outputs Output the control signals for object channels by relative bits
S 3 +6 Limitation Alarm Status Display the limitation alarms for object channels by relative bits
S 3 +7 Deviation Alarm Status Display the deviation alarms for object channels by relative bits
S 3 +8
System Operating Area Reserved for the internal processing of the TPID instruction
S 3 +9
The First Object Analog
S 3 +10 Output Display the analog output value of the first object channel 0~1000 × 0.1%

S 3 +11 The First Object


Reserved for the internal processing of the TPID instruction

Operating Area
S 3 +19
The Second Object
S 3 +20 Analog Output Display the analog output value of the second object channel 0~1000 × 0.1%

S 3 +21 The Second Object


Reserved for the internal processing of the TPID instruction

Operating Area
S 3 +29

The values in S 3 ~ S 3 +9 are the common parameters for all objects of this instruction.
And, to add any object channel will occupy extra 10 registers, those occupy form S 3 +10 to S 3 +(10×n+9).
The parameter at S 3 is the control output period setting for this instruction.
Usually, the length of control period depends on the type of loading.
If the the equipment is driven by a Magnetic Contactor (MC), to set the value bigger than 1000
(1000×10ms. = 10 Sec.) is recommend that is for extend its lifespan.
If the the equipment is driven by a Solid State Relay (SSR), can set the value to 200 (200×10ms.=2 Sec.)
The parameter at S 3 +1 is to set up control sensitivity for the response of this instruction.
The value in S 3 +1 will affect all object channels in the instruction.
To control the temperature of a system, always expect its response as soon as possible but in some condition the
quick response will cause temperature waving then occur a unsuccessful control. Therefore, could adjust its level
of response to get a better control.
The value 0~3 in this parameter represents the level of responsive sensitivity from the fast “0” to the slowest “3”.
Which “3” has the least possibility to cause temperature waving.

Each bit at S 3 +2 is for set up control direction of every single object channel.
When the measured Present Value (PV) < the Set Value (SV), it will generate a negative deviation and increase
the control effect, that is called the “Reverse” operation. E.g. An oven: before the heater of the oven turns on.
Usually the temperature of the oven is lower than the Set value. (PV) < (SV), this is a typical “Reverse”
operation control sample.
When the measured Present Value (PV) > the Set Value (SV), it will generate a positive deviation and increase
the control effect, that is called the “Forward” operation. E.g. An air conditioning system:
before the system turns on. Usually the indoor temperature is higher than the Set value. (PV) > (SV), this is a
typical “Forward” operation control sample.
b15 b1 b0
“0” stands for the “Reverse” (heating) control;
S 3 +2 “1” stands for the “Forward” (cooling) control
To assign the direction of the first object channel

To assign the direction of the second object channel

To assign the direction of the sixteenth object channel

247
Each bit at S 3 +3 is for set up Auto/Manual control of every single object channel.

b15 b1 b0
S 3 +3 “0” stands for PID automatic control; “1” stands for manual control.
When using the manual control mode, should input the expected output value
(0 ~ 1000) directly to relative register.

To assign the A / M method of the first object channel

To assign the A / M method of the second object channel

To assign the A / M method of the sixteenth object channel

Each bit at S 3 +4 is for trigger the Auto-Tuning (AT) function of every single object channel.
b15 b1 b0
S 3 +4 To trigger the b0 “ON”, the first object channel will start to process the AT
function; when its AT function finished, the b0 will be reset to “OFF” and the
parameters P (KP), I (TI) and D (TD) will put into relative registers in S 4 block.

To trigger the AT function of the first object channel

To trigger the AT function of the second object channel

To trigger the AT function of the sixteenth object channel

Each bit at S 3 +5 is for output the “ON” / ”OFF” control signal of every single object channel.
b15 b1 b0
S 3 +5 By the S 3 period and the calculated result of TPID instruction to produce
outputs (proportional “ON” / “OFF” rate in every period).

To output the control signal of the first object channel

To output the control signal of the second object channel

To output the control signal of the sixteenth object channel


Each object channel will also generate an analog PID output value.
The results are output to S 3 +(10×m) (m=1 ~ n). E.g. The S 3 +10 is the output value of the first object channel;
the S 3 +20 is the output value of the second object channel; and so on. Those output values can be used for the
digital-analog (D/A) convert circuits to perform the analog control outputs.
This S 3 +5 outputs are using those values in S 3 +(10×m) (m=1 ~ n) to produce proportional “ON” / “OFF”
output signals. But at the manual control method, should put the expected output values (0 ~ 1000) into relative
registers.

This instruction provides two alarm signals for each object channel. See the illustrations below.
1 Limitation Alarm 2 Deviation Alarm
When a object channel uses the When a object channel uses the Allowably (+/–) deviant value.
“Reverse” operation, the “Forward” operation, the
Limitation Alarm will “ON” if the Limitation Alarm will “ON” if the
PV is higher then the alarm PV is lower then the alarm set ON OFF ON
set value. value. PV
Low Hi
Set Value
OFF ON ON OFF (SV) of S 1
PV PV
Low Hi Low Hi
Alarm Alarm
Set Value Set Value

248
Each bit at S 3 +6 is for storage the status of Limitation Alarm of every single object channel.

b15 b1 b0
S 3 +6

The status of Limitation Alarm from the first object channel

The status of Limitation Alarm from the second object channel

The status of Limitation Alarm from the sixteenth object channel


A object channel has a set value of Limitation Alarm which is put in S 4 +(6×m +4) (m=0 ~ n–1); the S 4 +4 is
for the first object channel; the S 4 +10 is for the second object channel; and so on.

Each bit at S 3 +7 is for storage the status of Deviation Alarm of every single object channel.
b15 b1 b0
S 3 +7

The status of Deviation Alarm from the first object channel

The status of Deviation Alarm from the second object channel

The status of Deviation Alarm from the sixteenth object channel

An object channel has a set value of Deviation Alarm which is put in S 4 +(6×m +5) (m=0 ~ n–1); the S 4 +5 is
for the first object channel; the S 4 +11 is for the second object channel; and so on.

249
The exposition of parameter block S 4 ( KP, TI, TD & other set values )
Para- Parameter Description Available Range
meter Name/Function
Proportional Gain (KP)
S4 The P (Proportional) part of the PID loop 1~32767×0.01
of the First Object Channel
Integral Time Constant (TI) The I (Integral) part of the PID loop, (this parameter
S 4 +1 of the First Object Channel disables the I effect if it is “0”) 0~32767×100ms

Derivative Time Constant (TD) The D (Derivative) part of the PID loop (this parameter
S 4 +2 of the First Object Channel disables the D effect if it is “0”) 0~32767×10ms

Overshoot Repression Value To set this repression deviation appropriately could


S 4 +3 of the First Object Channel repress the overshoot at the beginning 0~32767

For the “Reverse” operation: Limitation Alarm


Limitation Alarm Set Value “ON” if PV > this set value.
S 4 +4 of the First Object Channel For the “Forward” operation: Limitation Alarm –32768~32767
“ON” if PV < this set value.
Deviation Alarm Set Value Deviation Alarm “ON” if PV > (SV + this set value) or
S 4 +5 of the First Object Channel PV < (SV - this set value) –32768~32767

Proportional Gain (KP) of the


S 4 +6 The P (Proportional) part of the PID loop 1~32767×0.01
Second Object Channel
Integral Time Constant (TI) of The I (Integral) part of the PID loop, (this parameter
S 4 +7 the Second Object Channel disables the I effect if it is “0”) 0~32767×100ms

Derivative Time Constant (TD) The D (Derivative) part of the PID loop, (this parameter
S 4 +8 of the Second Object Channel disables the D effect if it is “0”) 0~32767×10ms

Overshoot Repression Value To set this repression deviation appropriately could repress
S 4 +9 of the Second Object Channel the overshoot at the beginning 0~32767
For the “Reverse” operation: Limitation Alarm
Limitation Alarm Set Value “ON” if PV > this set value.
S 4 +10 of the Second Object Channel For the “Forward” operation: Limitation Alarm –32768~32767
“ON” if PV < this set value.
Deviation Alarm Set Value Deviation Alarm “ON” if PV > (SV + this set value) or
S 4 +11 of the Second Object Channel PV < (SV - this set value) –32768~32767

The register block starting from S 4 is for storage every channel’s KP, TI, TD parameters, starting Overshoot
Repression and two alarm set values.
Every channel will occupy 6 sequential registers. The S 4 ~ S 4 +5 keep parameters for the first channel;
the S 4 +6 ~ S 4 +11 keep parameters for the second channel; and so on.

Registers for the block of S 4 are usually assigned to latched registers.


Every channel's KP, TI and TD parameters could use the Auto-Tuning (AT) function to get the values,
also available given by user.
The unit of the Overshoot Repression follows the SV value. If the unit of SV is 0.1°C (usually), then to use the
function of starting Overshoot Repression, its unit is equal to 0.1 °C also.
If the application of temperature control which is sensitive to the starting overshoot, the channel could use this
function and appropriately set the deviation value then it can effectively repress starting overshoot. To get this
repressive value, could observe the maximum overshoot at AT processing. Or, approximately preset a value
( 10.0 ~ 20.0 °C ) to do an experiment then use the result to adjust the repressive value.

To read the statuses of alarms which are appointed by the parameter block S 4 , please refer to the instruction of
S 3 +6 and S 3 +7.

250
TPID Instruction Temperature Control Example I
When design a PID temperature control program, the method below is the recommendable procedure to perform
the TPID instruction.
Start to use the control To adjust the PID
system parameters by user No
Executes the Auto-Tuning (AT) According to the PID Is it an Yes The TPID instruction is
The controlled set value is performing well and gets a
function to get the appropriate parameters to execute expected
replaced
PID parameters of the channel the PID control result? satisfactory control

The controlled set value is


kept

The System Structure of Temperature Control


Isolated

Soldering Pot
Thermocouple
VS-PLC VS-2TC-EC
Set point value=245.0°C
Main Unit EC1 Temperature
Expansion
Card
C0 Y0 Y1
Heater

Overheating warning indicator


Magnetic Contactor

Program Example
When X0=“ON”, it will execute the Auto-Tuning (AT) function first and then start the PID control; Otherwise, when
X0=“OFF”, it will execute the PID operation directly.
Must be trigger the X0=“ON” once if this program is started at the first time, then by the Auto-Tuning (AT) function
to get the P, I and D parameters of the channel. Otherwise, the PID control will occur error because the related
parameters are not ready yet.
M9002
MOV K2450 D0 Let the set point = 2450, unit = 0.1 ℃ . (2450×0.1 ℃ = 245.0 ℃ )

MOV K1000 D100 Assign the period of output cycle to be 10 sec. (1000×10ms. = 10sec.)

MOV K0 D101 Assign the Responsive Sensitivity level as “Fast”.

MOV K0 D102 Set the TPID instruction to do the Reverse operation. (Heating control)

MOV K0 D103 Assign the control of the channel is automatic.

MOV K2800 D7004 Let 280 ℃ as the value of Limitation Alarm for overheating warning.

<> D106 K0 Y0 Output the Limitation Alarm signal to the Y1.


X0
MOVP H01 D104 When X0 = “OFF” → “ON”, the instruction will start to execute the Auto-Tuning.

= EC1D18 K105 M0 Ensure the expansion card in EC1 is the VS-2TC-EC.


M0
MOV H0 EC1D0 Set the external thermocouple to be the K Type.

MOV K20 EC1D6 Set the average of the TC1 to be 20 times.

MOV EC1D2 D10 Read the temperature value of the TC1 and copy it to the D10, unit = 0.1 ℃ .
M0
TPID D0 D10 D100 D7000 K1 Operate the TPID instruction.

<> D105 K0 Y1 By the result of the TPID calculation to drive the heater via Y1.

251
TPID Instruction Temperature Control Example II
Below provides an example of an 8 channel PID temperature control. This needs a 32 point VS2 Series Main Unit
and 2 of the VS-4TC-EC expansion cards. Also, a human-machine interface (HMI) is required to proceed for data
setting and status display.
The list of devices used in this example:
Controlled CH # 8 7 6 5 4 3 2 1
Auto/Manual Select M2007 M2006 M2005 M2004 M2003 M2002 M2001 M2000
AT Command M27 M26 M25 M24 M23 M22 M21 M20
AT Status M47 M46 M45 M44 M43 M42 M41 M40
Output Point Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
Limitation Alarm Status M67 M66 M65 M64 M63 M62 M61 M60
Deviation Alarm Status M87 M86 M85 M84 M83 M82 M81 M80
Temp. Set Value (SV) D7007 D7006 D7005 D7004 D7003 D7002 D7001 D7000
Temp. Present Value (PV) D7 D6 D5 D4 D3 D2 D1 D0
Parameter of P Phase (KP) D7142 D7136 D7130 D7124 D7118 D7112 D7106 D7100
Parameter of I Phase (TI) D7143 D7137 D7131 D7125 D7119 D7113 D7107 D7101
Parameter of D Phase (TD) D7144 D7138 D7132 D7126 D7120 D7114 D7108 D7102
Overshoot Repression Value D7145 D7139 D7133 D7127 D7121 D7115 D7109 D7103
Limitation Alarm Value D7146 D7140 D7134 D7128 D7122 D7116 D7110 D7104
Deviation Alarm Value D7147 D7141 D7135 D7129 D7123 D7117 D7111 D7105

Besides the devices on the table above, this instruction will occupy the registers D100~D189. When actually use this
instruction, some unnecessary control items (e.g. Auto/Manual control selection) could be removed from the program
then those items would not occupy components.
Program example:
M9002
MOV K1000 D100 Assign the output control cycle = 10 sec. (1000×10 ms. = 10 sec.)

MOV K0 D101 Assign the Responsive Sensitivity level as “Fast” for all the channels.
Assign the control direction of CH1~CH8 as the “Reverse”
MOV H0 D102 operation (Heating).
M9000 Setup Auto/Manual control method of CH1~CH8
MOV K2M2000 D103 by Latched M2000~M207.
Use the M20~M27 to trigger the AT function of CH1~CH8.
WOR K2M20 D104 D104 At this application must use the WOR instruction, the MOV
instruction can't be used here.
MOV D104 K2M40 Use the M40~M47 to display the AT operational status of the CH1~CH8.
If a coil “ON”, the corresponded channel is processing the AT.
Assign the Y0~Y7 become the control outputs of CH1~CH8, by the output
MOV D105 K2Y0 signals to drive the loaders.
Assign the M60~M67 become the Limitation Alarm indicators for the
MOV D106 K2M60 overheating warning of CH1~CH8.
M9013 K3600 Turn the C0 “ON” after one hour to activate the Deviation Alarm monitors, that
C0 would ensure the system is processing under normal temperature.
C0
MOV D107 K2M80 Assign
CH1~CH8.
the M80~M87 become the Deviation Alarm indicators of

= EC1D18 K106 = EC2D18 K106 M100 Ensure the expansion card in EC1 is a VS-4TC-EC,
and also in the EC2 is a VS-4TC-EC.
M100
MOV H0 EC1D0 Set the external thermocouples at the EC1's VS-4TC-EC to be the K Type.

FMOV K20 EC1D6 K4 Set the average temperature values of TC1~TC4 at the EC1's VS-4TC-EC
to be 20 times.
Read the temperature values of the EC1's TC1~TC4 and copy those to the
BMOV EC1D2 D0 K4 D0~D3, unit = 0.1 ℃ .
M100
MOV H0 EC2D0 Set the external thermocouples at the EC2's VS-4TC-EC to be the K Type.

FMOV K20 EC2D6 K4 Set the average temperature values of TC1~TC4 at the EC2's VS-4TC-EC
to be 20 times.
Read the temperature values of the EC2's TC1~TC4 and copy those to the
BMOV EC2D2 D4 K4 D4~D7, unit = 0.1 ℃ .
M100
TPID D7000 D0 D100 D7100 K8 Operate the TPID instruction.

252
FNC n
1 2 M 3
D T R D P S1 S2 D Read Data From Data Table
93 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1 Using a Table Code Q0~Q31 (V, Z index modiable) or a Table Nickname (by user-dened 16 English characters)
S2
D
n

S1 S2 D n S1 : the Table Code or Table Nickname of the


X20 data table
DTRDP FORMULA_TABLE K0 D1000 K100
S2 : the initial address number at the table to
be read
D : the initial register ID number to store the
read data
n : the length of the data to be read
(Unit: word)

This instruction in the VS Series PLC reads the specic data from the data table. And then, stores the data into
given Data Registers to provide as the reference source for program operation.

When X20 = “OFF” → “ON”, it will execute to read a group of data at the addresses 0~99 in the
“FORMULA_TABLE” and put the data in D1000~D1099. Due to the n = 100, it will read a group data that
contents with 100 words.

At the previous VB series PLC, it has the File Register. Usually, the user can preset a huge number of data in the
File Register and while the status of the PLC turns from STOP to RUN the system will duplicate the contents from a
block of the File Register to the specic general registers automatically. That is very useful for the machine's
parameters or reference data.
Compared with that, the VS series substitute the File Register to the Data Table to store a huge of preset data for
the parameters and the reference data. The new structure of Data Table can have many tables and be named for
each purpose. It has the advantage about easy to manage and access.

The Data Table is established by the programming tool Ladder Master S, it is a part of the project. Therefore, when
the project is installed to the PLC, all the Data Tables will be copied together.

253
FNC 1 2 M 3
ZPUSHP D Batch Store of All Index Register
102 ○
FNC 1 2 M 3
ZPOPP D Batch Recover of All Index Register
103 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
D

D D : the pointer to manage the packed location of the Index Registers


M9000
ZPUSH D0

D
M9000
ZPOP D0

The VS series PLC has 16 Index Registers (Z0~Z7 and V0~V7). If those are reused in the program and may
disturb to the results of each other, it is necessary to manage the Index Registers.
The purpose of the ZPUSH and ZPOP instructions are to manage the Index Registers conveniently.
To use these two instructions must be paired, the ZPUSH is to store the value of registers and the ZPOP is to
recover the data.
Firstly, let the D0 = 0. When the ZPUSH instruction is executed, it will duplicate the content values of Z0~V7 to the
D1~D16 and increase the value at D0 become 1 that means one set of Index Registers is stored.
When the ZPOP instruction is executed, it will retrieve the content values of D1~D16 back to the Z0~V7 and
decrease the value at D0 from 1 to 0 that means no preserved data for Index Registers.
Below is an example to appoint the data storage by D0. The ZPUSH instruction will store all the data of Index
Registers into the specified registers; the ZPOP instruction will restore the data from the specified registers.
M9002
MOV K0 D0 When the PLC turns STOP → RUN, to make D0 = 0.

M9000
ZPUSH D0 Duplicate the data from Z0~V7 to D1~D16 and increase the pointer D0=D0+1=1.

M9000
ZPUSH D0 Duplicate the data from Z0~V7 to D17~D32 and increase the pointer D0=D0+1=2.

M9000
ZPUSH D0 Duplicate the data from Z0~V7 to D32~D48 and increase the pointer D0=D0+1=3.

M9000
ZPOP D0 Retrieve the data from D33~D48 to Z0~V7 and decrease the pointer D0=D0 – 1=2.

M9000
ZPOP D0 Retrieve the data from D17~D32 to Z0~V7 and decrease the pointer D0=D0 – 1=1.

M9000
ZPOP D0 Retrieve the data from D1~D16 to Z0~V7 and decrease the pointer D0=D0 – 1=0.

The most common uses of the ZPUSH and ZPOP instructions are in the programming structure of the nest and call
subroutine.

Please note that occupied space of the instruction depends on the content value of D and the value is driven by
the using times of call and nest levels.

254
6-12 Floating Point Arithmetic Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3
Compare Two BIN Floating Point
110 D E C M P P S1 S2 D ○ ○ ○ ○
Numbers
Compare a BIN Float Number to
111 D E Z C P P S1 S2 S D ○ ○ ○ ○
BIN Float Zone

112 DEMOVP S D Move Floating Point Data ○ ○ ○ ○

Convert BIN Floating Point to


116 D E S T R P S1 S2 D Character String

Convert Character String to


117 DEVALP S D BIN Floating Point

Convert BIN to DEC Floating Point


118 DEBCDP S D ○ ○ ○ ○
Format
Convert DEC to BIN Floating Point
119 DEBINP S D ○ ○ ○ ○
Format

120 D E A D D P S1 S2 D BIN Floating Point Addition ○ ○ ○ ○

121 D E S U B P S1 S2 D BIN Floating Point Subtraction ○ ○ ○ ○

122 D E M U L P S1 S2 D BIN Floating Point Multiplication ○ ○ ○ ○

123 D E D I V P S1 S2 D BIN Floating Point Division ○ ○ ○ ○

124 DEXPP S D BIN Floating Point Number Exponent ○ ○ ○ ○

125 DLOGEP S D BIN Floating Point Nature Logarithm ○ ○ ○ ○

126 DLOG10P S D BIN Floating Point Common Logarithm ○ ○ ○ ○

127 DESQRP S D BIN Floating Point Square Root ○ ○ ○ ○

128 DENEGP D BIN Floating Point Negation ○ ○ ○ ○

129 DINTP S D BIN Floating Point → BIN Integer Format ○ ○ ○ ○

130 DSINP S D Calculate Sine ○ ○ ○ ○

131 DCOSP S D Calculate Cosine ○ ○ ○ ○

132 DTANP S D Calculate Tangent ○ ○ ○ ○

133 DASINP S D Calculate Arc Sine ○ ○ ○ ○

134 DACOSP S D Calculate Arc Cosine ○ ○ ○ ○

135 DATANP S D Calculate Arc Tangent ○ ○ ○ ○

136 DRADP S D Convert Angle From Degrees to Radian ○ ○ ○ ○

137 DDEGP S D Convert Angle From Radian to Degrees ○ ○ ○ ○

255
FNC Compare Two BIN Floating Point 1 2 M 3
D E C M P P S1 S2 D
110 Numbers ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D
D occupies 3 consecutive devices

S1 S2 D S1 : the compare value #1


X0
DECMP D0 D10 M0 S2 : the compare value #2
D : the compare result; occupying 3 consecutive points

Compare the content value of S 1 (compare value #1) with the value of S 2 (compare value #2), and save the
result in D (compare result).

The DECMP instruction will be enabled when X0 = “ON”, and all the content values are used by the BIN oating
point format.
If S 1 > S 2 (D1, D0 > D11, D10), then M0 = “ON”;
If S 1 = S 2 ( D1, D0 = D11, D10), then M1 = “ON”;
If S 1 < S 2 ( D1, D0 < D11, D10), then M2 = “ON”.

When X 0 = “OFF”, the instruction is disabled, the “ON”/“OFF” status of M0, M1 and M2 remains the same as the
status before X0 = “OFF”.

This instruction is a 32-bit instruction. Therefore, be sure to input DECMP or DECMPP in the program.

Please use serial or parallel links of M0~M2 to generate the result as “≥”, “≤” or “≠”.

If a source operand is assigned to a constant integer K or H, this instruction will automatically convert the number
to BIN oating point number for the calculation. Therefore, could execute the comparison function.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

256
FNC Compare a BIN Float Number to 1 2 M 3
D E Z C P P S1 S2 S D
111 BIN Float Zone ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
S
D
D occupies 3 consecutive devices S1 ≦ S2

S1 S2 S D S1 : the lower limit of zone compare


X0
DEZCP D0 D2 D10 M0 S2 : the upper limit of zone compare
S : the compare value
D : the compare result; occupying 3 consecutive points

Compare the content value of S (compare value) with the values of S 1 (lower limit of zone compare) and S 2
(upper limit of zone compare), then save the result in D (compare result).

The DEZCP instruction will be enabled when X0 = “ON”, and all the content values are used by the BIN oating
point format.
If S < S 1 (D11, D10 < D1, D0, the compare value is less than the lower limit), then M0 = “ON”;
If S 1 ≤ S ≤ S 2 (D1, D0 ≤ D11, D10 ≤ D3, D2, the compare value is between the upper and lower limit), then
M1 = “ON”;
If S > S 2 (D11, D10 > D3, D2, the compare value is bigger than the upper limit), then M2 = “ON”.

When X0 = “OFF”, the instruction is disabled, the “ON”/“OFF” status of M0, M1 and M2 remains the same as
the status before X0 = “OFF”.

This instruction is a 32-bit instruction. Therefore, be sure to input DEZCP or DEZCPP in the program.

When S 1 > S 2 , the content value of S 1 will become both upper/lower limits to be compared with the S .

If a source operand is assigned to a constant integer K or H, this instruction will automatically convert the number
to BIN oating point number for the calculation. Therefore, could execute the comparison function.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

257
FNC 1 2 M 3
DEMOVP S D Move Floating Point Data
112 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the source device to be transferred


X0
D : the destination device
DEMOV D0 D10

To copy the designated value from S to D .

The content value of the BIN oating point format in D1, D0 will be copied to D11, D10 when the X0 = “ON”.

The instruction is disabled and D11, D10 remain invariable when the X0 = “OFF”.

This instruction is a 32-bit instruction. Therefore, be sure to input DEMOV or DEMOVP in the program.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

258
FNC Convert BIN Floating Point to 1 2 M 3
D E S T R P S1 S2 D
116 Character String ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D

S1 S2 D S1 : the source of BIN floating point number


X0
DESTR D20 D10 D0 S2 : the devices to appoint the conversion format
D : the head ID of the converted storage devices

This instruction uses a BIN floating point number at the S 1 to perform the conversion. By the format parameters
at the S 2 to convert each digit of that number become an ASCII code and combine those codes to a string, then
stores into the devices which are headed by D .
Format of floating point number
S2 to display 0 : By the decimal notation; 1 : By the exponential notation

S 2 +1 Length of the converted string 2~24, the conversion could not exceed 24 characters.
Number of digits after the decimal
S 2 +2 point at the string 0~7, input 0 if the conversion is used to get an integer.

This instruction will use the following ASCII conversion table:


Sign & Number SPACE + – 0 1 2 3 4 5 6 7 8 9 E
ASCII Cord 20H 2BH 2DH 2EH 30H 31H 32H 33H 34H 35H 36H 37H 38H 39H 45H

By the decimal notation:

S2
D10 0 To assign the process is by the decimal notation
D11 8
D12 4

S 1 =(D21, D20)
–1.23456 – 1 2 3 4 6 The expanded number during the conversion

D D0 D0 D1 D1 D2 D2 D3 D3 D4
Lower Upper Lower Upper Lower Upper Lower Upper
8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits
2DH(–) 20H( ) 31H( 1) 2EH(•) 32H( 2) 33H( 3) 34H( 4) 36H( 6) 0000H
Positive or Space One's Decimal End of
negative place point 4 digits after the string
sign decimal point

The positive or negative sign is using the 20H to represent positive; the 2DH represents negative.
The byte next to the positive or negative sign is a blank space, that will ll in the code 20H.

If ( S 2 +2)=0, that indicates an integer will be shown, so there is no decimal point in the string; if ( S 2 +2)>0,
that indicates the number has a fractional part, so the decimal point will be added to the string.
The expanded number 1.2346 is caused by to round off the content of next digit 6, hence that increases the
last used digit from 5 to 6.
When the expanded number converts to the ASCII codes, the instruction adds the end of string at the tail
automatically. If the set length of the string is an odd number, the end of string is 00H; in addition, the string
with even number set length will add the end of string 0000H. Thus, the D4 at the converted string with the
value 0000H that is the end of string.

259
By the exponential notation:

S2
D10 1 To assign the process is by the exponential notation
D11 11
D12 3

S 1 =(D21, D20)
123.4567 1 2 3 5 E 0 2 The expanded number during the conversion

D D0 D0 D1 D1 D2 D2 D3 D3 D4 D4 D5 D5
Lower Upper Lower Upper Lower Upper Lower Upper Lower Upper Lower Upper
8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits
20H( ) 20H( ) 31H( 1) 2EH(•) 32H( 2) 33H( 3) 35H( 5) 45H( E) 2BH( +) 30H( 0) 32H( 2) 00H
Positive or Space One's Decimal Indicate Positive End of
negative place point 3 digits after the the or 2 digits exponent string
sign decimal point Exponential negative
sign for
exponent

The positive or negative sign is using the 20H to represent positive; the 2DH represents negative.
It has one digit at the one's place only.
Also, the byte next to the positive or negative sign is a blank space, that will ll in the code 20H.
If ( S 2 +2)=0, that indicates an integer will be shown at the mantissa, so there is no decimal point in the
string; if ( S 2 +2)>0, that indicates the number has a fractional part, so the decimal point will be added to
the string. At the example above, ( S 2 +2)=3, thus the decimal point will be added automatically.
The expanded number 1.235 is caused by to round off the content of next digit 5, hence that increases the
last used digit from 4 to 5.
For the part of the exponent:
The instruction adds a character "E" in the front of the exponent part automatically.
In this part, its positive or negative sign is using the 2BH to represent positive; the 2DH represents negative.
The length of the exponent number is xed to 2 digits.
When the expanded number converts to the ASCII codes, the instruction adds the end of string at the tail
automatically. If the set length of the string is an odd number, the end of string is 00H; in addition, the string
with even number set length will add the end of string 0000H. Thus, the D4 at the converted string with the
value 0000H that is the end of string.

This instruction is a 32-bit instruction. Therefore, be sure to input DESTR or DESTRP in the program.

260
FNC Convert Character String to 1 2 M 3
DEVALP S D
117 BIN Floating Point ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the head ID of the character string to be converted


X0
DEVAL D0 D100 D : the storage device for the BIN floating point result

This instruction uses a string started from the S to perform the BIN floating point number conversion, then stores
the result into the device D . The format of the source string can either use the decimal notation or the exponential
notation.

This instruction will use the following ASCII conversion table:


ASCII Cord 20H 2BH 2DH 2EH 30H 31H 32H 33H 34H 35H 36H 37H 38H 39H 45H
Sign & Number SPACE + – 0 1 2 3 4 5 6 7 8 9 E

By the decimal notation:


S D0 D0 D1 D1 D2 D2 D3 D3 D4 D4 D5 D5
Lower Upper Lower Upper Lower Upper Lower Upper Lower Upper Lower Upper
8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits
2DH(–) 20H( ) 30H( 0) 31H( 1) 32H( 2) 33H( 3) 2EH(•) 34H( 4) 35H( 5) 36H( 6) 37H( 7) 00H
End of
string

D =(D101, D100)
– 0 1 2 3 4 5 6 7 –123.456

The positive or negative sign:


Only 6 digits will be taken, discards
the 20H or 2BH represents positive; The ineffective bytes the rest (the 7 is useless)
the 2DH represents negative. (space 20H and zero
30H) will be ignored

By the exponential notation:


S D0 D0 D1 D1 D2 D2 D3 D3 D4 D4 D5 D5 D6 D6 D7 D7
Lower Upper Lower Upper Lower Upper Lower Upper Lower Upper Lower Upper Lower Upper Lower Upper
8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits
2BH 20H 30H 31H 2EH 32H 33H 34H 35H 36H 37H 45H 2BH 30H 32H
(+) ( ) ( 0) ( 1) (•) ( 2) ( 3) ( 4) ( 5) ( 6) ( 7) ( E) ( +) ( 0) ( 2) 00H
End of
string

D =(D101, D100)
0 1 2 3 4 5 6 7 E 0 2 1.23456E+2

The positive or negative sign: Ignore


The ineffective bytes Only 6 digits will be taken,
the 20H or 2BH represents
(space 20H and zero discards the rest (the 7 is
positive; the 2DH represents
30H) will be ignored useless)
negative.

The conversion could not process the string that exceeds 24 characters.

This instruction will affect the special devices below:

Description
Relay ID No. Indication
Cause Effect
M9020 Zero Flag The number is equal to 0 M9020=ON
M9021 Borrow Flag The absolute value is small then 2 -128
D =2 - 126 , M9021=ON
M9022 Carry Flag The absolute value is more then or equal to 2128 D =2 128 , M9022=ON

This instruction is a 32-bit instruction. Therefore, be sure to input DEVAL or DEVALP in the program.

261
FNC 1 2 M 3
DEBCDP S D Convert BIN to DEC Floating Point Format
118 ○ ○ ○ ○
FNC 1 2 M 3
DEBINP S D Convert DEC to BIN Floating Point Format
119 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the source device to be converted


X0
DEBCD D0 D10 D : the destination device which the results to be stored

When X0 = “ON”, this instruction is activated. It will uses the BIN format oating number in (D1, D0) to convert the
number to a DEC format oating number then moves the value into (D11, D10).

This instruction is a 32-bit instruction. Therefore, be sure to input DEBCD or DEBCDP in the program.

For example, if the content value in (D1, D0) is 1.234×102, then after the converted, (D10) = 1234 and (D11) = -1.

S D S : the source device to be converted


X1
DEBIN D2 D12 D : the destination device which the results to be stored

When X1 = “ON”, this instruction is activated. It will uses the DEC format oating number in (D3, D2) to convert the
number to a BIN format oating number then moves the value into (D13, D12).

This instruction is a 32-bit instruction. Therefore, be sure to input DEBIN or DEBINP in the program.

For example, if the content value in (D2) = 2345 and (D3) = 5, then after the converted, (D13, D12) is 2.345×108.

The format for storing a oating point number will occupy two Registers in the PLC system.

Please refer to the section 2-13 “Numerical System” for the formats of BIN and DEC oating point numbers are
stored in the Registers.

262
FNC 1 2 M 3
D E A D D P S1 S2 D BIN Floating Point Addition
120 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D

S1 S2 D S1 : the summand
X0
DEADDP D0 D2 D10 S2 : the addend
D : the total

When X0 = “OFF” → “ON”, the summand (D1, D0) will be added to the addend (D3, D2), and the total will be
stored at the specied destination device (D11, D10). The components used in the instruction which are all stored
in the BIN oating number format.

1.235×10 2 (D1, D0) BIN floating number

3.2×10 0 (D3, D2) BIN floating number

1.267×10 2 (D11, D10) BIN floating number

This instruction is a 32-bit instruction. Therefore, be sure to input DEADD or DEADDP in the program.

If a source operand is assigned to a constant integer K or H, this instruction will automatically convert the number
to BIN oating point number for the calculation. Therefore, could execute the addition function.

The result of this instruction will affect the status of the following ags:
When the operated result is equal to “0”, the Addition / Subtraction Zero Flag M9020 turns “ON”.
When the operated result is exceeded the upper limit of the BIN oating point format (positive & negative included),
the Carry Flag M9022 turns “ON”.
When the operated result is less than the insignicant limit of the BIN oating point format (positive & negative
included), the Borrow Flag M9021 turns “ON”.
The available range of the BIN oating point format, please refer to the section 2-13 “Numerical System” for the
reference of the oating point number.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

263
FNC 1 2 M 3
D E S U B P S1 S2 D BIN Floating Point Subtraction
121 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D

S1 S2 D S1 : the minuend
X0
DESUBP D0 D2 D10 S2 : the subtrahend
D : the difference

When X0 = “OFF” → “ON”, the subtrahend (D3, D2) will be subtracted from the minuend (D1, D0), and the
difference will be stored at the destination device (D11, D10). The components used in the instruction which are
all stored in the BIN oating number format.

1.235×10 2 (D1, D0) BIN floating number

3.2×10 0 (D3, D2) BIN floating number

1.203×10 2 (D11, D10) BIN floating number

This instruction is a 32-bit instruction. Therefore, be sure to input DESUB or DESUBP in the program.

If a source operand is assigned to a constant integer K or H, this instruction will automatically convert the number
to BIN oating point number for the calculation. Therefore, could execute the subtraction function.

The result of this instruction will affect the status of the following ags:
When the operated result is equal to “0”, the Addition / Subtraction Zero Flag M9020 turns “ON”.
When the operated result is exceeded the upper limit of the BIN oating point format (positive & negative included),
the Carry Flag M9022 turns “ON”.
When the operated result is less than the insignicant limit of the BIN oating point format (positive & negative
included), the Borrow Flag M9021 turns “ON”.
The available range of the BIN oating point format, please refer to the section 2-13 “Numerical System” for the
reference of the oating point number.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

264
FNC 1 2 M 3
D E M U L P S1 S2 D BIN Floating Point Multiplication
122 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D

S1 S2 D S1 : the multiplicand
X0
DEMUL D0 D2 D10 S2 : the multiplier
D : the product (of a multiplication)

When X0 = “ON”, the multiplicand (D1, D0) will be multiplied by the multiplier (D3, D2), and the product will be
stored at the destination device (D11, D10). The components used in the instruction which are all stored in the BIN
oating number format.

3.14×10 0 (D1, D0) BIN floating number

× 2.3×10 1 (D3, D2) BIN floating number

7.222×10 1 (D11, D10) BIN floating number

This instruction is a 32-bit instruction. Therefore, be sure to input DEMUL or DEMULP in the program.

If a source operand is assigned to a constant integer K or H, this instruction will automatically convert the number
to BIN oating point number for the calculation. Therefore, could execute the multiplication function.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

265
FNC 1 2 M 3
D E D I V P S1 S2 D BIN Floating Point Division
123 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D

S1 S2 D S1 : the dividend
X0
DEDIVP D0 D2 D10 S2 : the divisor
D : the quotient

When X0 = “OFF” → “ON”, the dividend (D1, D0) will be divided by the divisor (D3, D2), and the quotient will be
stored at the destination device (D11, D10). The components used in the instruction which are all stored in the
BIN oating number format.

1.23×10 4 (D1, D0) BIN floating number

÷ 3.0×10 -1 (D3, D2) BIN floating number

4.1×10 4 (D11, D10) BIN floating number

This instruction is a 32-bit instruction. Therefore, be sure to input DEDIV or DEDIVP in the program.

If a source operand is assigned to a constant integer K or H, this instruction will automatically convert the number
to BIN oating point number for the calculation. Therefore, could execute the division function.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

If the value of divisor S 2 is equal to “0”, the PLC will regard that as an operational error.

266
FNC 1 2 M 3
DEXPP S D BIN Floating Point Number Exponent
124 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the source device of the exponent at the function


X0
DEXPP D0 D10 D : the destination device to store the exponent result

This instruction performs the exponential function on a BIN oating point number that is designated by S and
stores the BIN oating point format result in the D designated device.

When X0 = “OFF” → “ON”, by way of the BIN oating point number in (D1, D0) as the exponent to perform the
exponential function, and the result will be stored in (D11, D10).
2.1 (D1, D0) BIN floating number
e = 8.166167 (D10, D11) BIN floating number

This instruction based on the constant base e = 2.71828 to perform the exponential function.

This instruction is a 32-bit instruction. Therefore, be sure to input DEXP or DEXPP in the program.

The source operand S must assign to a BIN oating point number for the calculation.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

128 -126
If the absolute value of the result D is larger than 2 or less than 2 , the PLC will regard that as an operational
error.

267
FNC 1 2 M 3
DLOGEP S D BIN Floating Point Nature Logarithm
125 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
S>0

S D S : the source device to be performed the natural logarithmic operation


X0
DLOGEP D0 D10 D : the destination device to store the natural logarithmic result

This instruction performs the natural logarithmic operation on a BIN oating point number that is designated by S
and stores the BIN oating point format result in the D designated device.

When X0 = “OFF” → “ON”, this instruction performs the natural logarithmic operation on the BIN oating point
number in (D1, D0) as the logarithm to the base of the mathematical constant e, and the result will be stored in
(D11, D10).
loge 10 = In 10= 2.302585 (D11, D10) BIN floating number
(D1, D0) BIN floating number

This instruction is based on the constant base e = 2.71828 to perform the natural logarithm function.

This instruction is a 32-bit instruction. Therefore, be sure to input DLOGEP or DLOGEP in the program.

The source operand S must assign to a BIN oating point number for the calculation.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

If the value of S is less than or equal to zero, the PLC will regard that as an operational error. Therefore, the S
must designate to a positive number.

268
FNC 1 2 M 3
DLOG10P S D BIN Floating Point Common Logarithm
126 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
S>0

S D S : the source device to be performed the common


X0 logarithmic operation
DLOG10P D0 D10
D : the destination device to store the common
logarithmic result

This instruction performs the common logarithmic operation on a BIN oating point number that is designated by
S and stores the BIN oating point format result in the D designated device.

When X0 = “OFF” → “ON”, this instruction performs the common logarithmic operation on the BIN oating point
number in (D1, D0) as the logarithm to the base 10, and the result will be stored in (D11, D10).
log10 20 = 1.30103 (D11, D10) BIN floating number
(D1, D0) BIN floating number

This instruction is based on the constant number 10 to perform the common logarithm function.

This instruction is a 32-bit instruction. Therefore, be sure to input DLOG10 or DLOG10P in the program.

The source operand S must assign to a BIN oating point number for the calculation.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

If the value of S is less than or equal to zero, the PLC will regard that as an operational error. Therefore, the S
must designate to a positive number.

269
FNC 1 2 M 3
DESQRP S D BIN Floating Point Square Root
127 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the source device to be performed the square root operation


X0
DESQR D0 D10 D : the destination device to store the square root result

This instruction performs the square root operation on a BIN oating point number that is designated by S and
stores the BIN oating point format result in the D designated device.

When X0 = “ON”, this instruction performs the square root operation on the BIN oating point number in (D1, D0),
and the result will be stored in (D11, D10).

This instruction is a 32-bit instruction. Therefore, be sure to input DESQR or DESQRP in the program.

If a source operand is assigned to a constant integer K or H, this instruction will automatically convert the number
to BIN oating point number for the calculation. Therefore, could execute the square root function.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

When the operated result is equal to “0” , the Addition / Subtraction Zero Flag M9020 turns “ON”.

If the value of S is less than zero, the PLC will regard that as an operational error and turn the M9067 = “ON”.

270
FNC 1 2 M 3
DENEGP D BIN Floating Point Negation
128 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
D

D D : the device to be positive/negative inverted


X0
DENEGP D0

This instruction inverts a BIN oating point format number which is designed by D into its negative value and
stores the result back into D .

When X0 = “OFF” → “ON”, this instruction performs the positive/negative inversion operation on the BIN oating
point number in (D1, D0), and then the result will be stored back into (D1, D0).
Before operation –123.45 (D1, D0) BIN floating number

X0=OFF → ON

After operation 123.45 (D1, D0) BIN floating number

This instruction is a 32-bit instruction. Therefore, be sure to input DENEG or DENEGP in the program.

The operand D must assign to a BIN oating point number for the calculation.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

271
FNC 1 2 M 3
DINTP S D BIN Floating Point → BIN Integer Format
129 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
The 16-bit instruction, D occupies 1 component The 32-bit instruction, D occupies 2 components

S D S : the source device to be performed the converting operation


X0
INT D0 D10 D : the destination device to store the converted result

This instruction performs the converting operation on a BIN oating point number that is designated by S and
stores the converted BIN format integer result in the D designated device. The fractional part of the oating point
number beyond the integer part will be ignored.

When X0 = “ON”, this instruction performs the converting operation on the BIN oating point number in (D1, D0),
then the result of converted BIN format integer part will be stored in the D10 but the rest value (the fractional part)
will be ignored.
Before operation 123.45 (D1, D0) BIN floating number

X0=ON

After operation 123 (D10) BIN integer, the value of fractional part will be ignored

When this instruction is used as a 32-bit instruction, the D is a 32-bit device, too.

S D
X0
DINTP D0 D10

When X0 = “OFF” → “ON”, this instruction performs the converting operation on the BIN oating point number in
(D1, D0), then the result of converted BIN format integer part will be stored in the (D11, D10) but the rest value (the
fractional part) will be ignored.
Before operation 123456.7 (D1, D0) BIN floating number

X0=OFF → ON

After operation 123456 (D11, D10) BIN integer, the value of fractional part will be ignored

When the operated result is equal to “0”, the Addition / Subtraction Zero Flag M9020 turns “ON”.
When the operated result has the fractional part and that is ignored, the Borrow Flag M9021 turns “ON”.
When the operated result is exceeded the available range of the BIN integer below, the Carry Flag M9022 turns “ON”.
For a 16 bit instruction: –32,768~32,767
For a 32 bit instruction: –2,147,483,648~2,147,483,647

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

272
FNC 1 2 M 3
DSINP S D Calculate Sine
130 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the source device for input the angle in radians


X0
DSIN D0 D10 D : the calculated result

This instruction performs the mathematical sine operation on the S designated BIN oating point radians of
angle, and the result is stored in the D designated device.

When X0 = “ON”, the instruction is activated, it uses the BIN oating point radians at (D1, D0) to calculate the sine
value, and the result will be stored at the specied destination devices (D11, D10).

Radian = Degree × π / 180

This instruction is a 32-bit instruction. Therefore, be sure to input DSIN or DSINP in the program.
The source operand S must assign to a BIN oating point number for the calculation, and the calculated result
D is by the BIN oating point format, too.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

The example below is to calculate the 45 degree angle become a radian value of oating point, then use the
radians to get the result value of SIN.
M9000
DEDIV K314159 K18000000 D0 (π/180) → (D1,D0)

DEMUL K45 D0 D2 The angel of 45 degree×( π / 180 ) → (D3, D2) [Unit: radian]

DSIN D2 D10 The result value of SIN is stored in (D11, D10).

273
FNC 1 2 M 3
DCOSP S D Calculate Cosine
131 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the source device for input the angle in radians


X0
DCOS D0 D10 D : the calculated result

This instruction performs the mathematical cosine operation on the S designated BIN oating point radians of
angle, and the result is stored in the D designated device.

When X0 = “ON”, the instruction is activated, it uses the BIN oating point radians at (D1, D0) to calculate the
cosine value, and the result will be stored at the specied destination devices (D11, D10).

Radian = Degree × π / 180

For to convert the angle unit between the radians and degrees, please refer to the DEG and RAD instructions.

This instruction is a 32-bit instruction. Therefore, be sure to input DCOS or DCOSP in the program.

The source operand S must assign to a BIN oating point number for the calculation, and the calculated result
D is by the BIN oating point format, too.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

274
FNC 1 2 M 3
DTANP S D Calculate Tangent
132 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the source device for input the angle in radians


X0
DTAN D0 D10 D : the calculated result

This instruction performs the mathematical tangent operation on the S designated BIN oating point radians of
angle, and the result is stored in the D designated device.

When X0 = “ON”, the instruction is activated, it uses the BIN oating point radians at (D1, D0) to calculate the
tangent value, and the result will be stored at the specied destination devices (D11, D10).

Radian = Degree × π / 180

For to convert the angle unit between the radians and degrees, please refer to the DEG and RAD instructions.

This instruction is a 32-bit instruction. Therefore, be sure to input DTAN or DTANP in the program.

The source operand S must assign to a BIN oating point number for the calculation, and the calculated result
D is by the BIN oating point format, too.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

275
FNC 1 2 M 3
DASINP S D Calculate Arc Sine
133 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
- 1.0≤S≤1.0

S D S : the source device for input the value of sine


X0
DASIN D0 D10 D : the device to store the calculated result (unit: radian)

-1
This instruction performs the mathematical Arcsine (inverse sine or sin ) operation by the S designated BIN
oating point sine value, and the result of radians is stored in the D designated device.

When X0 = “ON”, the instruction is activated, it uses the BIN oating point sine value at (D1, D0) to calculate the
Arcsine value, and the result of radians will be stored at the specied destination devices (D11, D10).
SIN - 1 0.8660254 = 1.047198 (D11, D10) BIN floating number
(D1, D0) BIN floating number
The calculated result at the (D11, D10) is by the value of radians and the range is between - π / 2 and π / 2.

Degree = Radian ×180 / π

This instruction is a 32-bit instruction. Therefore, be sure to input DASIN or DASINP in the program.

The source operand S must assign to a BIN oating point number for the calculation, and the calculated result
D is by the BIN oating point format, too.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

For to convert the angle unit between the radians and degrees, please refer to the DEG and RAD instructions.

The PLC will identify it as an operating error if the value of S is exceeded the available range -1.0 ~ 1.0.

276
FNC 1 2 M 3
DACOSP S D Calculate Arc Cosine
134 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
- 1.0 ≦ S ≦ 1.0

S D S : the source device for input the value of cosine


X0
DACOS D0 D10 D : the device to store the calculated result (unit: radian)

-1
This instruction performs the mathematical Arccosine (inverse cosine or cos ) operation by the S designated
BIN oating point cosine value, and the result of radians is stored in the D designated device.

When X0 = “ON”, the instruction is activated, it uses the BIN oating point cosine value at (D1, D0) to calculate the
Arccosine value, and the result of radians will be stored at the specied destination devices (D11, D10).
COS - 1 0.5 = 1.047198 (D11, D10) BIN floating number
(D1, D0) BIN floating number
The calculated result at the (D11, D10) is by the value of radians and the range is between 0 and π .

Degree = Radian ×180 / π

For to convert the angle unit between the radians and degrees, please refer to the DEG and RAD instructions.

This instruction is a 32-bit instruction. Therefore, be sure to input DACOS or DACOSP in the program.

The source operand S must assign to a BIN oating point number for the calculation, and the calculated result
D is by the BIN oating point format, too.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

The PLC will identify it as an operating error if the value of S is exceeded the available range -1.0 ~ 1.0.

277
FNC 1 2 M 3
DATANP S D Calculate Arc Tangent
135 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the source device for input the value of tangent


X0
DATAN D0 D10 D : the device to store the calculated result (unit: radian)

-1
This instruction performs the mathematical Arctan (inverse tangent or tan ) operation by the S designated BIN
oating point tangent value, and the result of radians is stored in the D designated device.

When X0 = “ON”, the instruction is activated, it uses the BIN oating point tangent value at (D1, D0) to calculate
the Arctangent value, and the result of radians will be stored at the specied destination devices (D11, D10).
TAN - 1 1.732051 = 1.047198 (D11, D10) BIN floating number
(D1, D0) BIN floating number
The calculated result at the (D11, D10) is by the value of radians and the range is between - π / 2 and π / 2.

Degree = Radian ×180 / π

For to convert the angle unit between the radians and degrees, please refer to the DEG and RAD instructions.

This instruction is a 32-bit instruction. Therefore, be sure to input DATAN or DATANP in the program.

The source operand S must assign to a BIN oating point number for the calculation, and the calculated result
D is by the BIN oating point format, too.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

278
FNC 1 2 M 3
DRADP S D Convert Angle From Degrees to Radian
136 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the source device for input the angle in degrees


X0
DRAD D0 D10 D : the calculated result in radians

This instruction performs the mathematical converting operation on the S designated BIN oating point degrees
of angle, and the result of radians is stored in the D designated device.

When X0 = “ON”, the instruction is activated, it uses the BIN oating point degrees at (D1, D0) to convert, and the
result of radians will be stored at the specied destination devices (D11, D10).
Angle by degrees Angle by radians
X0=ON
60 1.047198
(D1, D0) BIN floating number (D11, D10) BIN floating number

Radian = Degree × π / 180

This instruction is a 32-bit instruction. Therefore, be sure to input DRAD or DRADP in the program.

The source operand S must assign to a BIN oating point number for the calculation, and the calculated result
D is by the BIN oating point format, too.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

279
FNC 1 2 M 3
DDEGP S D Convert Angle From Radian to Degrees
137 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the source device for input the angle in degrees


X0
DDEG D0 D10 D : the calculated result in radians

This instruction performs the mathematical converting operation on the S designated BIN oating point radians
of angle, and the result of degrees is stored in the D designated device.

When X0 = “ON”, the instruction is activated, it uses the BIN oating point radians at (D1, D0) to convert, and the
result of degrees will be stored at the specied destination devices (D11, D10).
Angle by radians Angle by degrees
X0=ON
0.5235988 30
(D1, D0) BIN floating number (D11, D10) BIN floating number

Degree = Radian ×180 / π

This instruction is a 32-bit instruction. Therefore, be sure to input DDEG or DDEGP in the program.

The source operand S must assign to a BIN oating point number for the calculation, and the calculated result
D is by the BIN oating point format, too.

The format for storing a oating point number will occupy two Registers in the PLC system. Please refer to the
section 2-13 “Numerical System” for the reference of the oating point number.

280
6-13 Advanced Data Processing and MBUS Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3

140 DWSUMP S D n Sum of Word Data ○

141 WTOBP S D n Split Word to Byte ○

142 BTOWP S D n Combine Byte to Word ○

143 UNIP S D n Combine 4-bit Nibble to Word ○

144 DISP S D n Separate Word to 4-bit Nibble ○

147 DSWAPP D Swap High / Low Byte ○ ○ ○ ○

148 DSORT2 S m1 m2 D n Sort Tabulated Data 2 ○ ○ ○ ○

149 M B U S S1 S2 n MODBUS Communication Instruction ○ ○ ○ ○

281
FNC n
1 2 M 3
DWSUMP S D Sum of Word Data
140 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
For a 16-bit instruction, S occupies n components, D occupies 2 components
For a 32-bit instruction, S occupies (2×n) components, D occupies 4 components n>0

S D n S : the head ID of source devices to be added up


X0
WSUM D10 D100 K5 D : the destination device to store the amount
n : the number of consecutive devices to be accumulated

This 16-bit instruction adds up the consecutive n 16-bit word devices which are started from S , then store the
result to the 32-bit double word device D .

When the X0 = “ON”, this instruction accumulates the contents of D10~D14 (5 16-bit devices), then stores the
amount to the (D101, D100).
S
D10 101
D11 55 D
n =5 D12 234 X0=ON
655 ( D101, D100)
D13 186
D14 79

The result device D for this 16-bit instruction is a 32-bit device, the positive or negative sign is located at its
the Most Significant Bit (MSB = 0 = positive; MSB = 1 = negative).

S D n
X0
DWSUM D0 D100 K4

This 32-bit instruction adds up the consecutive n 32-bit word devices which are started from S , then store the
result to the 64-bit double word device D .

When the X0 = “ON”, this instruction accumulates the contents of (D1, D0) ~ (D7, D6) (4 32-bit devices), then
stores the amount to the (D103, D102, D101, D100).
S
(D1, D0) 100000
D
n =4
(D3, D2) 200000 X0=ON
1000000 (D103, D102, D101, D100)
(D5, D4) 300000
(D7, D6) 400000 64 bits

The result device D for this 32-bit instruction is a 64-bit device, the positive or negative sign is located at its
the Most Significant Bit (MSB = 0 = positive; MSB = 1 = negative).

282
FNC n
1 2 M 3
WTOBP S D Split Word to Byte
141 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
S occupies (n/2) components D occupies n components n≧0

S D n S : the head ID of source devices to be split


X0
WTOBP D10 D20 K5 D : the head ID of storage devices for the split result
n : the number of bytes to be split

This instruction splits the consecutive n byte devices which are started from the lower byte of S , then store
the split result to the lower bytes of devices those are started from D .

When X0 = “OFF” → “ON”, the instruction separates the contents of D10~D11 and D12's lower byte into 5 bytes
of data, then stores those bytes to 5 16-bit word components D20~D24. Since it is no data for all the upper bytes
of D20~D23, these bytes will be filled in 00H.
Source data X0=OFF → ON Executive result

S b15 b8 b7 b0 D b15 b8 b7 b0
D10 43H 21H D20 00H 21H
D11 87H 65H D21 00H 43H
D12 CBH A9H D22 00H 65H n =5
D23 00H 87H
D24 00H A9H

Fill in 00H

If n = 6, the execute result is shown below.


Source data X0=OFF → ON Executive result

S b15 b8 b7 b0 D b15 b8 b7 b0
D10 43H 21H D20 00H 21H
D11 87H 65H D21 00H 43H
D12 CBH A9H D22 00H 65H
n =6
D23 00H 87H
D24 00H A9H
D25 00H CBH

Fill in 00H

If n = 0, the instruction will not execute.

283
FNC n
1 2 M 3
BTOWP S D Combine Byte to Word
142 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
S occupies n components D occupies (n/2) components n≧0

S D n S : the head ID of source devices to be combined


X0
BTOWP D10 D20 K5 D : the head ID of storage devices for the combined result
n : the number of bytes to be combined

This instruction takes all the lower bytes of the devices that started from the S to get n bytes of data, then
restructures and stores the data to continuous 16-bit words that started from D .

When X0 = “OFF” → “ON”, the instruction takes 5 bytes of data from those lower bytes within D10~D14, to merge
and store the data into 16-bit word components D20~D22. Since it is no data for the upper byte of D22, this byte
will be filled in 00H.
Source data X0=OFF → ON Executive result

S b15 b8 b7 b0 D b15 b8 b7 b0
D10 00H 21H D20 43H 21H
D11 12H 43H D21 87H 65H
n =5 D12 70H 65H D22 00H A9H
D13 FFH 87H
D14 36H A9H Fill in 00H

Contents of every upper byte


will be ignored

If n = 6, the execute result is shown below.


Source data X0=OFF → ON Executive result

S b15 b8 b7 b0 D b15 b8 b7 b0
D10 00H 21H D20 43H 21H
D11 12H 43H D21 87H 65H
D12 70H 65H D22 CBH A9H
n =6
D13 FFH 87H
D14 36H A9H
D15 18H CBH

Contents of every upper byte


will be ignored

If n = 0, the instruction will not execute.

284
FNC n
1 2 M 3
UNIP S D Combine 4-bit Nibble to Word
143 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
S occupies n components n = 0~4

S D n S : the head ID of source devices to be combined


X0
UNIP D10 D20 K3 D : the head ID of storage devices for the combined result
n : the number of 4-bit nibbles to be combined

This instruction takes all the lowest nibbles of the devices that started from the S to get n nibbles of data, then
restructures and stores the data to the 16-bit word device D . If n = 0, the instruction will not execute. When
the n < 4, the vacant nibbles will be filled in 0H.

When X0 = “OFF” → “ON”, the instruction takes 3 nibbles of data from those lowest nibbles within D10~D12, to
merge and store the data into a 16-bit word component D20. Since it is no data for the highest nibble of D20, this
nibble will be filled in 0H.
Source data X0=OFF → ON Executive result

S b15 b4 b3 b0
D10 1H
n =3 D11 2H
D12 3H D D20 0H 3H 2H 1H
b15 b12 b11 b8 b7 b4 b3 b0
Ignored

Since n = 3, fill in 0H.

If n = 4, the execute result is shown below.


Source data X0=OFF → ON Executive result

S b15 b4 b3 b0
D10 AH
D11 9H
n =4
D12 8H
D13 2H D D20 2H 8H 9H AH
b15 b12 b11 b8 b7 b4 b3 b0
Ignored

285
FNC n
1 2 M 3
DISP S D Separate Word to 4-bit Nibble
144 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
D occupies n components n = 0~4

S D n S : the source device to be split


X0
DISP D10 D20 K4 D : the head ID of storage devices for the split result
n : the number of 4-bit nibbles to be split

This instruction separates the source device S to get n nibbles of data, then stores the nibble form data to n
16-bit word devices that started from the D . For all the devices related to D , those vacant upper 3 nibbles
(b4~b15) will be filled in 0. If n = 0, the instruction will not execute.

When X0 = “OFF” → “ON”, the instruction separates the content of D10 into 4 nibbles, then stores those nibbles
to 4 16-bit word components D20~D23. Since it is no data for all the b4~b15 of D20~D23, these 3 nibbles at
every result register will be filled in 000H.

Source data X0=OFF → ON Executive result

S b15 b12 b11 b8 b7 b4 b3 b0 D b15 b4 b3 b0


D10 4H 3H 2H 1H D20 000H 1H
D21 000H 2H
n =4
D22 000H 3H
D23 000H 4H

Fill in 000H to b4~b15.

If n = 3, the execute result is shown below.

Source data X0=OFF → ON Executive result

S b15 b12 b11 b8 b7 b4 b3 b0 D b15 b4 b3 b0


D10 AH 2H BH 4H D20 000H 4H
D21 000H BH n =3
D22 000H 2H

Fill in 000H to b4~b15.

286
FNC 1 2 M 3
DSWAPP S Swap High / Low Byte
147 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S

D D : the Upper / Lower 8 bits of the device to be swapped


X20
SWAPP D0

When X20 = “OFF” → “ON”, the Upper 8 bits and Lower 8 bits in the (D0) will be swapped.

Upper 8 bits Lower 8 bits

0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 D0

X20 = OFF → ON

1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 D0

D
X21
DSWAP D10

When X21 = “OFF” → “ON”, the Upper / Lower 8 bits in the (D10) will be swapped also the Upper / Lower 8 bits in
the (D11) will be swapped, too.

Upper 8 bits Lower 8 bits

0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 D10
1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 D11

X21 = ON

1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 D10
0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 D11

287
FNC m1 m2 n
1 2 M 3
DSORT2 S D Sort Tabulated Data 2
148 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
m1
m2
D
n
For a 16-bit instruction, each of the S and D respectively occupy (m1×m2) components
For a 32-bit instruction, each of the S and D respectively occupy (2×m1×m2) components
m 1 =1~32 m 2=1 ~6 n=1~m2

S m1 m2 D n S : the head register ID of the original data array


X0
SORT2 D0 K5 K4 D100 D200 m1 : the number of data record sets to be sorted
m2 : the number of data at an arrangement for each set
D : the head register ID number of the data array where
to store the sorted results
n : to assign the nth. data in an arrangement as the
sort basis nth

Original Data Array The SORT2 instruction is used to sort an data array that
(Starting from the appointed register S ) has a serial of data record sets (the number of sets is
assigned by m 1 ). Each set has a grouped arrangement
Data Arrangement
(the number of grouped data at each arrangement set is
1 2 3 4 assigned by m 2 ). While that n is used to assign the nth
Student ID Philology Mathematics History arrangement as the routing basis to sort the data array.
(D0) ( D1) ( D2) ( D3) The S is to designate the head register ID of the original
1 80 70 75 data array to be sorted, and the D is to designate the
head register ID of the result data array.
(D4) ( D5) ( D6) ( D7)
2 65 70 90 Both of the arrays S and D will separately occupy
m1 (D8) ( D9) ( D10) ( D11) m 1 × m 2 consecutive registers.
3 90 65 80
The M9165 is to assign the instruction's operation mode.
(D12) ( D13) ( D14) ( D15)
If the M9165 = “OFF”, the data sorting is in ascending
4 75 90 65
order; conversely, "ON" is in descending order.
(D16) ( D17) ( D18) ( D19)
5 80 85 95 When X0 = “ON”, the SORT2 instruction is starting to
perform. This instruction needs take 4 (the content of
m2 m 1 ) scan cycles to complete the sort action. When it is
completed, the Execution Completed Flag M9029 =
“ON” for a Scan Time and the sort action will be stopped.

When M9165 = “OFF”, the data sorting is in ascending order.


Sorted Data Result Array if the D200 = 2 Sorted Data Result Array if the D200 = 4
(Starting from the appointed register D ) (Starting from the appointed register D )
Data Arrangement Data Arrangement
1 2 3 4 1 2 3 4
Student ID Philology Mathematics History Student ID Philology Mathematics History
(D100) ( D101) ( D102) ( D103) ( D100) ( D101) ( D102) ( D103)
2 65 70 90 4 75 90 65
(D104) ( D105) ( D106) ( D107) ( D104) ( D105) ( D106) ( D107)
4 75 90 65 1 80 70 75

m1 (D108) ( D109) ( D110) ( D111) m1 ( D108) ( D109) ( D110) ( D111)


1 80 70 75 3 90 65 80
(D112) ( D113) ( D114) ( D115) ( D112) ( D113) ( D114) ( D115)
5 80 85 95 2 65 70 90
(D116) ( D117) ( D118) ( D119) ( D116) ( D117) ( D118) ( D119)
3 90 65 80 5 80 85 95

m2 m2

288
When M9165 = “ON”, the data sorting is in descending order.

Sorted Data Result Array if the D200 = 3 Sorted Data Result Array if the D200 = 1
(Starting from the appointed register D ) (Starting from the appointed register D )
Data Arrangement Data Arrangement
1 2 3 4 1 2 3 4
Student ID Philology Mathematics History Student ID Philology Mathematics History
(D100) ( D101) ( D102) ( D103) ( D100) ( D101) ( D102) ( D103)
4 75 90 65 5 80 85 95
(D104) ( D105) ( D106) ( D107) ( D104) ( D105) ( D106) ( D107)
5 80 85 95 4 75 90 65

m1 (D108) ( D109) ( D110) ( D111) m1 ( D108) ( D109) ( D110) ( D111)


1 80 70 75 3 90 65 80
(D112) ( D113) ( D114) ( D115) ( D112) ( D113) ( D114) ( D115)
2 65 70 90 2 65 70 90
(D116) ( D117) ( D118) ( D119) ( D116) ( D117) ( D118) ( D119)
3 90 65 80 1 80 70 75

m2 m2

In case of the 32-bit instruction is used, all of the components at S , m 1 , m 2 , D and n must by the format
of 32-bit.
The related special devices are summarized below:

Relay ID No. Description


Instruction execution completed ag. M9029=“ON” when the executions of some applied
M9029 instructions are completed (please refer to the relevant instructions).
Assigned the SORT2 instruction sort process mode. When M9165= “OFF” by ascending order;
M9165 and M9165= “ON” by descending order.

Notes
(1) During the instruction is in operation, all parameters and the contents of data are not allowed to change.
(2) There is no limit on the used times of the SORT2 instruction in the program. However, only two instructions can
be executed at the same time.
(3) After the operation of this instruction is completed and if that is required to sort again, should switch the
condition contact “OFF” and then “ON”.
(4) In this instruction, the components of the data arrays for the S and D are not allowed overlap, except for
S = D .

289
FNC n
1 2 M 3
M B U S S1 S2 MODBUS Communication Instruction
149 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1 Using a Table Code Q0~Q31 (V, Z index modiable) or a Table Nickname (by user-dened 16 English characters)
S2
n
S2 occupies 4 components For the VS1 series, n = 1~2; for the VS2 or VSM series, n= 1~3; for the VS3 series, n= 1~5

S1 S2 n S1 : the communication table that describes the data


X20 receiving and transmitting
MBUS ACCESS_MBS_EQUIP D100 K1
S2 : the working area for the instruction that occupies
4 registers
n : to designate the communication port, 1~5 =
CP1~CP5

The VS Series PLC uses this instruction to transmit or get the designated data via its Communication Port
CP1~CP5 with other peripherals which use the MODBUS ASCII or RTU protocol.
The CP1~CP5 are multi-functional communication ports. Each port can choose an appropriate communication
type from its various functions. When this instruction is using a port, should choose the “Application type:” become
the “MODBUS Master”. Regarding the application type selection and related parameter setting, please specify it
from the programming software Ladder Master S and at the “Project” -- “COM Port Setting”.
As shown in the gure below, connect the PLC with other device(s) by the RS-232 or RS-485 wiring. Furthermore,
to set a unique station number (1~247) for every device and make the other parameters identical. Besides, use the
Ladder Master S to open the project of the VS series PLC and write this MBUS instruction in the Master PLC's
program, then set the port's “Application type:” as the “MODBUS Master” also to set the communication parameters
in that window. After that, edit the MODBUS communication table to designate data transferring actions. Moreover,
to load this project to the Master PLC. Following these procedures, the purpose of data delivery between the PLC
and peripherals can be reached.

A device with A device with A device with


VS series MODBUS VS series MODBUS MODBUS
PLC protocol PLC protocol protocol

Digital scale / Temperature


MODBUS MODBUS Inverter
Display board / controller
Master Master
Barcode reader

RS- 232 RS- 485

When X20 = “ON”, the MBUS instruction starts execution. According to the contents described in the
“ACCESS_MBS_EQUIP” communication table, it proceeds data write or read actions to the appointed peripherals,
while the D100~D103 will be occupied to store the state of instruction execution.
When the contents of the communication table specied by the S 1 are execution completed from beginning to end,
the M9104 will be “ON” for a Scan Time then the procedure will start over again from the rst item set of the table.
When the X20 turns from “ON” to “OFF”, this instruction stops and the data sharing immediately stop but data
which has transferred previously will still remain.
The related special devices are summarized below: ( ■ : Means read only.)

Relay ID No. Description

M9103 CP1 RS / LINK / MBUS instruction on communication abnormal ag.


■ M9104 CP1 LINK / MBUS instruction on execution table complete once ag.
M9113 CP2 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9114 CP2 LINK / MBUS instruction on execution table complete once ag.
M9123 CP3 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9124 CP3 LINK / MBUS instruction on execution table complete once ag.
M9133 CP4 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9134 CP4 LINK / MBUS instruction on execution table complete once ag.
M9143 CP5 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9144 CP5 LINK / MBUS instruction on execution table complete once ag.

290
The communication table is assigned by the S 1 of the instruction.
An example of the “MBUS” provided by programming tool the Ladder Master S is shown below.

Item No. Command Device at Master Direction Slave St. Device at Slave Length Word/Bit Disable
No. Contact
1 H03 Read (4x) D0 1 1000 10 M1
2 H10 Write (4x) D10 1 1100 5 M1
3 H03 Read (4x) D20 2 1000 10 M2
4 H10 Write (4x) D30 2 1100 5
5 H10 Write (4x) D40 0 100 20 M0
The rst item set in the table means that the Master reads the data 1000~1009 from the Slave #1 and stores
them at the D0~D9 of the Master.
The second item set in the table means that the Master writes its data at D10~D14 to the 1100~1104 of the
Slave #1.
The third item set in the table means that the Master reads the data 1000~1009 from the Slave #2 and stores
them at the D20~D29 of the Master.
The fourth item set in the table means that the Master writes its data at D30~D34 to the 1100~1104 of the
Slave #2.
The fth item set in the table means that the Master writes its data at D40~D59 to all the 100~109 of the Slaves.
To set the Slave station #0 means that the Master writes the data to all of the Slaves. Note that Read Command
cannot be used in this application.
The last column of the table is for the Disable Contact. If that specied contact is “ON”, the communication item
set will be ignored. For example, if M1 = “ON”, the rst and second item sets in the table will skip. This is the
new function of the VS series, which can help designers effectively manage the operation of the communication
table. A communication item set does not need to specify a Disabled Contact (such as the fourth item set), so
that the command of the set does not have the disable control function.

The working area of the executive instruction is starting from the S 2 (using D100~D103 as the example).

S2 Description

Lower 8 bits The record of the Slave's station number when the first communication error is occurred

Instruction working status


0: Normal data transmitting / receiving
2: The length of the received data is incorrect
D100
Upper 8 bits 4: The error is caused by the assigned device is inappropriate
7: The error is caused by the communication command is incorrect
A: The communication setting is normal but no response from the Slave station
(Time-out occurs)
B: Abnormal communication

D101

The working area is required for the system when this instruction is performed
D103

The MBUS instruction will reset the D100 to be “0” before the rst item set at the table is executed.
If any communication error occurs during the execution of the instruction, a code will be recorded in D100.
Only when the content value of D100 is “0”, the recording action can be executed. Therefor, when there are
possibilities of several errors, users can use the program to move out the content value of D100 then reset it to “0”.
This way allows the D100 to record the next error.

To edit a communication table


Use the Ladder Master S to set up a MBUS communication table and through its interactive window can set up and
edit a communication table easily.
In the structure of VS Series PLC, the communication tables are a part of the project. When the programmer to copy
or access the project, those tables will be duplicated automatically with the program.

291
292
6-14 Real Time Clock Related Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3

160 T C M P P S1 S2 S3 S D Time Compare ○ ○ ○ ○

161 T Z C P P S1 S2 S D Time Zone Compare ○ ○ ○ ○

162 T A D D P S1 S2 D Time Addition ○ ○ ○ ○

163 T S U B P S1 S2 D Time Subtraction ○ ○ ○ ○

164 DHTOSP S D Convert Hour to Second ○ ○ ○ ○

165 DSTOHP S D Convert Second to Hour ○ ○ ○ ○

166 TRDP D Read RTC Data ○ ○ ○ ○

167 TWRP S Set RTC Data ○ ○ ○ ○

293
FNC 1 2 M 3
T C M P P S1 S2 S3 S D Time Compare
160 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
S3
S
D
S 1 =0~23 S 2 =0~59 S 3 =0~59 S occupies 3 components D occupies 3 components

S1 S2 S3 S D S1 : the “Hour” for comparison


X20
TCMP K8 K30 K20 D0 M0 S2 : the “Minute” for comparison
S3 : the “Second” for comparison
h m s
08 30 20 S : the registers of the time combination to do the
comparison
D : the compare result; occupying 3 consecutive
points

Compare the setting value (Hours, Minutes and Seconds which are designated by S 1 ~ S 3 ) to the time
combination (specied by the head ID S of 3 consecutive data devices), and the result of the comparison is
stored to D .

When X20 = “ON”, the instruction will be performed.


D0 (Hour)
h m s D1 (Minute) , then M0 = “ON”
If 08 30 20 >
D2 (Second)

D0 (Hour)
h m s D1 (Minute) , then M1 = “ON”
If 08 30 20 =
D2 (Second)

D0 (Hour)
h m s D1 (Minute) , then M2 = “ON”
If 08 30 20 <
D2 (Second)

The current time of the real time clock is stored in Special Registers D9013~D9015.
D9015 (Hours), D9014 (Minutes), D9013 (Seconds)

When X20 = “OFF”, the instruction is disabled, the “ON”/“OFF” status of M0, M1 and M2 remains the same as the
status before X20 = “OFF”.

Please use serial or parallel links of M0~M2 to generate the result as “≥”, “≤” or “≠”.

If the content value of the register designated by S exceeding the time value required, the PLC will regard that as
an operational error.

294
FNC 1 2 M 3
T Z C P P S1 S2 S D Time Zone Compare
161 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
S
D
All the S1, S2, S and D occupies 3 components respectively S1 ≦ S2

S1 S2 S D S1 : the lower setting of the time period combination


X20
TZCP D0 D10 D20 M0 S2 : the upper setting of the time period combination
S : the registers of the time combination to do the
comparison
D : the compare result; occupying 3 consecutive
points

The time value is dened by S , it will be compared to the lower setting of the time period dened by S 1 and the
upper setting of the time period dened by S 2 . And then, the compare result will be stored in D .

When X20 = “ON”, the instruction will be performed.


S1 S
D0 (Hour) D20 (Hour)
D1 (Minute) > D21 (Minute) , then M0 = “ON”
D2 (Second) D22 (Second)
S2
D0 (Hour) D20 (Hour) D10 (Hour)
D1 (Minute) ≦ D21 (Minute) ≦ D11 (Minute) , then M1 = “ON”
D2 (Second) D22 (Second) D12 (Second)

D20 (Hour) D10 (Hour)


D21 (Minute) > D11 (Minute) , then M2 = “ON”
D22 (Second) D12 (Second)

The current time of the real time clock is stored in Special Registers D9013~D9015.
D9015 (Hours), D9014 (Minutes), D9013 (Seconds)

When X20 = “OFF”, the instruction is disabled, the “ON”/“OFF” status of M0, M1 and M2 remains the same as the
status before X20 = “OFF”.

When S 1 > S 2 , the content value of S 1 will become both upper/lower settings to be compared with the S .

If the content value of the register designated by S 1 , S 2 or S exceeding the time value required, the PLC will
regard that as an operational error.

295
FNC 1 2 M 3
T A D D P S1 S2 D Time Addition
162 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D
All the S1, S2 and D occupies 3 components respectively

S1 S2 D S1 : the summand of the time combination


X20
TADD D0 D10 D20 S2 : the addend of the time combination
D : the sum of the time combination

The designated time combination of the summand S 1 will be added to the designated time combination S 2 and
the combination of the sum will be stored at the assigned registers D .

When X20 = “ON”, the instruction will be performed.


S1 S2 D
D0 = 8 (Hour) D10 = 6 (Hour) D20 = 15 (Hour)
D1 = 30 (Minute) + D11 = 35 (Minute) = D21 = 5 (Minute)
D2 = 0 (Second) D12 = 30 (Second) D22 = 30 (Second)
h m s h m s h m s
08 30 0 06 35 30 15 05 30

If the result of the time addition is exceeded 24 hours, the Carry Flag M9022 will be set “ON” and the D will
display the value where 24 hours is subtracted from the total.
S1 S2 D
D0 = 8 (Hour) D10 = 20 (Hour) D20 = 4 (Hour)
D1 = 25 (Minute) + D11 = 10 (Minute) = D21 = 35 (Minute) , also the M9022 = “ON”.
D2 = 30 (Second) D12 = 20 (Second) D22 = 50 (Second)
h m s h m s h m s
08 25 30 20 10 20 04 35 50
28-24=4

If the result of the time addition equals to “0” (0 hour 0 min 0 sec), then the Zero Flag M9020 will be set “ON”.

If the content value of the registers that designated by S 1 or S 2 exceeding the time value required, the PLC will
regard that as an operational error.

296
FNC 1 2 M 3
T S U B P S1 S2 D Time Subtraction
163 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D
All the S1, S2 and D occupies 3 components respectively

S1 S2 D S1 : the minuend of the time combination


X20
TSUB D0 D10 D20 S2 : the subtrahend of the time combination
D : the difference of the time combination

The designated time combination of the minuend S 1 will be subtracted to the designated time combination S 2
and the combination of the difference will be stored at the assigned registers D .

When X20 = “ON”, the instruction will be performed.


S1 S2 D
D0 = 18 (Hour) D10 = 8 (Hour) D20 = 9 (Hour)
D1 = 28 (Minute) - D11 = 40 (Minute) = D21 = 48 (Minute)
D2 = 50 (Second) D12 = 20 (Second) D22 = 30 (Second)
h m s h m s h m s
18 28 50 08 40 20 09 48 30

If the result of the time subtract is a negative value, the Borrow Flag M9021 will be set “ON” and the D will display
the value where 24 hours is added to the difference.
S1 S2 D
D0 = 6 (Hour) D10 = 20 (Hour) D20 = 10 (Hour)
D1 = 30 (Minute) - D11 = 20 (Minute) = D21 = 10 (Minute) , also the M9021 = “ON”.
D2 = 20 (Second) D12 = 10 (Second) D22 = 10 (Second)
h m s h m s h m s
06 30 20 20 20 10 10 10 10
(–14)+24=10

If the result of the time subtraction equals to “0” (0 hour 0 min 0 sec), then the Zero Flag M9020 will be set “ON”.

If the content value of the registers that designated by S 1 or S 2 exceeding the time value required, the PLC will
regard that as an operational error.

297
FNC 1 2 M 3
DHTOSP S D Convert Hour to Second
164 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
S occupies 3 components

S D S : the head register of the time combination to be transferred


X0
D : the transferred result
HTOS D0 D10

The designated time combination S uses three registers to store the Hours, Minutes and Seconds to be
transferred, this instruction converts those into decimal seconds and store the result to the assigned register D .

When X0 = “ON”, the instruction will be performed. The time combination at D0~D2 (Hours, Minutes and
Seconds) will convert to equal decimal seconds and the result stores at the D10.
S
D0 = 03 (Hour) D
X0=ON
D1 = 15 (Minute) D10 11748 (Second)
D2 = 48 (Second)

In case of the 32-bit instruction is used, the component D is by the format of 32-bit and that occupies 2 registers.
S D
X0
DHTOSP D0 D10

S
D0 = 40 (Hour) D
X0=OFF→ ON
D1 = 21 (Minute) (D11, D10) 145293 (Second)
D2 = 33 (Second)

For the 16-bit instruction, S = 0~4, S +1 = 0~59, S +2 = 0~59. If the content value of the registers
exceeding the range, the PLC will be regarded as an operating error.

For the 32-bit instruction, S = 0~32767, S +1 = 0~59, S +2 = 0~59. If the content value of the registers
exceeding the range, the PLC will regard that as an operational error.

298
FNC 1 2 M 3
DSTOHP S D Convert Second to Hour
165 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
D occupies 3 components

S D S : the decimal seconds to be transferred


X0
D : the transferred head register of the
STOH D10 D20
time combination result

The decimal seconds at S transfers to the Hours, Minutes and Seconds then respectively store those into three
registers D , D +1 and D +2.

When X0 = “ON”, the instruction will be performed. The decimal seconds at D10 will convert to equal time
combination by Hours, Minutes and Seconds and store those results into the D20, D21 and D22.
D

S D20 = 03 (Hour)
X0=ON
D10 11748 (Second) D21 = 15 (Minute)
D22 = 48 (Second)

In case of the 32-bit instruction is used, the component S is by the format of 32-bit and that occupies 2 registers.
S D
X0
DSTOHP D10 D20

S D20 = 40 (Hour)
X0=OFF→ON
(D11, D10) 145293 (Second) D21 = 21 (Minute)
D22 = 33 (Second)

For the 32-bit instruction, S = 0~117,964,799. If the content value of the register exceeding the range, the PLC
will regard that as an operational error.

For the 16-bit instruction, S = 0~32,767. If the content value of the register exceeding the range, the PLC will be
regarded as an operating error.

299
FNC 1 2 M 3
TRDP D Read RTC Data
166 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
D
D occupies 7 components

D D : the head register that stores the present value of the RTC
X20
TRD D0

When the Main Unit has installed a VS-MCR multi-function memory card, the PLC will provide with the real time
clock (RTC) function. The real time clock has seven sets of data, such as year, month, day, hour, minute, second
and day of the week, the data will be stored in the Special Registers D9013~D9019 sequentially.

Programmers do not need to memorize the Special Registers of the RTC, they can use this instruction to read the
current time and store the time data to contiguous 7 registers which are specied by D .
When X20 = “ON”, the instruction will be performed to read the current time from the RTC.

Item Special Register Content Value D


Year (C.E.) D9018 2000 〜 2099 D0
Month D9017 1 〜 12 D1
Day D9016 1 〜 31 Read D2
Hour D9015 0 〜 23 D3
Minute D9014 0 〜 59 D4
Second D9013 0 〜 59 D5
Week D9019 0〜6 D6

The meaning of the content value at the D9019:


0 = Sunday,
1 = Monday,
2 = Tuesday,
3 = Wednesday,
4 = Thursday,
5 = Friday,
6 = Saturday.

300
FNC 1 2 M 3
TWRP S Set RTC Data
167 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
S occupies 7 components

S S : the head register that stores the set time data of the RTC
X20
TWR D0

When the Main Unit has installed a VS-MCR multi-function memory card, the PLC will provide with the real time
clock (RTC) function. The real time clock has seven sets of data, such as year, month, day, hour, minute, second
and day of the week, the data will be stored in the Special Registers D9013~D9019 sequentially.
When X20 = “ON”, the instruction will be performed to write the designated data at S ~ S +6 to the RTC.

S Content Value Special Register RTC


D0 2000 〜 2099 D9018 Year (C.E.)
D1 1 〜 12 D9017 Month
D2 1 〜 31 Write D9016 Write Day
D3 0 〜 23 D9015 Hour
D4 0 〜 59 D9014 Minute
D5 0 〜 59 D9013 Second
D6 0〜6 D9019 Week

The meaning of the content value 0~6 at the D9019 represents Sunday~Saturday.
If one of the content value in the source register block S is exceeding its available range above, the PLC will
regard that as an operational error.
Alternatively, can use the programming software Ladder Master S to set up the current time of the RTC.

301
302
6-15 Code Conversion and Timer Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3

169 DHOUR S D1 D2 Hour Meter ○ ○ ○ ○

170 DGRYP S D Convert BIN to Gray Code ○ ○ ○ ○

171 DGBINP S D Convert Gray Code to BIN ○ ○ ○ ○

176 T F T D1 S D2 Timer (10 ms.) ○ ○ ○ ○

177 T F H D1 S D2 Timer (100 ms.) ○ ○ ○ ○

178 T F K D1 S D2 Timer (1 sec.) ○ ○ ○ ○

303
FNC 1 2 M 3
DHOUR S D1 D2 Hour Meter
169 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D1
D2
For a 16-bit instruction, D1 occupies 2 components For a 32-bit instruction, D1 occupies 3 components

S D1 D2 S : the set value of the timer (Unit: hour)


X0
HOUR K1000 D7000 Y0 D1 : the present value of the timer (Unit: hour)
D2 : the output contact of the timer

This instruction creates a timer which is using the hour as the counting unit.

When the condition contact is “ON”, this timer increases its present value at D 1 . After a while, the present value
of the timer will equal to or larger than the set value S , that causes the timer's output contact D 2 = “ON”.

The real setting period of the timer = 1 hour × the set value S .

The D 1 stores the integer number of the present value (in hours). Besides, the register next to the D 1 is to store
the remnant present value which is less than 1 hour (in seconds).

As the example diagram above:


When X0 = “ON”, the present value of the register D 1 will begin to do the increase counting (hourly). If the
present value of D7000 reaches the set value K1000 (1000 hours), the output contact of the timer Y0 = “ON”.
When X0 = “OFF”, the present value of the timer at the registers will be retained. Therefrom, the characteristic of
this instruction is similar to a retentive timer.
Mostly, this instruction is used to monitor the lifespan of a component or to remind the regular maintenance.
For to retain the present value of the timer during the power cut off, please assign the D 1 to a latched register.
If assign the D 1 to an unlatched general register, when the power cut off or the PLC is “STOP”, the content value
of the D 1 will be reset to “0”.

After the timer's output contact D 2 = “ON”, the timer's present value at the D 1 will continuously execute the
increase counting.

When the timer's present value D 1 reaches the maximum value of a 16-bit or 32-bit register, the counting will be
stopped.

Even though, the driving condition contact of this instruction (X0 in this example) is “OFF”, its output contact D 2
will turn “ON” as long as the present value D 1 >= the set value S ; on the other hand, if D 1 < S , that will
cause the D 2 = “OFF”.

304
FNC 1 2 M 3
DGRYP S D Convert BIN to Gray Code
170 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
For a 16-bit instruction, S = 0~32,767 For a 32-bit instruction, S = 0~2,147,483,647

S D S : the source device (by the decimal BIN value) to


X20 be converted
GRY D0 K4Y20
D : the destination device where the converted Gary
Code is stored

When the instruction is performed, it converts the content decimal BIN value of the S designated source device
into the Gary Code and stores the result to the designated device D .

When X20 = “ON”, the content value of (D0) will be converted to the Gary Code, and then the 16 continuous
contacts (Y20~Y37) will be exported to the output points of the PLC.
Decimal BIN Value 6,513

0 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1 D0
b15 b0
X20 = ON
Y37 Y20
0 0 0 1 0 1 0 1 1 1 0 0 1 0 0 1 K4Y20

Gary Code 6,513

The available range of the S is shown below. If the content value of the register designated by S exceeding
the range, the PLC will regard that as an operational error.
For a 16-bit instruction: 0~32,767
For a 32-bit instruction: 0~2,147,483,647

305
FNC 1 2 M 3
DGBINP S D Convert Gray Code to BIN
171 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
For a 16-bit instruction, S = 0~32,767 For a 32-bit instruction, S = 0~2,147,483,647

S D S : the source device (by the Gary Code) to be converted


X0
GBIN K4X20 D0 D : the destination device where the converted decimal
BIN value is stored

When the instruction is performed, it converts the content Gary Code of the S designated source device into the
decimal BIN value and stores the result to the designated device D .

There is a kind of position detecting device called the Absolute Rotary Encoder, usually this kind of encoder
generates the Gary Code signal to the PLC’s input terminals. So, need to use this instruction to convert the Gray
Code format to a decimal BIN value and store the result to the register in the PLC.

When X0 = “ON”, the status of those X20~X37 (16 inputs) receives the Gary Code from an Absolute Rotary
Encoder, and then this instruction converts the code to a decimal BIN format value and stores it to the D0.
Gary Code 6,513

0 0 0 1 0 1 0 1 1 1 0 0 1 0 0 1 K4X20
X37 X20
X0 = ON
b15 b0
0 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1 D0

Decimal BIN Value 6,513

The available range of the S is shown below. If the content value of the register designated by S exceeding
the range, the PLC will regard that as an operational error.
For a 16-bit instruction: 0~32,767
For a 32-bit instruction: 0~2,147,483,647

306
FNC 1 2 M 3
T F T D1 S D2 Timer (10 ms.)
176 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
D1
S
D2
S = 0~32,767, will be treated as 0 if it is exceeding this range.

D1 S D2 D1 : the present value of the timer (Unit: 10 ms.)


X0
TFT D0 K100 M0 S : the set value of the timer (Unit: 10 ms.)
D2 : the output contact of the timer

This instruction creates a timer which is using 10 ms. as the basic unit for the counting.

When the condition contact is “ON”, this timer increases its present value D 1 . After a while, the present value of
the timer will equal to the set value S , that causes the timer's output contact D 2 = “ON”.

The real setting period of the timer = 10 ms. × the set value S .

As the example diagram above:


When X0 = “ON”, the present value of the register D 1 will begin to do the increase counting (by every 10 ms.).
If the present value of D0 reaches the set value K100 (1 second), the output contact of the timer M0 = “ON”.
When X0 = “OFF”, the present value of the timer in the register D0 will be reset to “0”. And also, the output
contact M0 will be reset to “OFF”.

307
FNC 1 2 M 3
T F H D1 S D2 Timer (100 ms.)
177 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
D1
S
D2
S = 0~32,767, will be treated as 0 if it is exceeding this range.

D1 S D2 D1 : the present value of the timer (Unit: 100 ms.)


X0
TFH D0 K100 M0 S : the set value of the timer (Unit: 100 ms.)
D2 : the output contact of the timer

This instruction creates a timer which is using 100 ms. as the basic unit for the counting.

When the condition contact is “ON”, this timer increases its present value D 1 . After a while, the present value of
the timer will equal to the set value S , that causes the timer's output contact D 2 = “ON”.

The real setting period of the timer = 100 ms. × the set value S .

As the example diagram above:


When X0 = “ON”, the present value of the register D 1 will begin to do the increase counting (by every 100 ms.).
If the present value of D0 reaches the set value K100 (10 second), the output contact of the timer M0 = “ON”.
When X0 = “OFF”, the present value of the timer in the register D0 will be reset to “0”. And also, the output
contact M0 will be reset to “OFF”.

308
FNC 1 2 M 3
T F K D1 S D2 Timer (1 sec.)
178 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
D1
S
D2
S = 0~32,767, will be treated as 0 if it is exceeding this range.

D1 S D2 D1 : the present value of the timer (Unit: second)


X0 S : the set value of the timer (Unit: second)
TFK D0 K100 M0 D2 : the output contact of the timer

This instruction creates a timer which is using a second as the basic unit for the counting.

When the condition contact is “ON”, this timer increases its present value D 1 . After a while, the present value of
the timer will equal to the set value S , that causes the timer's output contact D 2 = “ON”.

The real setting period of the timer = 1 sec. × the set value S .

As the example diagram above:


When X0 = “ON”, the present value of the register D 1 will begin to do the increase counting (by every second).
If the present value of D0 reaches the set value K100 (100 second), the output contact of the timer M0 = “ON”.
When X0 = “OFF”, the present value of the timer in the register D0 will be reset to “0”. And also, the output
contact M0 will be reset to “OFF”.

309
310
6-16 RND, DUTY, CRC and HHCMV Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3

184 RNDP D Generate Random Number ○ ○ ○ ○

186 D U T Y n1 n2 D Timing Pulse Generation ○

188 CRCP S D n Cyclic Redundancy Check - 16 ○ ○ ○ ○

Hardware High-Speed Counter


189 DHHCMVP S D ○ ○ ○ ○
Data Move

311
FNC 1 2 M 3
RNDP D Generate Random Number
184 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
D

D D : the destination device where the generated


X0 random number is stored
RNDP D0

This instruction uses the content value at the (D9161, D9160) and by its calculation to generate a pseudo-random
number that the range of the number is from 0 to 32,767, then the instruction stores the result to the designated
device D .

When X0 = “OFF” → “ON”, this instruction follows the formula below to generate a random number and stores the
random number to the D0.
Step 1: ( D9161, D9160)=( D9161, D9160)×1103515245 + 12345.
Step 2: D0 = [( D9161, D9160) >> 16] (00007FFFH)
※ When the PLC's power is turned from “OFF” to “ON”, the value in the (D9161, D9160) will be set to K1
automatically. Also, the value in the (D9161, D9160) can not be a negative number.

Program example:
M9000
DINC D7000 The latched register (D7001, D7000) accumulates the times of scan cycle.
M9002
DBON D7000 M0 K31
When PLC from “STOP” → “RUN”, that takes the absolute value of the
M0 content in the (D7001, D7000), for ensuring it is a positive value.
DNEGP D7000
M9002
When PLC from “STOP” → “RUN”, that moves the value in (D7001, D7000) to
DMOV D7000 D9160 the (D9161, D9160) as the initial value for the RND instruction.
X10
RNDP D10 When X10 = “OFF” → “ON”, this instruction will generate a random number and store the
result at D10.

312
FNC 1 2 M 3
D U T Y n1 n2 D Timing Pulse Generation
186 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
n1
n2
D
n 1 >0 n 2 >0 D=M9330 〜 M9334

n1 n2 D n1 : the number of Scan Times to output “ON” in a pulse cycle


X0
DUTY K10 K5 M9330 n2 : the number of Scan Times to output “OFF” in a pulse cycle
D : the timing pulse output destination device

At the destination point D , it will get a pulse string that is using the PLC's Scan Time to switch ON/OFF. The n 1
appoints the number of Scan Times that turns the D to “ON”. The n 2 appoints the number of Scan Times that
turns the D to "OFF".
When the X0 = “ON”, the instruction drives the M9330 “ON” 10 Scan Times then “OFF” 5 Scan Times, this timing
sequence pulse will be alternately again and again.
When the n 1 or n 2 is equal to 0, the result of
X0
D is below:
D If n 1 = 0 and n 2 >= 0, the D is kept “OFF”;
n1 n2
M9330
If n 1 > 0 and n 2 = 0, the D is kept “ON”.
10 Scan Times 5 Scan Times

15

D9330

n 1 + n 2 Scan Times

The D of this instruction can assign to M9330~M9334 and those 5 destination components can not repeat.
Thus, the instruction can use 5 times only.
Each the D9330~D9334 is the cooperated timing sequence cycle counter for the M9330~M9334. When the
content value of the D9330~D9334 reaches the amount of n 1 + n 2 or the condition contact of this instruction
turns “OFF” → “ON”, the value will be reset to “0”.
When the condition contact is set to "ON" once, the operation is started. Even if the condition is turned to “OFF”,
the operation would not end. Also, the operation is suspended when the PLC is set to STOP. Cut off the power is
the only way to stop the operation.
If the content value of the n 1 or n 2 is less than 0, or the D is not assigned to the M9330~M9334, the PLC will
be regarded as an operating error.
The related special devices are summarized below: ( ■ : Means read only.)

Relay ID No. Description

M9330 Destination #1 for the timing sequence pulse generative instruction DUTY (FNC186).
M9331 Destination #2 for the timing sequence pulse generative instruction DUTY (FNC186).
M9332 Destination #3 for the timing sequence pulse generative instruction DUTY (FNC186).
M9333 Destination #4 for the timing sequence pulse generative instruction DUTY (FNC186).
M9334 Destination #5 for the timing sequence pulse generative instruction DUTY (FNC186).

Register ID No. Description


■ D9330 Cycle counter #1 for the timing sequence pulse generative instruction DUTY (FNC186).
■ D9331 Cycle counter #2 for the timing sequence pulse generative instruction DUTY (FNC186).
■ D9332 Cycle counter #3 for the timing sequence pulse generative instruction DUTY (FNC186).
■ D9333 Cycle counter #4 for the timing sequence pulse generative instruction DUTY (FNC186).
■ D9334 Cycle counter #5 for the timing sequence pulse generative instruction DUTY (FNC186).

313
FNC n
1 2 M 3
CRCP S D Cyclic Redundancy Check - 16
188 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
When S or D is designated to the Kn X, Kn Y, Kn M or Kn S, that Kn has to be K4 n = 1 〜 256

S D n S : the head ID of continuous data source


X20
CRC D0 D100 K7 D : the device where the result of CRC is stored
n : the number of source data to be checked

This instruction calculates the CRC-16 (Cyclic Redundancy Check) code from the content of continuous n bytes
(by the unit of 8-bit) data headed by S , the result is stored in the designated device D .

When the instruction is used for communication, the CRC-16 is applied to ensure and check the accuracy of the
16 15 2
data transmission. The polynomial of the CRC-16 code: X +X +X +1.

When X20 = “ON”, it uses 7 consecutive 8-bit of data that headed by the D0 to calculate the CRC-16 code, and
the result is stored in the D100 (if the M9161 = “ON”, two 8-bit codes are stored in D100 and D101).

The instruction has two operation modes depending on the status of M9161:

M9161 = “OFF” (16-bit mode)

This mode will separate the Upper 8 bits and Lower 8 bits of each 16-bit device as two 8-bit data. The
instruction uses n (= K7) 8-bit data (headed by S ) to calculate the CRC-16 code and stores the result to
D (by a 16-bit value).
Device Content value
S D0 Lower 8 bits H01
D0 Upper 8 bits H03
D1 Lower 8 bits H04
D1 Upper 8 bits HED n =K7
D2 Lower 8 bits H85
D2 Upper 8 bits HA3
D3 Lower 8 bits H28

D D100 H58A6

M9161 = “ON” (8-bit mode)

This mode will take the Lower 8 bits of each device as an 8-bit data (while ignore the Upper 8 bits). The
instruction uses n (= K7) 8-bit data (headed by S ) to calculate the CRC-16 code and stores the result to
D and D +1 (by two 8-bit values).
Device Content value
S D0 Lower 8 bits H01
D1 Lower 8 bits H03
D2 Lower 8 bits H04
D3 Lower 8 bits HED n =K7
D4 Lower 8 bits H85
D5 Lower 8 bits HA3
D6 Lower 8 bits H28

D D100 HA6
D101 H58

314
FNC 1 2 M 3
DHHCMVP S D Hardware High-Speed Counter Data Move
189 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
When the S or D is assigned to a HHSC related Special Register, not has the V, Z index function.

S D S : the source device to be transferred


X20
DHHCMVP D9226 D0 D : the destination device

This DHHCMV is a special instruction for to instantly read the content value of the Hardware High Speed Counter
(HHSC), or to instantly write a new content value or set-point value onto the HHSC.

When the S is assigned to a HHSC's related Special Register, the PLC’s CPU will process the following
procedure. First, reads the data from the related hardware circuit. Second, stores the data to the specic
Special Register S . Last, transmits the data to the designated D . Thus, the value at the HHSC can be read
instantly.
When the D is assigned to a HHSC's related Special Register, the PLC’s CPU will process the following
procedure. It copies the data from the designated S to the specic Special Register D , then duplicates the
data from the Special Register D to the related hardware circuit.
The writable object of the process is the set value or present value of the HHSC. Thus, the set value or present
value at the HHSC can be write instantly.

When X20 = “OFF” → “ON”, the present value at the hardware circuit of HHSC1 will be read and store to the
Special Register (D9227, D9226) and the destination register (D1, D0).

This instruction is a 32-bit instruction. Therefore, be sure to input DHHCMV or DHHCMVP in the program.

X21
DHHCMVP K1000 D9230

When X21 = “OFF” → “ON”, the Special Register (D9231, D9230) and the set value at the hardware circuit of
HHSC1 will be written by the constant K1000.

The related special devices are summarized below:

Register ID No. Description

D9226 Lower 16 bits


The present value of HHSC1.
D9227 Upper 16 bits
D9228 Lower 16 bits
The present value of HHSC2.
D9229 Upper 16 bits
D9230 Lower 16 bits
The set value of HHSC1.
D9231 Upper 16 bits
D9232 Lower 16 bits
The set value of HHSC2.
D9233 Upper 16 bits

315
316
6-17 Block Data Handling Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3

192 DBK P S1 S2 D n Block Data Addition ○

193 DBK P S1 S2 D n Block Data Subtraction ○

194 D B K C M P = P S1 S2 D n Block Data Compare (S1) = (S2) ○

195 D B K C M P > P S1 S2 D n Block Data Compare (S1) > (S2) ○

196 D B K C M P < P S1 S2 D n Block Data Compare (S1) < (S2) ○

197 D B K C M P < > P S1 S2 D n Block Data Compare (S1) ≠ (S2) ○

198 D B K C M P < = P S1 S2 D n Block Data Compare (S1) ≤ (S2) ○

199 D B K C M P > = P S1 S2 D n Block Data Compare (S1) ≥ (S2) ○

317
FNC n
1 2 M 3
DBK P S1 S2 D Block Data Addition
192 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D
n
For a 16-bit instruction, S1, S2 and D occupies n components individually (except that S2 is using K or H)
For a 32-bit instruction, S1, S2 and D occupies (2×n) components individually (except that S2 is using K or H)

S1 S2 D n S1 : the head ID of the summand block


X0
BK P D0 D10 D20 K5 S2 : the addend or the head ID of the addend block
D : the head ID of the sum block
n : the length of the data block to be calculated

When X0 = “OFF” → “ON”, each component in the summand block (D0~D4) will be added to the corresponding
component at the addend block (D10~D14), and store the result into the sum block (D20~D24) one by one.
S 1 D0 K100 S 2 D10 K10 D D20 K110
D1 K200 D11 K50 D21 K250
D2 K234 n + D12 K–10 n = D22 K224 n
D3 K400 D13 K150 D23 K550
D4 K–1 D14 K8 D24 K7

If the S 2 is appointed by a constant number (e.g. K100), the execution method is shown below.
S 1 D0 K100 D D20 K200
D1 K200 D21 K300
D2 K234 n + S 2 K100 = D22 K334 n
D3 K400 D23 K500
D4 K–1 D24 K99

For a 32-bit instruction, the components at the S 1 , S 2 , D and n are all organized by the 32-bit format.
S1 S2 D n
X0
DBK D0 D10 D20 D100

Assume the content value of the 32-bit instruction's n at (D101, D100) is equal to K3, the treatment is as the
following:
S 1 (D1, D0) K123456 S 2 ( D11, D10) K123456 D ( D21, D20) K246912
(D3, D2) K200000 n + ( D13, D12) K–2 n = ( D23, D22) K199998 n
(D5, D4) K5 ( D15, D14) K100 ( D25, D24) K105

The calculation may have the “Borrow” or “Carry” action, but that will not affect the corresponding flag.

The components which used by the instruction could not be overlapped. Otherwise, the PLC will regard that as an
operational error.

318
FNC n
1 2 M 3
DBK P S1 S2 D Block Data Subtraction
193 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D
n
For a 16-bit instruction, S1, S2 and D occupies n components individually (except that S2 is using K or H)
For a 32-bit instruction, S1, S2 and D occupies (2×n) components individually (except that S2 is using K or H)

S1 S2 D n S1 : the head ID of the minuend block


X0
BK P D0 D10 D20 K5 S2 : the subtrahend or the head ID of the subtrahend block
D : the head ID of the difference block
n : the length of the data block to be calculated

When X0 = “OFF” → “ON”, each component in the minuend block (D0~D4) will be subtracted to the
corresponding component of the subtrahend block (D10~D14), and store the result into the difference block
(D20~D24) one by one.
S 1 D0 K100 S 2 D10 K10 D D20 K90
D1 K200 D11 K50 D21 K150
D2 K234 n D12 K–10 n = D22 K244 n
D3 K400 D13 K150 D23 K250
D4 K–1 D14 K8 D24 K–9

If the S 2 is appointed by a constant number (e.g. K100), the execution method is shown below.
S 1 D0 K100 D D20 K0
D1 K200 D21 K100
D2 K234 n S 2 K100 = D22 K134 n
D3 K400 D23 K300
D4 K–1 D24 K–101

For a 32-bit instruction, the components at the S 1 , S 2 , D and n are all organized by the 32-bit format.

S1 S2 D n
X0
DBK D0 D10 D20 D100

Assume the content value of the 32-bit instruction's n at (D101, D100) is equal to K3, the treatment is as the
following:
S 1 (D1, D0) K123456 S 2 ( D11, D10) K123456 D ( D21, D20) K0
(D3, D2) K200000 n ( D13, D12) K–2 n = ( D23, D22) K200002 n
(D5, D4) K5 ( D15, D14) K10 ( D25, D24) K–5

The calculation may have the “Borrow” or “Carry” action, but that will not affect the corresponding flag.

The components which used by the instruction could not be overlapped. Otherwise, the PLC will regard that as an
operational error.

319
FNC n
1 2 M 3
D B K C M P = P S1 S2 D Block Data Compare (S1) = (S2)
194 ○
FNC n
1 2 M 3
D B K C M P > P S1 S2 D Block Data Compare (S1) > (S2)
195 ○
FNC n
1 2 M 3
D B K C M P < P S1 S2 D Block Data Compare (S1) < (S2)
196 ○
FNC n
1 2 M 3
D B K C M P < > P S1 S2 D Block Data Compare (S1) ≠ (S2)
197 ○
FNC n
1 2 M 3
D B K C M P < = P S1 S2 D Block Data Compare (S1) ≤ (S2)
198 ○
FNC n
1 2 M 3
D B K C M P > = P S1 S2 D Block Data Compare (S1) ≥ (S2)
199 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D
n
For a 16-bit instruction, S1, S2 and D occupies n components individually (except that S1 is using K or H)
For a 32-bit instruction, S1 and S2 occupies (2×n) components individually (except that S1 is using K or H),
also D occupies n components

S1 S2 D n S1 : the comparison value or the head ID of the


X0 comparison data block
BKCMP=P D0 D10 M0 K5
S2 : the head ID of another comparison data block
D : the head ID of the comparison result block
n : the length of the data block to be compared

When X0 = “OFF” → “ON”, each component in the first block (D0~D4) will compare with the relevant component
of the second block (D10~D14), and store the compare result to the destination block (M0~M4) one by one.

S 1 D0 K100 S 2 D10 K10 D M0 0( OFF)


D1 K200 D11 K200 M1 1( ON)
D2 K234 n "=" D12 K–10 n M2 0( OFF) n
CMP
D3 K400 D13 K400 M3 1( ON)
D4 K–1 D14 K8 M4 0( OFF)

The FNC194~FNC199 are designed for to execute the =, >, <, <>, ≤ and ≥ comparisons respectively.

The S 1 can directly use a constant number.

When all the comparative results in the D block are “ON”, the M9090 = “ON”.
For a 32-bit instruction, the components at the S 1 , S 2 and n are all organized by the 32-bit format.

S1 S2 D n
X0
DBKCMP<> D0 D10 M0 D100

Assume the content value of the 32-bit instruction’s n at (D101, D100) is equal to K3, the treatment is as the
following:
S 1 (D1, D0) K123456 S 2 ( D11, D10) K123456 D M0 0( OFF)
(D3, D2) K200000 n "<>" (D13, D12) K–2 n M1 1( ON) n
CMP
(D5, D4) K5 ( D15, D14) K10 M2 1( ON)

The related special devices are summarized below: ( ■ : Means read only.)

Relay ID No. Description


■ M9090 All bits “ON” ag at the result of a block data comparison BKCMP (FNC194~FNC199) instruction.

320
6-18 Character String Handling Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3

200 D S T R P S1 S2 D BIN to Character String Conversion ○

201 DVALP S D1 D2 Character String to BIN Conversion ○

202 $ P S1 S2 D Join Up Two Character Strings ○

203 LENP S D Character String Length Detection ○

204 RIGHTP S D n Read Character from the Right of String ○

205 LEFTP S D n Read Character from the Left of String ○

Extract Character from Specic Place


206 M I D R P S1 D S2 of String

Rewrite Characters to Specic Place


207 M I D W P S1 D S2 of String

n Search Character String from another


208 I N S T R P S1 S2 D String

209 $ MOVP S D Transfer Character String ○

321
FNC 1 2 M 3
D S T R P S1 S2 D BIN to Character String Conversion
200 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D

S1 S2 D S1 : the devices to appoint the conversion format


X0
STR D10 D20 D0 S2 : the source of a BIN number
D : the head ID of the devices where conversed character
string is stored

This instruction uses the format parameters at the S 1 to interpret a BIN number at the S 2 . By the format to
convert each digit of that number become an ASCII code and combine those codes to a string, then stores into the
devices which are headed by D .

S1 Length of the converted string 16-bit instruction, the length = 2~8; 32-bit instruction, the length = 2~13.

Number of digits after the


S 1 +1 decimal point at the string 16-bit instruction, the digits = 0~5; 32-bit instruction, the digits = 0~10.

This instruction will use the following ASCII conversion table:


Sign & Number SPACE – 0 1 2 3 4 5 6 7 8 9
ASCII Cord 20H 2DH 2EH 30H 31H 32H 33H 34H 35H 36H 37H 38H 39H

Assume the D10=8, D11=2, D20=-12345 and X0="ON", the instruction will be executed as follows:
Length of the
S1 converted string Number of digits after
D10 8 the decimal point
D11 2

S2
D20 –12345 – 1 2 3 4 5 The expanded number during the conversion

D D0 D0 D1 D1 D2 D2 D3 D3 D4
Lower Upper Lower Upper Lower Upper Lower Upper
8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits
2DH(–) 20H( ) 31H( 1) 32H( 2) 33H( 3) 2EH(•) 34H( 4) 35H( 5) 0000H
Positive or Space Decimal End of
negative Integer part point 2 digits after the string
sign decimal point
The positive or negative sign is using the 20H to represent positive; the 2DH represents negative.
The byte next to the positive or negative sign is a blank space, that will ll in the code 20H.
When the expanded number converts to the ASCII codes, the instruction adds the end of string at the tail
automatically. If the set length of the string is an odd number, the end of string is 00H; in addition, the string
with even number set length will add the end of string 0000H. Thus, the D4 at the converted string with the
value 0000H that is the end of string.

Assume the content value of the 16-bit instruction's D10=7, D11=0 and D20=12345, the instruction will be
executed as follows:
Length of the
S1 converted string
D10 7
Number of digits after
D11 0 the decimal point

S2
D20 12345 1 2 3 4 5

Since the D11=0, that indicates an integer will be shown, so there is no decimal point in the string.

322
Assume the content value of the 32-bit instruction's D10=13, D11=8 and (D21, D20)=-123450, the instruction will
be executed as follows:
S1 S2 D
X0
DSTR D10 D20 D0

S1 Length of the converted string Number of digits after


D10 13 the decimal point
D11 8

S2
( D21, D20) –123450 – 0 0 0 1 2 3 4 5 0

Negative sign 123450


Empty, inserts two space codes Insert the 0s and a decimal point

For example, the S 1 =3 and S 2 =123, that will be regarded as an operating error. Since, the S 2 = 123 is a 3
digits number, but to convert that will need a digit for the positive or negative sign in the front. So, the S 1 should
greater than or equal to 4.

323
FNC 1 2 M 3
DVALP S D1 D2 Character String to BIN Conversion
201 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D1
D2

S D1 D2 S : the head ID of the devices where character string is stored


X0
VAL D0 D10 D20 D1 : the format of the character string
D2 : the converted BIN number result

This instruction uses a string started from the S to perform the BIN number conversion, then stores that format
into the devices D 1 and the results of BIN pure number into the device D 2 .

D1 Length of the converted string 16-bit instruction, the length = 2~8; 32-bit instruction, the length = 2~13.

Number of digits after the


D 1 +1 decimal point at the string 16-bit instruction, the digits = 0~5; 32-bit instruction, the digits = 0~10.

This instruction will use the following ASCII conversion table:


ASCII Cord 20H 2DH 2EH 30H 31H 32H 33H 34H 35H 36H 37H 38H 39H
Sign & Number SPACE – 0 1 2 3 4 5 6 7 8 9

When X0 = “ON”, the 16-bit instruction will be executed as follows:


S D0 D0 D1 D1 D2 D2 D3 D3 D4 D4
Lower Upper Lower Upper Lower Upper Lower Upper Lower Upper
8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits
2DH(–) 20H( ) 31H( 1) 32H( 2) 33H( 3) 2EH(•) 34H( 4) 35H( 5) 00H
Positive or Space End of
negative string
sign

D2
– 1 2 3 4 5 D20 –12345

D1
D10 8 Length of the converted string
D11 2 Number of digits after the decimal point

The positive or negative sign: the 20H represents positive; the 2DH represents negative.
The byte next to the positive or negative sign is a blank space, that should ll in the code 20H.
After the conversion, will get the BIN pure number part at D 2 (-12345) and the string format at D 1 .

324
When to execute the 32-bit instruction, the results will as follows:
S D1 D2
X0
DVAL D0 D10 D20

Positive
(20H) Ignore the space
Value of the pure number part is 123456
D2
S string 1 2 3 4 5 6 ( D21, D20) 123456

D1
D10 11 Length of the source string
D11 3 Number of digits after the decimal
point at the string

Negative Ignore
Value of the pure number part is 1234567
D2
S string – 0 0 1 2 3 4 5 6 7 ( D21, D20) – 1234567

D1
D10 11 Length of the source string
D11 8 Number of digits after the decimal
point at the string

If the operation has one of the following situation, the PLC will regard that as an operational error.
1. Length of the converted string for the 16-bit instruction is not = 2~8; 32-bit instruction is not = 2~13.
2. Number of digits after the decimal point at the string for the 16-bit instruction is not = 0~5; 32-bit instruction is
not = 0~10.
3. The beginning (lowest byte) of the source string S is not the ASCII code 20H (positive) or 2DH (negative).

4. The source string S contains a code which is improper.


5. The result of the converted BIN number for the 16-bit instruction is over the available range -32,768~32,767;
32-bit instruction is over -2,147,483,648~2,147,483,647.

325
FNC $
1 2 M 3
P S1 S2 D Join Up Two Character Strings
202 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D

S1 S2 D S1 : the head ID of the character string #1


X0
$ D0 D10 D20 S2 : the head ID of the character string #2
D : the head ID of the combined string result

The instruction will join up the string S 2 after the string S 1 and store the combined result string into D .

When X0 = “ON”, the instruction will be executed as follows:


Upper Lower Upper Lower Upper Lower
8 bits 8 bits 8 bits 8 bits 8 bits 8 bits

S 1 D0 20H( ) 49H ( I ) S 2 D10 49H ( I ) 56H(V) D D20 20H( ) 49H ( I )


D1 49H ( I ) 4CH( L) D11 4FH ( O ) 47H(G) D21 49H ( I ) 4CH( L)
+ = S1
D2 45H( E) 4BH ( K ) D12 00H 52H (R) D22 45H( E) 4BH ( K )
D3 00H 20H( ) D23 56H(V) 20H( )
D24 47H(G) 49H ( I )
"I LIKE " " VIGOR" S2
D25 52H (R) 4FH ( O )
D26 0000H

The code for end of string


will be added.
"I LIKE VIGOR"

The instruction will add the end of string at the tail of D automatically. If the length of the result string is an odd
number, the end of string is “00H”; in addition, the string with even number length will add the end of string
“0000H”.

As the example instruction below, the S 1 or S 2 can be substituted by a key-in string between two quotation
marks. Only the length of the input string should less than 32 characters.
Upper Lower Upper Lower
8 bits 8 bits 8 bits 8 bits

S 1 D0 20H( ) 49H ( I ) D D20 20H( ) 49H ( I )


D1 49H ( I ) 4CH( L)
S2 D21 49H ( I ) 4CH( L)
+ " VIGOR" = S1
D2 45H( E) 4BH ( K ) D22 45H( E) 4BH ( K )
D3 00H 20H( ) D23 56H(V) 20H( )
D24 47H(G) 49H ( I )
"I LIKE " S2
D25 52H (R) 4FH ( O )
D26 0000H

The code for end of string


will be added.
"I LIKE VIGOR"

If both of the S 1 and S 2 are empty strings (their lower bytes are "00H"), the instruction will input the result
“0000H” to D .

If two or three of the operands for the S 1 , S 2 and D are allocated to a same component, the PLC will regard
that as an operational error.

326
FNC 1 2 M 3
LENP S D Character String Length Detection
203 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the head ID of the character string to be measured


X0
LEN D0 D100 D : the device to store the length of the string

To count the length of the string that is from the head component S to the last character (before the end of string
“00H” appears) and store the result number into D .

When X0 = “ON”, the instruction will be executed as follows:


Upper Lower
8 bits 8 bits

S D0 20H( ) 49H ( I )
D1 49H ( I ) 4CH( L)
D2 45H( E) 4BH ( K )
X0=ON
D3 56H(V) 20H( ) D D100 12
D4 47H(G) 49H ( I )
D5 52H (R) 4FH ( O )
D6 00H

"I LIKE VIGOR"

S If the length of the string is more than 32,767 characters, the PLC will regard that as an operational error.

327
FNC n
1 2 M 3
RIGHTP S D Read Character from the Right of String
204 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n

S D n S : the head ID of the source character string


X0
RIGHT D0 D10 K5 D : the head ID of the storage block for the read string
n : the length of the characters to be read

To read the last of n characters from the string S and store the extracted result into D .

When X0 = “ON”, the instruction will be executed as follows:


Upper Lower
8 bits 8 bits

S D0 20H( ) 49H ( I )
D1 49H ( I ) 4CH( L) Upper Lower
8 bits 8 bits
D2 45H( E) 4BH ( K )
D3 56H(V) 20H( ) D D10 49H ( I ) 56H(V)
X0=ON
D4 47H(G) 49H ( I ) D11 4FH ( O ) 47H(G)
D5 52H (R) 4FH ( O ) D12 00H 52H (R)
D6 00H " VIGOR"
"I LIKE VIGOR"

The instruction will add the end of string at the tail of result D automatically. If the n is equal to 0 or an even
number, the end of string “0000H” will be added; if the n is an odd number, the end of string is “00H”.

When the string from S which does not have the end of string code “00H” or the n is negative or the n is
exceeding the string from S could provide with, the PLC will regard that as an operational error.

328
FNC n
1 2 M 3
LEFTP S D Read Character from the Left of String
205 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n

S D n S : the head ID of the source character string


X0
LEFT D0 D10 K6 D : the head ID of the storage block for the read string
n : the length of the characters to be read

To read the beginning of n characters from the string S and store the extracted result into D .

When X0 = “ON”, the instruction will be executed as follows:


Upper Lower Upper Lower
8 bits 8 bits 8 bits 8 bits

S D0 20H( ) 49H ( I ) D D10 20H( ) 49H ( I )


X0=ON
D1 49H ( I ) 4CH( L) D11 49H ( I ) 4CH( L)
D2 45H( E) 4BH ( K ) D12 45H( E) 4BH ( K )
D3 56H(V) 20H( ) D13 0000H
D4 47H(G) 49H ( I )
"I LIKE"
D5 52H (R) 4FH ( O )
D6 00H

"I LIKE VIGOR"

The instruction will add the end of string at the tail of result D automatically. If the n is equal to 0 or an even
number, the end of string “0000H” will be added; if the n is an odd number, the end of string is “00H”.

When the string from S which does not have the end of string code “00H” or the n is negative or the n is
exceeding the string from S could provide with, the PLC will regard that as an operational error.

329
FNC Extract Character from Specic Place 1 2 M 3
M I D R P S1 D S2
206 of String ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
D
S2

S1 D S2 S1 : the head ID of the source character string


X0
MIDR D0 D10 D20 D : the head ID of the storage block for the read string
S2 : to appoint the patterns of the string reading

To read S 2 +1 characters by the S 2 designated starting position at the source string S , and store the extracted
result into D .

When X0 = “ON”, the instruction will be executed as follows:


Upper Lower
8 bits 8 bits
Upper Lower
8 bits 8 bits
S 1 D0 20H( ) 49H ( I )
D1 49H ( I ) 4CH( L) X0=ON D D10 49H ( I ) 4CH( L)
D2 45H( E) 4BH ( K ) D11 45H( E) 4BH ( K )
D3 56H(V) 20H( ) D12 0000H
D4 47H(G) 49H ( I )
" LIKE"
D5 52H (R) 4FH ( O )
D6 00H

"I LIKE VIGOR"

S 2 D20 3
D21 4

If the D21 = 0, this instruction will not execute.


If the D21 = –1, this instruction will extract a part of source string which is starting from the third position to the last
character. That is shown in the example below.

Upper Lower
8 bits 8 bits
Upper Lower
8 bits 8 bits
S 1 D0 20H( ) 49H ( I )
D1 49H ( I ) 4CH( L) D D10 49H ( I ) 4CH( L)
D2 45H( E) 4BH ( K ) D11 45H( E) 4BH ( K )
X0=ON
D3 56H(V) 20H( ) D12 56H(V) 20H( )
D4 47H(G) 49H ( I ) D13 47H(G) 49H ( I )
D5 52H (R) 4FH ( O ) D14 52H (R) 4FH ( O )
D6 00H D15 0000H

"I LIKE VIGOR" " LIKE VIGOR"

S 2 D20 3
D21 –1

If the operation has one of the following situation, the PLC will regard that as an operational error.
1. The string from S 1 which does not have the end of string code “00H”.
2. The S 2 is negative.

3. The value of S 2 +1 is exceeding the string from S 1 could provide with, or the S 2 +1 is less than –1.

330
FNC Rewrite Characters to Specic Place 1 2 M 3
M I D W P S1 D S2
207 of String ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
D
S2

S1 D S2 S1 : the head ID of the source character string


X0
MIDW D0 D10 D20 D : the head ID of the string for the partial replacement using
S2 : to appoint the replacement patterns

To read the beginning S 2 +1 characters from the string S 1 . Then use those to replace a part of the string D ,
the replacement starting position is designated by the S 2 .

When X0 = “ON”, the instruction will be executed as follows:


Upper Lower
8 bits 8 bits

S 1 D0 4FH ( O ) 4CH( L)
D1 45H( E) 56H(V)
D2 36H(6 ) 31H(1 )
To extract 4
D3 00H 38H(8 ) characters
from the
" LOVE168" beginning
To replace starting from the third place
S 2 D20 3
D21 4

Upper Lower Upper Lower


8 bits 8 bits 8 bits 8 bits

D D10 20H( ) 49H ( I ) D D10 20H( ) 49H ( I )


D11 49H ( I ) 4CH( L) D11 4FH ( O ) 4CH( L)
D12 45H( E) 4BH ( K ) D12 45H( E) 56H(V)
X0=ON
D13 56H(V) 20H( ) D13 56H(V) 20H( )
D14 47H(G) 49H ( I ) D14 47H(G) 49H ( I )
D15 52H (R) 4FH ( O ) D15 52H (R) 4FH ( O )
D16 00H D16 00H

"I LIKE VIGOR" "I LOVE VIGOR"

If the D21 ( S 2 +1) is equal to 0, the instruction will not execute.

331
If the D21 = –1, this instruction will extract all the characters at the source string S 1 . As the example below, the
characters “LOVE168” are caught.
If use the extracted characters to replace a part of string D and that range is exceeded the string D have, the
replacement will only affect to the original occupied space, as the example below.
Upper Lower
8 bits 8 bits

S 1 D0 4FH ( O ) 4CH( L)
D1 45H( E) 56H(V)
D2 36H(6 ) 31H(1 )
Since the D21= –1,
D3 00H 38H(8 ) all of the 7
characters at the
" LOVE168" S 1 will be taken.

S 2 D20 8 To replace starting from the eighth place,


but only 5 characters are effective.
D21 –1
Upper Lower Upper Lower
8 bits 8 bits 8 bits 8 bits

D D10 20H( ) 49H ( I ) D D10 20H( ) 49H ( I )


D11 49H ( I ) 4CH( L) D11 49H ( I ) 4CH( L)
D12 45H( E) 4BH ( K ) D12 45H( E) 4BH ( K )
X0=ON
D13 56H(V) 20H( ) D13 4CH( L) 20H( )
D14 47H(G) 49H ( I ) D14 56H(V) 4FH ( O )
D15 52H (R) 4FH ( O ) D15 31H(1 ) 45H( E)
D16 00H D16 00H

"I LIKE VIGOR"

If the operation has one of the following situation, the PLC will regard that as an operational error.
1. The string from S 1 or D which does not have the end of string code “00H”.
2. The S 2 designated starting location is not in the string D or the S 2 is negative.

3. The value of S 2 +1 is exceeding the string from S 1 could provide with or the S 2 +1 is less than –1.

332
FNC n Search Character String from another 1 2 M 3
208 I N S T R P S1 S2 D String ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D
n

S1 S2 D n S1 : the head ID of the searching source character string


X0
INSTR D0 D10 D20 K1 S2 : the head ID of the string to be searched
D : the search result
n : to appoint the starting location of the search

Use the character string S 1 to execute a search that is starting from the designated n place at the source string
S 2 , and the result of the matched location is stored into D .

When X0 = “ON”, the instruction will be executed as follows:


Upper Lower
8 bits 8 bits

S 1 D0 49H ( I ) 4CH( L)
D1 45H( E) 4BH ( K )
D2 00H

" LIKE"

Upper Lower
8 bits 8 bits

S 2 D10 20H( ) 49H ( I ) Since the n =1, the search starts from the first one. If the n is less than 1,
the instruction will not execute.
D11 49H ( I ) 4CH( L)
D12 45H( E) 4BH ( K )
X0=ON
D13 56H(V) 20H( ) D D20 3
D14 47H(G) 49H ( I ) If the n =5, the search will be starting from the fifth
D15 52H (R) 4FH ( O ) position of the string S 2 . Therefore, the search cannot
D16 00H find a section who is equal to the S 1 , so the result at the
D20 will get 0.

As the example instruction below, the S 1 can be substituted by a key-in string between two quotation marks.
The instruction will get the result D = D20=8.

S1 S2 D n
X0
INSTR “VIGOR” D10 D20 K3

If the operation has one of the following situation, the PLC will regard that as an operational error.
1. The string from S 1 or S 2 which does not have the end of string code "00H".
2. The n designated starting location is not in the string S 2 .

333
FNC $ MOVP Transfer Character String
1 2 M 3
S D
209 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D

S D S : the head ID of the source character string


X0
$MOV D0 D10 D : the head ID of the moving target

Move the character string from the S to the D .

When X0 = “ON”, the instruction will be executed as follows:


Upper Lower Upper Lower
8 bits 8 bits 8 bits 8 bits

S D0 49H ( I ) 56H(V) D D10 49H ( I ) 56H(V)


X0=ON
D1 4FH ( O ) 47H(G) D11 4FH ( O ) 47H(G)
D2 00H 52H (R) D12 00H 52H (R)

" VIGOR"
The code of the end of string

In the example above, the source string S has 5 characters that length is an odd number, thus the instruction will
add the end of string "00H" at the tail of result D automatically. Else, if the string length is an even number, will
add the end of string "0000H".
Upper Lower Upper Lower
8 bits 8 bits 8 bits 8 bits

S D0 49H ( I ) 4CH( L) D D10 49H ( I ) 4CH( L)


X0=ON
D1 45H( E) 4BH ( K ) D11 45H( E) 4BH ( K )
D2 00H D12 0000H The code of the end of string

" LIKE"

If the string from S which does not have the end of string code “00H”, the PLC will regard that as an operational
error.

334
6-19 Data Table Handling and Shift Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3
n Delete Data from Specic Location
210 FDELP S D ○
of Table

n Insert Data into Specic Location


211 FINSP S D ○
of Table

n Shift the Last Register Read


212 POPP S D
(FILO Last Read)

n Shift n Bit Right in 16-bit Word Data


213 SFRP D with Carry

n Shift n Bit Left in 16-bit Word Data


214 SFLP D with Carry

335
FNC n Delete Data from Specic Location 1 2 M 3
FDELP S D
210 of Table ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
n>0

S D n S : the register is to store the split data from the data table
X0
FDELP D0 D2 D1 D : the head ID of the data table to be shortened
n : to appoint the point at the table to be cut

This instruction uses a series of word components starting with the D to form a data table, and the component
D is used to define the size of the data table.
When the instruction is executed, the n th data in the table will extract out and store to the component S , and
all the data behind will shift one position backward, also the size of the data table at the D will decrease one.

When X0 = “OFF” → “ON” and n = (D1) = K3, the process result is below.

Data table X0=OFF→ON Data table


Set the size
of the data table D D2 5 D D2 4 5 –1 =4
which is user dened)
(Related to the contents of D
The total size of the data table

D3 100 1 D3 100
D4 200 2 D4 200
There are 5 data n =3
in the table will be D5 300 3 D5 400
used
D6 400 4 D6 500
D7 500 5 D7 0 Fill in 0

S D0 300

Please pay attention to the total size of the data table, the programmer should manage it to avoid interferes with
other data is used.

When the instruction executes, the n should bigger than 0, and also should equal or less than the size of the
data table at D ; otherwise, the PLC will regard that as an operational error.

336
FNC n Insert Data into Specic Location 1 2 M 3
FINSP S D
211 of Table ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
n>0

S D n S : the register is to store the split data from the data table
X0
FINSP D0 D2 D1 D : the head ID of the data table to be shortened
n : to appoint the point at the table to be cut

This instruction uses a series of word components starting with the D to form a data table, and the component
D is used to define the size of the data table.
When the instruction is executed, all the data starting from the n th component at the table will shift one position
forward and insert the content of S into the place of n th in the table, also the size of the data table at the D
will increase one.

When X0 = “OFF” → “ON” and n = (D1) = K3, the process result is below.

Data table X0=OFF→ON Data table


Set the size
of the data table
D D2 4 D D2 5 4 +1 =5
which is user dened)
(Related to the contents of D
The total size of the data table

D3 100 1 D3 100
D4 200 2 D4 200
There are 4 data n =3
in the table will be D5 400 3 D5 300
used
D6 500 4 D6 400
D7 0 5 D7 500

S D0 300

Please pay attention to the total size of the data table, the programmer should manage it to avoid interferes with
other data is used.

When the instruction executes, the n should bigger than 0, and also equal or less than the size of the data table
at D plus one; otherwise, the PLC will regard that as an operational error.

337
FNC n Shift the Last Register Read 1 2 M 3
POPP S D
212 (FILO Last Read) ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
n
S occupies n components n = 2~512

S D n S : the header ID of the FILO data stack


X0
D : the destination device for storing read data
POPP D0 D101 K10
from a FILO data stack
n : the length of the FILO data stack

A series of word data can be used for the FILO (First In, Last Out) data stack access. The FILO data stack is
headed by S , the size is assigned by n and the stack's first device is designated to be the indicator. When
each time this instruction is enabled, it firstly reads out the content value of the device which is designated by the
indicator in the FILO data stack, and then duplicates the value to the destination device D , after that the content
value of the indicator decreases 1.

Length is designated by n D
The FILO data stack is composed by
D0~ D9, where D0 is the indicator D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 S D101
The
indicator
D0=9

D0=8

D0=7

D0=6

D0=5

D0=4

D0=3

D0=2

D0=1

When X0 = “OFF” → “ON” and S = D0 = 5, the content value at D5 will duplicate to D101 also the content
value of D0 decreases 1 become 4. After that, if turn the X0 “OFF” → “ON” one more time, the content value at D4
will duplicate to D101 then the content value of D0 decreases 1 become 3, and so on.
D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 D101
50 40 30 20 10 5 S D

X0=OFF→ ON

D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 D101
50 40 30 20 10 4 S D 50
5–1=4

X0=OFF→ ON

D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 D101
50 40 30 20 10 3 S D 40
4 – 1=3

When the content value of D0 is equal to 0 and the instruction is active again, it will not execute to duplicate data or
decrease the indicator any more. So the value of D101 will remain unchanged, and furthermore the Zero Flag
M9020 = “ON”.
When the content value of D0 is equal to 1 and the instruction is active again, it will decrease the indicator become
0 and furthermore the Zero Flag M9020 = “ON”.
This POP instruction can be used jointly with the FNC38 SFWR instruction to achieve the write / read control of the
FILO (First In, Last Out) data stack.

338
FNC n Shift n Bit Right in 16-bit Word Data 1 2 M 3
SFRP D
213 with Carry ○
FNC n Shift n Bit Left in 16-bit Word Data 1 2 M 3
SFLP D
214 with Carry ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
D
n
n = 0 〜 15

D n D : the word data device to be shifted


X0
SFRP D0 K4 n : the number of the bits to be shifted

The bit format of the designated device D executes to shift to the right by the number of n bits.

When X0 = “OFF” → “ON”, the 16-bit data of (D0) will be shifted by 4 bits to the right, and the status of the highest
bit that shifted out will be copied to the Carry Flag M9022. All blank bits will be filled with 0 at every blank bit.

b15 Shift right n bits b0


1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1
D0 M9022

After execution of a bits shift

0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0
D0 M9022
Fill in 0 at every blank bit

D n D : the word data device to be shifted


X1
SFLP D1 K4 n : the number of the bits to be shifted

The bit format of the designated device D executes to shift to the left by the number of n bits.

When X1 = “OFF” → “ON”, the 16-bit data of (D1) will be shifted by 4 bits to the left, and the status of the lowest bit
that shifted out will be copied to the Carry Flag M9022. All blank bits will be filled with 0 at every blank bit.

b15 Shift left n bits b0


0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
M9022 D1

After execution of a bits shift

1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0
M9022 D1
Fill in 0 at every blank bit

339
340
6-20 In-Line Comparison Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3
Initial In-line Compare, Connect Up if
224 D= S1 S2 (S1) = (S2)
○ ○ ○ ○

Initial In-line Compare, Connect Up if


225 D> S1 S2 (S1) > (S2)
○ ○ ○ ○

Initial In-line Compare, Connect Up if


226 D< S1 S2 (S1) < (S2)
○ ○ ○ ○

Initial In-line Compare, Connect Up if


228 D < > S1 S2 (S1) ≠ (S2)
○ ○ ○ ○

Initial In-line Compare, Connect Up if


229 D < = S1 S2 (S1) ≤ (S2)
○ ○ ○ ○

Initial In-line Compare, Connect Up if


230 D > = S1 S2 (S1) ≥ (S2)
○ ○ ○ ○

Serial In-line Compare, Connect Up if


232 D= S1 S2 (S1) = (S2)
○ ○ ○ ○

Serial In-line Compare, Connect Up if


233 D> S1 S2 (S1) > (S2)
○ ○ ○ ○

Serial In-line Compare, Connect Up if


234 D< S1 S2 (S1) < (S2)
○ ○ ○ ○

Serial In-line Compare, Connect Up if


236 D<> S1 S2 (S1) ≠ (S2)
○ ○ ○ ○

Serial In-line Compare, Connect Up if


237 D<= S1 S2 (S1) ≤ (S2)
○ ○ ○ ○

Serial In-line Compare, Connect Up if


238 D>= S1 S2 (S1) ≥ (S2)
○ ○ ○ ○

Parallel In-line Compare, Connect Up if


240 D= S1 S2 (S1) = (S2)
○ ○ ○ ○

Parallel In-line Compare, Connect Up if


241 D> S1 S2 (S1) > (S2)
○ ○ ○ ○

Parallel In-line Compare, Connect Up if


242 D< S1 S2 (S1) < (S2)
○ ○ ○ ○

Parallel In-line Compare, Connect Up if


244 D<> S1 S2 (S1) ≠ (S2)
○ ○ ○ ○

Parallel In-line Compare, Connect Up if


245 D<= S1 S2 (S1) ≤ (S2)
○ ○ ○ ○

Parallel In-line Compare, Connect Up if


246 D>= S1 S2 (S1) ≥ (S2)
○ ○ ○ ○

341
FNC Initial In-line Compare, Connect Up if 1 2 M 3
D= S1 S2
224 (S1) = (S2) ○ ○ ○ ○
FNC Initial In-line Compare, Connect Up if 1 2 M 3
D> S1 S2
225 (S1) > (S2) ○ ○ ○ ○
FNC Initial In-line Compare, Connect Up if 1 2 M 3
D< S1 S2
226 (S1) < (S2) ○ ○ ○ ○
FNC Initial In-line Compare, Connect Up if 1 2 M 3
D < > S1 S2
228 (S1) ≠ (S2) ○ ○ ○ ○
FNC Initial In-line Compare, Connect Up if 1 2 M 3
D < = S1 S2
229 (S1) ≤ (S2) ○ ○ ○ ○
FNC Initial In-line Compare, Connect Up if 1 2 M 3
D > = S1 S2
230 (S1) ≥ (S2) ○ ○ ○ ○
FNC Serial In-line Compare, Connect Up if 1 2 M 3
D= S1 S2
232 (S1) = (S2) ○ ○ ○ ○
FNC Serial In-line Compare, Connect Up if 1 2 M 3
D> S1 S2
233 (S1) > (S2) ○ ○ ○ ○
FNC Serial In-line Compare, Connect Up if 1 2 M 3
D< S1 S2
234 (S1) < (S2) ○ ○ ○ ○
FNC Serial In-line Compare, Connect Up if 1 2 M 3
D<> S1 S2
236 (S1) ≠ (S2) ○ ○ ○ ○
FNC Serial In-line Compare, Connect Up if 1 2 M 3
D<= S1 S2
237 (S1) ≤ (S2) ○ ○ ○ ○
FNC Serial In-line Compare, Connect Up if 1 2 M 3
D>= S1 S2
238 (S1) ≥ (S2) ○ ○ ○ ○
FNC Parallel In-line Compare, Connect Up if 1 2 M 3
240 D= S1 S2 (S1) = (S2) ○ ○ ○ ○
FNC Parallel In-line Compare, Connect Up if 1 2 M 3
241 D> S1 S2 (S1) > (S2) ○ ○ ○ ○
FNC Parallel In-line Compare, Connect Up if 1 2 M 3
242 D< S1 S2 (S1) < (S2) ○ ○ ○ ○
FNC Parallel In-line Compare, Connect Up if 1 2 M 3
244 D<> S1 S2 (S1) ≠ (S2) ○ ○ ○ ○
FNC Parallel In-line Compare, Connect Up if 1 2 M 3
245 D<= S1 S2 (S1) ≤ (S2) ○ ○ ○ ○
FNC Parallel In-line Compare, Connect Up if 1 2 M 3
246 D>= S1 S2 (S1) ≥ (S2) ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2

S1 : the compare value #1


S2 : the compare value #2

S1 S2
X0
= K100 D0 Y0 When the content value of D0 = K100 and X0 = “ON”, Y0 = “ON”.

S1 S2
X1
D<> C235 K10 Y1 When X1 = “ON” and the present value of C235 ≠ K10, Y1 = “ON”.

S1 S2
D<= D100 D200 Besides, when the content value of (D101, D100) ≤ the content
value of (D201, D200), Y0 = “ON” too.

Since the programming software Ladder Master S at the monitoring mode could not to read the status at the
special module’s BFM directly, the operand in the instruction which is appointed to the UnG will not have the
correct value to display. Furthermore, that in-line comparison could not display the result. However, the logical
processing at the PLC is correct.

342
6-21 Handy Instructions and DABIN, BINDA, HSCT Instructions

FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3

256 D L I M I T P S1 S2 S3 D Limit Control ○

257 D B A N D P S1 S2 S3 D Dead Band Control ○

258 D Z O N E P S1 S2 S3 D Zone Shift Control ○

259 D S C L P S1 S2 D Scaling (Coordinate by Point Data) ○ ○ ○ ○

269 D S C L 2 P S1 S2 D Scaling 2 (Coordinate by X/Y Data) ○ ○ ○ ○

Convert Decimal ASCII String to


260 DDABINP S D ○
BIN Number
Convert BIN Number to Decimal
261 DBINDAP S D ASCII String

m n Software High Speed Counter Table


280 D H S C T S1 S2 D Compare
○ ○ ○ ○

343
FNC 1 2 M 3
D L I M I T P S1 S2 S3 D Limit Control
256 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
S3
D
S 2 >S 1

S1 S2 S3 D S1 : the lower limit value


X0
LIMIT K500 K1000 D0 D1 S2 : the upper limit value
S3 : the input value
D : the output value

Output
D

Use the lower limit S 1 and the upper limit S 2 to create


a conversion curve as shown in the right diagram.
Through that curve, an input value from the S 3 can get
a restrictive output value at the D . S2
If the S 3 < S 1 , the output D is equal to the lower limit S 1 .
If the S 1 <= S 3 <= S 2 , the output D is equal to the
input S 3 .
S1
If the S 3 > S 2 , the output D is equal to the upper limit
S2 .
S 3 Input
S1 S2

D D1

When X0 = “ON”, the instruction and the input value 32767


D0 use the two limits at the right diagram to generate
a restricted result D1.
S2
By the setting at the right diagram, the S 1 =500 and 1000
S 2 =1000:
If the D0 < 500, the output D1 is equal to 500. S1
500
If the 500 <= D0 <= 1000, the output D1 is equal to
the input D0.
If the D0 > 1000, the output D1 is equal to 1000. –32768 S 3 D0
–32768 500 1000 32767
S1 S2

For a 16-bit instruction, the available range of the S 3 and D are –32,768~+32,767.
For a 32-bit instruction, the available range of the S 3 and D are –2,147,483,648~+2,147,483,647.

344
FNC 1 2 M 3
D B A N D P S1 S2 S3 D Dead Band Control
257 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
S3
D
S 1 <S 2

S1 S2 S3 D S1 : the lower unresponsive value of the dead band


X0
BAND K-5000 K5000 D0 D1 S2 : the upper unresponsive value of the dead band
S3 : the input value of the dead band control
D : the output value of the dead band control
Output
Use the values of lower unresponsive S 1 and upper D
unresponsive S 2 to create a dead band conversion
curve as shown in the right diagram. Through that
curve, an input value from the S 3 can get an adjusted
output value at the D .

If the S 3 < S 1 , the output D is equal to the arithmetical S3 – S2


difference of S 3 – S 1 . 0
If the S 1 <= S 3 <= S 2 , the output D is equal to 0. S3 – S1
If the S 3 > S 2 , the output D is equal to the arithmetical
difference of S 3 – S 2 .
S 3 Input
S1 S2

D D1

32767
S3 S2
When X0 = “ON”, the instruction and the input value D0 (D0)–(5000)
use the dead band between two unresponsive points
S3 S1
at the right diagram to generate an adjusted result D1.
(D0)–(–5000)
By the setting at the right diagram, the S 1 =-5000 and 0
S 2 =5000:
If the D0 < -5000, the output D1 is equal to D0 – ( – 5000).
If the -5000 <= D0 <= 5000, the output D1 is equal to 0.
–32768 S 3 D0
If the D0 > 5000, the output D1 is equal to D0 – (5000). –32768 –5000 5000 32767
S1 S2

For a 16-bit instruction, the available range of the S 3 and D are –32,768~+32,767.
For a 32-bit instruction, the available range of the S 3 and D are –2,147,483,648~+2,147,483,647.

345
FNC 1 2 M 3
D Z O N E P S1 S2 S3 D Zone Shift Control
258 ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
S3
D
S 1 <S 2

S1 S2 S3 D S1 : the negative bias value of the shift control


X0
ZONE K-5000 K5000 D0 D1 S2 : the positive bias value of the shift control
S3 : the input value of the zone shift control
D : the output value of the zone shift control

Output
D
Use the values of negative bias S 1 and positive bias
S 2 to create two shift control conversion curves as
shown in the right diagram. Through the curves, an
input value from the S 3 can get an adjusted output
value at the D .
S2 S3 + S2
If the S 3 < 0, the output D is equal to the amount of
S3 + S1 . 0
S1 S 3 =0= D
If the S 3 = 0, the output D is equal to 0.
S3 + S1
If the S 3 > 0, the output D is equal to the amount of
S3 + S2 .
S 3 Input
0

32767
When X0 = “ON”, the instruction and the input value
D0 use the two bias values and curves at the right S3 S2
diagram to generate a shifted result D1. (D0)+(5000)
S2
By the setting at the right diagram, the S 1 = – 5000 5000
and S 2 =5000: 0 S 3 =0= D
If the D0 < 0, the output D1 is equal to D0 + ( –5000). –5000
S1 (D0)+(–5000)
If the D0 = 0, the output D1 is equal to 0. S3 S1
If the D0 > 0, the output D1 is equal to D0 + (5000). –32768 S 3 D0
–32768 0 32767

For a 16-bit instruction, the available range of the S 3 and D are –32,768~+32,767.
For a 32-bit instruction, the available range of the S 3 and D are –2,147,483,648~+2,147,483,647.

346
FNC 1 2 M 3
D S C L P S1 S2 D Scaling (Coordinate by Point Data)
259 ○ ○ ○ ○
FNC 1 2 M 3
D S C L 2 P S1 S2 D Scaling 2 (Coordinate by X/Y Data)
269 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D

S1 S2 D S1 : the source device to store the input value of


X0 scaling (X coordinate)
SCL D0 D1000 D1
S2 : the head register ID of the conversion data table
is used
D : the device to store the result value of scaling
(Y coordinate)

When this SCL instruction is active, it will base on the specied input value at S 1 (X coordinate) and the
conversion data table started from the S 2 , then by the comparison and proportion to produce a result
(Y coordinate) afterwards stores that to the specied device D .

When X0 = “ON”, the content value at the source device D0 and the conversion data table (that is started from the
D1000) will be used to calculate the scaled result, then the result will be stored at the destination device D1.
For 16-bit SCL instruction: For 32-bit SCL instruction:
Y Conversion data table S 2 Conversion data table S 2
Point 4 Number of Number of
Coordinate S2 D1000 Coordinate S 2 +1, S 2
Point 3 Points Points
D1 D
X S 2 +1 D1001 X S 2 +3, S 2 +2
Point 1 Point 1
Y S 2 +2 D1002 Y S 2 +5, S 2 +4
Point 2 X S 2 +3 D1003 X S 2 +7, S 2 +6
Point 1
Point 2 Point 2
Y S 2 +4 D1004 Y S 2 +9, S 2 +8
X S 2 +5 D1005 X S 2 +11, S 2 +10
X Point 3 Point 3
D0 S 1 Y S 2 +6 D1006 Y S 2 +13, S 2 +12
Error Operation is enabled Error X S 2 +7 D1007 X S 2 +15, S 2 +14
(outside (outside Point 4 Point 4
the table) Y S 2 +8 D1008 Y S 2 +17, S 2 +16
the table)

It is an easy and effective solution for to transform the values between analog I/O and external physical quantity
(such as weight, length, temperature.... ).

If the result data (Y coordinate) is not an integer, round the number to the nearest integer.

If two or more points in the conversion data table are specied their X coordinate values to a same number,
moreover the content value of the source S 1 is just equal to this number, the result value at D will be the Y
coordinate value of the second point.

Any one of the following mistake may cause an operating error: (the Operation Error ag M9067 = “ON” and the
error code in D9067 = K9067 .)
1. At the conversion data table, those Xn are not edited by the ascending order. (do not let Xn > Xn+1)
2. When the input source value S 1 exceeds the range of the conversion data table.
3. When the difference between two adjacent points (Xn and Xn+1 or Yn and Yn+1) is more than “65,535”.

347
Application example: To transform the position from a linear potentiometer
Use the 1st. channel of a VS-4AD module to connect with a 500 mm stroke linear potentiometer for measuring the
position. This application in the machine just needs to use a part of the potentiometer (50 mm to 450 mm).
The request is to get a value which is between 0 to 4,000 (unit: 0.1 mm).
Input a stander 10 VDC to the 0 ~ 500 mm potentiometer, it should return a 0 ~ 10 V analog signal to the AIN1+
of VS-4AD then at its BFM#5 will have a value between 0 ~ 32,000. Since this application is only using the section
50 ~ 450 mm, at its BFM#5 will get 3,200 ~28,800.
The chart below is to show the conversion curve of this application.
Y
Conversion data table for SCL instruction
Item Register ID Content value
4000 Point 2
S2 Number of
D1000 2
Coordinate Points
S 2 +1 X D1001 3200
Point 1
S 2 +2 Y D1002 0
S 2 +3 X D1003 28800
Point 1 Point 2
0 X S 2 +4 Y D1004 4000
0 3200 28800
X axis represents analog input value.
Y axis represents the current position ( Unit : 0.1mm)

M9000
FROM K1 K5 D0 K1 To read the VS-4AD's analog value (BFM#5) and put it to the D0.
By the SCL instruction, to transform at the location of the potentiometer and
SCL D0 D1000 D1 put the position data into D1. (unit: 0.1 mm)

Functionally, both the SCL2 and SCL instructions are the same. The difference between these instructions are the
arrangement of data in the conversion table. The tables below are the way to organize the data tables of the SCL2
instruction. (if the total number of the points is 4)
For 16-bit SCL2 instruction For 32-bit SCL2 instruction
Number of Number of
Coordinate Points S2 S 2 +1, S 2
Coordinate Points
X1 S 2 +1 X1 S 2 +3, S 2 +2
X X2 S 2 +2 X X2 S 2 +5, S 2 +4
coordinate X3 S 2 +3 coordinate X3 S 2 +7, S 2 +6
X4 S 2 +4 X4 S 2 +9, S 2 +8
Y1 S 2 +5 Y1 S 2 +11, S 2 +10
Y Y2 S 2 +6 Y Y2 S 2 +13, S 2 +12
coordinate Y3 S 2 +7 coordinate Y3 S 2 +15, S 2 +14
Y4 S 2 +8 Y4 S 2 +17, S 2 +16

348
FNC Convert Decimal ASCII String to 1 2 M 3
DDABINP S D
260 BIN Number ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
For a 16-bit instruction, S occupies 3 components For a 32-bit instruction, S occupies 6 components

S D S : the head ID of the devices where the decimal


X0 ASCII string is stored
DABIN D0 D10
D : the converted BIN number result
This instruction uses a decimal format ASCII string number started from the S to perform the BIN number
conversion, then stores the result into the device D .

This instruction will use the following ASCII conversion table:


ASCII Cord 00H 20H 2DH 30H 31H 32H 33H 34H 35H 36H 37H 38H 39H
Sign & Number NULL SPACE – 0 1 2 3 4 5 6 7 8 9

When the X0 = “ON”, this 16-bit instruction converts the content of an ASCII code string at D0~D2, then stores the
result of a BIN number to the D10.
S D0 D0 D1 D1 D2 D2
Lower Upper Lower Upper Lower Upper
8 bits 8 bits 8 bits 8 bits 8 bits 8 bits
Sign code 10 4 10 3 10 2 10 1 10 0
2DH(–) 31H( 1) 32H( 2) 35H( 5) 38H( 8) 39H( 9)

D
D10 –12589

The lowest byte in the string is the sign code for the conversion. If the sign is 2DH, the number is negative;
otherwise, 20H means positive.
The remaining bytes are to store the data of a value. If the ASCII codes in this segment of value have the 20H, 00H
or 30H, that will be treated as 30H.
For a 16-bit instruction, the available range is –32,768~+32,767.

For a 32-bit instruction, the structure of the source string starting from the S is shown below.
(assume the S = D0)
S D0 D0 D1 D1 D2 D2 D3 D3 D4 D4 D5 D5
Lower Upper Lower Upper Lower Upper Lower Upper Lower Upper Lower Upper
8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits
Sign code 10 9 10 8 10 7 10 6 10 5 10 4 10 3 10 2 10 1 10 0 Ignore

For a 32-bit instruction, the available range is –2,147,483,648~+2,147,483,647. Therefore, with a sign code, that
will occupy 11 bytes.

If the source string S contains a code which is improper or the result is exceeded to the available range, the PLC
will regard that as an operational error.

349
FNC Convert BIN Number to Decimal 1 2 M 3
DBINDAP S D
261 ASCII String ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
For a 16-bit instruction, D occupies 4 components For a 32-bit instruction, D occupies 6 components

S D S : the source BIN number to be converted


X0
BINDA D10 D0 D : the head ID of the converted decimal ASCII string

This instruction uses a BIN number at the S to perform the conversion and the result is using a decimal format
ASCII string to explain the number, then stores the string into the devices started from D .

This instruction will use the following ASCII conversion table:


Sign & Number NULL SPACE – 0 1 2 3 4 5 6 7 8 9
ASCII Cord 00H 20H 2DH 30H 31H 32H 33H 34H 35H 36H 37H 38H 39H

When the X0 = “ON”, this 16-bit instruction converts the content of a BIN number in the D10, then stores the result
using an ASCII code string to D0~D3.
S
D10 –12589

D D0 D0 D1 D1 D2 D2 D3
Lower Upper Lower Upper Lower Upper
8 bits 8 bits 8 bits 8 bits 8 bits 8 bits
Sign code 10 4 10 3 10 2 10 1 10 0 End of string
2DH(–) 31H( 1) 32H( 2) 35H( 5) 38H( 8) 39H( 9) 0H or retain

If the D10 is positive, the sign code will fill in 20H; If the M9091 = “OFF”, will ll in 0000H.
else the D10 is negative, the sign code will fill in 2DH. If the M9091 = “ON”, will retain the
Assume the content value at the D10 is 125, the result is below: original data at D3.

D D0 D0 D1 D1 D2 D2 D3
Lower Upper Lower Upper Lower Upper
8 bits 8 bits 8 bits 8 bits 8 bits 8 bits
20H( ) 20H( ) 20H( ) 31H( 1) 32H( 2) 35H( 5) 0H
It is 1 2 5
positive. Empty, ll in 20H. Assume the M9091 = “OFF”.

For a 32-bit instruction, the structure of the result string starting from the D is shown below.
(assume the D = D0)
D D0 D0 D1 D1 D2 D2 D3 D3 D4 D4 D5 D5
Lower Upper Lower Upper Lower Upper Lower Upper Lower Upper Lower Upper
8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits 8 bits
Sign code 10 9 10 8 10 7 10 6 10 5 10 4 10 3 10 2 10 1 10 0 0H or 20H

For a 32-bit instruction, the available range is If the M9091 = “OFF”, will ll in 00H.
–2,147,483,648 ~ +2,147,483,647. If the M9091 = “ON”, will ll in 20H.
Therefore, with a sign code, that will occupy 11 bytes.

The related special device for this instruction:


Relay ID No. Description

Assign the BINDA operating mode.


16-bit instruction: When M9091= “OFF”, will add the end of string 0000H after the result.
M9091 When M9091=“ON”, will only convert the data without to add the end of string.
32-bit instruction: When M9091=“OFF”, will add the end of string 00H at the result's last upper 8 bits.
When M9091=“ON”, will add the end of string 20H at the result's last upper 8 bits.

350
FNC m n Software High Speed Counter Table 1 2 M 3
D H S C T S1 S2 D
280 Compare ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
m
S2
D
n
1≤m≤16 S 2 = C235~C255 When D is assigned to Y, only Y0~Y7 have instant response ability 1≤n≤16

S1 m S2 D n S1 : the head register ID of the comparison table


X20
DHSCT D0 K6 C235 Y4 K3 m : the number of data sets to be compared
S2 : the ID of the designated Software High Speed Counter
D : the head ID of output components for the comparison
results
n : the number of output components for the comparison
results

This instruction uses a comparison table which is headed by the S 1 and continuously occupies m × 3 registers,
then takes the present value of the S 2 designated Software High Speed Counter to compare to that table,
furthermore the comparison result presents through the D headed continuously n components. Both the
values comparison and result outputting at this instruction are operated by the interruption of system.
S 1 Comparison Table
D9162 600
500
Data Set to be Output
Compared Appointer Table Counter 400
300
(D1,D0) D2 200
0
K100 H05 Present Value of 100
(D4,D3) D5 C235
1
K200 H02 Y4
(D7,D6) D8
2 Y5
K300 H06
m Y6
(D10,D9) D11
3 5
K400 H03
4
(D13,D12) D14 3
4
K500 H04 Table Counter at 2
(D16,D15) D17 D9162 0 1
5
K600 H00 M9162

When X20 = “ON”, this instruction starts operation. The present value of C235 SHSC assigned by S 2 will
compare with the content value of the 1st data set (D1, D0) in the comparison table. If the input makes those
values equal, the content value of the 1st output appointer (D2) in the comparison table will be instantly output
through the Y4~Y6 (assigned by D and n ), also it increases the value in the table counter D9162 by 1
(become 1 from 0). After that, the present value of C235 will compare with the content value of the 2nd data set
(D4, D3) in the table. When the values are equal, the content value of the 2nd output appointer (D5) in the table will
be instantly output through the Y4~Y6, also it increases the value in the table counter D9162 by 1 (become 2 from
1). The comparison action is continuous, until the value of the last data set in the table is equal to the present
value of C235. That causes the operation completion ag M9162 for one Scan Time and the D9162 will be reset to
0, furthermore the comparison operation should start over again from the 1st data set.
When the X20 turns from “ON” to “OFF”, this instruction stops and the content value of D9162 will be reset to 0 but
the result status which has output previously will still remain.
This instruction is a 32-bit instruction. Therefore, be sure to input DHSCT in the program.
This instruction can only be used once in the program.
The related special devices are summarized below: ( ■ : Means read only.)
Relay ID No. Description
■ M9162 To indicate the completion of HSCT instruction.

Register ID No. Description


■ D9162 The number of count is activated at the table of HSCT instruction.

351
Program Example:

This example uses the C235, it will count the number of pulses from the input point X0. The program arranges
the C235 become an increasing cycle counter and limits its present value between 0 to 1000. During the
counting process, the DHSCT instruction generates output signals according to the contents in the comparison
table.
M9001
M9235 Set the C235 to be an increasing counter
M9000 K1000
C235 Activate the C235 to start counting

MOVP H05 K1Y4 Set the initial status of Y4~Y7

DHSCR K1000 C235 C235 Let the C235 to be a 0~1000 cycle counter

DHSCT D0 K6 C235 Y4 K4 The DHSCT table compare instruction

Comparison Table
D9162
Data Set to be Output
Compared Appointer Table Counter

( D1,D0) D2
0
K100 H1
( D3,D4) D5
1
K300 H6
( D6,D7) D8
2
K500 HA
( D10,D9) D11
3
K600 HC
( D13,D12) D14
4
K800 H8
( D16,D15) D17
5
K900 H5

1000
900
800
600
500
300
Present Value of 100
C235
Y4
Y5
Y6
Y7
5 5
4 4
3 3
Table Counter at 2 2
D9162 0 1 0 1 0

M9162

352
6-22 Positioning Control Instructions
The VS series PLCs are provided with 4 axes control function. Given that to use positing control function is more than
understanding positioning control instructions, more professional description is needed. Thus, this manual provides a
special chapter 8 “Statement of Positioning Control Functions” for detailed description about the function.
Hereby provides the table of positioning control instructions for reference.
FNC Applicable VS
Mnemonic in Ladder Diagram Function Description
No. 1 2 M 3

300 D Z R N S1 S2 D1 D2 Zero (Home Position) Return ○ ○ ○ ○

301 D J O G F S1 S2 D1 D2 Jog Forward ○ ○ ○ ○

302 D J O G R S1 S2 D1 D2 Jog Reverse ○ ○ ○ ○

303 D D R V R S1 S2 D1 D2 Drive to Relative Position ○ ○ ○ ○

304 D D R V A S1 S2 D1 D2 Drive to Absolute Position ○ ○ ○ ○

305 D D V 2 R S1 S2 D1 D2 Drive to Relative Position by 2 Stages ○ ○ ○ ○

306 D D V 2 A S1 S2 D1 D2 Drive to Absolute Position by 2 Stages ○ ○ ○ ○

307 D D V I T S1 S2 D1 D2 Interrupt Constant Quantity Positioning ○ ○ ○ ○

2 Stages Interrupt Constant Quantity


308 D D V 2 I S1 S2 D1 D2 Positioning
○ ○ ○ ○

Interrupt to Stop or Drive to Relative


309 D D V S R S1 S2 D1 D2 ○ ○ ○ ○
Position
Interrupt to Stop or Drive to Absolute
310 D D V S A S1 S2 D1 D2 ○ ○ ○ ○
Position

311 DPLSV S D1 D2 Variable Speed Pulse Output ○ ○ ○ ○

312 D T B L S1 S2 D1 D2 Data Table Positioning ○ ○ ○ ○

313 DABS S D1 D2 Absolute Current Value Read ○ ○ ○ ○

314 M P G S1 S2 D1 D2 Handwheel Positioning ○ ○ ○ ○

315 DLIR S D Relatively Linear Interpolation ○ ○ ○ ○

316 DLIA S D Absolutely Linear Interpolation ○ ○ ○ ○

353
354
7. Statement of Communication Functions
In the eld of industrial automatic control, communication between equipment has become an extremely important part.
The abilities to transmit data mutually, collaborate and communicate with each other to complete the control work
together are highly valued. PLCs are the most basic and most common control equipment in industrial automatic
control, and thus naturally it is also very important to enhance their communication capacity.
According to the different model of the VS series PLC, could have 3 to 6 communication ports.
Those are not only equipped to execute the programming, but also vertically uplink with the Human-Machine Interface
(HMI) or Supervisory Control And Data Acquisition system (SCADA) to construct a monitoring network; horizontally, it
can be connected to multiple VS PLCs to operate the distributed control. In addition, can be the master to connect with
peripheral equipments (such as thermostat, inverter, etc.). Therefore, these create a complete control system.
Compared to the company's previous products, the VS series PLC has made great progress in increasing the number
of communication ports, communication speeds, the exibility of application types and user-friendliness.
This chapter is specically for the VS series PLC communication function to provide a detailed description, and provides
useful help when users operate these communication functions.

7-1 Key Points of Communication Functions


7-1-1 Fundamental Object about the Communication Function
Communication Interface
The communication interface which can go with the VS series PLC is including the USB, RS-232 and RS-485.
USB interface ― the most popular interface used on computers. The VS PLC's main units are all equipped
with a built-in USB port to be the programming interface of the PLC and that with a speed rate up to 12 Mbps.
RS-232 interface ― often used in point-to-point short distance (within 15 meters) communication.
RS-485 interface ― often used for multi-points long distance communication. Since it provides with multi-points
data exchange capability and long distance communication performance; therefore, now is widely used in
industrial control eld.

Communication Parameters
To transfer data through communication interface, the settings such as “data bit length”, “parity”, “stop bit” and
“baud rate” must be configured first. These settings are collectively referred to as communication parameters
and can be regarded as communication protocols at the hardware level. The communication parameters must
be consistent for all communication devices in a system.

Communication Protocol
All the device which provided with communication function should have a communication protocol to support
data transmitting with other equipment.
The communication protocol is a protocol at the software level. Through the same communication protocol,
can reach the purpose of data exchange between different devices.
A communication protocol usually consists of starting character, station number, communication
command, data content, end character, check code, and so on. Of course, each device will dene the
appropriate communication protocol according to its communication needs. Meanwhile, some equipment will
follow the commonly used communication agreement on the market and the MODBUS is undoubtedly the most
common one.

Communication Principles
When two or more devices exchange data between each other, these devices must be linked together to form a
communication circuit. Moreover, this communication circuit needs to follow the basic principles below to start
working:
Have consistent communication interface.
Have consistent communication parameters.
Have consistent communication protocol.
The communication circuit must have a main leader, and only one at a time.

355
7-1-2 Notes for Constructing Communication Systems
Keep away from high noise sources as can as possible while wiring. In the distribution box, do not use the same
groove with the power wire. For the external environment, keep away from the equipment which produces
electromagnetic radiation.

Pay attention to the communication distance and select the appropriate communication interface. As the
specications of the RS-485 interface are much better than the RS-232, should use the RS-485 interface as far
as possible in industrial control systems. Even so, in the use of RS-485 interface, many things must be noted in
accordance with its specications.

Guidelines for the use of RS-485


A. The transfer wire need to use shielded twisted pair wire. Normal twisted pair wire can be used when
conducting short distance communication in low noise environment to cut down cost. But in high noise
environment, long distance communication or in occasions where high communication quality is required, the
dedicated transfer wire for RS-485 (like the Belden 9841) is recommended. It may make higher budget, but the
communication quality will be improved magnicently.

B. Make sure the principle of connect in sequence is followed when do hardware wiring. Do not use the T-type,
the radial distribution type or any other wiring method for the purpose of convenience.

Connect in sequence wiring T-type wiring Radial distribution wiring

C. Terminal resistances must be parallel connected to the two terminal devices of the whole communication circuit.
For the twisted pair wire used by RS-485 interface, the terminal resistances should choose 120 Ω 1/2 W resistors.
1 1
120Ω 2 W 120Ω 2 W

D+ D D+ D D+ D
Terminal device Terminal device

All of the VS series communication cards have built-in terminal resistances, user can be enabled the function
by short connect the TR terminals. For those communication devices which have no built-in terminal resistances,
take special note during wiring to ensure that the external terminal resistance is well connected.

D. Although the RS-485 is a two-wires-style interface, when the distance between 2 communication devices is too
long, communication often fails for the earth electric potential difference of the 2 devices is too big. Thus we
normally recommend using the shield layer of the transfer wire to connect the SG terminals of the 2 devices, so
that the earth electric potential difference can be reduced, and to achieve the purpose of normal communication.

Shielded Twisted Pair Wire

D+ D SG SG D D+

E. When the number of serial connections at the RS-485 circuit has exceeded a certain amount (depends on the
specication of the devices connected, usually 32), an RS-485 amplier has to be added to the circuit.

F. According to the standard specications of the RS-485 interface, the longest communication distance is 1200
meters. When the RS-485 communication circuit exceeds this distance, the RS-485 amplier must be added to
increase the communication distance.

It is possible that one communication circuit to connect with different devices at the same time, thus when the
communication fails, carefully inspect whether all wirings are correct and stable, furthermore check the
conguration values of each device are correct. On the other hand, usually a complicated structure is more
difcult to nd out the problem. Therefore, can separate a device to do individual checking before connecting it
with many other devices, that for to make sure every device can work well.

356
Misconception about communication speed.
The communication systems are built for various purposes and applications. Most people feel that faster
communication means better. In fact, this concept is not necessarily correct. The reason is that faster communication
speed relies on the higher communication quality to support, which also means that higher communication
construction costs may be required.
Therefore, the correct approach is to, in response to the needs, choose the appropriate communication speed,
consider moderate construction costs and pursue stable communication quality.

For the situations when the constructed system can communicate acceptably, but sometimes breaks or error occurs.
That results the unsmooth and delayed data transmission, there are several suggestions listed below:
A. Check whether the communication software is working properly, including whether the communication parameters
(such as the time-out period setting) are correct.
B. Reduce and improve on the interference from the surrounding environment. Specic practices include reducing
the carrier frequency of the inverter, setting appropriately the grounding system of inverters and a variety of power
equipment. Besides, can even add noise suppress devices to the power wire.
C. It is recommended to use RS-485 dedicated transmission cable if the general transmission line is currently used.
D. Rewire the communication cables that following the principle of keeping away from sources of interference.

Overall consideration for the communication quality:


When building a communication system, it is often necessary to connect a variety of devices with different brands
and which is the difcult part. Additionally, the impact of environmental factors makes it more complicated.
When constructing communication systems, users often ask questions such as how long can this communication
distance be, then how long will the communication distance be? Nothing is wrong to ask such questions, since only
the excellent communication quality can ensure smooth communication. However, there is no standard answer.
Too many factors impact the communication quality of a project, such as the quality of equipment, wiring quality, the
quality of the environment at the site, even software quality and so on.
The suggestions to improve the quality of communication are made as follows.
A. Equipment quality:
The isolated communication interface is denitely better than non-isolated communication interface. However, for
many cheap communication interface converters on the market, even their specications do not meet the
standard. They may work in a simple testing, but the communication quality is poor, so should avoid using them.
B. Wiring quality:
Each communication interface has its standard transmission cable. The user often uses inappropriate cables in
order to reduce costs. When the communication system begins to appear to be unstable, please replace the
standard transmission cable to enhance the communication quality.
C. The quality of the environment at the site:
When a high noise source at the work site affects the communication, this situation should be improved by
reducing noise interferences. If this cannot be changed, should consider changing the routes of wiring to keep
away from the noise source.
D. The quality of the software program:
The communication system is generally used as monitor of equipments. There are monitoring computer and
monitoring software at the monitoring center. There are possibilities for errors to occur during communication.
During the communication, there may have the possibility of error. Therefore, the ability of monitoring software
to handle errors is related to the stability of the entire system.
At the hardware part, the communication quality should be improved as much as possible to avoid communication
errors. When the occasional error occurs, the quality of the software can offer a correct treatment. Only
two-pronged approach can build a stable and reliable communication system.

357
7-2 Structure of Communication System
All the VS PLC main units are equipped with a built-in mini USB port to be the programming interface which is for
connecting and communicating with programming devices.
Also, all the VS PLC main units are also equipped with built-in the CP1 which is a RS-485 multi-functional
communication port, supporting various types of communication application and connecting various external peripheral
equipments to accomplish control objectives collaboratively.
If more communication ports are needed, can be achieved by installing communication expansion cards to expand the
number of communication ports. Moreover, all of the expanded communication ports are multi-functional and can be
applied to a variety of uses.
The VS Series PLC Main Unit not only has a built-in CP1 communication port, but also the EC1 Expansion Card Socket
is available to install a communication expansion card. Thus, by the EC1 socket, the VS1 could get the CP2; the VS2
and VSM could have the CP2 and CP3. Moreover, the VS3 can use its EC1 and EC3 to expand CP2~CP5. However, if
the CP5 at a VS3 PLC is required, its EC2 socket may install a VS-3AV-EC card or not to use; any DIO or SF Card at
EC2 will cause the CP5 at EC3 ineffective.
A communication port at CP card is not related to the working area of DIO expansion or SF card, to operate the port is
directly by the installed setting and program.

Item Model Name Main Specification

VS-485-EC RS-485 Comm. Expansion Card: One non-isolated RS-485 port with TX / RX indicators; dist. 50m Max.
VS-485A-EC RS-485 Comm. Expansion Card: One isolated RS-485 port with TX / RX indicators; dist. 1000m Max.
VS-D485-EC RS-485 Comm. Expansion Card: Dual non-isolated RS-485 ports with TX / RX indicators; dist. 50m Max.

Comm. VS-D485A-EC RS-485 Comm. Expansion Card: Dual isolated RS-485 ports with TX / RX indicators; dist. 1000m Max.
Expansion RS-232C Comm. Expansion Card: Dual non-isolated RS-232 ports with TX / RX indicators;
Card VS-D232-EC dist. 15m Max.; wiring by the RX / TX / SG terminals
RS-485 + RS-232C Comm. Expansion Card: One isolated RS-485 port (1000m) &
VS-D52A-EC one non-isolated RS-232C port (15m), both with TX / RX indicators and wiring by terminals
Ethernet + RS-485 Communication Expansion Card: One Ethernet port (with additional non-isolated
VS-ENET-EC RS-485, dist. 50m) & one non-isolated RS-485 port (dist. 50m), both with TX / RX indicators

358
D D SG TR TR D D SG TR TR D D SG TR TR D D SG TR TR

485 485A 485 485A


RS-485 RX TX RX TX RX TX RX TX RS-485
CP2 CP4

DC IN DC IN
24V 0V 24V 0V

D D SG TR TR D D SG TR TR D D SG TR TR D D SG TR TR
CH1 CH1 CH1 CH1

RS-485 D485 D485A D485 D485A


RS-485
CP2 CP4
CH1 CH1 CH1 CH1
RX TX RX TX RX TX RX TX

RX TX RX TX RX TX RX TX
CH2 CH2 CH2 CH2

RS-485 RS-485
CP3 CP5
CH2 DC IN CH2 CH2 DC IN CH2
D D SG TR TR 24V 0V D D TR D D SG TR TR 24V 0V D D TR

D D SG TR TR D D SG TR TR
CH1 CH1
RS-485 RS-485
CP2 D52A D52A CP4
CH1 CH1
RX TX RX TX

RX TX RX TX
CH2 CH2

RS-232 RS-232
CP3 CP5
DC IN CH2 DC IN CH2
24V 0V RX TX SG 24V 0V RX TX SG

RX TX SG RX TX SG
CH1 CH1
RS-232 RS-232
CP2 D232 D232 CP4
CH1 CH1
RX TX RX TX

RX TX RX TX
CH2 CH2

RS-232 RS-232
CP3 CP5
CH2 CH2
RX TX SG RX TX SG

S S X0 X1 X2 X3 X4 X5 X6 X7 X10 X11 X12 X13 X14 X15 X16 X17

CP1 Terminal INPUT X


RS-485
RUN VS3-32MR
STOP

X0 1 2 3 4 5 6 7

MC 10 11 12 13 14 15 16 17

PWR RUN ERR

Y0 1 2 3 4 5 6 7
10 11 12 13 14 15 16 17

Programming Port
(Mini USB) EC1 EC2 EC3
DC24V
INPUT OUTPUT Y
S23M-32D

C0 Y0 Y1 Y2 Y3 C1 Y4 Y5 Y6 Y7 C2 Y10 Y11 Y12 Y13 C3 Y14 Y15 Y16 Y17

359
The communication application types supported by the VS series PLC are briey introduced below:
The VS Computer Link Slave (hereby referred to as the VS Slave)
When the VS PLC’s communication port has been set to the application type of the “VS Computer Link Slave”, the
human-machine interface (HMI) or supervisory control and data acquisition system (SCADA) can access the
VS PLC’s data through the “VS Computer Link protocol” (hereby referred to as the VS Protocol).

HMI HMI
VS series VS series VS series
or or
PLC PLC PLC
SCADA SCADA

VS VS VS VS VS
protocol Slave protocol Slave Slave

RS- 232 RS- 485

The VS Computer Link Master (hereby referred to as the VS Master)


When the VS PLC’s communication port has been set to the application type of the
“VS Computer Link Master”, it cooperates with the LINK instruction and a LINK communication table to
operate communication procedures. This Master links and communicates with Slaves through the
“VS Computer Link protocol” (hereby referred to as the VS Protocol).

VS series VS series VS series VS series VS series


PLC PLC PLC PLC PLC

VS VS VS VS VS
Master Slave Master Slave Slave

RS- 232 RS- 485

The VB Computer Link Slave (hereby referred to as the VB Slave)


When the VS PLC’s communication port has been set to the application type of the
“VB Computer Link Slave”, the human-machine interface (HMI) or supervisory control and data
acquisition system (SCADA) can access the VS PLC’s data through the “VB Computer Link protocol”
(hereby referred to as the VB protocol).

HMI HMI
VS series VS series VS series
or or
PLC PLC PLC
SCADA SCADA

VB VB VB VB VB
protocol Slave protocol Slave Slave

RS- 232 RS- 485

The MODBUS Slave


When the VS PLC’s communication port has been set to the application type of the “MODBUS Slave”, the
human-machine interface (HMI) or supervisory control and data acquisition system (SCADA) can access the
VS PLC’s data through the “MODBUS protocol”.

HMI HMI
VS series VS series VS series
or or
PLC PLC PLC
SCADA SCADA

MODBUS MODBUS MODBUS MODBUS MODBUS


protocol Slave protocol Slave Slave

RS- 232 RS- 485

360
The MODBUS Master
When the VS PLC’s communication port has been set to the application type of the “MODBUS Master”, it cooperates
with the MBUS instruction and a MODBUS communication table to operate communication procedures. This Master
links and communicates with MODBUS Slaves (such as inverters, temperature controllers, power meters, etc.)
through the “MODBUS protocol”.

VS series Provided with VS series Provided with Provided with


PLC MODBUS PLC MODBUS MODBUS
protocol protocol protocol

Digital scale,
MODBUS MODBUS
Electric board, Temperature
Master Master Inverter
Barcode reader controller

RS- 232 RS- 485

The CPU Link


The VS Series PLC uses this application to share instant data between VS PLCs to serve the purpose of distributed
control.
When the communication ports of VS PLCs have been set the application for to share instant data between PLCs,
select one of the PLC to cooperate with the CPUL instruction and CPUL communication table, through its particular
protocol to share instant data.

VS series VS series VS series VS series VS series


PLC PLC PLC PLC PLC

CPU LINK CPU LINK CPU LINK CPU LINK CPU LINK
St. #1 St. #2 St. #1 St. #2 St. #n

RS- 232 RS- 485

The Non Protocol communication


When the VS PLC’s communication port has been set to the application type of the “Non Protocol”, the PLC does not
execute any specied communication protocol. All communication procedures are operated by the PLC's user
program. Then the RS instruction is used to receive and send out data in order to complete the communication
operation. This application type is often applied to communicate between PLC and peripheral, such as temperature
controllers, inverters and barcode readers.

A variety of peripheral equipment in the market


VS series PLC
RS- 232
Application type: RS- 485
Non Protocol

Edit the communication


program for
corresponding equipments
Temperature Barcode reader
Inverter controller

361
7-2-1 Main Unit Built-in Communication Port
Every VS PLC main unit is equipped with a built-in mini USB port, which is the programming interface with 12 Mbps
transmission rate and uses the “VS Computer Link Protocol”. User can follow the protocol to make a communications
procedure for to access the data in the VS PLC.
VIGOR provides the VSPC-200 noise suppression USB cable that is designed for industrial environment use, could
reduce the USB communication failed. Therefore, use a computer to do the programming can acquire stable and rapid
communication quality.
Furthermore, every VS PLC main unit is equipped with a built-in CP1 communication port, which is a non-isolated
RS-485 interface. Through the installed project (which includes the port’s parameter setting and appropriate program),
this communication port can choose one from a variety of communication functions.

A variety of peripheral equipment


VS series PLC
in the market

SCADA HMI Inverter Temperature


controller

RUN VS1-32MR
STOP
X0 1 2 3 4 5 6 7
10 11 12 13 14 15 16 17

MC 20 21 22 23

PWR RUN ERR

VSPC-200A Y0 1 2 3 4 5 6 7
10 11 12 13

USB

Ladder Master S DC24V


INPUT

The specication of CP1

Item Specification

Communication Interface RS-485


Isolation Method No isolation
Max. Communication Distance 50 M
Communication Method Half-duplex
Baud Rate By the setting of installed project (115,200 bps. Max.)
Wiring Method Fixed 5mm Screw-Clamp Terminal Block
Parameter Conguration By the installed project (via the "COM Port setting" page in the programming software)

362
7-2-2 VS-485-EC Communication Expansion Card
The VS-485-EC Communication Expansion Card offers one set of non-isolated RS-485 port. By way of the parameter
setting and well planned program at the VS Series PLC Main Unit, the port can perform one of various communication
functions.
Product Exterior
Fix Clip (upper)
25mm 15mm 30mm

Communication
Connecting Terminal
D D SG TR TR
Terminal Resistor
Connecting Terminal Expansion Card
Connector
Brief Model Name 485
Communication Status

64mm
RX TX
Indicator

Complete
Model Name VS-485-EC
VIGOR LOGO 1306-
Serial Number 0001
Manufacturer VIGOR

Fix Clip (lower)

Product Specification

Item Specification

Communication Interface RS-485


Isolation Method No isolation
Communication Indicator TX (transmitting) and RX (receiving)
Max. Communication Distance 50 M
Communication Method Half-duplex
Baud Rate By the setting of installed project (115,200 bps. Max.)
Power Consumption DC5V 50mA (from PLC Main Unit)
Wiring Method Fixed 5mm Screw-Clamp Terminal Block
Terminal Resistor 120Ω, enabled when two TR terminals are short-connected
Parameter Conguration By the installed project (via the "COM Port setting" page in the programming software)

363
7-2-3 VS-485A-EC Communication Expansion Card
The VS-485A-EC Communication Expansion Card offers one set of isolated RS-485 port. By way of the parameter
setting and well planned program at the VS Series PLC Main Unit, the port can perform one of various communication
functions.
Product Exterior
Fix Clip (upper)
25mm 15mm 30mm

Communication
Connecting Terminal
D D SG TR TR
Terminal Resistor
Connecting Terminal Expansion Card
Connector
Brief Model Name 485A
Communication Status

64mm
RX TX
Indicator

Complete
Model Name VS-485A-EC
VIGOR LOGO Serial Number 1306-
0001
Manufacturer VIGOR
DC IN
24V 0V
DC Input
Connecting Terminal

Fix Clip (lower)

Product Specification

Item Specification

Communication Interface RS-485


Isolation Method PLC internal circuit and external driving circuit are isolated by a magnetic coupler
Communication Indicator TX (transmitting) and RX (receiving)
Max. Communication Distance 1000 M
Communication Method Half-duplex
Baud Rate By the setting of installed project (115,200 bps. Max.)
Power Consumption DC24V 25mA from the DC input terminal
Wiring Method Fixed 5mm Screw-Clamp Terminal Block
Terminal Resistor 120Ω, enabled when two TR terminals are short-connected
Parameter Conguration By the installed project (via the "COM Port setting" page in the programming software)

364
7-2-4 VS-D485-EC Communication Expansion Card
The VS-D485-EC Communication Expansion Card offers two sets of non-isolated RS-485 port. By way of the
parameter setting and well planned program at the VS Series PLC Main Unit, each port can separately perform one of
various communication functions.
Product Exterior
Fix Clip (upper)
25mm 15mm 30mm

CH1 Communication
Connecting Terminal
D D SG TR TR
Terminal Resistor CH1
Connecting Terminal Expansion Card
Connector
Brief Model Name D485
CH1
CH1 Communication

64mm
RX TX
Status Indicator
CH2 Communication RX TX
Status Indicator CH2
Complete
Model Name VS-D485-EC
VIGOR LOGO 1306-
Serial Number 0001
Terminal Resistor Manufacturer VIGOR
Connecting Terminal CH2
D D SG TR TR
CH2 Communication
Connecting Terminal

Fix Clip (lower)

Product Specification

Specification
Item
CH1 CH2
Communication Interface RS-485 RS-485
Isolation Method No isolation No isolation
Communication Indicator TX (transmitting) and RX (receiving) TX (transmitting) and RX (receiving)
Max. Communication Distance 50 M 50 M
Communication Method Half-duplex Half-duplex
Baud Rate By the setting of installed project (115,200 bps. Max.)
Power Consumption DC5V 100mA (from PLC Main Unit)
Wiring Method Fixed 5mm Screw-Clamp Terminal Block Fixed 5mm Screw-Clamp Terminal Block
Terminal Resistor 120Ω, enabled when two TR terminals are short-connected
Parameter Conguration By the installed project (via the "COM Port setting" page in the programming software)

365
7-2-5 VS-D485A-EC Communication Expansion Card
The VS-D485A-EC Communication Expansion Card offers two sets of isolated RS-485 port. By way of the parameter
setting and well planned program at the VS Series PLC Main Unit, each port can separately perform one of various
communication functions.
Product Exterior
Fix Clip (upper)
25mm 15mm 30mm

CH1 Communication
Connecting Terminal
D D SG TR TR
Terminal Resistor CH1
Connecting Terminal Expansion Card
Connector
Brief Model Name D485A
CH1
CH1 Communication

64mm
RX TX
Status Indicator
CH2 Communication RX TX
Status Indicator CH2
Complete
Model Name VS-D485A-EC
VIGOR LOGO 1306-
Serial Number 0001
Manufacturer VIGOR
DC IN CH2
DC Input 24V 0V D D TR
Connecting Terminal
CH2 Communication
Connecting Terminal

Fix Clip (lower) Terminal Resistor


Connecting Terminal

Product Specification

Specification
Item
CH1 CH2
Communication Interface RS-485 RS-485
PLC internal circuit and external driving circuit are isolated by a magnetic coupler; no isolation
Isolation Method
between two channels
Communication Indicator TX (transmitting) and RX (receiving) TX (transmitting) and RX (receiving)
Max. Communication Distance 1000 M 1000 M
Communication Method Half-duplex Half-duplex
Baud Rate By the setting of installed project (115,200 bps. Max.)
Power Consumption DC 24 V 50m A from the DC input terminal
Wiring Method Fixed 5mm Screw-Clamp Terminal Block Fixed 5mm Screw-Clamp Terminal Block
120Ω, enabled when two TR terminals are 120Ω, enabled when the D- and TR terminals are
Terminal Resistor short-connected short-connected
Parameter Conguration By the installed project (via the "COM Port setting" page in the programming software)

366
7-2-6 VS-D232-EC Communication Expansion Card
The VS-D232-EC Communication Expansion Card offers two sets of non-isolated RS-232C port. By way of the
parameter setting and well planned program at the VS Series PLC Main Unit, each port can separately perform one of
various communication functions.
Product Exterior
Fix Clip (upper)
25mm 15mm 30mm

CH1 Communication
Connecting Terminal
RX TX SG
CH1
Expansion Card
Connector
Brief Model Name D232
CH1
CH1 Communication

64mm
RX TX
Status Indicator
CH2 Communication RX TX
Status Indicator CH2
Complete
Model Name VS-D232-EC
VIGOR LOGO 1306-
Serial Number 0001
Manufacturer VIGOR
CH2
RX TX SG
CH2 Communication
Connecting Terminal

Fix Clip (lower)

Product Specification

Specification
Item
CH1 CH2
Communication Interface RS-232C RS-232C
Isolation Method No isolation No isolation
Communication Indicator TX (transmitting) and RX (receiving) TX (transmitting) and RX (receiving)
Max. Communication 15 M 15 M
Communication Method Half-duplex Half-duplex
Baud Rate By the setting of installed project (115,200 bps. Max.)
Power Consumption DC5V 25mA (from PLC Main Unit)
Wiring Method Fixed 5mm Screw-Clamp Terminal Block Fixed 5mm Screw-Clamp Terminal Block
Parameter Conguration By the installed project (via the "COM Port setting" page in the programming software)

367
7-2-7 VS-D52A-EC Communication Expansion Card
The VS-D52A-EC Communication Expansion Card offers one isolated RS-485 port and one non-isolated RS-232C port.
By way of the parameter setting and well planned program at the VS Series PLC Main Unit, each port can separately
perform one of various communication functions.

Product Exterior
Fix Clip (upper)
25mm 15mm 30mm

CH1 Communication
Connecting Terminal
D D SG TR TR
Terminal Resistor CH1
Connecting Terminal Expansion Card
Connector
Brief Model Name D52A
CH1
CH1 Communication

64mm
RX TX
Status Indicator
CH2 Communication RX TX
Status Indicator CH2
Complete
Model Name VS-D52A-EC
VIGOR LOGO 1306-
Serial Number 0001
Manufacturer VIGOR
DC IN CH2
DC Input 24V 0V RX TX SG
Connecting Terminal
CH2 Communication
Connecting Terminal

Fix Clip (lower)

Product Specification

Specification
Item
CH1 CH2
Communication Interface RS-485 RS-232C

PLC internal circuit and external driving circuit are


Isolation Method isolated by a magnetic coupler; no isolation No isolation
between two channels

Communication Indicator TX (transmitting) and RX (receiving) TX (transmitting) and RX (receiving)


Max. Communication Distance 1000 M 15 M
Communication Method Half-duplex Half-duplex
Baud Rate By the setting of installed project (115,200 bps. Max.)
Power Consumption DC24V 50mA (from the DC input terminal) + DC5V 25mA (from PLC Main Unit)
Wiring Method Fixed 5mm Screw-Clamp Terminal Block Fixed 5mm Screw-Clamp Terminal Block
120Ω, enabled when two TR terminals are
Terminal Resistor short-connected —

Parameter Conguration By the installed project (via the "COM Port setting" page in the programming software)

368
7-2-8 VS-ENET-EC Communication Expansion Card
The VS-ENET-EC Communication Expansion Card is a dual port card. It offers one Ethernet port (with an additional
non-isolated RS-485 interface) and one non-isolated RS-485 port.
By way of the parameter setting and well planned program at the VS Series PLC Main Unit, each port can separately
perform one of various communication functions.

Product Exterior
Fix Clip (upper) 25mm 15mm 30mm

RJ-45 Ethernet Jack


ETHERNET

Expansion Card
Connector
Brief Model Name ENET
ON

64mm
Communication RX TX RX TX
Status Indicator CH1 CH2
Complete
Model Name VS-ENET-EC
VIGOR LOGO Serial Number 1807-
0001
RS-485 RS-485 Manufacturer VIGOR
CH1 CH2
D D SG D D
CH2 Communication
Connecting Terminal

Fix Clip (lower)

Product Specification

Item Specification about the Ethernet

Physical Transport Layer 10BASE-T / 100BASE-TX


Transport Protocol TCP (Client / Server) , UDP (Client / Server)
Application Protocol Transparent or conversion MODBUS TCP to MODBUS RTU
Connected Serial Port CH1
IP Address Allocation Automatic by DHCP server or Static (manual) allocation

Unique Identier The media access control address (MAC address) is used
Comm. Parameter Modify Use the specic conguration software
Status Indicator LINK (green, ON when physical link is established); Data (yellow, blink when data is transferring)
Interface Ethernet RJ-45 jack

Specification about Communication Ports


Item
CH1 CH2
Communication Interface RS-485 RS-485
Isolation Method No isolation No isolation
Communication Indicator TX (transmitting) and RX (receiving) TX (transmitting) and RX (receiving)
Max. Communication 50 M 50 M
Communication Method Half-duplex Half-duplex
Baud Rate By the setting of installed project (115,200 bps. Max.)
Power Consumption Ethernet DC5V 100mA + RS-485 ports DC5V 100mA (total is 200mA from PLC Main Unit)
Wiring Method Fixed 5mm Screw-Clamp Terminal Block Fixed 5mm Screw-Clamp Terminal Block
Parameter Conguration By the installed project (via the "COM Port setting" page in the programming software)

369
7-3 Communication Types
The VS Series PLCs have a complete selection of communication functions. They can be connected with a maximum
of ve communication ports CP1~CP5. Furthermore, each one is a multi-functional communication port and can be
applied separately to a variety of communication application types. Each communication operating type will be
introduced below.

7-3-1 Selections of Communication Types


Since the CP1~CP5 are multi-functional communication ports, the operation type of each port must be set precisely
before use.
The operation types of communication ports are specied from the Ladder Master S programming software. The setting
procedure is shown below:

Select “COM Port Setup” from the Navigation Pane of


the Project

A sheet as shown in the right diagram will appear,


select an application type according to the request

There are corresponding items for each application


type, which will guide user to set relevant parameters

After the settings of all communication ports are


completed, click the on the upper corner at the
setup window to nish and close it.

After the setup is completed, should run the


“Write Project to PLC” function. Then, the parametes
take effect on the PLC.

370
7-3-2 VS Computer Link Slave
When the VS PLC’s communication port has been set to the application type of the “VS Computer Link Slave”, the
human-machine interface (HMI) or supervisory control and data acquisition system (SCADA) can access the VS PLC’s
data through the “VS Compurter Link Protocol” (hereby referred to as VS Protocol).
A computer or HMI through the “VS Protocol” could communicate with the VS PLCs. The HMI or SCADA supplier base
on the “VS Protocol” to compile its driving programs, by way of that communicates with VS PLC’s to construct a
monitoring area network.

HMI HMI
VS series VS series VS series
or or
PLC PLC PLC
SCADA SCADA

VS VS VS VS VS
protocol Slave protocol Slave Slave

RS- 232 RS- 485

Item Specification

Communication Interface RS-232 RS-485


Communication Protocol VS Compurter Link Protocol (hereby referred to as VS Protocol)
Commection Method Half-duplex
Communication Paramete Bits-per-character: 8 bits; parity check: None; stop bit: 1 bit
Baud Rate Selectable: 300/600/1200/2400/4800/9600/19200/34800/57600/115200 bps.
Distance Up to 15 meters Non-isolated: 50 m.; Isolated: 1 km.

Max. 255 stations (For more than 32, add


No. of Slave Stations 1 Slave station only
repeater(s) in the circuit is required)

CP1: Main Unit built-in


CP2~CP5: VS-D232-EC CP2~CP5: VS-D485-EC, VS-D485A-EC
Linking Equipment
CP3, CP5: VS-D52A-EC(CH2) CP2, CP4: VS-485-EC, VS-485A-EC, VS-D52A-EC(CH1)
CP3, CP5: VS-ENET-EC(CH2)
Available Model VS Series PLC (including VS1, VS2, VSM and VS3)
Transferable Device All the X, Y, M, S, T, C, D, R are included

The VS PLC will respond to the communication requirement by any device (such as a computer, HMI,...) if that follows
the particular “VS Compurter Link Protocol” to give correct command. For the detail of the VS Protocol, please refer
to the section “7-4 VS Series PLC Communication Protocol” for details.

Usually, HMI or SCADA supplier base on the “VS Compurter Link Protocol” to compile driving program. Therefore, the
HMI or SCADA user just needs to select the correct communication type when planning the system, so that can
communicate with VS PLCs to construct a monitoring area network.

Some software or HMI may not be equipped with the driving program of the VS Series PLC. In this case, the
“MODBUD Slave” application type can be used to connect them. Please refer to the section “7-3-5 MODBUD Slave”
for details.

371
Application Example
In this example, a computer uses its USB port to connect with an USB to RS-485 converter to transfer the
communication signal to the RS-485 interface. Then, the RS-485 is connected to two VS series PLC’s CP1 those
station numbers are assigned to #1 and #2. After that, executes the Ladder Master S programming software on the
computer to connect with the station #1 and station #2 PLCs for to read the project, control STOP/RUN and
monitor those PLCs.
Converter VS PLC Station #1 VS PLC Station #2
USB VS Computer Link Slave VS Computer Link Slave
USB RS-485 Baud Rate: 19200 bps Baud Rate: 19200 bps
Station No.: #1 Station No.: #2
RS-485 CP1 CP1
Ladder Master S

Please follow the procedures below to operate the test:


① Edit the project of PLC Station #1
Use the Ladder Master S to set the CP1's parameters of PLC Station #1 and compile relevant program. Then,
connect to the USB programming port of Station #1 and write the project into the PLC Station #1.

Set the application type: Set the baud rate: Set the station No.:
VS Computer Link Slave 19200 bps Station #1

※ Usually the default delay response time is not necessary to change, except that:
When the communication mistake is caused by the signal collision in the circuit, try to extend the delay response
time.
The program writes to the PLC By the USB programming port, the project is written into the PLC
Station #1. Station #1
M9013 K1000
C0
RUN VS1-32MR
STOP
X0 1 2 3 4 5 6 7
10 11 12 13 14 15 16 17

MC 20 21 22 23

PWR RUN ERR

Y0 1 2 3 4 5 6 7
10 11 12 13

USB
VSPC-200A DC24V
INPUT

Ladder Master S PLC Station #1

372
② Edit the project of PLC Station #2
Use the Ladder Master S to set the CP1's parameters of PLC Station #2 and compile relevant program. Then,
connect to the USB programming port of Station #2 and write the project into the PLC Station #2.

The program writes to the PLC Station #2.


M9013 K2000
C100

By the USB programming port, the project is written into the PLC
Station #2

RUN VS1-32MR
STOP
X0 1 2 3 4 5 6 7
10 11 12 13 14 15 16 17

MC 20 21 22 23

PWR RUN ERR

Y0 1 2 3 4 5 6 7
10 11 12 13

USB
VSPC-200A DC24V
INPUT

Ladder Master S PLC Station #2


Set the station No.:
Station #2

③ After complete to edit and load the projects to those two PLCs sequentially, do the wiring jobs between the
computer, RS-485 converter and two PLCs’ CP1.

④ Usually the application of the SCADA software is to monitor equipments through the communication network. In
this example, the Ladder Master S replaces the SCADA software to execute the monitoring work. However, the
Ladder Master S can only be connected to a single PLC at a time. Therefore, it is necessary to link and test with
different PLC stations one by one.
In the real applications, when a communication system is nished the wiring but which cannot function normally,
may use the Ladder Master S to test each station one by one to ensure the correctness of communication network.
To set the connection method of the Ladder Master S:

373
To set the connection method To set the connection device To set the baud rate

This example is using the USB to In this example, the given port is
RS-485 converter, thus the “USB” COM4 after the USB to RS-485
is selected. For using the converter is applied.
Set the baud rate as same as all
computer’s own communication
PLCs’ in the network circuit, that is
port, select the “COM Port”.
19200 bps in this example.

⑤ To test the connected PLC Station #1.

On the screen, it shows the program of the PLC


To read the PLC’s project
Station #1 as written in the procedure ① .

The ladder diagram on the screen by the monitor


To monitor the PLC mode to display status.

The present value of C0 in the program increases


To let the PLC RUN with a frequency of 1 per second.
Set the connecting station No.
to the #1.

⑥ To test the connected PLC Station #2.

On the screen, it shows the program of the PLC


To read the PLC’s project
Station #2 as written in the procedure ② .

The ladder diagram on the screen by the monitor


To monitor the PLC mode to display status.

The present value of C100 in the program


To let the PLC RUN increases with a frequency of 1 per second.
Set the connecting station No.
to the #2.

374
7-3-3 VS Computer Link Master
When the VS PLC’s communication port has been set to the application type of the “VS Computer Link Master”, it
should cooperate with the LINK instruction and a LINK communication table to operate communication procedures.
This Master PLC links and communicates with Slaves through the “VS Computer Link protocol” (hereby referred to as
the VS Protocol).
It is available to connect with several VS PLCs by the RS-485 interface.
Select one of these linked PLCs and set its application type as the “VS Computer Link Master” (this application type).
This PLC is referred to as the Master station and the other PLCs are the Slaves. Therefore, all the Slave PLCs should
set the application type as the “VS Computer Link Slave”. The only one Master station of the connected PLCs should
cooperate with the LINK instruction (FNC 89) and a LINK communication table to designate its data transferring
between the Slave and Master.
Through this, the Master can sequential read and store data for all the Slave PLC stations on the net, therefore reaches
the purpose of data transmission.
This application type is suitable for sharing a large amount of data between PLCs.

VS series VS series VS series VS series VS series


PLC PLC PLC PLC PLC

VS VS VS VS VS
Master Slave Master Slave Slave

RS-232 RS-485

Item Specification

Communication Interface RS-232 RS-485


Communication Protocol VS Compurter Link Protocol (hereby referred to as VS Protocol)
Commection Method Half-duplex
Communication Paramete Bits-per-character: 8 bits; parity check: None; stop bit: 1 bit
Baud Rate Selectable: 300/600/1200/2400/4800/9600/19200/34800/57600/115200 bps.
Distance Up to 15 meters Non-isolated: 50 m.; Isolated: 1 km.
Max. 256 stations (For more than 32, add
No. of Slave Stations 1 Slave station only
repeater(s) in the circuit is required)

CP1: Main Unit built-in


CP2~CP5: VS-D232-EC CP2~CP5: VS-D485-EC, VS-D485A-EC
Linking Equipment
CP3, CP5: VS-D52A-EC(CH2) CP2, CP4: VS-485-EC, VS-485A-EC, VS-D52A-EC(CH1)
CP3, CP5: VS-ENET-EC(CH2)

Available Model VS Series PLC (including VS1, VS2, VSM and VS3)
Transferable Device All the X, Y, M, S, T, C, D, R are included

375
FNC n
1 2 M 3
L I N K S1 S2 Easy Link Communication Instruction
89 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1 Using a Table Code Q0~Q31 (V, Z index modiable) or a Table Nickname (by user-dened 16 English characters)
S2
n
For the VS1 series, n = 1~2; for the VS2 or VSM series, n = 1~3; for the VS3 series, n = 1~5

S1 S2 n S1 : the communication table that describes the data


X20 receiving and transmitting
LINK CP1_DATA_TRANS D100 K1
S2 : the working area for the instruction that occupies
4 registers
n : to designate the communication port, 1~5=CP1~CP5

The VS Series PLC uses this instruction to transmit or get the designated data via its Communication Port CP1~
CP5 with other VS PLCs.
The CP1~CP5 are multi-functional communication ports. Each port can choose an appropriate communication
type from its various functions. When this instruction is using a port, should choose the “Application type:”
become the “VS Computer Link Master”. Regarding the application type selection and related parameter setting,
please specify it from the programming software Ladder Master S and at the “Project” -- “COM Port Setting”.
This instruction could be used to transfer for various devices that is including all the Y, M, S, T, C, D and R (except
for special M and special D).
As shown in the gure below, select one of these linked PLCs as the Master station and the rest as the Slave
stations. First, use the Ladder Master S to orderly open every Slave PLC's project and set its “Application type:” as
the “VS Computer Link Slave” then to set an unique station No. (ranging from 0~254). After that, connect to the
programming port of every PLC to load the project to each Slave PLC.
Next, write this instruction in the Master PLC's program and set its “Application type:” as the “VS Computer Link
Master”, then edit the LINK communication table to designate data transferring actions. After that, to load this
project to the Master PLC. Following these procedures, the purpose of data delivery between the PLCs can be
reached.

VS series VS series VS series VS series VS series


PLC PLC PLC PLC PLC

VS LINK VS LINK VS LINK VS LINK VS LINK


Master Slave Master Slave Slave

RS- 232 RS- 485

When X20=“ON”, the LINK instruction starts execution. According to the contents described in the
“CP1_DATA_TRANS” communication table, it proceeds data write or read actions to the appointed Slave PLC
stations, while the D100~D103 will be occupied to store the state of instruction execution.
When the contents of the communication table specied by the S 1 are execution completed from beginning to end,
the M9104 will be “ON” for a scan time then the procedure will start over again from the rst item set of the table.
When the X20 turns from “ON” to “OFF”, this instruction stops and the data sharing immediately stop but data
which has transferred previously will still remain.
The related special devices are summarized below: ( ■ : Means read only.)
Relay ID No. Description

M9103 CP1 RS / LINK / MBUS instruction on communication abnormal ag.


■ M9104 CP1 LINK / MBUS instruction on execution table complete once ag.
M9113 CP2 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9114 CP2 LINK / MBUS instruction on execution table complete once ag.
M9123 CP3 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9124 CP3 LINK / MBUS instruction on execution table complete once ag.
M9133 CP4 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9134 CP4 LINK / MBUS instruction on execution table complete once ag.
M9143 CP5 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9144 CP5 LINK / MBUS instruction on execution table complete once ag.

376
The communication table is assigned by the S 1 of the instruction.
An example of the “LINK” provided by programming tool the Ladder Master S is shown below.

Item Command Device at Direction Slave St. Device at Length Word / Bit Disable
No. Master No. Slave Contact
1 Read D0 1 D0 10 M1
2 Write D10 1 D10 5 M1
3 Read D20 2 D0 10 M2
4 Write D30 2 D10 5
5 Write D40 255 D40 20 M0

The rst item set in the table means that the Master reads the data D0~D9 from the Slave #1 and stores them at
the D0~D9 of the Master.
The second item set in the table means that the Master writes its data at D10~D14 to the D10~D14 of the Slave #1.
The third item set in the table means that the Master reads the data D0~D9 from the Slave #2 and stores them at
the D20~D29 of the Master.
The fourth item set in the table means that the Master writes its data at D30~D34 to the D10~D14 of the Slave #2.
The fth item set in the table means that the Master writes its data at D40~D59 to all the D40~D59 of the Slaves.
To set the Slave station #255 means that the Master writes the data to all of the Slaves. Note that Read Command
cannot be used in this application.
The last column of the table is for the Disable Contact. If that specied contact is “ON”, the communication item
set will be ignored. For example, if M1 = “ON”, the rst and second item sets in the table will skip. This is the new
function of the VS series, which can help designers effectively manage the operation of the communication table.
A communication item set does not need to specify a Disabled Contact (such as the fourth item set), so that the
command of the set does not have the disable control function.

The working area of the executive instruction is starting from the S 2 (using D100~D103 as the example).

S2 Description

Lower 8 bits The record of the Slave's station number when the rst communication error is occurred
Instruction working status
0: Normal data transmitting / receiving
D100 4: The error is caused by the assigned device is inappropriate
Upper 8 bits 7: The error is caused by the communication command is incorrect
A: The communication setting is normal but no response from the Slave station
(Time-out occurs)
B: Abnormal communication
D101

The working area is required for the system when this instruction is performed
D103

The LINK instruction will reset the D100 to be 0 before the rst item set at the table is executed.
If any communication error occurs during the execution of the instruction, a code will be recorded in D100. Only when
the content value of D100 is 0, the recording action can be executed. Therefor, when there are possibilities of several
errors, users can use the program to move out the content value of D100 then reset it to 0. This way allows the D100
to record the next error.

To edit a communication table


Use the Ladder Master S to set up a LINK communication table and through its interactive window can set up and
edit a communication table easily.
In the structure of VS Series PLC, the communication tables are a part of the project. When the programmer to copy
or access the project, those tables will be duplicated automatically with the program.

377
Application Example
In this example, those CP1s of three VS PLCs are connected by the RS-485 interface and execute the VS Computer
Link.
In the following gure, let the rst one from the left be the Master station of VS Computer Link to execute the
“VS Computer Link Master” application type and set the baud rate to be 19200 bps. Add the LINK instruction in the
program and then edit the LINK communication table, thereby to process data transmitting from or to the
VS Computer Link Slaves.
Another two are the VS Computer Link Slave PLCs, those are executing the “VS Computer Link Slave” application
type. The baud rate of those connected ports should be the same as the port of the Master PLC. Then, individually
set the station numbers of Slaves become the #1 and #2. Afterward, write the relevant control programs into the
PLCs.
Master VS PLC Slave VS PLC #1 Slave VS PLC #2
VS Computer Link Master VS Computer Link Slave VS Computer Link Slave
Baud Rate: 19200 bps Baud Rate: 19200 bps Baud Rate: 19200 bps
Station No.: #1 Station No.: #2

CP1 CP1 CP1


RS- 485 RS- 485

Please follow the procedures below to operate the test:


① Edit the project of Slave PLC #1
Use the Ladder Master S to set the CP1's parameters of Slave PLC #1 and compile relevant program. Then,
connect to the USB programming port of Slave #1 and write the project into the PLC.

暫放
Set the application type: Set the baud rate: Set the station No.:
VS Computer Link Slave 19200 bps Station #1

※ Usually the default delay response time is not necessary to change, except that:
When the communication mistake is caused by the signal collision in the circuit, try to extend the delay response
time.
The program writes to the Slave By the USB programming port, the project is written into the Slave
PLC #1. PLC #1
M9000
MOV D0 K2Y0
RUN VS1-32MR
STOP
X0 1 2 3 4 5 6 7

ADD D0 K100 D1 MC
10 11 12 13 14 15 16 17
20 21 22 23

PWR RUN ERR

Y0 1 2 3 4 5 6 7
10 11 12 13

USB
VSPC-200A DC24V
INPUT

Ladder Master S
Slave PLC #1

378
② Edit the project of Slave PLC #2
Use the Ladder Master S to set the CP1's parameters of Slave PLC #2 and compile relevant program. Then,
connect to the USB programming port of Slave #2 and write the project into the PLC.

The program writes to the Slave PLC #2


M9000
Send the content value of D0 to the
MOV D0 K2Y0 output points Y0~Y7.
Add 100 to the content value of D0
ADD D0 K100 D1
and store it to the D1.

By the USB programming port, the project is written into the Slave
PLC #2

RUN VS1-32MR
STOP
X0 1 2 3 4 5 6 7
10 11 12 13 14 15 16 17

MC 20 21 22 23

PWR RUN ERR

Y0 1 2 3 4 5 6 7
10 11 12 13

USB
VSPC-200A
Set the station No.: DC24V
INPUT

Station #2
Ladder Master S Slave PLC #2

③ Edit the project of the Master PLC


Use the Ladder Master S to set the CP1's parameters of Master PLC. Compile the LINK communication table, the
LINK instruction and relevant program. Then, connect to the USB programming port of Master and write the
project into the PLC.

Set the application type: Set the baud rate:


VS Computer Link Master 19200 bps

※ Usually the default delay response time is not necessary to change, except that:
When the communication mistake is caused by the signal collision in the circuit, try to extend the delay response
time.

379
Open a new LINK communication table at the Master PLC.

Name this LINK communication table as “LINK_TEST” first, and then compile its contents.

Edit the program for the Master PLC.


M9000
The LINK instruction bases on the contents of the “LINK_TEST” table to
LINK LINK_TEST D100 K1 operate communication.

By the USB programming port, the project is written into the Master PLC.

RUN VS1-32MR
STOP
X0 1 2 3 4 5 6 7
10 11 12 13 14 15 16 17

MC 20 21 22 23

PWR RUN ERR

Y0 1 2 3 4 5 6 7
10 11 12 13

USB
VSPC-200A DC24V
INPUT

Ladder Master S Master PLC

380
④ After sequentially edit and load the projects to those PLCs, do the wiring jobs between three PLCs. Then, connect
the computer to the USB programming port of the Master PLC, to test and monitor the process through the
Ladder Master S.
⑤ Read the project from the Master PLC then execute the monitor mode, at the screen to add and monitor the
components D0, D1, D10 and D11.

When the example is performing, the data at every PLC will follow its own program and the “LINK_TEST”
communication table to execute the operation below.
1. The content value of Master's D0 is written into the D0 at the Slave PLC #1 via communication (the rst
command in the communication table). At the Slave #1, the content value of D0 is sent to its output points
Y0~Y7.
Therefore, when the value of Master's D0 is 1, the Y0 at the Slave #1 turns “ON”; when the value of Master’s D0
is 5, the Y0 and Y2 at the Slave #1 turn “ON”, and so forth.
At the PLC Slave #1, its content value of D0 will be added 100 up and stored to the D1.
Afterward, the PLC Master reads the value of D1 at the Slave #1 via the communication and stores the value to
the Master's D10 (the second command in the communication table).
Thus, to observe the value of D10 at the Master that is always equal to the content value of D0 added up to 100
if the communication is successful.
2. The content value of Master's D1 is written into the D0 at the Slave PLC #2 via communication (the third
command in the communication table). At the Slave #2, the content value of D0 is sent to its output points
Y0~Y7. Therefore, when the value of Master's D1 is 1, the Y0 at the Slave #2 turns “ON”; when the value of
Master's D1 is 7, the Y0, Y1 and Y2 at the Slave #1 turn “ON”, and so forth.
At the PLC Slave #2, its content value of D0 will be added 100 up and stored to the D1.
Afterward, the PLC Master reads the value of D1 at the Slave #1 via the communication and stores the value to
the Master's D11 (the fourth command in the communication table).
Thus, to observe the value of D11 at the Master that is always equal to the content value of D1 added up to 100
if the communication is successful.

By the VS Computer Link communication, the LINK instruction and its table at the Master PLC that produces the
following results:
1.The content value of the Master's D0 is output to the points Y0~Y7 of the Slave #1.
2.The content value of the Master's D10 equals to the sum of the content value of its D0 and 100.
3.The content value of the Master's D1 is output to the points Y0~Y7 of the Slave #2.
4.The content value of the Master's D11 equals to the sum of the content value of its D1 and 100.

381
7-3-4 VB Computer Link Slave
When the VS PLC’s communication port has been set to the application type of the “VS Computer Link Slave”, the
human-machine interface (HMI) or supervisory control and data acquisition system (SCADA) can access the VS PLC’s
data through the “M, VB and VH series Communication Protocol” (hereby referred to as VB protocol).
This application type is mainly applied to the following situations:
1. When the old versions of HMI or SCADA can only support the “M, VB and VH Protocol” but not support the
“VS Computer Link Protocol”.
2. When the existed “VB Protocol” network is added with a new VS series PLC, the added VS PLC must work under this
application type.
When the VS PLC works under this application type, the components can be accessed are limited to the previously VB
series PLC can support. (The components which the VS PLC can be used are more then the VB series have.)

HMI HMI
VS series VS series VS series
or or
PLC PLC PLC
SCADA SCADA

VB VB VB VB VB
protocol Slave protocol Slave Slave

RS- 232 RS- 485

Item Specification

Communication Interface RS-232 RS-485


Communication Protocol M, VB and VH series Communication Protocol (hereby referred to as VB protocol)
Commection Method Half-duplex
Communication Paramete Bits-per-character: 7 bits; parity check: Even; stop bit: 1 bit
Baud Rate Selectable: 300/600/1200/2400/4800/9600/19200/34800/57600/115200 bps.
Distance Up to 15 meters Non-isolated: 50 m.; Isolated: 1 km.
Max. 256 stations (For more than 32, add
No. of Slave Stations 1 Slave station only
repeater(s) in the circuit is required)

CP1: Main Unit built-in


CP2~CP5: VS-D232-EC CP2~CP5: VS-D485-EC, VS-D485A-EC
Linking Equipment
CP3, CP5: VS-D52A-EC(CH2) CP2, CP4: VS-485-EC, VS-485A-EC, VS-D52A-EC(CH1)
CP3, CP5: VS-ENET-EC(CH2)

Available Model VS Series PLC (including VS1, VS2, VSM and VS3)
Transferable Device All the X, Y, M, S, T, C and D are included

Set the application type: Set the baud rate Set the station No.
VB Computer Link Slave

※ Usually the default delay response time is not necessary to change, except that:
When the suspect of bad communication is caused by the problem of signal collision in the circuit, try to extend
the delay response time.

382
7-3-5 MODBUS Slave
MODBUS is a very popular communication protocol on the market. Various common industrial products such as the
human-machine interface (HMI) or the supervisory control and data acquisition system (SCADA) all support the
“MODBUS protocol”. Nonetheless, if the selected HMI or SCADA does not support the “VS Protocol”, use the
“MODBUS protocol” to connect it with the VS Series PLC’s.

HMI HMI
VS series VS series VS series
or or
PLC PLC PLC
SCADA SCADA

MODBUS MODBUS MODBUS MODBUS MODBUS


protocol Slave protocol Slave Slave

RS- 232 RS- 485

Item Specification

Communication Interface RS-232 RS-485


Communication Protocol MODBUS Protocol
Commection Method Half-duplex
Format: ASCII or RTU; bits-per-character: 7 bits / 8 bits;
Communication Paramete parity check: None / Even / Odd; stop bit: 1 bit / 2 bits

Baud Rate Selectable: 300/600/1200/2400/4800/9600/19200/34800/57600/115200 bps.


Distance Up to 15 meters Non-isolated: 50 m.; Isolated: 1 km.
Max. 247 stations (For more than 32, add
No. of Slave Stations 1 Slave station only
repeater(s) in the circuit is required)

CP1: Main Unit built-in


CP2~CP5: VS-D232-EC CP2~CP5: VS-D485-EC, VS-D485A-EC
Linking Equipment
CP3, CP5: VS-D52A-EC(CH2) CP2, CP4: VS-485-EC, VS-485A-EC, VS-D52A-EC(CH1)
CP3, CP5: VS-ENET-EC(CH2)

Available Model VS Series PLC (including VS1, VS2, VSM and VS3)
Transferable Device All the X, Y, M, S, T, C, D, R are included

Set the application type: Set the corresponding parameters The MODBUS Mapping can be
MODBUS Slave in the sheet expanded to get the VS PLC’s
components

※ Usually the default delay response time is not necessary to change, except that:
When the communication mistake is caused by the signal collision in the circuit, try to extend the delay response
time.

383
7-3-6 MODBUS Master
Many automation devices and equipment (e.g. inverters, temperature controllers) support the “MODBUS protocol”.
Hence, the VS PLC provides the MBUS instruction and MBUS communication table, that cooperatively produces the
MODBUS commands to access devices which possess the MODBUS communication function, to serve the purpose of
exchanging data between the PLC and these devices.
When the VS PLC’s communication port has been set to the application type of the “MODBUS Master”, it cooperates
with the MBUS instruction and a MODBUS communication table to operate communication procedures. This Master
links and communicates with MODBUS Slaves (such as inverters, temperature controllers, power meters, etc.) through
the “MODBUS protocol”.

VS series Provided with VS series Provided with Provided with


PLC MODBUS PLC MODBUS MODBUS
protocol protocol protocol

Digital scale,
MODBUS MODBUS
Electric board, Temperature
Master Master Inverter
Barcode reader controller

RS- 232 RS- 485

Item Specification

Communication Interface RS-232 RS-485


Communication Protocol MODBUS Protocol
Commection Method Half-duplex
Format: ASCII or RTU; bits-per-character: 7 bits / 8 bits;
Communication Paramete parity check: None / Even / Odd; stop bit: 1 bit / 2 bits

Baud Rate Selectable: 300/600/1200/2400/4800/9600/19200/34800/57600/115200 bps.


Distance Up to 15 meters Non-isolated: 50 m.; Isolated: 1 km.
Max. 247 stations (For more than 32, add
No. of Slave Stations 1 Slave station only
repeater(s) in the circuit is required)

CP1: Main Unit built-in


CP2~CP5: VS-D232-EC CP2~CP5: VS-D485-EC, VS-D485A-EC
Linking Equipment
CP3, CP5: VS-D52A-EC(CH2) CP2, CP4: VS-485-EC, VS-485A-EC, VS-D52A-EC(CH1)
CP3, CP5: VS-ENET-EC(CH2)

Available Model VS Series PLC (including VS1, VS2, VSM and VS3)
Transferable Device All the X, Y, M, S, T, C, D, R are included

384
FNC n
1 2 M 3
M B U S S1 S2 MODBUS Communication Instruction
149 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1 Using a Table Code Q0~Q31 (V, Z index modiable) or a Table Nickname (by user-dened 16 English characters)
S2
n
S2 occupies 4 components For the VS1 series, n = 1~2; for the VS2 or VSM series, n= 1~3; for the VS3 series, n= 1~5

S1 S2 n S1 : the communication table that describes the data


X20 receiving and transmitting
MBUS ACCESS_MBS_EQUIP D100 K1
S2 : the working area for the instruction that occupies
4 registers
n : to designate the communication port, 1~5 =
CP1~CP5

The VS Series PLC uses this instruction to transmit or get the designated data via its Communication Port
CP1~CP5 with other peripherals which use the MODBUS ASCII or RTU protocol.
The CP1~CP5 are multi-functional communication ports. Each port can choose an appropriate communication
type from its various functions. When this instruction is using a port, should choose the “Application type:” become
the “MODBUS Master”. Regarding the application type selection and related parameter setting, please specify it
from the programming software Ladder Master S and at the “Project” -- “COM Port Setting”.
As shown in the gure below, connect the PLC with other device(s) by the RS-232 or RS-485 wiring. Furthermore,
to set a unique station number (1~247) for every device and make the other parameters identical. Besides, use the
Ladder Master S to open the project of the VS series PLC and write this MBUS instruction in the Master PLC's
program, then set the port's “Application type:” as the “MODBUS Master” also to set the communication parameters
in that window. After that, edit the MODBUS communication table to designate data transferring actions. Moreover,
to load this project to the Master PLC. Following these procedures, the purpose of data delivery between the PLC
and peripherals can be reached.

A device with A device with A device with


VS series MODBUS VS series MODBUS MODBUS
PLC protocol PLC protocol protocol

Digital scale / Temperature


MODBUS MODBUS Inverter
Display board / controller
Master Master
Barcode reader

RS- 232 RS- 485

When X20 = “ON”, the MBUS instruction starts execution. According to the contents described in the
“ACCESS_MBS_EQUIP” communication table, it proceeds data write or read actions to the appointed peripherals,
while the D100~D103 will be occupied to store the state of instruction execution.
When the contents of the communication table specied by the S 1 are execution completed from beginning to end,
the M9104 will be “ON” for a Scan Time then the procedure will start over again from the rst item set of the table.
When the X20 turns from “ON” to “OFF”, this instruction stops and the data sharing immediately stop but data
which has transferred previously will still remain.
The related special devices are summarized below: ( ■ : Means read only.)

Relay ID No. Description

M9103 CP1 RS / LINK / MBUS instruction on communication abnormal ag.


■ M9104 CP1 LINK / MBUS instruction on execution table complete once ag.
M9113 CP2 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9114 CP2 LINK / MBUS instruction on execution table complete once ag.
M9123 CP3 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9124 CP3 LINK / MBUS instruction on execution table complete once ag.
M9133 CP4 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9134 CP4 LINK / MBUS instruction on execution table complete once ag.
M9143 CP5 RS / LINK / MBUS instruction on communication abnormal ag.
■ M9144 CP5 LINK / MBUS instruction on execution table complete once ag.

385
The communication table is assigned by the S 1 of the instruction.
An example of the “MBUS” provided by programming tool the Ladder Master S is shown below.

Item No. Command Device at Master Direction Slave St. Device at Slave Length Word/Bit Disable
No. Contact
1 H03 Read (4x) D0 1 1000 10 M1
2 H10 Write (4x) D10 1 1100 5 M1
3 H03 Read (4x) D20 2 1000 10 M2
4 H10 Write (4x) D30 2 1100 5
5 H10 Write (4x) D40 0 100 20 M0
The rst item set in the table means that the Master reads the data 1000~1009 from the Slave #1 and stores
them at the D0~D9 of the Master.
The second item set in the table means that the Master writes its data at D10~D14 to the 1100~1104 of the
Slave #1.
The third item set in the table means that the Master reads the data 1000~1009 from the Slave #2 and stores
them at the D20~D29 of the Master.
The fourth item set in the table means that the Master writes its data at D30~D34 to the 1100~1104 of the
Slave #2.
The fth item set in the table means that the Master writes its data at D40~D59 to all the 100~109 of the Slaves.
To set the Slave station #0 means that the Master writes the data to all of the Slaves. Note that Read Command
cannot be used in this application.
The last column of the table is for the Disable Contact. If that specied contact is “ON”, the communication item
set will be ignored. For example, if M1 = “ON”, the rst and second item sets in the table will skip. This is the
new function of the VS series, which can help designers effectively manage the operation of the communication
table. A communication item set does not need to specify a Disabled Contact (such as the fourth item set), so
that the command of the set does not have the disable control function.

The working area of the executive instruction is starting from the S 2 (using D100~D103 as the example).

S2 Description

Lower 8 bits The record of the Slave's station number when the first communication error is occurred

Instruction working status


0: Normal data transmitting / receiving
2: The length of the received data is incorrect
D100
Upper 8 bits 4: The error is caused by the assigned device is inappropriate
7: The error is caused by the communication command is incorrect
A: The communication setting is normal but no response from the Slave station
(Time-out occurs)
B: Abnormal communication

D101

The working area is required for the system when this instruction is performed
D103

The MBUS instruction will reset the D100 to be “0” before the rst item set at the table is executed.
If any communication error occurs during the execution of the instruction, a code will be recorded in D100.
Only when the content value of D100 is “0”, the recording action can be executed. Therefor, when there are
possibilities of several errors, users can use the program to move out the content value of D100 then reset it to “0”.
This way allows the D100 to record the next error.

To edit a communication table


Use the Ladder Master S to set up a MBUS communication table and through its interactive window can set up and
edit a communication table easily.
In the structure of VS Series PLC, the communication tables are a part of the project. When the programmer to copy
or access the project, those tables will be duplicated automatically with the program.

386
Application Example
In this example, those CP1s of three VS PLCs are connected by the RS-485 interface and execute the MODBUS
communication.
In the following gure, let the rst one from the left be the Master station of MODBUS communication to execute the
“MODBUS Master” application type and set the baud rate to be 19200 bps. Add the MBUS instruction in the
program and then edit the MBUS communication table, thereby to process data transmitting from or to the MODBUS
Slaves.
Another two are the MODBUS Slave PLCs, executing the “MODBUS Slave” application type. The baud rate of those
connected ports should be the same as the port of the Master PLC. Then, individually set the station numbers of
Slaves become the #1 and #2. Afterward, write the relevant control programs into the PLCs.

Master VS PLC Slave VS PLC #1 Slave VS PLC #2


MODBUS Master MODBUS Slave MODBUS Slave
Baud Rate: 19200 bps Baud Rate: 19200 bps Baud Rate: 19200 bps
Station No.: #1 Station No.: #2

CP1 CP1 CP1

Please follow the procedures below to operate the test:

① Edit the project of Slave PLC #1


Use the Ladder Master S to set the CP1's parameters of Slave PLC #1 and compile relevant program. Then,
connect to the USB programming port of Slave #1 and write the project into the PLC.

Set the application type: Set the baud rate and Set the station No.:
MODBUS Slave relevant parameters Station #1

※ Usually the default delay response time is not necessary to change, except that:
When the communication mistake is caused by the signal collision in the circuit, try to extend the delay response
time.
The program writes to the Slave By the USB programming port, the project is written into the Slave
PLC #1. PLC #1
M9000
MOV D0 K2Y0
RUN VS1-32MR
STOP
X0 1 2 3 4 5 6 7

ADD D0 K100 D1 MC
10 11 12 13 14 15 16 17
20 21 22 23

PWR RUN ERR

Y0 1 2 3 4 5 6 7
10 11 12 13

USB
VSPC-200A DC24V
INPUT

Ladder Master S Slave PLC #1

387
② Edit the project of Slave PLC #2
Use the Ladder Master S to set the CP1's parameters of Slave PLC #2 and compile relevant program. Then,
connect to the USB programming port of Slave #2 and write the project into the PLC.

The program writes to the Slave PLC #2


M9000 Send the content value of D0 to the
MOV D0 K2Y0 output points Y0~Y7.

ADD D0 K100 D1 Add 100 to the content value of D0


and store it to the D1.

By the USB programming port, the project is written into the Slave
PLC #2

RUN VS1-32MR
STOP
X0 1 2 3 4 5 6 7
10 11 12 13 14 15 16 17

MC 20 21 22 23

PWR RUN ERR

Y0 1 2 3 4 5 6 7
10 11 12 13

USB
Set the station No.: VSPC-200A DC24V
INPUT

Station #2
Ladder Master S Slave PLC #2

③ Edit the project of the Master PLC


Use the Ladder Master S to set the CP1's parameters of Master PLC. Compile the MBUS communication table, the
MBUS instruction and relevant program. Then, connect to the USB programming port of Master and write the
project into the PLC.

Set the application type: Set the baud rate and


MODBUS Master relevant parameters

※ Usually the default delay response time is not necessary to change, except that:
When the communication mistake is caused by the signal collision in the circuit, try to extend the delay response
time.

388
Open a new MBUS communication table at the Master PLC

Name this MBUS communication table as “MBUS_TEST” first, and then compile its contents.

Edit the program for the Master PLC.


M9000
The MBUS instruction bases on the contents of the “MBUS_TEST”
MBUS MBUS_TEST D100 K1 table to operate communication.

By the USB programming port, the project is written into the Master PLC.

RUN VS1-32MR
STOP
X0 1 2 3 4 5 6 7
10 11 12 13 14 15 16 17

MC 20 21 22 23

PWR RUN ERR

Y0 1 2 3 4 5 6 7
10 11 12 13

USB
VSPC-200A DC24V
INPUT

Ladder Master S Master PLC

389
④ After sequentially edit and load the projects to those PLCs, do the wiring jobs between three PLCs. Then, connect
the computer to the USB programming port of the Master PLC, to test and monitor the process through the
Ladder Master S.
⑤ Read the project from the Master PLC then execute the monitor mode, at the screen to add and monitor the
components D0, D1, D10 and D11.

When the example is performing, the data at every PLC will follow its own program and the communication table to
execute the operation below.
1. The content value of Master's D0 is written into the 40000 at the Slave PLC #1 via communication (the rst
command in the communication table that 40000 is corresponding to the D0).
At the Slave #1, the content value of D0 is sent to its output points Y0~Y7. Therefore, when the value of
Master’s D0 is 1, the Y0 at the Slave #1 turns “ON”; when the value of Master's D0 is 5, the Y0 and Y2 at the
Slave #1 turn “ON”, and so forth.
At the PLC Slave #1, its content value of D0 will be added 100 up and stored to the D1.
Afterward, the PLC Master reads the value of 40001 at the Slave #1 via the communication and stores the value
to the Master's D10 (the second command in the communication table that 40001 is corresponding to the D1).
Thus, to observe the value of D10 at the Master that is always equal to the content value of D0 added up to 100
if the communication is successful.
2. The content value of Master’s D1 is written into the 40000 at the Slave PLC #2 via communication (the third
command in the communication table that 40000 is corresponding to the D0). At the Slave #2, the content
value of D0 is sent to its output points Y0~Y7. Therefore, when the value of Master's D1 is 1, the Y0 at the Slave
#2 turns “ON”; when the value of Master's D1 is 7, the Y0, Y1 and Y2 at the Slave #1 turn “ON”, and so forth.
At the PLC Slave #2, its content value of D0 will be added 100 up and stored to the D1.
Afterward, the PLC Master reads the value of D1 at the Slave #1 via the communication and stores the value to
the Master's D11 (the fourth command in the communication table that 40001 is corresponding to the D1).
Thus, to observe the value of D11 at the Master that is always equal to the content value of D1 added up to 100
if the communication is successful.

By the MODBUS communication, the MBUS instruction and its table at the Master PLC that produces the following
results:
1.The content value of the Master's D0 is output to the points Y0~Y7 of the Slave #1.
2.The content value of the Master's D10 equals to the sum of the content value of its D0 and 100.
3.The content value of the Master's D1 is output to the points Y0~Y7 of the Slave #2.
4.The content value of the Master's D11 equals to the sum of the content value of its D1 and 100.

390
7-3-7 CPU Link
The VS Series PLC uses this application to share instant data between VS PLCs to serve the purpose of distributed
control.
When the communication ports of VS PLCs have been set the application for to share instant data between PLC’s,
select one of the PLC to cooperate with the CPUL instruction and CPUL communication table, through its particular
protocol to share instant data.

VS series VS series VS series VS series VS series


PLC PLC PLC PLC PLC

CPU LINK CPU LINK CPU LINK CPU LINK CPU LINK
St. #1 St. #2 St. #1 St. #2 St. #n

RS- 232 RS- 485

Item Specification

Communication Interface RS-232 RS-485


Communication Protocol CPU Link particular protocol
Commection Method Half-duplex
Baud Rate Selectable: 300/600/1200/2400/4800/9600/19200/34800/57600/115200 bps.
Distance Up to 15 meters Non-isolated: 50 m.; Isolated: 1 km.

Max. 255 stations (For more than 32, add


No. of Slave Stations 1 Slave station only
repeater(s) in the circuit is required)

CP1: Main Unit built-in


CP2~CP5: VS-D232-EC CP2~CP5: VS-D485-EC, VS-D485A-EC
Linking Equipment
CP3, CP5: VS-D52A-EC(CH2) CP2, CP4: VS-485-EC, VS-485A-EC, VS-D52A-EC(CH1)
CP3, CP5: VS-ENET-EC(CH2)

Available Model VS Series PLC (including VS1, VS2, VSM and VS3)
Transferable Device All the X, Y, M, S, T, C, D, R are included

The most of the VS Series PLC communication application types are replying at the particular time that is when the
PLC is nished its user program cycle. Thus, the spending time of entire communication does not only depend on
the baud rate, but also affected by the PLC’s Scan Time. Therefore, it is not easy to calculate the communication
turnaround time.
The CPU Link proceeds the communication by the way of immediate interrupt and thus its communication response
is the fastest. Also, the communication turnaround time (TAT) can be calculated. Therefore, it is suitable for a
distributed control system which needs to be quickly responded.
The calculation of the communication turnaround time (TAT) is introduced below:
The communication turnaround time is the total time to complete all the item sets in the communication table
(excluding disabled item set).
The calculation of the time for each communication item set is introduced below:
(11 + The number of data bytes to be transmitted) × 11
+20µs
Baud rate ( bps)

Example: The communication baud rate is Device Range Word/Bit Disable Contact
Item No. Station No.
38,400 bps. As the communication
table at the right shows, there are 1 0 D0 – D9 M1
three item sets. Then the
2 1 M0 – M7 M1
communication turnaround time
(TAT) is calculated as follows: 3 2 D10 M2

( 11 +( 10×2 ) ) × 11
The spending time of the rst item set is: +20µs=8.88ms+20µs=8.9ms
38400

( 11 +( 1 ) ) × 11
The spending time of the second item set is: +20µs=3.44ms+20µs=3.46ms
38400

( 11 +( 1×2 ) ) × 11
The spending time of the third item set is: +20µs=3.72ms+20µs=3.74ms
38400
The communication turnaround time (TAT) is the total time taken when the rst, second and third communication item
sets are completed.
= 8.9ms + 3.46ms + 3.74ms=16.1ms

391
FNC n
1 2 M 3
C P U L S1 S2 CPU Link Communication Instruction
87 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1 Using a Table Code Q0~Q31 (V, Z index modiable) or a Table Nickname (by user-dened 16 English characters)
S2
n
S2 occupies 4 components For the VS1 series, n1=1~2; for the VS2 or VSM series, n1=1~3; for the VS3 series, n1=1~5

S1 S2 n S1 : the communication table that describes the data


X20 receiving and transmitting
CPUL DISTRIBUTED_CTRL D100 K1
S2 : the working area for the instruction that occupies
4 registers
n : to designate the communication port, 1~5 =
CP1~CP5

The VS Series PLC uses this instruction to share the particular data via its Communication Port CP1~CP5 with
other VS PLCs, that achieved the purpose of distributed control.

The main character of the CPU LINK is to share instant data.


What we call “Instant” means all the communication work is dealt with instantly without being affected by the PLC
scan time. Other communication method, such as Easy LINK, MODBUS communication and Non Protocol
communication, will follow the PLC's executive cycle and thus is affected by the PLC scan time.
What we call “share” means the way of the CPU LINK communication work is that each station in the
communication network automatically transfers a part of data orderly to other stations in the network. This way the
operation of the whole communication network can be understood through each station in the communication
network.
Through the function of CPU LINK that instantly sharing data with other PLCs, a distributed control system can be
established.

The CP1~CP5 are multi-functional communication ports. Each port can choose an appropriate communication
type from its various functions. When this instruction is using a port, should choose the “Application type:” become
the “CPU Link”. Regarding the application type selection and related parameter setting, please specify it from the
programming software Ladder Master S and at the “Project” -- “COM Port Setting”.

This instruction could be used to transfer for various devices that is including all the Y, M, S, T, C, D and R (except
for special M and special D).

As shown in the gure below, rst use the Ladder Master S to orderly open every PLC's project and set its
“Application type:”as the “CPU Link” then to set an unique station No. (ranging from 0~254) hereafter connect to
the programming port of every PLC to load the project to each PLC.
Afterward, write this instruction in one of the PLC's program then edit the CPUL communication table to designate
data sharing actions, hereafter to load this project to the specic PLC. Following these procedures, the purpose of
sharing instant data between the PLCs is reached.

VS series VS series VS series VS series VS series


PLC PLC PLC PLC PLC

CPU LINK CPU LINK CPU LINK CPU LINK CPU LINK
St. #1 St. #2 St. #1 St. #2 St. #n

RS- 232 RS- 485

When X20 = “ON”, the CPUL instruction starts execution. According to the contents described in the
“DISTRIBUTED_CTRL” communication table, it will arrange sharing particular data between stations, while the
D100~D103 will be occupied to store the state of instruction execution.

When the contents of the communication table specied by the S 1 are execution completed from beginning to
end, it will start over again from the rst item set of the table.

When the X20 turns from “ON” to “OFF”, this instruction stops and the data sharing immediately stop but data
which has transferred previously will still remain.

392
The communication table is assigned by the S 1 of the instruction.
An example of the “CPU Link” provided by programming tool the Ladder Master S is shown below.

Item No. Station No. Device Range Word/Bit Disable Contact


1 0 D0 – D9 M1
2 1 D10 – D19 M1
3 2 D20 – D29 M2
4 3 D30 – D39
※ When the device is selected to be the bit device (Y, M, S or the contact of T, C), the initially ID number at the
device range must be a multiplier of 8, such as Y0, Y10, Y20, M0, M24 or T8. Also, the length must be a
multiplier of 8 as well, such as M0~M23 (24 devices), T8~T15 (8 devices), Y10~Y27 (16 devices), M24~M63
(40 devices).
The rst item set in the table means that Station #0 transmits its D0~D9 to the D0~D9 of other stations in the
communication network.
The second item set in the table means that Station #1 transmits its D10~D19 to the D10~D19 of other stations in
the communication network.
The third item set in the table means that Station #2 transmits its D20~D29 to the D20~D29 of other stations in the
communication network.
The fourth item set in the table means that Station #3 transmits its D30~D39 to the D30~D39 of other stations in
the communication network.
The last column of the table is for the Disable Contact. If that specied contact is “ON”, the communication item
set will be ignored. For example, if M1 = “ON”, the rst and second item sets in the table will skip. This is the new
function of the VS series, which can help designers effectively manage the operation of the communication table.
A communication item set does not need to specify a Disabled Contact (such as the fourth item set), so that the
command of the set does not have the disable control function.

The working area of the executive instruction is starting from the S 2 (using D100~D103 as the example).

S2 Description
Lower 8 bits The record of the station number when the rst communication error is occurred

Instruction working status


D100 0: Normal data transmitting / receiving
Upper 8 bits
A: The communication setting is normal but no response from the Slave station (Time-out occurs)
B: Abnormal communication

D101
The working area is required for the system when this instruction is performed

D103

If any communication error occurs during the execution of the instruction, a code will be recorded in D100. Only
when the content value of D100 is 0, the recording action can be executed.
Therefor, when there are possibilities of several errors, users can use the program to move out the content value of
D100 then reset it to 0. This way allows the D100 to record the next error.

To edit a communication table


Use the Ladder Master S to set up a CPUL communication table and through its interactive window can set up and
edit a communication table easily.
In the structure of VS Series PLC, the communication tables are a part of the project. When the programmer to copy
or access the project, those tables will be duplicated automatically with the program.

393
Application Example
In this example, those CP1’s of three VS PLC’s are connected by the RS-485 interface and execute the CPU Link
communication.
In the following gure, let the rst one from the left be the station #0 of the CPU Link communication to execute the
“CPU Link” application type and set the baud rate to be 38400 bps. Add the CPUL instruction in the program and
then edit the CPUL communication table, thereby to process data sharing between the all CPU Link PLC’s.
Another two are also the CPU Link PLC’s, executing the “CPU Link” application type. The baud rate of those
connected ports should be the same as the port of the Station #0. Then, individually set the station numbers of
those become the #1 and #2. Afterward, write the relevant control programs into the PLC’s.
VS PLC #0 VS PLC #1 VS PLC #2
CPU Link CPU Link CPU Link
Baud Rate: 38400 bps Baud Rate: 38400 bps Baud Rate: 38400 bps
Station No.: #0 Station No.: #1 Station No.: #2
CP1 CP1 CP1

Please follow the procedures below to operate the test:

① Edit the project of VS PLC #0


Use the Ladder Master S to set the CP1's parameters of VS PLC #0, edit the communication table and compile
relevant program. Then, connect to the USB programming port of VS PLC #0 and write the project into the PLC.

Set the application type: Set the baud rate: Set the station No.:
CPU Link 38400 bps. Station #0

394
Open a new CPUL communication table at the VS PLC #0

Name this CPUL communication table as the “CPUL_TEST” rst, and then compile its contents.

Edit the program for the VS PLC #0.


M9000
The CPUL instruction bases on the contents of the “CPUL_TEST” table
CPUL CPUL_TEST D100 K1 to operate communication.
M9000
MOV K4X0 D0 Send the status of X0~X17 to the D0.

MOV D20 K4Y0 Send the content value of D20 to the output points Y0~Y17.

By the USB programming port, the project is written into the VS PLC #0.

RUN VS1-32MR
STOP
X0 1 2 3 4 5 6 7
10 11 12 13 14 15 16 17

MC 20 21 22 23

PWR RUN ERR

Y0 1 2 3 4 5 6 7
10 11 12 13

USB
VSPC-200A DC24V
INPUT

Ladder Master S VS PLC #0

395
② Edit the project of VS PLC #1
Use the Ladder Master S to set the CP1's parameters of VS PLC #1 and compile relevant program. Then, connect
to the USB programming port of VS PLC #1 and write the project into the PLC.

The program writes to the VS PLC #1.


M9000
Send the status of X0~X17
MOV K4X0 D10
to the D10.
MOV D0 K4Y0 Send the content value of D0 to the
output points Y0~Y17.

By the USB programming port, the project is written into the


VS PLC #1

RUN VS1-32MR
STOP
X0 1 2 3 4 5 6 7
10 11 12 13 14 15 16 17

MC 20 21 22 23

PWR RUN ERR

Y0 1 2 3 4 5 6 7
10 11 12 13

USB
VSPC-200A
Set the station No.:
DC24V
INPUT

Station #1
Ladder Master S VS PLC #1

③ Edit the project of VS PLC #2


Use the Ladder Master S to set the CP1's parameters of VS PLC #2 and compile relevant program. Then, connect
to the USB programming port of VS PLC #2 and write the project into the PLC.

The program writes to the VS PLC #2.


M9000 Send the status of X0~X17
MOV K4X0 D20 to the D20.

MOV D10 K4Y0 Send the content value of D10 to the


output points Y0~Y17.

By the USB programming port, the project is written into the


VS PLC #2

RUN VS1-32MR
STOP
X0 1 2 3 4 5 6 7
10 11 12 13 14 15 16 17

MC 20 21 22 23

PWR RUN ERR

Y0 1 2 3 4 5 6 7
10 11 12 13

USB
VSPC-200A
Set the station No.:
DC24V
INPUT

Station #2
Ladder Master S VS PLC #2

④ After sequentially edit and load the projects to those PLC’s, do the wiring jobs between three PLC’s. Then, trigger
the inputs and monitor the response at the other PLC’s.

⑤ When the example is performing, the data at every PLC will follow its own program and the communication table to
execute the operation below.
VS PLC #0: its statuses X0~X17 send to the D0, and the content value of D20 sends to the output points Y0~Y17.
VS PLC #1: its statuses X0~X17 send to the D10, and the content value of D0 sends to the output points Y0~Y17.
VS PLC #2: its statuses X0~X17 send to the D20, and the content value of D10 sends to the output points Y0~Y17.

By the CPU Link communication, the CPUL instruction and its table at the VS PLC #0 that produces the following
results:
The statuses X0~X17 of the VS PLC #0 is reected to the points Y0~Y17 of the VS PLC #1. The statuses X0~X17 of
the VS PLC #1 is reected to the points Y0~Y17 of the VS PLC #2. The statuses X0~X17 of the VS PLC #2 is
reected to the points Y0~Y17 of the VS PLC #0.

396
7-3-8 Non Protocol
When the VS PLC’s communication port has been set to the application type of the “Non Protocol”, the PLC does not
execute any specied communication protocol. All communication procedures are operated by the PLC’s user
program. Then the RS instruction is used to receive and send out data in order to complete the communication
operation. This application type is often applied to communicate between PLC and peripheral, such as temperature
controllers, inverters and barcode readers.

A variety of peripheral equipment in the market


VS series PLC
RS- 232
Application type: RS- 485
Non Protocol

Edit the communication


program for
corresponding equipments
Temperature Barcode reader
Inverter controller

Item Specification

Communication Interface RS-232 RS-485


Communication Protocol VS Compurter Link Protocol (hereby referred to as VS Protocol)
Commection Method Half-duplex
Communication Paramete Bits-per-character: 8 bits; parity check: None; stop bit: 1 bit
Baud Rate Selectable: 300/600/1200/2400/4800/9600/19200/34800/57600/115200 bps.
Up to 15 meters Non-isolated: 50 m.; Isolated: 1 km.
Distance

CP1: Main Unit built-in


CP2~CP5: VS-D232-EC CP2~CP5: VS-D485-EC, VS-D485A-EC
Linking Equipment
CP3, CP5: VS-D52A-EC(CH2) CP2, CP4: VS-485-EC, VS-485A-EC, VS-D52A-EC(CH1)
CP3, CP5: VS-ENET-EC(CH2)

Available Model VS Series PLC (including VS1, VS2, VSM and VS3)
Transferable Device All the X, Y, M, S, T, C, D, R are included

397
FNC m n n1 Receive/Send Communication 1 2 M 3
RS S D
80 Instruction ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
m
D
n
n1
m, n = 0~4096 For the VS1 series, n1=1~2; for the VS2 or VSM series, n1 = 1~3; for the VS3 series, n1 = 1~5

S m D n n1 S : the head register ID number for the data to be sent


X20
RS D0 D200 D100 D201 K1 m : the length of the data to be sent
D : the head register ID number for the receiving data
n : the length of the data want to receive
n1 : to appoint the communication port, 1~5 = CP1~CP5

The VS Series PLC uses this instruction to send out or receive the data via its Communication Port CP1~CP5, and
that is by the serial communication interface to communicate with external peripheral equipment.

As many peripheral equipments in the market (e.g. inverters, barcode readers, card readers, electronic displays,
etc.) are equipped with serial communications interfaces and have their own protocols. In order to transfer data
between the PLC and those peripherals, a PLC user need to write the program with communicable function
therefor this RS instruction is to adapt with these communication protocols.

The CP1~CP5 are multi-functional communication ports. Each port can choose an appropriate communication
type from its various functions. When this instruction is using a port, should choose the “Application type:” become
the “Non Protocol”. Regarding the application type selection and related parameter setting, please specify it from
the programming software Ladder Master S and at the “Project” -- “COM Port Setting”.

As shown in the gure below, use the Ladder Master S to set the communication port's “Application type:” of the
VS Series PLC as the “Non Protocol” and at the same page to set other relevant parameters. Set the station No.
and related parameters for each peripheral. Next, in the VS Series PLC, according to the communication protocol
of the peripheral equipments, compile the program with relevant communication.

A variety of peripheral equipment in the market


VS Series PLC
RS- 232
RS- 485
Application type: Non Protocol

Edit the communication


program for corresponding
equipments
Inverter Temperature Controller Barcode Reader

Designate m to be K0 when there is not need to send out data and designate n to be K0 when there is not
need to receive data.

The data transmissions can be divided into the 16-bit mode (M9161 = “OFF”) or 8-bit mode (M9161 = “ON”)
when the RS instruction is performed. Also, the mode ag M9161 should be set before the RS instruction is started.

398
The related special devices are summarized below: ( ■ : Means read only.)
Relay ID No. Description

M9100 CP1 RS instruction data sending out request ag.


M9101 CP1 RS instruction data receive completed ag.
M9102 CP1 RS instruction data receive time-out ag.
M9103 CP1 RS / LINK / MBUS instruction on communication abnormal ag.
M9110 CP2 RS instruction data sending out request ag.
M9111 CP2 RS instruction data receive completed ag.
M9112 CP2 RS instruction data receive time-out ag.
M9113 CP2 RS / LINK / MBUS instruction on communication abnormal ag.
M9120 CP3 RS instruction data sending out request ag.
M9121 CP3 RS instruction data receive completed ag.
M9122 CP3 RS instruction data receive time-out ag.
M9123 CP3 RS / LINK / MBUS instruction on communication abnormal ag.
M9130 CP4 RS instruction data sending out request ag.
M9131 CP4 RS instruction data receive completed ag.
M9132 CP4 RS instruction data receive time-out ag.
M9133 CP4 RS / LINK / MBUS instruction on communication abnormal ag.
M9140 CP5 RS instruction data sending out request ag.
M9141 CP5 RS instruction data receive completed ag.
M9142 CP5 RS instruction data receive time-out ag.
M9143 CP5 RS / LINK / MBUS instruction on communication abnormal ag.

Register ID No. Description


■ D9101 The CP1's amount of residual data to be sent out by the instruction RS.
■ D9102 The CP1's amount of the data already received by the instruction RS.
■ D9111 The CP2's amount of residual data to be sent out by the instruction RS.
■ D9112 The CP2's amount of the data already received by the instruction RS.
■ D9121 The CP3's amount of residual data to be sent out by the instruction RS.
■ D9122 The CP3's amount of the data already received by the instruction RS.
■ D9131 The CP4's amount of residual data to be sent out by the instruction RS.
■ D9132 The CP4's amount of the data already received by the instruction RS.
■ D9141 The CP5's amount of residual data to be sent out by the instruction RS.
■ D9142 The CP5's amount of the data already received by the instruction RS.

399
Sequence of Data Sending and Receiving (Using the CP1 as an example)

X20
RS D0 D200 D100 D201 K1
Edit the data string which is beginning from the D0 to be sent and the
Fill the data string to be sent
length of data string is specified by the D200.
A trigger
pulse for The M9100 will turn “OFF” automatically when that data sending out is completed.
SET M9100 Do not use the RST instruction to reset the M9100.
to send
data Set the data sending
out request flag once
M9101
Move the received data string which is beginning from
Move the received data to the data storage area
the D100 to the data storage area.
The data
receiving is Reset the data receive completed flag M9101 for preparing to receive the next data
RST M9101 string set. Do not reset the M9101 consecutively in the program.
completed
Reset the data receive
completed flag

The Related Flags and Data Registers


1 The Data Sending Out Flag M9100:
When the conditional contact X20 = “ON”, the RS instruction is performed. At this time, if a pulse signal
forces the status of M9100 to be “ON”, the content values of the registers which are beginning from D0
will be sent out via the serial communication port CP1. After the data sending is completed, the M9100
will be reset to “OFF” automatically.
2 The Receive Completed Flag M9101:
When the conditional contact X20 = “ON”, the RS instruction is performed. The CP1 of PLC is ready to
receive communication data.
When the data receiving is completed, the M9101 = “ON”. At this moment, the received data in the buffer
should be moved to the data storage area, and then M9101 could be reset to “OFF”. Afterwards, PLC will
be ready for the status of receiving immediately.
3 The Receive Time-out Flag M9102:
When the data of receiving is paused and the waiting time exceeds the Time-out duration (designated by the
“COM Port Setting”), the M9102 will turn “ON” to represent the happening of Time-out also the Receive
Completed ag M9101 will be forced “ON” to terminate the data receiving action.
The M9102 will not reset automatically, must use an instruction in the program to reset the status of M9101
then the M9102 will be reset too.
By using the function of the Time-out ag, the PLC could receive the data of transferring from peripheral
equipments which without the particular length or “End of Text”.
The Time-out duration is specied by using the programming software Ladder Master S – “Project” –
“COM Port Setting”.
Receiving data

Receiving data Data


The time-out duration

M9102
Reset by program
M9101

4 The Communication Abnormal Flag M9103:


When the RS instruction occurs Parity error or Framing error, the Communication Abnormal Flag M9103
will turn ON. The M9103 must use an instruction in the program to reset the status of M9103

400
Description of Data Sending / Receiving (by the CP1): 16-bit Mode (M9161 = "OFF")

S m D n n1 A 16-bit data Divide the 16-bit data into two


X20
RS D0 K5 D100 K10 K1 Upper 8 bits Lower 8 bits Bytes of data: Upper 8 bits
data and Lower 8 bits data.

Conditional contact
X20 to active the
instruction

Data sending out


request ag M9100
5
4
3
2
D9101 the number 1
of data remaining
to be transferred 0

Data sending out


D0 D0 D1 D1 D2
(TXD) STX Upper 8 Bits Upper 8 Bits ETX
Lower 8 Bits Lower 8 Bits Lower 8 Bits
PLC→ Peripheral
Start Number of sending out data Bytes is designated by m End
of Text of Text

Start Number of received Bytes is designated by n End


of Text of Text

Data received
D100 D100 D101 D101
(RXD) STX Upper 8 Bits Upper 8 Bits ETX
Lower 8 Bits Lower 8 Bits
PLC ← Peripheral
Ready for Ready for
receiving receiving

4
3
2
1
D9102 the number
of received data 0
The data receive
completed ag M9101

Reset by the program Not reset by the


program

Either one of the condition below is completed will cause the receive completed ag M9101 “ON” and stop to
receive.
1 The number of assigned n bytes is satised.

2 The End of Text is received.


3 The occurrence of Time-out.

401
Description of Data Sending / Receiving (by the CP1): 8-bit Mode (M9161 = "ON")

S m D n n1 A 16-bit data The Lower 8 bits of the 16-bit


X20
RS D0 K5 D100 K10 K1 Useless Lower 8 bits data is treated as one Byte data.
(the Upper 8 bits data are useless)

Conditional contact
X20 to active the
instruction

Data sending out


request ag M9100
5
4
3
2
D9101 the number 1
of data remaining
to be transferred 0

Data sending out


(TXD) D0 D1 D2 D3 D4
STX
Lower 8 Bits Lower 8 Bits Lower 8 Bits Lower 8 Bits Lower 8 Bits ETX
PLC→ Peripheral
Start Number of sending out data Bytes is designated by m End
of Text of Text

Start Number of received Bytes is designated by n End


of Text of Text

Data received
(RXD) D100 D101 D102 D103
STX ETX
Lower 8 Bits Lower 8 Bits Lower 8 Bits Lower 8 Bits
PLC ← Peripheral
Ready for Ready for
receiving receiving

4
3
2
1
D9102 the number
of received data 0
The data receive
completed ag M9101

Reset by the program Not reset by the


program

Either one of the condition below is completed will cause the receive completed ag M9101 “ON” and stop to
receive.
1 The number of assigned n bytes is satised.

2 The End of Text is received.


3 The occurrence of Time-out.

402
Application Example
In this example, two VS PLC’s CP1 are connected by the RS-485 interface and execute the Non Protocol
communication.
In the following gure, let the left one executes the “Non Protocol” application type and set the baud rate to be 19200
bps.
Let the right one executes the “VS Computer Link Slave” application type. The baud rate should be the same as the
port of the left PLC also set the station number become the Slave #1.
Afterward, edit a relevant communication program and write that into the left PLC. The program uses the RS
instruction and follows the “VS Compurter Link Protocol” (hereby referred to as VS Protocol) format to access the
right side PLC's data.
Actually, there are simpler ways to exchange data between VS Series PLC’s in the real applications. This main purpose
of this example is to demonstrate the usage of the “Non Protocol” and the RS instruction.
Master VS PLC Slave VS PLC #1
Non Protocol VS Computer Link Slave
Baud Rate: 19200 bps Baud Rate: 19200 bps
Station No.: #1

CP1 CP1

The application example below briey explains the relevant descriptions to the “VS Protocol”. For the details about
the protocol, please refer to the section “7-4 VS Series PLC Communication Protocol”.
The parameters of the VS Protocol are --- bits-per-character: 8 bits ; parity check: NONE ; stop bit: 1bit.
The rule of the SUM Check code:
Function
Station

code
Device
Sum up the content values of data D S Number Head number Number D E SUM
No.

code

from the beginning of the station No. L T of data of devices of L T Check


E X Bytes devices E X
to the end of the data block.
Convert the last two digits of the
total HEX value into two ASCII L H L H L H

H L
codes to be the SUM Check code.
10H 02H 00H 07H 00H 20H A0H 34H 12H 00H 05H 00H 10H 03H 31H 32H
Both the data sending and receiving
devices should operate the same
code-checking procedures that can
ensure the data transmission to be correct. Sum up those HEX values and store at the last 2 digits by the ASCII codes
00H+07H+00H+20H+A0H+34H+12H+00H+05H+00H=112H

The communication command is to read the content value of the D1 from the Slave Station #1. (Assume the content
value of the D1 is 0000H)
Function
Station

Number
code
Device

D S Head number Number D E SUM


No.

code

The command L T of data of devices of L T Check


data string is sent E X Bytes devices E X
to the Slave
Station #1 L H L H L H H

L
10H 02H 01H 07H 00H 20H A0H 01H 00H 00H 01H 00H 10H 03H 43H 41H
Error code
Station

D A Number Content D E SUM


No.

L C of data value L T Check


The feedback data E K Bytes of D1 E X
string from the
Slave Station #1
L H L H H L
10H 06H 01H 03H 00H 00H 00H 00H 10H 03H 30H 34H

The communication command to write a value into the D0 in the Slave Station #1. (Assume the data to be written is 0000H)
Function
Station

Number
code
Device

D S Head number Number Data write D E SUM


No.

code

The command L T of data of devices of to D0 L T Check


data string is sent E X Bytes devices E X
to the Slave
Station #1 L H L H L H L H

H L
10H 02H 01H 09H 00H 28H A0H 00H 00H 00H 01H 00H 00H 00H 10H 03H 44H 33H
Error code
Station

D A Number D E SUM
No.

L C of data L T Check
The feedback data E K Bytes E X
string from the
Slave Station #1
L H H L
10H 06H 01H 01H 00H 00H 10H 03H 30H 32H

403
Please follow the procedures below to operate the test:

① Edit the project of Slave PLC #1


Use the Ladder Master S to set the CP1's parameters of Slave PLC #1 and compile relevant program. Then,
connect to the USB programming port of Slave #1 and write the project into the PLC.

Set the application type: VS Computer Link Slave


Set the baud rate: 19200 bps
Set the station No.: Station #1

※ Usually the default delay response time is not necessary to change,


except that:
When the communication mistake is caused by the signal collision in
the circuit, try to extend the delay response time.

By the USB programming port, the project is written into the Slave
The program writes to the Slave PLC #1 PLC #1
M9000
MOV D0 K2Y0
RUN VS1-32MR
STOP
X0 1 2 3 4 5 6 7

ADD D0 K100 D1 MC
10 11 12 13 14 15 16 17
20 21 22 23

PWR RUN ERR

Y0 1 2 3 4 5 6 7
10 11 12 13

USB
VSPC-200A DC24V
INPUT

Ladder Master S Slave PLC #1

② Edit the project of the Master PLC (by the Non Protocol and the RS instruction)
Use the Ladder Master S to set the CP1's parameters of Master PLC. Compile the RS instruction and relevant
program. Then, connect to the USB programming port of Master and write the project into the PLC.

Set the application type: Set the baud rate to be According to the VS Protocol
Non Protocol 19200 bps. to set the parameters at the sheet
of Non Protocol.

404
Edit the program for the left PLC (Master).
M9000
M9161 Assign the RS, CCD... instructions to operate in the 8-bit mode

M9168 Assign the SMOV instruction to operate in the HEX mode


M9002
D100 stores the Slave's station No. to be communicated, in
MOV K1 D100 this example it is 1.
M9002
D0 is the number of data to transmit,
RS D1 D0 D51 D50 K1
D1 is the transmit buffer space.
T200 K10 Comm. D50 is the number of data to receive,
T200 procedures D51 is the receive buffer space.
switching timer
T200
ALTP M0 Take turns to execute the reading or writing procedure
M0
M1 is the pulse for to send out the communication command of
PLS M1 reading procedure
M2 is the pulse for to send out the communication command of
PLF M2 writing procedure
M1
MOV K12 D50 Set the number of data bytes to be received

MOV K16 D0 Set the number of data bytes to be sent

MOV H10 D1 The command data


string from the Master
MOV H02 D2
D1 10H DLE

MOV D100 D3 D2 02H STX


D3 01H Station No.
DMOV H07 D4 D4 07H L Number
of data
D5 00H H Bytes
MOV H20 D6 Function
D6 20H code
This program block is to
MOV HA0 D7 D7 A0H Device code constitute the data
D8 01H L reading command of
MOV H01 D8 Head the “VS Protocol”.

D9 00H number In this example, it reads


of devices
D10 00H H the register D0 at the
DMOV H00 D9 Slave station #1.
D11 01H L Number
of
DMOV H01 D11 D12 00H H devices
D13 10H DLE
MOV H10 D13
D14 03H ETX

MOV H03 D14 D15 43H H SUM


D16 41H L Check
CCD D3 D102 K10

ASCI D102 D15 K2

SET M9100 Activate the sending out flag of the CP1


M0 M9101 Calculate the SUM Check
CCD D53 D104 K6 code from the received The Slave’s feedback
Recive data string, take the last data string
completed two digits then store that
WAND D104 HFF D104 into D104. D51 10H DLE
ag
Convert the received SUM Check code D52 06H ACK
HEX D61 D106 K2 into HEX code and store to D106.
D53 01H Station No.
Compare the calculated with the
CMP D104 D106 M3 received SUM Check codes, see D54 03H L Number
whether they are equal of data
D55 00H H Bytes
Check whether the error code is “0”
CMP D56 K0 M6 (no error).
D56 00H Error code
M4 M7 If the SUM Check codes
are equal and no error D57 00H L Content
MOV D57 D111 value of
code, the communication D58 00H H
is successful. Convert the D1
SMOV D58 K2 K2 D111 K4 received value and store D59 10H DLE
M4 that into D111.
D60 03H ETX
SET Y0 Ifcode
the SUM Check codes are not equal or the error
is not “0”, turn the Y0 “ON” that means the D61 30H H
M7 reading communication is unsuccessful. SUM
D62 34H L Check

RST M9101 Clear the recive completed flag


Continue on next page
405
M2
MOV K10 D50 Set the number of data bytes to be received

MOV K18 D0 Set the number of data bytes to be sent

MOV H10 D1

MOV H02 D2 The command data string


from the Master
MOV D100 D3 D1 10H DLE
D2 02H STX
DMOV H09 D4
D3 01H Station No.

MOV H28 D6 D4 09H L Number


of data
D5 00H H Bytes
MOV HA0 D7 D6 28H Function
code This program block is
D7 A0H Device code to constitute the data
MOV H00 D8 writing command of
D8 00H L
Head the “VS Protocol”.


MOV H00 D9 D9 00H number In this example, it
of devices
D10 00H H uses the content
MOV H00 D10 value of this PLC’s
D11 01H L Number
of D110 then writes that
D12 00H H devices value to the D0 of the
DMOV H01 D11
D13 00H L Data VS Slave #1.
write to
MOV D110 D13 D14 00H H D0
D15 10H DLE
MOV D110 D14
D16 03H ETX

SWAP D14 D17 44H H SUM


D18 33H L Check
MOV H10 D15

MOV H03 D16

CCD D3 D102 K12

ASCI D102 D17 K2

SET M9100 Activate the sending out flag of the CP1


M0 M9101
Calculate the SUM Check
CCD D53 D104 K4 code from the received The Slave’s feedback
Recive data string, take the last
completed
data string
WAND D104 HFF D104 two digits then store that
ag into D104. D51 10H DLE
Convert the received SUM Check code D52 06H ACK
HEX D59 D106 K2 into HEX code and store to D106.
D53 01H Station No.
Compare the calculated with the
CMP D104 D106 M3 received SUM Check codes, see D54 01H L Number
whether they are equal of data
D55 00H H Bytes
CMP D55 K0 M6 Check whether the error code is “0”
(no error).
M4 D56 00H Error code
If the SUM Check codes are not equal or the error
SET Y1 code is not “0”, turn the Y1 “ON” that means the D57 10H DLE
M7 writing communication is unsuccessful. D58 03H ETX
D59 30H H SUM
D60 32H L Check
RST M9101 Clear the recive completed flag

END

406
By the USB programming port, the project is written into the Master PLC.

RUN VS1-32MR
STOP
X0 1 2 3 4 5 6 7
10 11 12 13 14 15 16 17

MC 20 21 22 23

PWR RUN ERR

Y0 1 2 3 4 5 6 7
10 11 12 13

USB
VSPC-200A DC24V
INPUT

Ladder Master S Master PLC

③ After sequentially edit and load the projects to those PLCs, do the wiring and testing jobs between two PLC’s.

④ When the example is performing, the data at every PLC will follow its own program and the communication table
to execute the operation below.
The left PLC (Master): According to the format of the “VS Protocol” to edit the program using the RS instruction.
The PLC Master reads the value of D1 at the right side Slave #1 via the communication and stores
the value to the Master’s D111.
Also, writes the content value of the Master's D110 to the D0 of Slave #1.
The right PLC (Slave #1): The content value of D0 is sent to its output points Y0~Y7.
Also, its content value of D0 will be added 100 up and stored to the D1.
Since the left PLC (Master) is based on the format of the “VS Protocol” to edit the program with the RS instruction,
that can use the communication to access the data at the Slave #1. The operation produces the following results.
1. The content value of the Master's D110 is output to the points Y0~Y7 of the Slave #1.
2. The content value of the Master's D111 equals to the sum of the content value of its D110 and 100.
Try to change the content value of the left Master PLC's D110 and observe the changes of the content value of
D111, also the output points Y0~Y7 at the right PLC Slave #1 are related to the value.

407
7-4 VS Series PLC Communication Protocol
A. The relevant communication parameters

Bits-per-character: 8 bits
Parity check: None
Stop bit: 1 bit
Baud rate: 300/600/1200/2400/4800/9600/19200/34800/57600/115200 bps. selectable (default: 19200 bps.)

Syntax of a communication character


DATA 8 bits
START STOP bit

0 b0 b1 b2 b3 b4 b5 b6 b7 1

LOWER UPPER
HEX digit HEX digit

This communication protocol adopted the mixed method of ASCII and the HEX code to transmit data. This protocol
adopts a few ASCII codes, the conversion table below shows those characters and the corresponding ASCII codes.

Character ASCII Code Character ASCII Code Character ASCII Code


STX 02H 0 30H 8 38H
ETX 03H 1 31H 9 39H
ACK 06H 2 32H A 41H
DLE 10H 3 33H B 42H
4 34H C 43H
5 35H D 44H
6 36H E 45H
7 37H F 46H

Communication station number:


The available station number is between 0~254 (default: 0). If the communication command uses the station
number 255, that is a broadcast command.
Error code: When data string is feedback from a PLC, will include with an error code. The table lists the meaning of
every error code.

Error Code Description Error Code Description

00H Communication is normal; no error 06H The number of data bits exceeds the range
02H Communication SUM Check Error 08H Error ASCII conversion
The number of data bytes or the
04H number of components is 0 31H The command / function code is not existed

408
B. Communication protocol data format
The communication command string is sent to the Slave PLC
Number of
Header data Bytes Function Terminator SUM Check
ASCII CODE Station No. HEX code ASCII Code ASCII Code
HEX HEX Data block
DLE STX 0~FFH L H DLE ETX 16 1 16 0

The total number


of bytes

Sum up those HEX values and store at the last


2 digits by the ASCII codes
The communication feedback string from the Slave PLC
Number of
Header data Bytes Terminator SUM Check
ASCII CODE Station No. HEX Error code ASCII Code ASCII Code
HEX HEX Data block
DLE ACK 0~FFH L H DLE ETX 16 1 16 0

The total number


of bytes

Sum up those HEX values and store at the last


2 digits by the ASCII codes

Header: The starting characters of the data string to be transferred.


The characters of the header for command string sent to the Slave is DLE(10H) + STX(02H) by the ASCII
code; the header of feedback string from the Slave is DLE(10H) + ACK(06H) by the ASCII code.
Station No.: The Slave's identication number.
Every Slave PLC at the same communication circuit must have an unique station number, the Slave will
respond to the command if its station number matches with the number in the command. Thus, the
Master (computer) can use the station number to make a command for the particular Slave PLC.
Number of data Bytes: Counting the number of bytes from the function or error code to the end of the data block.
Function code: The Master PLC or computer commands the Slave PLC to do the appointed task.

Command Function Code Object of Device

Word Device Read 20H D,SD,R,T,C


Word Device Write 28H D,SD,R,T,C
Bit Device Read 21H the coil or contact of X, Y, M, SM, S, T and C
Bit Device Write 29H the coil or contact of X, Y, M, SM, S, T and C

Data block: The contents in the data block may include the head number of devices, the number of devices, the
content values of sending data and so forth.
Terminator: The last characters of the data string to be transferred.
The characters of the terminator for command string is DLE(10H) + ETX(03H) by the ASCII code.
SUM Check: Sum up the content values of HEX data from the beginning of station No. to the end of the data block.
Use the accumulated last two digits (by the HEX format) and convert that into two ASCII codes to be
the check code.
To operate the same code-checking procedures at both data sending and receiving ends can ensure
the data transmission is correct.
Function
code
Device
Station

D S Number Head number Number D E SUM


code
No.

L T of data of devices of L T Check


To E X Bytes devices E X
PLC

L H L H L H H L
10H 02H 00H 07H 00H 20H A0H 34H 12H 00H 05H 00H 10H 03H 31H 32H

Sum up those HEX values and store at the last


2 digits by the ASCII codes
00H+07H+00H+20H+A0H+34H+12H+00H+05H+00H=112H

409
C. Statement of the Device code
Mapping the head device's “Device code” is often needed for the data block access, following describes the coding
rules.
The Device code takes four Bytes. The rst Byte represents the device type and the second to fourth Bytes represent
the number of the device.
General the bit devices and word devices follow the coding rule below:

The rst Byte The second Byte The third Byte The fourth Byte
Device code tens ones thousands hundreds hundred ten
thousands thousand

Device Device number Device Device number


code code
M1234 92H 34H 12H 00H D0 A0H 00H 00H 00H

Fill the remaining Fill the remaining


digit by 0 digit by 0

The bit at a register (D.b or R.b) follows the coding rule below:
The rst Byte The second Byte The third Byte The fourth Byte
ones ten
Device code bit hundreds tens thousand thousands

Device Device number


Device Device number code
code
R23999.3 97H 93H 99H 23H
D100.B 95H 0BH 10H 00H

Fill the remaining


digit by 0

Device Range of Examples of Device Code


Device Device ID Code Device No.
Device ID Code L → H
External Input X X0~X377 ( Octal ) 90H 0~377 X15 90H,15H,00H,00H
External Output Y Y0~Y377 ( Octal ) 91H 0~377 Y123 91H,23H,01H,00H
Auxiliary Relay M M0~M8191 92H 0~8191 M1234 92H,34H,12H,00H
Step Relay S S0~S4095 93H 0~4095 S100 93H,00H,01H,00H
Special Relay M M9000~M9511 94H 0~511 M9012 94H,12H,00H,00H
D0~D8999 at 0~8999
Register D’s Bit D.b 95H D123 . F 95H,3FH,12H,00H
D . 0~D . F 0~F
R0~R23999 at 0~23999
Register R’s Bit R.b 97H R23999 . 3 97H,93H,99H,23H
R . 0~R . F 0~F
Coil of a timer T T 0~ T511 98H 0 ~ 511 T25 98H,25H,00H,00H
Contact of a timer T T 0~ T511 99H 0 ~ 511 T123 99H,23H,01H,00H
Coil of a counter C C 0~ C255 9CH 0 ~ 255 C0 9CH,00H,00H,00H
Contact of a counter C C 0~ C255 9DH 0 ~ 255 C200 9DH,00H,02H,00H
Register D
D 0~ D8999 A0H 0 ~ 8999 D1000 A0H,00H,10H,00H
(content value)
Special Register SD
D900 0~ D9511 A1H 0 ~ 511 D9001 A1H,01H,00H,00H
(content value)
Register R
R 0~ R23999 A2H 0 ~ 23999 R12345 A2H,45H,23H,01H
(content value)
Timer T (present value) T 0~ T511 A8H 0 ~ 511 T255 A8H,55H,02H,00H
16-bit Counter C
C 0~ C199 ACH 0 ~ 199 C0 ACH,00H,00H,00H
(current valur)
32-bit Counter C
C20 0~ C255 ADH 200 ~ 255 C235 ADH,35H,02H,00H
(current valur)

410
D. Statement of the communication command
The sending equipment will bind the codes together that includes the header, terminator and check code in a
communication command string. Except those three special purpose codes, if the content data include with the
code 10H in the string, the code 10H should be repeated once.
For example:

Add-on Add-on

10H 35H 10H 10H 35H 10H 10H 10H 10H 10H 10H
Data to be sent Actually sent Data to be sent Actually sent

When a receiving equipment gets two consecutive 10H codes, the second 10H code needs to be ignored.
For example:

Ignore Ignore

10H 10H 35H 10H 35H 10H 10H 10H 10H 10H 10H
Actually received Data to be received Actually received Data to be received

411
Function code 20H: to read word devices (up to 64 words can be read at one command).

Function

Device code
Station
D S Number Head Number D E SUM

code
No.
L T of data number of L T Check
Bytes of devices devices
Command E X E X
to PLC 00H



10H 02H FFH L H 20H XXH L H L H 10H 03H H L

Error code
Station
D A Number Data Data D E SUM
No.
L C of data block block L T Check
Feedback Bytes
E K ..... E X
from PLC
(complete)
As
10H 06H above L H 00H L H L H 10H 03H H L

Error code
Station

D A Number D E SUM
No.

L C of data L T Check
Feedback Bytes
E K E X
from PLC
(error)
As
10H 06H above 01H 00H XXH 10H 03H H L

Example 1: Read the content values of D1234~D1238 at the Salve #0. (ve 16-bit word devices)
Suppose D1234 = 89ABH, D1235 = 1000H, D1236 = 2345H, D1237 = 0H and D1238 = 3FH
at the Salve #0.
Device code
Function
Station

D S Number Head Number D E SUM


code
No.

L T of data number of L T Check


Bytes of devices devices
Command E X E X
to PLC

L H L H L H H L
10H 02H 00H 07H 00H 20H A0H 34H 12H 00H 05H 00H 10H 03H 31H 32H
Error code

Value Value Value Value Value


Station

D A Number D E SUM
at at at at at
No.

L C of data L T Check
Bytes D1234 D1235 D1236 D1237 D1238
Feedback E K E X
from PLC
(complete)
L H L H L H L H L H L H H L
10H 06H 00H 0BH 00H 00H ABH 89H 00H 10H 45H 23H 00H 00H 3FH 00H 10H 03H 46H 36H

Example 2: Read the present values of C235 and C236 at the Salve #0. (two 32-bit double word devices)
Suppose C235 = 236B9H and C236 = 11253648H at the Salve #0.
Since the C235 and C236 are 32-bit devices, their current value will be consisted of two words
(Low word and High word).
Device code
Function

Number
Station

D S Head Number D E SUM


code
No.

L of data number of L T Check


T Bytes of devices devices
Command E X E X
to PLC

L H L H L H H L
10H 02H 00H 07H 00H 20H ADH 35H 02H 00H 02H 00H 10H 03H 30H 44H
Error code
Station

D A Number Present value at C235 Present value at C236 D E SUM


No.

L C of data L T Check
Feedback Bytes
E K E X
from PLC
(complete)
L H LL LH HL HH LL LH HL HH H L
10H 06H 00H 09H 00H 00H B9H 36H 02H 00H 48H 36H 25H 11H 10H 03H 41H 45H

412
Function code 21H: to read bit devices (up to 1024 bits can be read at one command).

Device code
Function
Number

Station
D S Head Number D E SUM

code
No.
L of data number of L T Check
T Bytes of devices devices
Command E X E X
to PLC 00H



10H 02H FFH L H 21H XXH L H L H 10H 03H H L

Number

code
Error
Station
D A Data block D E SUM
of data
No.
L C (Transmit unit: Byte) L T Check
Bytes
Feedback E K E X
from PLC
(complete) .....
As
10H 06H above L H 00H B0 B1 Bn 10H 03H H L

code
Error
Station

D A Number D E SUM
No.

L C of data L T Check
Feedback Bytes
E K E X
from PLC
(error)
As
10H 06H above 01H 00H XXH 10H 03H H L

Example 1: Read the states of M10~M63 at the Salve #0 (total 54 bit devices)
Suppose the states of M10~M63 at the Salve #0 are as below: (composed to Byte values)

8 bits

55H 0 1 0 1 0 1 0 1 M10(B0)

AAH 1 0 1 0 1 0 1 0 M18(B1)

00H 0 0 0 0 0 0 0 0 M26(B2)

FFH 1 1 1 1 1 1 1 1 M34(B3) ※ 54 bits in total, 54 = 36H (the number of devices)

ABH 1 0 1 0 1 0 1 1 M42(B4)

12H 0 0 0 1 0 0 1 0 M50(B5)

2EH 0 0 1 0 1 1 1 0 M58(B6)

M63
Fill the unused
devices as “0”
Device code
Function
Station

D S Number Head Number D E SUM


code
No.

L T of data number of L T Check


Bytes of devices devices
Command E X E X
to PLC

L H L H L H H L
10H 02H 00H 07H 00H 21H 92H 10H 00H 00H 36H 00H 10H 03H 30H 30H

Number
code
Error
Station

D A Status (by Byte values) D E SUM


of data
No.

L C at M10~M63 L T Check
Bytes
Feedback E K E X
from PLC
(complete)
L H B0 B1 B2 B3 B4 B5 B6 H L
10H 06H 00H 08H 00H 00H 55H AAH 00H FFH ABH 12H 2EH 10H 03H 46H 31H

413
Function code 28H: to write word devices (up to 64 words can be write at one command).

Device code
Function
Station
D S Number Head Number Data Data D E SUM

code
No.
L T of data number of to be to be L T Check
Bytes of devices devices written written
Command E X ..... E X
to PLC 00H



10H 02H FFH L H 28H XXH L H L H L H L H 10H 03H H L

Error code
Station
D A Number D E SUM

No.
L C of data L T Check
Feedback Bytes
E K E X
from PLC
(complete)
As
10H 06H above 01H 00H 00H 10H 03H H L The error code in feedback string at a successful
communication is 00H; but if the error code is not 00H,
that means error happened (refer to the list at the
Error code beginning of this section).
Station

D A Number D E SUM
No.

L C of data L T Check
Feedback Bytes
E K E X
from PLC
(error)
As
10H 06H above 01H 00H XXH 10H 03H H L

Example 1: Write the values 2048H and 300H into the D7000 and D7001 at the Salve #0 (two 16-bit word devices)
Device code
Function
Station

D S Number Head Number Data write Data write D E SUM


code
No.

L T of data number of to to L T Check


Bytes of devices devices D7000 D7001
Command E X E X
to PLC

L H L H L H L H L H H L
10H 02H 00H 0BH 00H 28H A0H 00H 70H 00H 02H 00H 48H 20H 00H 03H 10H 03H 42H 30H
Error code
Station

D A Number D E SUM
No.

L C of data L T Check
Feedback Bytes
E K E X
from PLC
(complete)
L H H L
10H 06H 00H 01H 00H 00H 10H 03H 30H 31H

Example 2: Write the value 89AB1234H into the C210 at the Salve #0 (a 32-bit double word device)
Device code
Function
Station

D S Number Head Number Data write to C210 D E SUM


code
No.

L T of data number of L T Check


Bytes of devices devices
Command E X E X
to PLC

L H L H L H LL LH HL HH H L
10H 02H 00H 0BH 00H 28H ADH 10H 02H 00H 01H 00H 34H 12H ABH 89H 10H 03H 36H 44H
Error code
Station

D A Number D E SUM
No.

L C of data L T Check
Feedback Bytes
E K E X
from PLC
(complete)
L H H L
10H 06H 00H 01H 00H 00H 10H 03H 30H 31H

414
Function code 29H: to write bit devices (up to 1024 bits can be write at one command).

Device code
Function
Station
D S Number Head Number Data block D E SUM

code
No.
L T of data number of (Transmit unit: Byte) L T Check
Bytes of devices devices
Command E X E X
to PLC 00H .....



10H 02H FFH L H 29H XXH L H L H B0 B1 Bn 10H 03H H L

Error code
Station
D A Number D E SUM

No.
L C of data L T Check
Feedback Bytes
E K E X
from PLC
(complete)
As
10H 06H above 01H 00H 00H 10H 03H H L The error code in feedback string at a successful
communication is 00H; but if the error code is not 00H,
that means error happened (refer to the list at the
Error code beginning of this section).
Station

D A Number D E SUM
No.

L C of data L T Check
Feedback Bytes
E K E X
from PLC
(error)
As
10H 06H above 01H 00H XXH 10H 03H H L

Example 1: Write the status below into the M100~M127 at the Salve #0 (total 28 bit devices)
8 bits

EFH 1 1 1 0 1 1 1 1 M100(B0)

CDH 1 1 0 0 1 1 0 1 M108(B1)
※ 28 bits in total, 28 = 1CH (the number of
35H 0 0 1 1 0 1 0 1 M116(B2) devices)

00H 0 0 0 0 0 0 0 0 M124(B3)

Fill the unused M127


devices as “0”
Device code
Function
Station

D S Number Head Number Data write to D E SUM


code
No.

L T of data number of M100~M127 L T Check


Bytes of devices devices
Command E X E X
to PLC

L H L H L H B0 B1 B2 B3 H L
10H 02H 00H 0BH 00H 29H 92H 00H 01H 00H 1CH 00H EFH CDH 35H 00H 10H 03H 44H 34H
Error code
Station

D A Number D E SUM
No.

L C of data L T Check
Feedback Bytes
E K E X
from PLC
(complete)
L H H L
10H 06H 00H 01H 00H 00H 10H 03H 30H 31H

415
416
8. Statement of Positioning Control Functions
The VS series PLC Main Unit provided with four high-speed pulse output points, and thus can operate four axis controls.
In the multi-axis positioning control applications, it is very suitable and effective.
The pulse output frequency of the VS1 and VS2 Series transistor PLCs can reach up to 50 kHz, can be used to complete
various of basic positioning control.
The VSM Motion Control Main Unit is equipped with quick reaction high-speed I/O points, because it is special design
for positioning control applications with complete positioning functions.
The VS3 High Performance Main Unit can satisfy the most diverse and the highest level of applications, the transistor
model also possesses complete positioning control functions.
The pulse output frequency of the VSM and VS3 Series PLCs can reach to 200 kHz, furthermore the VSM-28L can even
reach to 1 MHz. All the VS series PLC can support 17 positioning instructions of complete functions and thus can
complete various types of exquisite and smooth positioning control.
When using the positioning control functions of the VS series PLC Main Units, some common precautions are noted
below:
The VS1 and VS2 series transistor models are provided with four 50 kHz high-speed pulse outputs, the VSM and VS3
transistor models are provided with four 200 kHz high-speed pulse outputs. Moreover, the VSM-28L provides four
1 MHz high-speed line-driver output circuits.
There is no limitation on the number of times that positioning instructions are wrote at the user program. However,
must regard to that do not use two or more instructions to drive the same output point at the same time.
The load voltage of transistor output points is DC5V~24V, and for the general output uses the current capacity is
0~0.5 A; but when a point Y0~Y3 is assigned for the high-speed pulse function, its current is 0~100 mA.
About the positioning control method at the VS series PLC, its controlling output form is “Pulse train + Direction
signal”. The output points for the direction signals can use Y0~Y7 or internal auxiliary relays M.
Nonetheless, those are better using Y0~Y7 to minimize output delay.

Y0 CK Servo motor driver or


step motor driver
Y4 DIR

Y1 CK Servo motor driver or


step motor driver
Y5 DIR
The VS series PLC
Y2 CK Servo motor driver or
step motor driver
Y6 DIR

Y3 CK Servo motor driver or


step motor driver
Y7 DIR

The VS series PLC's positioning control functions are achieved by the positioning instructions, parameters (by the
Ladder Master S to congure) and relevant special devices, the following sections will introduce those respectively.

417
8-1 Positioning Parameter Setup
The Ladder Master S provides the Positioning Parameter Setup function to simplify the VS series PLC’s process of
setting relevant parameters. The contents of positioning parameters will be written onto the PLC with the project. After
that, only the appropriate positioning control instructions are needed to complete the positioning control work easily.
In the most of cases, the Positioning Parameter Setup function can satisfy application requirements.
However, during the operation, some specic applications may need to change related parameters. Thus, a part of the
positioning parameters are not only preset by the setting of the parameter setup page, but also can make changes at
relevant special registers via the user program.
When PLC’s power is turned from “OFF” to “ON” and the project had been written into the PLC, the corresponding
parameters will be copied to relevant special registers. After that, if there is a demand to change positioning
parameters during PLC is in operation, the user just needs to change the values in relevant special registers before to
execute the positioning control instruction. Then, the positioning control instruction will base on the changed values in
the special registers to execute the instruction. For example, to change the time of acceleration or deceleration.

To open the setup page, select the option “Positioning Parameter Setup” under the “Project” of the Ladder Master S.
Hereby we illustrate the setting for each item on the page one by one.

Press the “Default” button, that will reset the set contents to the default values about this axis.

418
8-1-1 Assign the positioning Units
The VS series PLC’s positioning control functions are through the high-speed pulse output points, to operate the motor
positioning control drives. Thus, the basic unit of operating speed is the output pulse frequency (Hz) and the position is
the number of pulses (PLS).
Nonetheless, using the machine unit is more suitable for the positioning control of the real applications. Therefore, the
VS PLC provides the unit setting function, that unit conversion is performed by the system. By way of the function, it
allows user to proceed the positioning control by using the most appropriate unit.
Positioning unit in the system:
According to actual control needs, select one from the Motor (pulse) system, Machine system or Combined system.
The Motor system is defaulted.

Type Description
Motor system The units of position and speed at the control are based on the number of pulses
Machine system The units of position and speed at the control are based on metric/inch lengths or angles
The units of speed at the control is based on the number of pulses per second;
Combined system
The units of position at the control is based on metric/inch length or angle

Unit of the speed:


According to the unit on the control system to select an appropriate speed unit. The frequency Hz is defaulted.
This speed unit is relate to the maximum speed, bias speed, jog speed, home position return speed, home position
return creep speed, operating speed and current speed value of the positional control.
Unit of the position:
According to the unit on the control system to select an appropriate position unit. The number of pulses (PLS) is
defaulted.
This position unit is relate to the home position, the target position and the current position value of the positional
control.
Pulse Per Revolution of motor and Distance Per Revolution of motor:
When the Machine system or Combined system is selected as the unit of the control type, it is necessary to set the
contents of the “Pulse Per Revolution of motor” and “Distance Per Revolution of motor”.
Thus, the positioning control system can proceed the unit conversion and then send correct pulse strings.
The default value of the “Pulse Per Revolution of motor” is 2000 PLS.
The default value of the “Distance Per Revolution of motor” is 2000 µm.
Multiple ratio of speed:
This is used to change the operating speed when the positioning control is active. The default value is 1,000 (equal to
100.0%).
The jog speed, home position return speed, home position return creep speed and operating speed are affected by
this parameter.
If this parameter value is changed during the positioning control instruction is active, the actual operating speed is
changed accordingly.
The available range of the multiple ratio is from 1 to 30,000, in a unit of 0.1% (that means 0.1% ~ 3000.0%).
Speed

Time
Multiple ratio
1000=100.0% 700=70.0%
of speed

419
8-1-2 Basic Parameters
The VS series PLC provides the positioning control with the acceleration and deceleration functions, as shown in the
following diagram. It is necessary to set relevant parameters before to use the positioning control instructions, thus can
perform the operation correctly. The parameters in the diagram below uses Y0 output axis as an example.
Speed
(Frequency) Acceleration time Deceleration time
(D9343) (D9344)

Maximum speed (D9341,D9340)

Operating speed

The area under this drawing line


is equal to
the total number of output pulses

Bias speed (D9342)


Time

Maximum speed
This value connes the highest limit of the positioning control speed at a certain axis. If its operation speed exceeds
the limit of the maximum speed during the action of any positioning control instruction, the instruction will be operated
according to the maximum speed.
The highest output frequency of the VS1 or VS2 series is 50 kHz. The acceptable value range is from 1 to 50 k (Hz).
Any value less than 1 is regarded as 1 Hz; more than 50 k is regarded as 50 kHz. The default value is 50 kHz.
The highest output frequency of the VSM or VS3 series is 200 kHz. The acceptable value range is from 1 to
200 k (Hz). Any value less than 1 is regarded as 1 Hz; more than 200 k is regarded as 200 kHz. The default value is
200 kHz.
The highest output frequency of the VSM-28ML series is 1 MHz. The acceptable value range is from 1 to 1 M (Hz).
Any value less than 1 is regarded as 1 Hz; more than 1 M is regarded as 1 MHz. The default value is 1 MHz.
Bias speed
This value connes the lowest limit of the positioning control speed at a certain axis. The main purpose is to avoid the
low-frequency resonance area of a step motor. Thus, it is usually set to be 0 for a servo motor.
If the operation speed is lower than the bias speed during the action of any positioning control instruction, the
instruction will be operated according to the bias speed.
The acceptable value range is from 0 to 20 k (Hz). Any value less than 0 is regarded as 0 Hz; more than 20 k is
regarded as 20 kHz. The default value is 0 Hz.
Acceleration timey
As shown in the diagram, the acceleration time refers to the time it takes for speeding up from the bias speed to the
maximum speed (not the operating speed).
The acceptable value range is from 0 to 32,000 (ms). Any value less than 0 is regarded as 0 ms; more than 32,000 is
regarded as 32,000 ms. The default value is 100 ms.
Deceleration time
As shown in the diagram, the deceleration time refers to the time it takes for slowing down from the maximum speed
(not the operating speed) to the bias speed.
The acceptable value range is from 0 to 32,000 (ms). Any value less than 0 is regarded as 0 ms; more than 32,000 is
regarded as 32,000 ms. The default value is 100 ms.
Rotational direction
Users can select the direction control pattern: “Increase present value when forward” or “Increase present value when
backward”. That will affect to the direction output of the positioning control. The default is “Increase present value
when forward”.
If the “Increase present value when forward” is selected and the positioning instruction decides to increase its present
value, then the direction control point will turn “ON” to drive the motor moving forward.
If the “Increase present value when backward” is selected and the positioning instruction decides to increase its
present value, then the direction control point will turn “OFF” to drive the motor moving backward.

420
8-1-3 Positioning Operation Setting Up
Demonstrated below is the brief conguration of a general positioning control system, which we will use to illustrate the
related parameter settings for the positioning control.

Pulse output

Direction output
VS series
Servo motor drive CLR PLC
Clear signal
PG0
Zero point signal

LSR LSR DOG DV2I INT LSF LSF


Reverse limit Reverse limit Near point Speed change Interrupt Forward limit Forward limit
switch switch signal signal signal switch switch

Direction of home positioning

Sliding table
Servo
motor
Driving screw

Home Position Return (Zero Return)


The VS PLC provides a variety of home position return modes when the ZRN instruction is used, which will be
explained one by one below. The parameters in the setup sheet are decided on those different modes. Hence, to
easily complete the setting, all the users need to do is to select the appropriate mode, and then ll in the relevant
parameters.
DOG Rear End home positioning
Speed

Direction of home positioning


DOG Front End, start to slow down

Home positioning speed

Home positioning creep speed Stop immediately when DOG's Rear End comes
Time

DOG Signal

CLR Signal
Positioning
completed ag Condition contact “OFF”

Home positioning
complete ag

The DOG signal may use a X or M. Usually assigned to the X0~X7, because by the interrupt input
point can have the precise home position. On the other hand, if the signal for the DOG is not from
X0~X7, the home position after the return will have some inaccurate error.
The CLR signal output can assign to a Y or M, the width of that “ON” signal is ≥ 20ms.

421
DOG Front End home positioning
Speed

Direction of home positioning


DOG Front End, start to slow down

Home positioning speed Motor reversed (opposite to the


direction of home positioning)

Home positioning
creep speed
Time

Direction signal
to the motor

DOG Signal DOG Forward, OFF → ON DOG Backward, ON → OFF

CLR Signal
Positioning Condition contact
completed ag “OFF”
Home positioning
complete ag

The DOG signal may use a X or M. Usually assigned to the X0~X7, because by the interrupt input
point can have the precise home position. On the other hand, if the signal for the DOG is not from
X0~X7, the home position after the return will have some inaccurate error.
The CLR signal output can assign to a Y or M, the width of that “ON” signal is ≥ 20ms.

DOG Rear End with PG0 count home positioning


Speed

Direction of home positioning


DOG Front End, start to slow down

Home positioning speed


Instantly stops when the PG0’s
counting set value is reached
Home positioning
creep speed
Time

DOG Signal

PG0 Signal 1 2
Starts to count PG0 signals after DOG’s Rear End
is appeared. Set number of PG0 signals = 2.
CLR Signal
Positioning Condition contact
completed ag “OFF”
Home positioning
complete ag

The DOG signal may use a X or M. Usually assigned to the X0~X7, because the interrupt
input point can have the instant response.
Should avoid the DOG's Rear End signal to be too close to the PG0's Front End signal, that
may cause the PG0 counting error.
For the PG0 signal input, must use X0~X7. The PLC processes the counting by the way of
interrupt.
The CLR signal output can assign to a Y or M, the width of that “ON” signal is ≥ 20ms.

422
DOG Front End with PG0 count home positioning
Speed

Direction of home positioning


DOG Front End, start to slow down

Home positioning speed

Instantly stops when the PG0’s


Home positioning creep speed counting set value is reached
Time
Starts to count PG0 signals after
DOG’s Front End is appeared.
DOG Signal Set number of PG0 signals = 3.

PG0 Signal 1 2 3

CLR Signal
Positioning Condition contact
completed ag “OFF”
Home positioning
complete ag

The DOG signal may use a X or M. Usually assigned to the X0~X7, because the interrupt input
point can have the instant response.
Should avoid the DOG's Front End signal to be too close to the PG0’s Front End signal, that
may cause the PG0 counting error.
For the PG0 signal input, must use X0~X7. The PLC processes the counting by the way of
interrupt.
The CLR signal output can assign to a Y or M, the width of that “ON” signal is ≥ 20ms.

Data-set type home return


At this mode, the motor does not rotate because it is no actual moving position. When the function is operated, it
will fill the preset value of the home position into the register which stores the present value also turn the home
positioning complete flag “ON”. If the CLR output is activated, the width of the signal pulse is ≥ 20ms.

Dog search home positioning


When the positioning system has installed with limit switches to provide the limiter signals for the VS PLC, by this
mode that will give the automatic search capability for the home positioning. (the examples are using the DOG
Rear End home positioning)

Limit switch DOG Direction of home positioning

( 4) ( 3) ( 2) ( 1)
Home

The diagram above illustrates the different actions from the starting points (1)~(4) to complete the home positioning.
(1) If the starting point is located on the right of the DOG switch:
The home positioning is moving the sliding table by the home positioning speed and the direction of home
positioning. Until the Front End of the DOG is reached, the speed decreases to the creep speed, then to finish
the home positioning.
(2) If the starting point had been driving the DOG switch “ON”:
The home positioning is moving the sliding table by the home positioning speed and the opposite direction of
home positioning. Until the Front End of the DOG is separated (the signal turns from “ON” to “OFF”), the speed
slowing down and then stop. After that, it is moving the sliding table by the home positioning speed and the
direction of home positioning. Until the Front End of the DOG is reached, the speed decreases to the creep
speed, then to finish the home positioning.

423
(3) If the starting point is located on the right of the DOG switch:
The home positioning is moving the sliding table by the home positioning speed and the direction of home
positioning. Until the limit switch is reached, the speed slowing down and then stop. After that, moving the
sliding table by the home positioning speed and the opposite direction of home positioning until the Rear End of
the DOG is separated (the signal turns from “ON” to “OFF”), the speed slowing down and then stop.
Furthermore, it uses the home positioning speed and the direction of home positioning to move the table again
until the Rear End of the DOG is reached, the speed decreases to the creep speed then to finish the home
positioning.
(4) If the starting point has caused the limit switch “ON”:
The home positioning is moving the sliding table by the home positioning speed and the opposite direction of
home positioning until the Rear End of the DOG is separated (the signal turns from “ON” to “OFF”), the speed
slowing down and then stop. Furthermore, it uses the home positioning speed and the direction of home
positioning again to move the table until the Front End of the DOG is reached, the speed decreases to the creep
speed then to finish the home positioning.

Limit Switches
Forward Limit Switch (LSF)
This is a limit switch for a motor which moves forward. When the forward limit switch is active, that limits all the
forward actions. That makes the forward motor to slow down and stop. However, it is not interfering with reversed
actions. The imit switch can be assigned to any external input X or internal auxiliary relay M.
Reverse Limit Switch (LSR)
This is a limit switch for a motor which moves reversed. When the reverse limit switch is active, that limits all the
reversed actions. That makes the reversed motor to slow down and stop. However, it is not interfering with forward
actions. The imit switch can be assigned to any external input X or internal auxiliary relay M.

Interrupt Signals for Positioning


Other interruption related positioning control instructions are introduced below:

DVIT Interrupt Constant DVSR or DVSA Interrupt DV2I 2 Stages Interrupt Constant
Quantity Positioning to Stop Positioning Quantity Positioning
Speed Speed Speed

Time Time Time


Interrupt signal Interrupt signal Speed change Interrupt
signal signal

INT interrupt signal


When there is an interrupt signal input, the positioning instructions start pertinent control actions. The interruption
signal must have instant response to reach a higher accuracy of positioning. Hence, the interruption signal through
the external input X0~X7 is necessary for the PLC to control that in the way of interruption.
DV2I speed change signal
To operate the DV2I 2 stages interrupt constant quantity positioning instruction, its speed change signal can be
assigned to an external input X or internal auxiliary relay M.

424
8-2 Special Components Related to Positioning Control Instructions
In the tables below, the symbo “ ■ ” represents that the component is not allowed to use an instruction in the program
to drive the relay or write data to the register.

Relay ID Description Series


No.
Y0 Axis's Positioning Control Flag VS1 VS2 VSM VS3
Y0 axis's status. “OFF” means the Y0 is in the READY status, it is available for a positioning
■ M9340 ○ ○ ○ ○
instruction; while “ON” = BUSY, the Y0 has been occupying.
■ M9341 Y0 axis's pulse output monitor. “ON” means pulse is generating. ○ ○ ○ ○

■ M9342 Y0 axis's positioning completed ag. ○ ○ ○ ○

■ M9343 Y0 axis's positioning abnormal stop ag. ○ ○ ○ ○

■ M9344 Y0 axis's zero home positioning has been completed. ○ ○ ○ ○

M9345 Y0 axis's stop ag (with gradually slow down). ○ ○ ○ ○

M9346 Y0 axis's immediately stop ag. ○ ○ ○ ○

M9347 Y0 axis's table positioning start signal. ○ ○ ○ ○

■ M9348 Y0 axis's M-code active ag. ○ ○ ○ ○

M9349 Y0 axis's M-code clear command. ○ ○ ○ ○

Y0 axis's external interrupt trigger type. When M9350= “OFF”, the interrupt is triggered by a rising
M9350 edge; when M9350= “ON”, that is triggered by a falling edge. ○ ○ ○ ○

Y1 Axis's Positioning Control Flag VS1 VS2 VSM VS3


■ M9360
Y1 axis's status. “OFF” means the Y1 is in the READY status, it is available for a positioning ○ ○ ○ ○
instruction; while “ON” = BUSY, the Y1 has been occupying.
■ M9361 Y1 axis's pulse output monitor. “ON” means pulse is generating. ○ ○ ○ ○

■ M9362 Y1 axis's positioning completed ag. ○ ○ ○ ○

■ M9363 Y1 axis's positioning abnormal stop ag. ○ ○ ○ ○

■ M9364 Y1 axis's zero home positioning has been completed. ○ ○ ○ ○

M9365 Y1 axis's stop ag (with gradually slow down). ○ ○ ○ ○

M9366 Y1 axis's immediately stop ag. ○ ○ ○ ○

M9367 Y1 axis's table positioning start signal. ○ ○ ○ ○

■ M9368 Y1 axis's M-code active ag. ○ ○ ○ ○

M9369 Y1 axis's M-code clear command. ○ ○ ○ ○

Y1 axis's external interrupt trigger type. When M9370= “OFF”, the interrupt is triggered by a rising
M9370 edge; when M9370= “ON”, that is triggered by a falling edge. ○ ○ ○ ○

Y2 Axis's Positioning Control Flag VS1 VS2 VSM VS3


Y2 axis's status. “OFF” means the Y2 is in the READY status, it is available for a positioning
■ M9380 ○ ○ ○ ○
instruction; while “ON” = BUSY, the Y2 has been occupying.
■ M9381 Y2 axis's pulse output monitor. “ON” means pulse is generating. ○ ○ ○ ○

■ M9382 Y2 axis's positioning completed ag. ○ ○ ○ ○

■ M9383 Y2 axis's positioning abnormal stop ag. ○ ○ ○ ○

■ M9384 Y2 axis's zero home positioning has been completed. ○ ○ ○ ○

M9385 Y2 axis's stop ag (with gradually slow down). ○ ○ ○ ○

M9386 Y2 axis's immediately stop ag. ○ ○ ○ ○

M9387 Y2 axis's table positioning start signal. ○ ○ ○ ○

■ M9388 Y2 axis's M-code active ag. ○ ○ ○ ○

M9389 Y2 axis's M-code clear command. ○ ○ ○ ○

Y2 axis's external interrupt trigger type. When M9390=“OFF”, the interrupt is triggered by a rising
M9390 edge; when M9390= “ON”, that is triggered by a falling edge. ○ ○ ○ ○

Y3 Axis's Positioning Control Flag VS1 VS2 VSM VS3


■ M9400
Y3 axis's status. “OFF” means the Y3 is in the READY status, it is available for a positioning ○ ○ ○ ○
instruction; while “ON” = BUSY, the Y3 has been occupying.
■ M9401 Y3 axis's pulse output monitor. “ON” means pulse is generating. ○ ○ ○ ○

■ M9402 Y3 axis's positioning completed ag. ○ ○ ○ ○

■ M9403 Y3 axis's positioning abnormal stop ag. ○ ○ ○ ○

■ M9404 Y3 axis's zero home positioning has been completed. ○ ○ ○ ○

M9405 Y3 axis's stop ag (with gradually slow down). ○ ○ ○ ○

M9406 Y3 axis's immediately stop ag. ○ ○ ○ ○

M9407 Y3 axis's table positioning start signal. ○ ○ ○ ○

425
Relay ID Description Series
No.
Y3 Axis's Positioning Control Flag VS1 VS2 VSM VS3
■ M9408 Y3 axis's M-code active ag. ○ ○ ○ ○

M9409 Y3 axis's M-code clear command. ○ ○ ○ ○

Y3 axis's external interrupt trigger type. When M9410=“OFF”, the interrupt is triggered by a rising
M9410 edge; when M9410=“ON”, that is triggered by a falling edge. ○ ○ ○ ○

Register Description
ID No. Series
Y0 Axis's Positioning Control VS1 VS2 VSM VS3
D9340 Lower 16 bits The Y0's maximum speed (by user unit).
(Convert it to the real frequency that should appropriate to the PLC's range: ○ ○ ○ ○
D9341 Upper 16 bits VS1, VS2 is 1~50kHz; VSM, VS3 is 1~200kHz; VSM-28ML is 1~1MHz)
D 9 342 The Y0's bias speed (by user unit). (Convert it to the real frequency should between 0~20kHz). ○ ○ ○ ○

The Y0's acceleration time, range = 0~32,000ms.


D 9 343 If <0, then equal to 0; if >32,000, then equal to 32,000. ○ ○ ○ ○

The Y0's deceleration time, range = 0~32,000ms.


D 9 344 If <0, then equal to 0; if >32,000, then equal to 32,000. ○ ○ ○ ○

The Y0's number of PG0 input when to execute the ZRN instruction, range = 1~32,767.
D9345 If out of the range, then equal to 1. ○ ○ ○ ○

D9346 Lower 16 bits The Y0's preset value when the ZRN is nished (by user unit).
(Convert it to the number of pulse should between -2,147,483,648~ ○ ○ ○ ○
D9347 Upper 16 bits +2,147,483,647)
The Y0's pulse output speed multiple ratio, ranging from 1~30,000 = 0.1%~3,000.0%. ○ ○ ○ ○
D 9 348 If over the range, then equal to 1,000 (100.0%).

■ D 9 349 The Y0's M-code register. ○ ○ ○ ○

■ D9350 Lower 16 bits The Y0's current speed (by user unit). If used for the PLSY or PLSR
○ ○ ○ ○
■ D9351 Upper 16 bits instruction, that is the current speed by the unit of Hz.

D 9 352 Lower 16 bits The Y0's current location (by the number of pulse). The initial value is 0.
○ ○ ○ ○
D 9 353 Upper 16 bits If used for the PLSY or PLSR instruction, that is the pulse output amount.

D 9 354 Lower 16 bits The Y0's current location (present value, PV) of positioning (by user unit). ○ ○ ○ ○
D 9 355 Upper 16 bits The initial value is 0.

Y1 Axis's Positioning Control VS1 VS2 VSM VS3


D9360 Lower 16 bits The Y1's maximum speed (by user unit).
(Convert it to the real frequency that should appropriate to the PLC's range: ○ ○ ○ ○
D9361 Upper 16 bits VS1, VS2 is 1~50kHz; VSM, VS3 is 1~200kHz; VSM-28ML is 1~1MHz)

D 9 362 The Y1's bias speed (by user unit). (Convert it to the real frequency should between 0~20kHz). ○ ○ ○ ○

The Y1's acceleration time, range = 0~32,000ms.


D 9 363 If <0, then equal to 0; if >32,000, then equal to 32,000. ○ ○ ○ ○

The Y1's deceleration time, range = 0~32,000ms.


D 9 364 If <0, then equal to 0; if >32,000, then equal to 32,000. ○ ○ ○ ○

The Y1's number of PG0 input when to execute the ZRN instruction, range = 1~32,767.
D9365 If out of the range, then equal to 1. ○ ○ ○ ○

D9366 Lower 16 bits The Y1's preset value when the ZRN is nished (by user unit).
(Convert it to the number of pulse should between -2,147,483,648~ ○ ○ ○ ○
D9367 Upper 16 bits +2,147,483,647)
The Y1's pulse output speed multiple ratio, ranging from 1~30,000 = 0.1%~3,000.0%.
D 9 368 If over the range, then equal to 1,000 (100.0%). ○ ○ ○ ○

■ D 9 369 The Y1's M-code register. ○ ○ ○ ○

■ D9370 Lower 16 bits The Y0's current speed (by user unit). If used for the PLSY or PLSR
○ ○ ○ ○
■ D9371 Upper 16 bits instruction, that is the current speed by the unit of Hz.

D 9 372 Lower 16 bits The Y0's current location (by the number of pulse). The initial value is 0.
○ ○ ○ ○
D 9 373 Upper 16 bits If used for the PLSY or PLSR instruction, that is the pulse output amount.

D 9 374 Lower 16 bits The Y0's current location (present value, PV) of positioning (by user unit). ○ ○ ○ ○
D 9 375 Upper 16 bits The initial value is 0.

426
Register Description
ID No. Series
Y2 Axis's Positioning Control VS1 VS2 VSM VS3
D9380 Lower 16 bits The Y2's maximum speed (by user unit).
(Convert it to the real frequency that should appropriate to the PLC's range: ○ ○ ○ ○
D9381 Upper 16 bits VS1, VS2 is 1~50kHz; VSM, VS3 is 1~200kHz; VSM-28ML is 1~1MHz)
D 9 382 The Y2's bias speed (by user unit). (Convert it to the real frequency should between 0~20kHz). ○ ○ ○ ○

The Y2's acceleration time, range = 0~32,000ms.


D 9 383 If <0, then equal to 0; if >32,000, then equal to 32,000. ○ ○ ○ ○

The Y2's deceleration time, range = 0~32,000ms.


D 9 384 If <0, then equal to 0; if >32,000, then equal to 32,000. ○ ○ ○ ○

The Y2's number of PG0 input when to execute the ZRN instruction, range = 1~32,767.
D9385 If out of the range, then equal to 1. ○ ○ ○ ○

D9386 Lower 16 bits The Y2's preset value when the ZRN is nished (by user unit).
(Convert it to the number of pulse should between -2,147,483,648~ ○ ○ ○ ○
D9387 Upper 16 bits +2,147,483,647)
The Y2's pulse output speed multiple ratio, ranging from 1~30,000 = 0.1%~3,000.0%.
D 9 388 If over the range, then equal to 1,000 (100.0%). ○ ○ ○ ○

■ D 9 389 The Y2's M-code register. ○ ○ ○ ○

■ D9390 Lower 16 bits The Y2's current speed (by user unit). If used for the PLSY or PLSR
○ ○ ○ ○
■ D9391 Upper 16 bits instruction, that is the current speed by the unit of Hz.

D 9 392 Lower 16 bits The Y2's current location (by the number of pulse). The initial value is 0.
○ ○ ○ ○
D 9 393 Upper 16 bits If used for the PLSY or PLSR instruction, that is the pulse output amount.

D 9 394 Lower 16 bits The Y2's current location (present value, PV) of positioning (by user unit). ○ ○ ○ ○
D 9 395 Upper 16 bits The initial value is 0.

Y3 Axis's Positioning Control VS1 VS2 VSM VS3


D9400 Lower 16 bits The Y3's maximum speed (by user unit).
(Convert it to the real frequency that should appropriate to the PLC's range: ○ ○ ○ ○
D9401 Upper 16 bits VS1, VS2 is 1~50kHz; VSM, VS3 is 1~200kHz; VSM-28ML is 1~1MHz)
D 9 402 The Y3's bias speed (by user unit). (Convert it to the real frequency should between 0~20kHz). ○ ○ ○ ○

The Y3's acceleration time, range = 0~32,000ms.


D 9 403 If <0, then equal to 0; if >32,000, then equal to 32,000. ○ ○ ○ ○

The Y3's deceleration time, range = 0~32,000ms.


D 9 404 If <0, then equal to 0; if >32,000, then equal to 32,000. ○ ○ ○ ○

The Y3's number of PG0 input when to execute the ZRN instruction, range = 1~32,767.
D9405 If out of the range, then equal to 1. ○ ○ ○ ○

D9406 Lower 16 bits The Y3's preset value when the ZRN is nished (by user unit).
(Convert it to the number of pulse should between -2,147,483,648~ ○ ○ ○ ○
D9407 Upper 16 bits +2,147,483,647)
D 9 408 The Y3's pulse output speed multiple ratio, ranging from 1~30,000 = 0.1%~3,000.0%. ○ ○ ○ ○
If over the range, then equal to 1,000 (100.0%).
■ D 9 409 The Y3's M-code register. ○ ○ ○ ○

■ D9410 Lower 16 bits The Y3's current speed (by user unit). If used for the PLSY or PLSR instruction,
○ ○ ○ ○
■ D9411 Upper 16 bits that is the current speed by the unit of Hz.

D 9 412 Lower 16 bits The Y3's current location (by the number of pulse). The initial value is 0.
○ ○ ○ ○
If used for the PLSY or PLSR instruction, that is the pulse output amount.
D 9 413 Upper 16 bits
D 9 414 Lower 16 bits The Y3's current location (present value, PV) of positioning (by user unit). ○ ○ ○ ○
D 9 415 Upper 16 bits The initial value is 0.

427
428
8-3 Positioning Control Instructions

FNC Applicable VS
Mnemonic in Ladder Chart Function Description
No. 1 2 M 3

300 D Z R N S1 S2 D1 D2 Zero Return (Home positioning) ○ ○ ○ ○

301 D J O G F S1 S2 D1 D2 Jog Forward ○ ○ ○ ○

302 D J O G R S1 S2 D1 D2 Jog Reverse ○ ○ ○ ○

303 D D R V R S1 S2 D1 D2 Drive to Relative Position ○ ○ ○ ○

304 D D R V A S1 S2 D1 D2 Drive to Absolute Position ○ ○ ○ ○

305 D D V 2 R S1 S2 D1 D2 Drive to Relative Position by 2 Stages ○ ○ ○ ○

306 D D V 2 A S1 S2 D1 D2 Drive to Absolute Position by 2 Stages ○ ○ ○ ○

307 D D V I T S1 S2 D1 D2 Interrupt Constant Quantity Positioning ○ ○ ○ ○

2 Stages Interrupt Constant


308 D D V 2 I S1 S2 D1 D2 Quantity Positioning
○ ○ ○ ○

Interrupt to Stop or Drive to


309 D D V S R S1 S2 D1 D2 ○ ○ ○ ○
Relative Position
Interrupt to Stop or Drive to
310 D D V S A S1 S2 D1 D2 ○ ○ ○ ○
Absolute Position

311 DPLSV S D1 D2 Variable Speed Pulse Output ○ ○ ○ ○

312 D T B L S1 S2 D1 D2 Data Table Positioning ○ ○ ○ ○

313 DABS S D1 D2 Absolute Current Value Read ○ ○ ○ ○

314 M P G S1 S2 D1 D2 Handwheel Positioning ○ ○ ○ ○

315 DLIR S D Relative Linear Interpolation ○ ○ ○ ○

316 DLIA S D Absolute Linear Interpolation ○ ○ ○ ○

429
FNC 1 2 M 3
D Z R N S1 S2 D1 D2 Zero Return (Home positioning)
300 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D1
D2
D1 = Y0~Y3 If the D2 is assigned to a Y, it must use Y0~Y7

S1 S2 D1 D2 S1 : the home positioning speed (by user unit)


M0
DZRN K50000 K1000 Y0 Y4 S2 : the home positioning creep speed (by user unit)
D1 : the output point of generated pulse string
D2 : the output point of direction control signal

The executive mode of this zero return example is using the “DOG Rear End with PG0 count home positioning”
which is appointed by the “Positioning Parameter Setup” under the Ladder Master S. Also, The DOG signal is
assigned to X10, PG0 signal to X0 and CLR outputs by Y10.
Speed

Direction of home positioning


DOG Front End, start to slow down

Home positioning
S 1 speed Stop immediately when the PG0’s
counting set value is reached

Home positioning
S 2 creep speed
Time

M0
Condition contact

DOG Signal X10

PG0 Signal X0 1 2
Starts to count PG0 signals after DOG’s Rear End
CLR Signal Y10 is appeared. The set number of PG0 signals = 2.

M9342 Positioning
completed ag
M9344 Home positioning
complete ag

The DOG signal may use a X or M. Usually assigned to the X0~X7, because the interrupt
input point can have the instant response.
Should avoid the DOG's Rear End signal to be too close to the PG0's Front End signal, that
may cause the PG0 counting error.
For the PG0 signal input, must use X0~X7. The PLC processes the counting by the way of
interrupt.
The CLR signal output can assign to a Y or M, the width of that “ON” signal is ≥ 20ms.

When M0 = “ON”, the ZRN instruction starts to execute. With the assigned speeds S 1 , S 2 and following the
selected home return mode, to complete the home positioning action. Then the preset value of home position
(D9347, D9346) will be duplicated to the present value of Y0 axis (D9355, D9354).
The VS series PLC provides with 5 home return modes (DOG Rear End home positioning / DOG Front End home
positioning / DOG Rear End with PG0 count home positioning / DOG Front End with PG0 count home positioning
and Data-set type home return). For the details of their actions, please refer to the section 8-1-3 “Positioning
Operation Setup”.
S 1 is for to assign the operating speed of home positioning
The available range is from the bias speed (D9342) to the maximum speed (D9341, D9340).
When S 1 < the bias speed, it will be regarded as the bias speed. Oppositely, when S 1 > the maximum
speed, it will be regarded as the maximum speed.

430
S 2 is for to assign the creep speed when the DOG near point is triggered.
The available range is from the bias speed (D9342) to the equivalent speed of 30 kHz.
When S 2 < the bias speed, it will be regarded as the bias speed; when S 2 > the equivalent speed of 30 kHz,
it will be regarded as the equivalent speed of 30 kHz.
D 1 is for to assign the output point of generated pulse string.
It can only appoint to a point between Y0~Y3, and must use a transistor or line driver output Main Unit.
D 2 is for to assign the output point of direction control signal.
When the output of direction control signal is “ON”, the motor moves forward; conversely, “OFF” moves
reverse.
Besides, the “ON”/“OFF” status of the direction control signal is related to both the parameters of the rotational
direction (increase present value when forward / backward) and the return direction (by the direction of present
value increasing / decreasing).

When the M0 turns from “OFF” to “ON”, this ZRN instruction uses the parameters of the bias speed (D9342), the
maximum speed (D9341, D9340), the acceleration time (D9343), the deceleration time (D9344), S 1 the home
positioning speed, S 2 the home positioning creep speed, the speed multiple ratio (D9348) and the setup about
home positioning to decide the home positioning procedures. During this instruction is in operation, to change any
parameter above will be regarded as invalid. Which is different from other positioning instructions and should pay
attention to this.
When the return action is completed, that will let the zero home positioning has been completed ag M9344 = “ON”.
If the condition contact M0 turns “OFF” before it is nished, the movement will be gradually slow down then stop.
The example below uses Y0 output axis for the description of this instruction since the output axes Y1~Y3 have the
same function. The three devices between parentheses ( ) indicate those are corresponding to Y1~Y3 respectively.
M9340 indicates the Y0 is occupied by a positioning instruction. (M9360, M9380, M9400)
Any instruction uses the Y0 to generate pulse string and it is already activated, that will occupy the resource of Y0
axis consistently. However, turn the condition contact of this activated instruction “OFF” could release the resource.
Thus, before to activate this instruction should conrm the state of M9340.
If the M9340 = “ON”, that indicates the Y0 is BUSY to generate pulse string or other instruction still occupies the
resource of the Y0. Even though, the condition contact of this instruction is “ON”, the instruction will not execute.
If the M9340 = “OFF”, that indicates the Y0 is in the READY status (its resource is free to use), the Y0 can be used
for this instruction.
M9341 is the pulse output monitor of the Y0. (M9361, M9381, M9401)
When the Y0 is generating pulses, M9341 = “ON”.
M9342 is the positioning completed ag of the Y0. (M9362, M9382, M9402)
When the Y0's positioning instruction is completed, M9342 = “ON”.
Turn “OFF” the condition contact of the completed instruction will lead the ag M9342 “OFF”.
M9343 is the positioning abnormal stop ag of the Y0. (M9363, M9383, M9403)
Trigger any related compulsive stop ag during the unnished positioning or the ZRN instruction could not nd the
DOG signal, that will cause Y0 stops to generate pulses and let the M9343 = “ON” to indicate this stop is abnormal.
Turn “OFF” the condition contact of the activated instruction will lead the ag M9343 “OFF”.
M9344 is the home positioning completed ag of the Y0. (M9364, M9384, M9404)
When the Y0's ZRN instruction has completed, M9344 = “ON”.
When the ZRN instruction is operated again, the M9344 will be reset to “OFF”.
M9345 is the ag to stop the Y0 generating pulse string (by gradually slow down). (M9365, M9385, M9405)
When the M9345 is turned “ON”, the pulse generating at the Y0 will gradually slow down then stop.
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
M9346 is the ag to imminently stop the Y0 generating pulse string. (M9366, M9386, M9406)
When the M9346 is turned “ON”, the pulse generating at the Y0 will stop imminently (without to slow down).
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
Forward / Reverse limit switch (under the “Positioning Parameter Setup” of the Ladder Master S).
When the forward / reverse limit switch is active, that limits all the forward / reverse actions. That makes the forward
/ reverse motor to slow down and stop.
At this moment, only the moving request of opposite direction can be accepted.
D9348 is the multiple ratio of the Y0 positioning speed. (D9368, D9388, D9408)
The actual operating speed at Y0 positioning is equal to the operating speed designated by the positioning
instruction multiplied by the value of the multiple ratio.
Before the ZRN instruction operates, the actual operating speed at Y0 positioning can be modied by changing the
ratio. But, to change the ratio could not modify the actual operating speed during the ZRN instruction is operating.
Its available value range to be set is 1~30,000 (Unit: 0.1%), therefore the speed multiple ratio is 0.1%~3,000.0%.
D9351, D9350 display the positioning current speed of Y0. (DD9370, DD9390, DD9410)
When the instruction is active, this 32-bit special register shows the present value of operating speed (by user unit).
D9355, D9354 display the positioning location (present value PV) of Y0. (DD9374, DD9394, DD9414) (by user unit)
When the power is turned from “OFF” to “ON”, the initial value of this 32-bit special register is 0. Afterward, to
operate any related positioning control instruction will affect to its content, it shows the location of Y0 (by user unit).
When this ZRN instruction is operated and completed, the preset value of the home point will be lled in.

431
FNC 1 2 M 3
D J O G F S1 S2 D1 D2 Jog Forward
301 ○ ○ ○ ○
FNC 1 2 M 3
D J O G R S1 S2 D1 D2 Jog Reverse
302 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D1
D2
S1 = 0~5,000 D1 = Y0~Y3 If the D2 is assigned to a Y, it must use Y0~Y7

S1 S2 D1 D2 S1 : the start delay time (Unit: ms.)


M0
JOGF K300 D20 Y0 Y4 S2 : the operating speed (by user unit)
D1 : the output point of generated pulse string
D2 : the output point of direction control signal

Speed Acceleration time Deceleration time


(D9343) (D9344)

Maximum speed
(D9341, D9340)

S1
S 2 Operating speed

One unit of the position Bias speed (D9342)


that is user dened Time

M0
Condition contact
M9340
READY/BUSY Flag
M9341
Pulse output monitor ag

When M0 = “ON”, the Y0 outputs pulse string as the diagram above. During the pulse string generates, the
content value of the S 2 can be modied in order to change the operating speed. If the condition contact M0 turns
“OFF” during the pulse string is output, the movement will be gradually slow down then stop.
If the period of the M0 = “ON” is less than the start delay time S 1 or the time needed for one unit of the position,
the Y0 will generate the particular number of pulses that is equal to one unit of the position.
If the period of the M0 = “ON” is longer than the start delay time S 1 , as the diagram above shows, rst the Y0 will
generate the particular number of pulses that is equal to one unit of the position. After the start delay time S 1 is
reached, it begins to generate pulses continually.
S 1 is for to assign the start delay time, unit: ms.
The available range is 0~5,000.
When S 1 < 0, it will be regarded as 0; when S 1 >5,000, it will be regarded as 5,000.
S 2 is for to assign the operating speed of JOG.
The available range is from the bias speed (D9342) to the maximum speed (D9341, D9340).
When S 2 < the bias speed, it will be regarded as the bias speed; when S 2 > the maximum speed, it will be
regarded as the maximum speed.
D 1 is for to assign the output point of generated pulse string.
It can only appoint to a point between Y0~Y3, and must use a transistor or line driver output Main Unit.
D 2 is for to assign the output point of direction control signal.
When the output of direction control signal is “ON”, the motor moves forward; conversely, “OFF” moves reverse.
Besides, the “ON”/“OFF” status of the direction control signal is decided by the JOGF or JOGR instruction is
executed.

432
When the M0 turns from “OFF” to “ON”, the JOGF or JOGR instruction uses the parameters of the bias speed
(D9342), the maximum speed (D9341, D9340), the acceleration time (D9343), the deceleration time (D9344), S 1
the start delay time, S 2 the operating speed and the speed multiple ratio (D9348) to decide the jog positioning
procedures. During the instruction is in operation, could change the value of the S 2 operating speed or the speed
multiple ratio (D9348) to modify the real operating speed, but to change other parameters above will be regarded
as invalid.
These instructions can be used as many times as required and the points Y0~Y3 can be used to generate pulses
individually at the same time.
The example below uses Y0 output axis for the description of this instruction since the output axes Y1~Y3 have the
same function. The three devices between parentheses ( ) indicate those are corresponding to Y1~Y3 respectively.
M9340 indicates the Y0 is occupied by a positioning instruction. (M9360, M9380, M9400)
Any instruction uses the Y0 to generate pulse string and it is already activated, that will occupy the resource of Y0
axis consistently. However, turn the condition contact of this activated instruction “OFF” could release the resource.
Thus, before to activate this instruction should conrm the state of M9340.
If the M9340 = “ON”, that indicates the Y0 is BUSY to generate pulse string or other instruction still occupies the
resource of the Y0. Even though, the condition contact of this instruction is “ON”, the instruction will not execute.
If the M9340 = “OFF”, that indicates the Y0 is in the READY status (its resource is free to use), the Y0 can be used
for this instruction.
M9341 is the pulse output monitor of the Y0. (M9361, M9381, M9401)
When the Y0 is generating pulses, M9341 = “ON”.
M9345 is the ag to stop the Y0 generating pulse string (by gradually slow down). (M9365, M9385, M9405)
When the M9345 is turned “ON”, the pulse generating at the Y0 will gradually slow down then stop.
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
M9346 is the ag to imminently stop the Y0 generating pulse string. (M9366, M9386, M9406)
When the M9346 is turned “ON”, the pulse generating at the Y0 will stop imminently (without to slow down).
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
Forward / Reverse limit switch (under the “Positioning Parameter Setup” of the Ladder Master S).
When the forward / reverse limit switch is active, that limits all the forward / reverse actions. That makes the
forward / reverse motor to slow down and stop.
At this moment, only the moving request of opposite direction can be accepted.
D9348 is the multiple ratio of the Y0 positioning speed. (D9368, D9388, D9408)
The actual operating speed at Y0 positioning is equal to the operating speed designated by the positioning
instruction multiplied by the value of the multiple ratio.
During the instruction is operating, to change the ratio could modify the Y0's actual operating speed.
Its available value range to be set is 1~30,000 (Unit: 0.1%), therefore the speed multiple ratio is 0.1%~3,000.0%.
D9351, D9350 display the positioning current speed of Y0. (DD9370, DD9390, DD9410)
When the instruction is active, this 32-bit special register shows the present value of operating speed
(by user unit).
D9355, D9354 display the positioning location (present value PV) of Y0. (DD9374, DD9394, DD9414) (by user unit)
When the power is turned from “OFF” to “ON”, the initial value of this 32-bit special register is 0. Afterward,
to operate any related positioning control instruction will affect to its content, it shows the location of Y0
(by user unit).

433
FNC 1 2 M 3
D D R V R S1 S2 D1 D2 Drive to Relative Position
303 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D1
D2
D1 = Y0~Y3 If the D2 is assigned to a Y, it must use Y0~Y7

S1 S2 D1 D2 S1 : the moving distance (by user unit)


M0
DRVR D10 D20 Y0 Y4 S2 : the operating speed (by user unit)
D1 : the output point of generated pulse string
D2 : the output point of direction control signal

Speed Acceleration time Deceleration time


(D9343) (D9344)

Maximum speed
(D9341, D9340)

S 2 Operating speed

S 1 Moving distance

Bias speed (D9342)


Time

M0
Condition contact
M9340
READY/BUSY Flag
M9341
Pulse output monitor ag
M9342
Positioning completed ag

When M0 = “ON”, as the diagram above, the Y0 by the set operating speed S 2 to generate the corresponding
number of pulses. That pulse number comes from the set value of moving distance S 1 . When the number of the
moving distance is nished, it stops to generate pulses, the positioning action is completed.
Assume that the rotational mode “Increase present value when forward” is selected. If the set value of the moving
distance S 1 is a positive number, that needs to increase the present value, thus the instruction will turn the Y4
“ON” to drive motor moves forward. On the other hand, the set value of the moving distance is a negative number,
that needs to decrease the present value, thus the instruction will turn the Y4 “OFF” to drive motor moves backward.
S 1 is for to assign the moving distance.
If the S 1 > 0, it will move in the direction of to increase the present value. Oppositely, if the S 1 < 0, it will
move in the direction of to decrease the present value. The PLC will convert this distance to the pulse unit for
the positioning, thus the converted number must meet the range of a 32-bit data. If the converted value is
exceeded, the PLC will be regarded that as an operating error and M9067 will be “ON”.
S 2 is for to assign the operating speed.
The available range is from the bias speed (D9342) to the maximum speed (D9341, D9340).
When S 2 < the bias speed, it will be regarded as the bias speed; when S 2 > the maximum speed, it will be
regarded as the maximum speed.
D 1 is for to assign the output point of generated pulse string.
It can only appoint to a point between Y0~Y3, and must use a transistor or line driver output Main Unit.
D 2 is for to assign the output point of direction control signal.
When the output of direction control signal is “ON”, the motor moves forward; conversely, “OFF” moves
reverse.
Besides, the “ON”/“OFF” status of the direction control signal is decided by both the +/– numerical value of
the distance S 1 and the parameter of the rotational direction (increase present value when forward /
backward) are executed.

434
When the M0 turns from “OFF” to “ON”, this DRVR instruction uses the parameters of the bias speed (D9342), the
maximum speed (D9341, D9340), the acceleration time (D9343), the deceleration time (D9344), S 1 the moving
distance, S 2 the operating speed and the speed multiple ratio (D9348) to decide the positioning procedures.
During the instruction is in operation, could change the value of the S 2 operating speed or the speed multiple ratio
(D9348) to modify the real operating speed, but to change other parameters above will be regarded as invalid.
When this instruction completes the S 1 specic distance move, that will let the positioning completed ag
M9342 = “ON”.
If the condition contact M0 turns “OFF” during the pulse is output, the movement will be gradually slow down then
stop. Thus, that will not to turn the positioning completed ag M9342 “ON”.
This instruction can be written as many times as required and the points Y0~Y3 can be used to generate pulses
individually at the same time.
The example below uses Y0 output axis for the description of this instruction since the output axes Y1~Y3 have the
same function. The three devices between parentheses ( ) indicate those are corresponding to Y1~Y3 respectively.
M9340 indicates the Y0 is occupied by a positioning instruction. (M9360, M9380, M9400)
Any instruction uses the Y0 to generate pulse string and it is already activated, that will occupy the resource of Y0
axis consistently. However, turn the condition contact of this activated instruction “OFF” could release the resource.
Thus, before to activate this instruction should conrm the state of M9340.
If the M9340 = “ON”, that indicates the Y0 is BUSY to generate pulse string or other instruction still occupies the
resource of the Y0. Even though, the condition contact of this instruction is “ON”, the instruction will not execute.
If the M9340 = “OFF”, that indicates the Y0 is in the READY status (its resource is free to use), the Y0 can be used
for this instruction.
M9341 is the pulse output monitor of the Y0. (M9361, M9381, M9401)
When the Y0 is generating pulses, M9341 = “ON”.
M9342 is the positioning completed ag of the Y0. (M9362, M9382, M9402)
When the Y0's positioning instruction is completed, M9342 = “ON”.
Turn “OFF” the condition contact of the completed instruction will lead the ag M9342 “OFF”.
M9343 is the positioning abnormal stop ag of the Y0. (M9363, M9383, M9403)
Trigger any related compulsive stop ag or the forward / reverse limit switch during the unnished Y0 positioning
function, will cause Y0 stops to generate pulses and let the M9343 = “ON” to indicate this stop is abnormal.
Turn “OFF” the condition contact of the activated instruction will lead the ag M9343 “OFF”.
M9345 is the ag to stop the Y0 generating pulse string (by gradually slow down). (M9365, M9385, M9405)
When the M9345 is turned “ON”, the pulse generating at the Y0 will gradually slow down then stop.
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
M9346 is the ag to imminently stop the Y0 generating pulse string. (M9366, M9386, M9406)
When the M9346 is turned “ON”, the pulse generating at the Y0 will stop imminently (without to slow down).
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
Forward / Reverse limit switch (under the “Positioning Parameter Setup” of the Ladder Master S).
When the forward / reverse limit switch is active, that limits all the forward / reverse actions. That makes the
forward / reverse motor to slow down and stop.
At this moment, only the moving request of opposite direction can be accepted.
D9348 is the multiple ratio of the Y0 positioning speed. (D9368, D9388, D9408)
The actual operating speed at Y0 positioning is equal to the operating speed designated by the positioning
instruction multiplied by the value of the multiple ratio.
During the instruction is operating, to change the ratio could modify the Y0's actual operating speed.
Its available value range to be set is 1~30,000 (Unit: 0.1%), therefore the speed multiple ratio is 0.1%~3,000.0%.
D9351, D9350 display the positioning current speed of Y0. (DD9370, DD9390, DD9410)
When the instruction is active, this 32-bit special register shows the present value of operating speed
(by user unit).
D9355, D9354 display the positioning location (present value PV) of Y0. (DD9374, DD9394, DD9414) (by user unit)
When the power is turned from “OFF” to “ON”, the initial value of this 32-bit special register is 0. Afterward,
to operate any related positioning control instruction will affect to its content, it shows the location of Y0
(by user unit).

435
FNC 1 2 M 3
D D R V A S1 S2 D1 D2 Drive to Absolute Position
304 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D1
D2
D1 = Y0~Y3 If the D2 is assigned to a Y, it must use Y0~Y7

S1 S2 D1 D2 S1 : the moving target (by user unit)


M0
DDRVA D10 D20 Y0 Y4 S2 : the operating speed (by user unit)
D1 : the output point of generated pulse string
D2 : the output point of direction control signal
Speed Acceleration time Deceleration time
(D9343) (D9344)

Maximum speed
(D9341, D9340)

S 2 Operating speed
Distance to be moved (error) =
Moving target S 1
Distance to be moved (error)
− Y0's PV (DD9354)

Bias speed (D9342)


Time

M0
Condition contact
M9340
READY/BUSY Flag
M9341
Pulse output monitor ag
M9342
Positioning completed ag

When M0 = “ON”, as the diagram above, the Y0 by the set operating speed S 2 to generate the corresponding
number of pulses. That number of pulses is converted from the error (distance to be moved) between the set value
of S 1 (D11, D10) and the present value of Y0's position (D9355, D9354). When the positioning action is completed
(to make the PV at D9355, D9354 = D11, D10), it stops to generate pulses.
Assume that the rotational mode “Increase present value when forward” is selected. If the error (distance to be
moved) is a positive number (the moving target S 1 > the axis's present value), that needs to increase the present
value, thus the instruction will turn the Y4 “ON” to drive motor moves forward. On the other hand, the error
(distance to be moved) is a negative number (the moving target S 1 < the axis's present value), that needs to
decrease the present value, thus the instruction will turn the Y4 “OFF” to drive motor moves backward.
S 1 is for to assign the moving target.
This moving target is an absolute point relative to the zero point. If the error is a positive ( S 1 − PV > 0) , it will
move in the direction of to increase the present value. Oppositely, if the error is a negative ( S 1 − PV < 0), it
will moving in the direction of to decrease the present value. The PLC will convert this moving target to the
pulse unit for the positioning, thus the converted number must meet the range of a 32-bit data. If the converted
value is exceeded this range, the PLC will be regarded that as an operating error and M9067 will be “ON”.
S 2 is for to assign the operating speed.
The available range is from the bias speed (D9342) to the maximum speed (D9341, D9340).
When S 2 < the bias speed, it will be regarded as the bias speed; when S 2 > the maximum speed, it will be
regarded as the maximum speed.
D 1 is for to assign the output point of generated pulse string.
It can only appoint to a point between Y0~Y3, and must use a transistor or line driver output Main Unit.
D 2 is for to assign the output point of direction control signal.
When the output of direction control signal is “ON”, the motor moves forward; conversely, “OFF” moves reverse.
Besides, the “ON”/”OFF” status of the direction control signal is decided by both the +/− numerical value of the
error ( S 1 − PV) and the parameter of the rotational direction (increase present value when forward / backward)
are executed.

436
When the M0 turns from “OFF” to “ON”, this DRVA instruction uses the parameters of the bias speed (D9342), the
maximum speed (D9341, D9340), the acceleration time (D9343), the deceleration time (D9344), the moving target
S 1 , the present value (PV, D9355, D9354), the operating speed S 2 and the speed multiple ratio (D9348) to
decide the positioning procedures. During the instruction is in operation, could change the value of the operating
speed S 2 or the speed multiple ratio (D9348) to modify the real operating speed, but to change other parameters
above will be regarded as invalid.
When this instruction completes the movement (generates pulses to make its present value PV equal to the S 1 ),
that will let the positioning completed ag M9342 = “ON”.
If the condition contact M0 turns “OFF” during the pulse is output, the movement will be gradually slow down then
stop. Thus, that will not to turn the positioning completed ag M9342 “ON”.
This instruction can be written as many times as required and the points Y0~Y3 can be used to generate pulses
individually at the same time.
The example below uses Y0 output axis for the description of this instruction since the output axes Y1~Y3 have the
same function. The three devices between parentheses ( ) indicate those are corresponding to Y1~Y3 respectively.
M9340 indicates the Y0 is occupied by a positioning instruction. (M9360, M9380, M9400)
Any instruction uses the Y0 to generate pulse string and it is already activated, that will occupy the resource of Y0
axis consistently. However, turn the condition contact of this activated instruction “OFF” could release the resource.
Thus, before to activate this instruction should conrm the state of M9340.
If the M9340 = “ON”, that indicates the Y0 is BUSY to generate pulse string or other instruction still occupies the
resource of the Y0. Even though, the condition contact of this instruction is “ON”, the instruction will not execute.
If the M9340 = “OFF”, that indicates the Y0 is in the READY status (its resource is free to use), the Y0 can be used
for this instruction.
M9341 is the pulse output monitor of the Y0. (M9361, M9381, M9401)
When the Y0 is generating pulses, M9341 = “ON”.
M9342 is the positioning completed ag of the Y0. (M9362, M9382, M9402)
When the Y0's positioning instruction is completed, M9342 = “ON”.
Turn “OFF” the condition contact of the completed instruction will lead the ag M9342 “OFF”.
M9343 is the positioning abnormal stop ag of the Y0. (M9363, M9383, M9403)
Trigger any related compulsive stop ag or the forward / reverse limit switch during the unnished Y0 positioning
function, will cause Y0 stops to generate pulses and let the M9343 = "ON" to indicate this stop is abnormal.
Turn “OFF” the condition contact of the activated instruction will lead the ag M9343 “OFF”.
M9345 is the ag to stop the Y0 generating pulse string (by gradually slow down). (M9365, M9385, M9405)
When the M9345 is turned “ON”, the pulse generating at the Y0 will gradually slow down then stop.
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
M9346 is the ag to imminently stop the Y0 generating pulse string. (M9366, M9386, M9406)
When the M9346 is turned “ON”, the pulse generating at the Y0 will stop imminently (without to slow down).
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
Forward / Reverse limit switch (under the “Positioning Parameter Setup” of the Ladder Master S).
When the forward / reverse limit switch is active, that limits all the forward / reverse actions. That makes the
forward / reverse motor to slow down and stop.
At this moment, only the moving request of opposite direction can be accepted.
D9348 is the multiple ratio of the Y0 positioning speed. (D9368, D9388, D9408)
The actual operating speed at Y0 positioning is equal to the operating speed designated by the positioning
instruction multiplied by the value of the multiple ratio.
During the instruction is operating, to change the ratio could modify the Y0's actual operating speed.
Its available value range to be set is 1~30,000 (Unit: 0.1%), therefore the speed multiple ratio is 0.1%~3,000.0%.
D9351, D9350 display the positioning current speed of Y0. (DD9370, DD9390, DD9410)
When the instruction is active, this 32-bit special register shows the present value of operating speed
(by user unit).
D9355, D9354 display the positioning location (present value PV) of Y0. (DD9374, DD9394, DD9414) (by user unit)
When the power is turned from “OFF” to “ON”, the initial value of this 32-bit special register is 0. Afterward,
to operate any related positioning control instruction will affect to its content, it shows the location of Y0
(by user unit).

437
FNC 1 2 M 3
D D V 2 R S1 S2 D1 D2 Drive to Relative Position by 2 Stages
305 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D1
D2
S1 and S2 occupy 2 components respectively D1 = Y0~Y3 If the D2 is assigned to a Y, it must use Y0~Y7

S1 S2 D1 D2 S1 : the head register of moving distances (by user unit)


M0
DV2R D10 D20 Y0 Y4 S2 : the head register of operating speeds (by user unit)
D1 : the output point of generated pulse string
D2 : the output point of direction control signal

Speed Acceleration time Deceleration time


(D9343) (D9344)

Maximum speed
(D9341, D9340)

S1 S2
Operating
S 1 +1
Moving
distance speed #1 Moving S 2 +1
#1 distance #2
Operating
speed #2
Bias speed (D9342)
Time

M0
Condition contact
M9340
READY/BUSY Flag
M9341
Pulse output monitor ag
M9342
Positioning completed ag

When M0 = “ON”, as the diagram above, at the rst stage, the Y0 uses the operating speed #1 (D20) and distance
#1 (D10) to generate the corresponding number of pulses. Subsequently at the second stage, it uses the operating
speed #2 (D21) and distance #2 (D11) to generate the corresponding number of pulses. When the distance #2 is
nished, it stops to generate pulses, the two stages positioning action is completed.
Assume that the rotational mode “Increase present value when forward” is selected. If the set value of the moving
distance is a positive number, that needs to increase the present value, thus the instruction will turn the Y4 “ON” to
drive motor moves forward. On the other hand, the set value of the moving distance is a negative number, that
needs to decrease the present value, thus the instruction will turn the Y4 “OFF” to drive motor moves backward.
S 1 is for to assign the moving distance #1 and the following S 1 +1 is for to assign the moving distance #2.
If the content value of the moving distance > 0, it will move in the direction of to increase the present value.
Oppositely, if the content value of the moving distance < 0, it will move in the direction of to decrease the
present value. The PLC will convert these distances to the pulse unit for the positioning, thus the converted
numbers must meet the range of a 32-bit data. If a converted value is exceeded, the PLC will be regarded that
as an operating error and M9067 will be “ON”.
S 2 is for to assign the operating speed #1 and the following S 2 +1 is for to assign the operating speed #2.
The available range is from the bias speed (D9342) to the maximum speed (D9341, D9340).
When the content value of the operating speed < the bias speed, it will be regarded as the bias speed; when
the content value of the operating speed > the maximum speed, it will be regarded as the maximum speed.
D 1 is for to assign the output point of generated pulse string.
It can only appoint to a point between Y0~Y3, and must use a transistor or line driver output Main Unit.
D 2 is for to assign the output point of direction control signal.
When the output of direction control signal is “ON”, the motor moves forward; conversely, “OFF” moves reverse.
Besides, the “ON”/“OFF” status of the direction control signal is decided by both the +/– numerical value of the
distance to be moved at the stage and the parameter of the rotational direction (increase present value when
forward / backward) are executed.

438
When the M0 turns from “OFF” to “ON”, this DV2R instruction uses the parameters of the bias speed (D9342), the
maximum speed (D9341, D9340), the acceleration time (D9343), the deceleration time (D9344), the moving
distances the operating speeds and the speed multiple ratio (D9348) to decide the positioning procedures. During
the instruction is in operation, could change the value of the operating speeds or the speed multiple ratio (D9348)
to modify the real operating speed, but to change other parameters above will be regarded as invalid.
When this instruction completes the movement of the amount of two specic moving distances, that will let the
positioning completed ag M9342 = “ON”.
If the condition contact M0 turns “OFF” during the pulse is output, the movement will be gradually slow down then
stop. Thus, that will not to turn the positioning completed ag M9342 “ON”.
If the values of the moving distances #1 and #2 are +/− opposite, the positioning of the stage #1 will be
executed rst. After that, it will make a brief pause, then carry on the operation of the opposite direction immediately.
This instruction can be written as many times as required and the points Y0~Y3 can be used to generate pulses
individually at the same time.
The example below uses Y0 output axis for the description of this instruction since the output axes Y1~Y3 have the
same function. The three devices between parentheses ( ) indicate those are corresponding to Y1~Y3 respectively.
M9340 indicates the Y0 is occupied by a positioning instruction. (M9360, M9380, M9400)
Any instruction uses the Y0 to generate pulse string and it is already activated, that will occupy the resource of Y0
axis consistently. However, turn the condition contact of this activated instruction “OFF” could release the resource.
Thus, before to activate this instruction should conrm the state of M9340.
If the M9340 = “ON”, that indicates the Y0 is BUSY to generate pulse string or other instruction still occupies the
resource of the Y0. Even though, the condition contact of this instruction is “ON”, the instruction will not execute.
If the M9340 = “OFF”, that indicates the Y0 is in the READY status (its resource is free to use), the Y0 can be used
for this instruction.
M9341 is the pulse output monitor of the Y0. (M9361, M9381, M9401)
When the Y0 is generating pulses, M9341 = “ON”.
M9342 is the positioning completed ag of the Y0. (M9362, M9382, M9402)
When the Y0's positioning instruction is completed, M9342 = “ON”.
Turn “OFF” the condition contact of the completed instruction will lead the ag M9342 “OFF”.
M9343 is the positioning abnormal stop ag of the Y0. (M9363, M9383, M9403)
Trigger any related compulsive stop ag or the forward / reverse limit switch during the unnished Y0 positioning
function, will cause Y0 stops to generate pulses and let the M9343 = “ON” to indicate this stop is abnormal.
Turn “OFF” the condition contact of the activated instruction will lead the ag M9343 “OFF”.
M9345 is the ag to stop the Y0 generating pulse string (by gradually slow down). (M9365, M9385, M9405)
When the M9345 is turned “ON”, the pulse generating at the Y0 will gradually slow down then stop.
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
M9346 is the ag to imminently stop the Y0 generating pulse string. (M9366, M9386, M9406)
When the M9346 is turned “ON”, the pulse generating at the Y0 will stop imminently (without to slow down).
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
Forward / Reverse limit switch (under the “Positioning Parameter Setup” of the Ladder Master S).
When the forward / reverse limit switch is active, that limits all the forward / reverse actions. That makes the
forward / reverse motor to slow down and stop.
At this moment, only the moving request of opposite direction can be accepted.
D9348 is the multiple ratio of the Y0 positioning speed. (D9368, D9388, D9408)
The actual operating speed at Y0 positioning is equal to the operating speed designated by the positioning
instruction multiplied by the value of the multiple ratio.
During the instruction is operating, to change the ratio could modify the Y0's actual operating speed.
Its available value range to be set is 1~30,000 (Unit: 0.1%), therefore the speed multiple ratio is 0.1%~3,000.0%.
D9351, D9350 display the positioning current speed of Y0. (DD9370, DD9390, DD9410)
When the instruction is active, this 32-bit special register shows the present value of operating speed
(by user unit).
D9355, D9354 display the positioning location (present value PV) of Y0. (DD9374, DD9394, DD9414) (by user unit)
When the power is turned from “OFF” to “ON”, the initial value of this 32-bit special register is 0. Afterward,
to operate any related positioning control instruction will affect to its content, it shows the location of Y0
(by user unit).

439
FNC 1 2 M 3
D D V 2 A S1 S2 D1 D2 Drive to Absolute Position by 2 Stages
306 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D1
D2
S1 and S2 occupy 2 components respectively D1 = Y0~Y3 If the D2 is assigned to a Y, it must use Y0~Y7

S1 S2 D1 D2 S1 : the head register of moving targets (by user unit)


M0
DDV2A D10 D20 Y0 Y4 S2 : the head register of operating speeds (by user unit)
D1 : the output point of generated pulse string
D2 : the output point of direction control signal

Speed Acceleration time Deceleration time


(D9343) (D9344)

Maximum speed
(D9341, D9340)

Distance to be moved (error) =


S2 Moving target
Distance − Y0's present value (PV)
Distance Operating
speed #1 to be S 2 +1
to be moved #2
moved #1 Operating
speed #2
Bias speed (D9342)
Time
M0
Condition contact
M9340
READY/BUSY Flag
M9341
Pulse output monitor ag
M9342
Positioning completed ag

At the rst stage, the Y0 uses the operating speed #1 (D21, D20) to generate pulses that will let its present value
(PV at D9355, D9354) equal to moving target #1 (D11, D10). Subsequently at the second stage, it uses the
operating speed #2 (D23, D22) to generate pulses that will let its present value (PV at D9355, D9354) equal to
moving target #2 (D13, D12). When the target #2 is arrived, it stops to generate pulses, the two stages
positioning is completed.
Assume that the rotational mode “Increase present value when forward” is selected. If the error (distance to be
moved) is a positive number (the moving target > the axis's present value), that needs to increase the present
value, thus the instruction will turn the Y4 “ON” to drive motor moves forward. On the other hand, the error
(distance to be moved) is a negative number (the moving target < the axis's present value), that needs to
decrease the present value, thus the instruction will turn the Y4 “OFF” to drive motor moves backward.
S 1 is for to assign the moving target #1 and the following S 1 +1 is for to assign the moving target #2.
If the content value of the distance to be moved (error) > 0 (target > PV), it will move in the direction of to
increase the present value. Oppositely, if the content value of the distance to be moved (error) < 0 (target < PV),
it will move in the direction of to decrease the present value. The PLC will convert these targets to the pulse unit
for the positioning, thus the converted numbers must meet the range of a 32-bit data. If a converted value is
exceeded, the PLC will be regarded that as an operating error and M9067 will be “ON”.
S 2 is for to assign the operating speed #1and the following S 2 +1 is for to assign the operating speed #2.
The available range is from the bias speed (D9342) to the maximum speed (D9341, D9340).
When the content value of the operating speed < the bias speed, it will be regarded as the bias speed; when
the content value of the operating speed > the maximum speed, it will be regarded as the maximum speed.
D 1 is for to assign the output point of generated pulse string.
It can only appoint to a point between Y0~Y3, and must use a transistor or line driver output Main Unit.

440
D 2 is for to assign the output point of direction control signal.
When the output of direction control signal is “ON”, the motor moves forward; conversely, “OFF” moves reverse.
Besides, the “ON”/“OFF” status of the direction control signal is decided by both the +/− numerical value of the
error at the stage and the parameter of the rotational direction (increase present value when forward / backward)
are executed.
When the M0 turns from “OFF” to “ON”, this DV2A instruction uses the parameters of the bias speed (D9342), the
maximum speed (D9341, D9340), the acceleration time (D9343), the deceleration time (D9344), the moving targets,
the present value (PV, D9355, D9354), the operating speeds and the speed multiple ratio (D9348) to decide the
positioning procedures. During the instruction is in operation, could change the value of the operating speeds or
the speed multiple ratio (D9348) to modify the real operating speed, but to change other parameters above will be
regarded as invalid.
When this instruction completes the movement (that generates pulses to make its present value PV equal to the
moving target #1 and #2 sequentially), that will let the positioning completed ag M9342 = “ON”.
If the condition contact M0 turns “OFF” during the pulse is output, the movement will be gradually slow down then
stop. Thus, that will not to turn the positioning completed ag M9342 “ON”.
This instruction can be written as many times as required and the points Y0~Y3 can be used to generate pulses
individually at the same time.
The example below uses Y0 output axis for the description of this instruction since the output axes Y1~Y3 have the
same function. The three devices between parentheses ( ) indicate those are corresponding to Y1~Y3 respectively.
M9340 indicates the Y0 is occupied by a positioning instruction. (M9360, M9380, M9400)
Any instruction uses the Y0 to generate pulse string and it is already activated, that will occupy the resource of Y0
axis consistently. However, turn the condition contact of this activated instruction “OFF” could release the resource.
Thus, before to activate this instruction should conrm the state of M9340.
If the M9340 = “ON”, that indicates the Y0 is BUSY to generate pulse string or other instruction still occupies the
resource of the Y0. Even though, the condition contact of this instruction is “ON”, the instruction will not execute.
If the M9340 = “OFF”, that indicates the Y0 is in the READY status (its resource is free to use), the Y0 can be used
for this instruction.
M9341 is the pulse output monitor of the Y0. (M9361, M9381, M9401)
When the Y0 is generating pulses, M9341 = “ON”.
M9342 is the positioning completed ag of the Y0. (M9362, M9382, M9402)
When the Y0's positioning instruction is completed, M9342 = “ON”.
Turn “OFF” the condition contact of the completed instruction will lead the ag M9342 “OFF”.
M9343 is the positioning abnormal stop ag of the Y0. (M9363, M9383, M9403)
Trigger any related compulsive stop ag or the forward / reverse limit switch during the unnished Y0 positioning
function, will cause Y0 stops to generate pulses and let the M9343 = "ON" to indicate this stop is abnormal.
Turn “OFF” the condition contact of the activated instruction will lead the ag M9343 “OFF”.
M9345 is the ag to stop the Y0 generating pulse string (by gradually slow down). (M9365, M9385, M9405)
When the M9345 is turned “ON”, the pulse generating at the Y0 will gradually slow down then stop.
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
M9346 is the ag to imminently stop the Y0 generating pulse string. (M9366, M9386, M9406)
When the M9346 is turned “ON”, the pulse generating at the Y0 will stop imminently (without to slow down).
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
Forward / Reverse limit switch (under the “Positioning Parameter Setup” of the Ladder Master S).
When the forward / reverse limit switch is active, that limits all the forward / reverse actions. That makes the
forward / reverse motor to slow down and stop.
At this moment, only the moving request of opposite direction can be accepted.
D9348 is the multiple ratio of the Y0 positioning speed. (D9368, D9388, D9408)
The actual operating speed at Y0 positioning is equal to the operating speed designated by the positioning
instruction multiplied by the value of the multiple ratio.
During the instruction is operating, to change the ratio could modify the Y0's actual operating speed.
Its available value range to be set is 1~30,000 (Unit: 0.1%), therefore the speed multiple ratio is 0.1%~3,000.0%.
D9351, D9350 display the positioning current speed of Y0. (DD9370, DD9390, DD9410)
When the instruction is active, this 32-bit special register shows the present value of operating speed
(by user unit).
D9355, D9354 display the positioning location (present value PV) of Y0. (DD9374, DD9394, DD9414) (by user unit)
When the power is turned from “OFF” to “ON”, the initial value of this 32-bit special register is 0. Afterward,
to operate any related positioning control instruction will affect to its content, it shows the location of Y0
(by user unit).

441
FNC 1 2 M 3
D D V I T S1 S2 D1 D2 Interrupt Constant Quantity Positioning
307 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D1
D2
D1 = Y0~Y3 If the D2 is assigned to a Y, it must use Y0~Y7

S1 S2 D1 D2 S1 : the distance to be moved after the interrupt is input (by user unit)
M0
DVIT D10 D20 Y0 Y4 S2 : the operating speed (by user unit)
D1 : the output point of generated pulse string
D2 : the output point of direction control signal

Speed Acceleration time Deceleration time


(D9343) (D9344)

Maximum speed
(D9341, D9340)

S 2 Operating speed

S1
Distance to be
moved after the
interrupt is input

Bias speed (D9342)


Time

M0
Condition contact
X0
The interrupt signal
M9340
READY/BUSY Flag
M9341
Pulse output monitor ag
M9342
Positioning completed ag

When M0 = “ON”, as the diagram above, the Y0 by the set operating speed S 2 to generate pulses. Until the
designated interrupt signal X0 is input (“OFF” → “ON”), it will continuously generate the corresponding number of
pulses then stop. That pulse number comes from the set value of distance to be moved after the interrupt is input
S 1 . When the number of distance is nished, the positioning action is completed.
Assume that the rotational mode “Increase present value when forward” is selected. If the set value of the distance
to be moved after the interrupt S 1 is a positive number, that needs to increase the present value, thus the
instruction will turn the Y4 “ON” to drive motor moves forward. On the other hand, the set value of the distance to
be moved after the interrupt S 1 is a negative number, that needs to decrease the present value, thus the instruction
will turn the Y4 “OFF” to drive motor moves backward.
The interrupt signal in this instruction is appointed by the “Positioning Parameter Setup” under the Ladder Master S.
Also, the signal must input from X0~X7, so the PLC can have an instant interrupt reaction.
Besides, the M9350 can be used to assign the interrupt trigger mode (“OFF” = rising edge; “ON” = falling edge).
S 1 is for to assign the distance to be moved after the interrupt is input.
If the S 1 > 0, it will move in the direction of to increase the present value. Oppositely, if the S 1 < 0, it will
move in the direction of to decrease the present value. The PLC will convert this distance to the pulse unit for
the positioning, thus the converted number must meet the range of a 32-bit data. If the converted value is
exceeded, the PLC will be regarded that as an operating error and M9067 will be “ON”.
S 2 is for to assign the operating speed.
The available range is from the bias speed (D9342) to the maximum speed (D9341, D9340).
When S 2 < the bias speed, it will be regarded as the bias speed; when S 2 > the maximum speed, it will be
regarded as the maximum speed.
D 1 is for to assign the output point of generated pulse string.
It can only appoint to a point between Y0~Y3, and must use a transistor or line driver output Main Unit.

442
D 2 is for to assign the output point of direction control signal.
When the output of direction control signal is “ON”, the motor moves forward; conversely, “OFF” moves reverse.
Besides, the “ON”/“OFF” status of the direction control signal is decided by both the +/– numerical value of the
S 1 and the parameter of the rotational direction (increase present value when forward / backward) are executed.
When the M0 turns from “OFF” to “ON”, this DVIT instruction uses the parameters of the bias speed (D9342), the
maximum speed (D9341, D9340), the acceleration time (D9343), the deceleration time (D9344), the distance to be
moved after the interrupt S 1 , the operating speedt S 2 and the speed multiple ratio (D9348) to decide the
positioning procedures. During the instruction is in operation, could change the value of the S 2 operating speed
or the speed multiple ratio (D9348) to modify the real operating speed, but to change other parameters above will
be regarded as invalid.

When this instruction has an interrupt input after it is active and it completes the S 1 specic distance move after
the interrupt, that will let the positioning completed ag M9342 = “ON”.
If the condition contact M0 turns “OFF” during the pulse is output, the movement will be gradually slow down then
stop. Thus, that will not to turn the positioning completed ag M9342 “ON”.
This instruction can be written as many times as required and the points Y0~Y3 can be used to generate pulses
individually at the same time.
The example below uses Y0 output axis for the description of this instruction since the output axes Y1~Y3 have the
same function. The three devices between parentheses ( ) indicate those are corresponding to Y1~Y3 respectively.
M9340 indicates the Y0 is occupied by a positioning instruction. (M9360, M9380, M9400)
Any instruction uses the Y0 to generate pulse string and it is already activated, that will occupy the resource of Y0
axis consistently. However, turn the condition contact of this activated instruction “OFF” could release the resource.
Thus, before to activate this instruction should conrm the state of M9340.
If the M9340 = “ON”, that indicates the Y0 is BUSY to generate pulse string or other instruction still occupies the
resource of the Y0. Even though, the condition contact of this instruction is “ON”, the instruction will not execute.
If the M9340 = “OFF”, that indicates the Y0 is in the READY status (its resource is free to use), the Y0 can be used
for this instruction.
M9341 is the pulse output monitor of the Y0. (M9361, M9381, M9401)
When the Y0 is generating pulses, M9341 = “ON”.
M9342 is the positioning completed ag of the Y0. (M9362, M9382, M9402)
When the Y0's positioning instruction is completed, M9342 = “ON”.
Turn “OFF” the condition contact of the completed instruction will lead the ag M9342 “OFF”.
M9343 is the positioning abnormal stop ag of the Y0. (M9363, M9383, M9403)
Trigger any related compulsive stop ag or the forward / reverse limit switch during the unnished Y0 positioning
function, will cause Y0 stops to generate pulses and let the M9343 = “ON” to indicate this stop is abnormal.
Turn “OFF” the condition contact of the activated instruction will lead the ag M9343 “OFF”.
M9345 is the ag to stop the Y0 generating pulse string (by gradually slow down). (M9365, M9385, M9405)
When the M9345 is turned “ON”, the pulse generating at the Y0 will gradually slow down then stop.
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
M9346 is the ag to imminently stop the Y0 generating pulse string. (M9366, M9386, M9406)
When the M9346 is turned “ON”, the pulse generating at the Y0 will stop imminently (without to slow down).
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
M9350 is the flag to assign the Y0 interrupt input trigger mode. (M9370, M9390, M9410)
When the M9350 is “OFF”, the interrupt will be triggered by the rising edge of the designated input point.
When the M9350 is “ON”, the interrupt will be triggered by the falling edge of the designated input point.
Forward / Reverse limit switch (under the “Positioning Parameter Setup” of the Ladder Master S).
When the forward / reverse limit switch is active, that limits all the forward / reverse actions. That makes the
forward / reverse motor to slow down and stop.
At this moment, only the moving request of opposite direction can be accepted.
D9348 is the multiple ratio of the Y0 positioning speed. (D9368, D9388, D9408)
The actual operating speed at Y0 positioning is equal to the operating speed designated by the positioning
instruction multiplied by the value of the multiple ratio.
During the instruction is operating, to change the ratio could modify the Y0's actual operating speed.
Its available value range to be set is 1~30,000 (Unit: 0.1%), therefore the speed multiple ratio is 0.1%~3,000.0%.
D9351, D9350 display the positioning current speed of Y0. (DD9370, DD9390, DD9410)
When the instruction is active, this 32-bit special register shows the present value of operating speed
(by user unit).
D9355, D9354 display the positioning location (present value PV) of Y0. (DD9374, DD9394, DD9414) (by user unit)
When the power is turned from “OFF” to “ON”, the initial value of this 32-bit special register is 0. Afterward,
to operate any related positioning control instruction will affect to its content, it shows the location of Y0
(by user unit).

443
FNC 2 Stages Interrupt Constant 1 2 M 3
D D V 2 I S1 S2 D1 D2
308 Quantity Positioning ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D1
D2
S2 occupies 2 components D1 = Y0~Y3 If the D2 is assigned to a Y, it must use Y0~Y7

S1 S2 D1 D2 S1 : the distance to be moved after the interrupt is input (by user unit)
M0
DV2I D10 D20 Y0 Y4 S2 : the head register of operating speeds (by user unit)
D1 : the output point of generated pulse string
D2 : the output point of direction control signal

Speed Acceleration time Deceleration time


(D9343) (D9344)

Maximum speed (D9341, D9340)

S2
Operating S 2 +1
speed #1 Operating S1
speed #2 Distance to be
Bias speed moved after the
(D9342) interrupt is input
Time

M0
Condition contact
X10
The speed change signal
X0
The interrupt signal
M9340
READY/BUSY Flag
M9341
Pulse output monitor ag
M9342
Positioning completed ag

When M0 = “ON”, as the diagram above, at the rst stage, the Y0 uses the operating speed #1 (D20) to generate
pulses. Since the designate speed change signal X10 is input (“OFF” → “ON”), it will uses the operating speed #2
(D21) to generate pulses. Until the designated interrupt signal X0 is input (“OFF” → “ON”), it will continuously
generate the particular number of pulses then stop. That pulse number comes from the set value of distance to be
moved after the interrupt is input S 1 . When the number of distance is nished, the positioning action is completed.
Assume that the rotational mode “Increase present value when forward” is selected. If the set value of the distance
to be moved after the interrupt S 1 is a positive number, that needs to increase the present value, thus the
instruction will turn the Y4 “ON” to drive motor moves forward. On the other hand, the set value of the distance to
be moved after the interrupt S 1 is a negative number, that needs to decrease the present value, thus the instruction
will turn the Y4 “OFF” to drive motor moves backward.
The interrupt signal and the speed change signal in this instruction are appointed by the “Positioning Parameter
Setup” under the Ladder Master S. However, the interrupt signal must use X0~X7 and the M9350 can be used to
assign the interrupt trigger mode (“OFF” = rising edge; “ON” = falling edge).
S 1 is for to assign the distance to be moved after the interrupt is input.
If the S 1 > 0, it will move in the direction of to increase the present value. Oppositely, if the S 1 < 0, it will
move in the direction of to decrease the present value. The PLC will convert this distance to the pulse unit for
the positioning, thus the converted number must meet the range of a 32-bit data. If the converted value is
exceeded, the PLC will be regarded that as an operating error and M9067 will be “ON”.
S 2 is for to assign the operating speed #1and the following S 2 +1 is for to assign the operating speed #2.
The available range is from the bias speed (D9342) to the maximum speed (D9341, D9340).
When the content value of the operating speed < the bias speed, it will be regarded as the bias speed; when
the content value of the operating speed > the maximum speed, it will be regarded as the maximum speed.

444
D 1 is for to assign the output point of generated pulse string.
It can only appoint to a point between Y0~Y3, and must use a transistor or line driver output Main Unit.

D 2 is for to assign the output point of direction control signal.


When the output of direction control signal is “ON”, the motor moves forward; conversely, “OFF” moves reverse.
Besides, the “ON”/“OFF” status of the direction control signal is decided by both the +/– numerical value of the
distance S 1 and the parameter of the rotational direction (increase present value when forward / backward) are
executed.
When the M0 turns from “OFF” to “ON”, this DV2I instruction uses the parameters of the bias speed (D9342), the
maximum speed (D9341, D9340), the acceleration time (D9343), the deceleration time (D9344), the distance to be
moved after the interrupt S 1 , the operating speeds and the speed multiple ratio (D9348) to decide the positioning
procedures. During the instruction is in operation, could change the value of the operating speeds or the speed
multiple ratio (D9348) to modify the real operating speed, but to change other parameters above will be regarded
as invalid.

When this instruction has an interrupt input after it changes to the operating speed #2 and it completes the S 1
specic distance move after the interrupt, that will let the positioning completed ag M9342 = “ON”.
If the condition contact M0 turns “OFF” during the pulse is output, the movement will be gradually slow down then
stop. Thus, that will not to turn the positioning completed ag M9342 “ON”.
This instruction can be written as many times as required and the points Y0~Y3 can be used to generate pulses
individually at the same time.
The example below uses Y0 output axis for the description of this instruction since the output axes Y1~Y3 have the
same function. The three devices between parentheses ( ) indicate those are corresponding to Y1~Y3 respectively.
M9340 indicates the Y0 is occupied by a positioning instruction. (M9360, M9380, M9400)
Any instruction uses the Y0 to generate pulse string and it is already activated, that will occupy the resource of Y0
axis consistently. However, turn the condition contact of this activated instruction “OFF” could release the resource.
Thus, before to activate this instruction should conrm the state of M9340.
If the M9340 = “ON”, that indicates the Y0 is BUSY to generate pulse string or other instruction still occupies the
resource of the Y0. Even though, the condition contact of this instruction is “ON”, the instruction will not execute.
If the M9340 = “OFF”, that indicates the Y0 is in the READY status (its resource is free to use), the Y0 can be used
for this instruction.
M9341 is the pulse output monitor of the Y0. (M9361, M9381, M9401)
When the Y0 is generating pulses, M9341 = “ON”.
M9342 is the positioning completed ag of the Y0. (M9362, M9382, M9402)
When the Y0's positioning instruction is completed, M9342 = “ON”.
Turn “OFF” the condition contact of the completed instruction will lead the ag M9342 “OFF”.
M9343 is the positioning abnormal stop ag of the Y0. (M9363, M9383, M9403)
Trigger any related compulsive stop ag or the forward / reverse limit switch during the unnished Y0 positioning
function, will cause Y0 stops to generate pulses and let the M9343 = "ON" to indicate this stop is abnormal.
Turn “OFF” the condition contact of the activated instruction will lead the ag M9343 “OFF”.
M9345 is the ag to stop the Y0 generating pulse string (by gradually slow down). (M9365, M9385, M9405)
When the M9345 is turned “ON”, the pulse generating at the Y0 will gradually slow down then stop.
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
M9346 is the ag to imminently stop the Y0 generating pulse string. (M9366, M9386, M9406)
When the M9346 is turned “ON”, the pulse generating at the Y0 will stop imminently (without to slow down).
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
M9350 is the flag to assign the Y0 interrupt input trigger mode. (M9370, M9390, M9410)
When the M9350 is “OFF”, the interrupt will be triggered by the rising edge of the designated input point.
When the M9350 is “ON”, the interrupt will be triggered by the falling edge of the designated input point.
Forward / Reverse limit switch (under the “Positioning Parameter Setup” of the Ladder Master S).
When the forward / reverse limit switch is active, that limits all the forward / reverse actions. That makes the
forward / reverse motor to slow down and stop.
At this moment, only the moving request of opposite direction can be accepted.
D9348 is the multiple ratio of the Y0 positioning speed. (D9368, D9388, D9408)
The actual operating speed at Y0 positioning is equal to the operating speed designated by the positioning
instruction multiplied by the value of the multiple ratio.
During the instruction is operating, to change the ratio could modify the Y0's actual operating speed.
Its available value range to be set is 1~30,000 (Unit: 0.1%), therefore the speed multiple ratio is 0.1%~3,000.0%.
D9351, D9350 display the positioning current speed of Y0. (DD9370, DD9390, DD9410)
When the instruction is active, this 32-bit special register shows the present value of operating speed
(by user unit).
D9355, D9354 display the positioning location (present value PV) of Y0. (DD9374, DD9394, DD9414) (by user unit)
When the power is turned from “OFF” to “ON”, the initial value of this 32-bit special register is set as 0. Afterward,
to operate any related positioning control instruction will affect to its content, it shows the location of Y0
(by user unit).

445
FNC Interrupt to Stop or Drive to 1 2 M 3
D D V S R S1 S2 D1 D2
309 Relative Position ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D1
D2
D1 = Y0~Y3 If the D2 is assigned to a Y, it must use Y0~Y7

S1 S2 D1 D2 S1 : the moving distance (by user unit)


M0
DVSR D10 D20 Y0 Y4 S2 : the operating speed (by user unit)
D1 : the output point of generated pulse string
D2 : the output point of direction control signal

Speed Acceleration time Deceleration time


(D9343) (D9344)

Maximum speed
(D9341, D9340)

S 2 Operating
speed

S 1 Moving
distance

Bias speed
(D9342)
Time

M0
Condition contact
X0
The interrupt signal
M9340
READY/BUSY Flag
M9341
Pulse output monitor ag
M9342
Positioning completed ag

When M0 = “ON”, as the diagram above, the Y0 uses operating speed S 2 and the set value of moving distance
S 1 to generate the corresponding number of pulses. If the number of distance is nished, it stops to generate
pulses, the positioning action is completed. However, the designated interrupt signal X0 is input (“OFF” → “ON”)
during the instruction generating pulses, it will immediately slow down then stop, also the positioning action is
regarded as completed.
Assume that the rotational mode “Increase present value when forward” is selected. If the set value of the
distance to be moved S 1 is a positive number, that needs to increase the present value, thus the instruction will
turn the Y4 “ON” to drive motor moves forward. On the other hand, the set value of the moving distance S 1 is
a negative number, that needs to decrease the present value, thus the instruction will turn the Y4 “OFF” to drive
motor moves backward.
The interrupt signal in this instruction is appointed by the “Positioning Parameter Setup” under the Ladder Master S.
Also, the interrupt signal must use an input between the X0~X7 so the PLC can have an instant interrupt reaction.
Besides, the M9350 can be used to assign the interrupt trigger mode (“OFF” = rising edge; “ON” = falling edge).
S 1 is for to assign the moving distance.
If the S 1 > 0, it will move in the direction of to increase the present value. Oppositely, if the S 1 < 0, it will
move in the direction of to decrease the present value. The PLC will convert this distance to the pulse unit for
the positioning, thus the converted number must meet the range of a 32-bit data. If the converted value is
exceeded, the PLC will be regarded that as an operating error and M9067 will be “ON”.
S 2 is for to assign the operating speed.
The available range is from the bias speed (D9342) to the maximum speed (D9341, D9340).
When S 2 < the bias speed, it will be regarded as the bias speed; when S 2 > the maximum speed, it will be
regarded as the maximum speed.
D 1 is for to assign the output point of generated pulse string.
It can only appoint to a point between Y0~Y3, and must use a transistor or line driver output Main Unit.

446
D 2 is for to assign the output point of direction control signal.
When the output of direction control signal is “ON”, the motor moves forward; conversely, “OFF” moves
reverse.
Besides, the “ON”/“OFF” status of the direction control signal is decided by both the +/– numerical value of
the distance S 1 and the parameter of the rotational direction (increase present value when forward / backward)
are executed.
When the M0 turns from “OFF” to “ON”, this DVSR instruction uses the parameters of the bias speed (D9342), the
maximum speed (D9341, D9340), the acceleration time (D9343), the deceleration time (D9344), the moving distance
S 1 , the operating speed S 2 and the speed multiple ratio (D9348) to decide the positioning procedures.
During the instruction is in operation, could change the value of the operating speed S 2 or the speed multiple ratio
(D9348) to modify the real operating speed, but to change other parameters above will be regarded as invalid.
When this instruction is completed by either the S 1 specic moving distance or the designated interrupt signal is
input during the process to cause it immediately into the procedure of gradually slow down then stop, that will let the
positioning completed ag M9342 = “ON”.
If the condition contact M0 turns “OFF” during the pulse is output, the movement will be gradually slow down then
stop. Thus, that will not to turn the positioning completed ag M9342 “ON”.
This instruction can be written as many times as required and the points Y0~Y3 can be used to generate pulses
individually at the same time.
The example below uses Y0 output axis for the description of this instruction since the output axes Y1~Y3 have the
same function. The three devices between parentheses ( ) indicate those are corresponding to Y1~Y3 respectively.
M9340 indicates the Y0 is occupied by a positioning instruction. (M9360, M9380, M9400)
Any instruction uses the Y0 to generate pulse string and it is already activated, that will occupy the resource of Y0
axis consistently. However, turn the condition contact of this activated instruction “OFF” could release the resource.
Thus, before to activate this instruction should conrm the state of M9340.
If the M9340 = “ON”, that indicates the Y0 is BUSY to generate pulse string or other instruction still occupies the
resource of the Y0. Even though, the condition contact of this instruction is “ON”, the instruction will not execute.
If the M9340 = “OFF”, that indicates the Y0 is in the READY status (its resource is free to use), the Y0 can be used
for this instruction.
M9341 is the pulse output monitor of the Y0. (M9361, M9381, M9401)
When the Y0 is generating pulses, M9341 = “ON”.
M9342 is the positioning completed ag of the Y0. (M9362, M9382, M9402)
When the Y0's positioning instruction is completed by either the S 1 specic distance movement is ready or the
designated interrupt signal is input to cause it gradually slow down then stop, M9342 = “ON”.
Turn “OFF” the condition contact of the completed instruction will lead the ag M9342 “OFF”.
M9343 is the positioning abnormal stop ag of the Y0. (M9363, M9383, M9403)
Trigger any related compulsive stop ag or the forward / reverse limit switch during the unnished Y0 positioning
function, will cause Y0 stops to generate pulses and let the M9343 = "ON" to indicate this stop is abnormal.
Turn “OFF” the condition contact of the activated instruction will lead the ag M9343 “OFF”.
M9345 is the ag to stop the Y0 generating pulse string (by gradually slow down). (M9365, M9385, M9405)
When the M9345 is turned “ON”, the pulse generating at the Y0 will gradually slow down then stop.
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
M9346 is the ag to imminently stop the Y0 generating pulse string. (M9366, M9386, M9406)
When the M9346 is turned “ON”, the pulse generating at the Y0 will stop imminently (without to slow down).
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
M9350 is the flag to assign the Y0 interrupt input trigger mode. (M9370, M9390, M9410)
When the M9350 is “OFF”, the interrupt will be triggered by the rising edge of the designated input point.
When the M9350 is “ON”, the interrupt will be triggered by the falling edge of the designated input point.
Forward / Reverse limit switch (under the “Positioning Parameter Setup” of the Ladder Master S).
When the forward / reverse limit switch is active, that limits all the forward / reverse actions. That makes the
forward / reverse motor to slow down and stop.
At this moment, only the moving request of opposite direction can be accepted.
D9348 is the multiple ratio of the Y0 positioning speed. (D9368, D9388, D9408)
The actual operating speed at Y0 positioning is equal to the operating speed designated by the positioning
instruction multiplied by the value of the multiple ratio.
During the instruction is operating, to change the ratio could modify the Y0's actual operating speed.
Its available value range to be set is 1~30,000 (Unit: 0.1%), therefore the speed multiple ratio is 0.1%~3,000.0%.
D9351, D9350 display the positioning current speed of Y0. (DD9370, DD9390, DD9410)
When the instruction is active, this 32-bit special register shows the present value of operating speed
(by user unit).
D9355, D9354 display the positioning location (present value PV) of Y0. (DD9374, DD9394, DD9414) (by user unit)
When the power is turned from “OFF” to “ON”, the initial value of this 32-bit special register is 0. Afterward,
to operate any related positioning control instruction will affect to its content, it shows the location of Y0
(by user unit).

447
FNC Interrupt to Stop or Drive to 1 2 M 3
D D V S A S1 S2 D1 D2
310 Absolute Position ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D1
D2
D1 = Y0~Y3 If the D2 is assigned to a Y, it must use Y0~Y7

S1 S2 D1 D2 S1 : the moving target (by user unit)


M0
DDVSA D10 D20 Y0 Y4 S2 : the operating speed (by user unit)
D1 : the output point of generated pulse string
D2 : the output point of direction control signal

Speed Acceleration time Deceleration time


(D9343) (D9344)

Maximum speed
(D9341, D9340)

S 2 Operating
speed
Distance to be moved (error) =
Moving target S 1
Distance to be
moved (error) − Y0's PV (DD9354)

Bias speed
(D9342)
Time

M0
Condition contact
X0
The interrupt signal
M9340
READY/BUSY Flag
M9341
Pulse output monitor ag
M9342
Positioning completed ag

When M0 = “ON”, as the diagram above, the Y0 by the set operating speed S 2 generates pulses to move the Y0's
present value (PV) to the set value S 1 (D11, D10). When the positioning action is completed (to make the PV at
D9355, D9354 = D11, D10), it stops to generate pulses, the positioning action is completed. However, the
designated interrupt signal X0 is input (“OFF” → “ON”) during the instruction generating pulses, it will immediately
slow down then stop, also the positioning action is regarded as completed.
Assume that the rotational mode “Increase present value when forward” is selected. If the error (distance to be
moved) is a positive number (the moving target > the axis's present value), that needs to increase the present value,
thus the instruction will turn the Y4 “ON” to drive motor moves forward. ON the other hand, the error (distance to be
moved) is a negative number (the moving target < the axis's present value), that needs to decrease the present
value, thus the instruction will turn the Y4 “OFF” to drive motor moves backward.
The interrupt signal in this instruction is appointed by the “Positioning Parameter Setup” under the Ladder Master S.
However, the interrupt signal must use X0~X7 and the M9350 can be used to assign the interrupt trigger mode
(“OFF” = rising edge; “ON” = falling edge).
S 1 is for to assign the moving target.
This moving target is an absolute point relative to the zero point. If the error is a positive ( S 1 − PV > 0) , it will
move in the direction of to increase the present value. Oppositely, if the error is a negative ( S 1 − PV < 0), it
will move in the direction of to decrease the present value. The PLC will convert this moving target to the pulse
unit for the positioning, thus the converted number must meet the range of a 32-bit data. If the converted value
is exceeded this range, the PLC will be regarded that as an operating error and M9067 will be “ON”.
S 2 is for to assign the operating speed.
The available range is from the bias speed (D9342) to the maximum speed (D9341, D9340).
When S 2 < the bias speed, it will be regarded as the bias speed; when S 2 > the maximum speed, it will be
regarded as the maximum speed.

448
D 1 is for to assign the output point of generated pulse string.
It can only appoint to a point between Y0~Y3, and must use a transistor or line driver output Main Unit.
D 2 is for to assign the output point of direction control signal.
When the output of direction control signal is “ON”, the motor moves forward; conversely, “OFF” moves reverse.
Besides, the “ON”/“OFF” status of the direction control signal is decided by both the +/− numerical value of the
error ( S 1 − PV) and the parameter of the rotational direction (increase present value when forward / backward)
are executed.
When the M0 turns from “OFF” to “ON”, this DVSA instruction uses the parameters of the bias speed (D9342), the
maximum speed (D9341, D9340), the acceleration time (D9343), the deceleration time (D9344), the moving target
S 1 , the present value (PV, D9355, D9354), the operating speed S 2 and the speed multiple ratio (D9348) to
decide the positioning procedures. During the instruction is in operation, could change the value of the operating
speed S 2 or the speed multiple ratio (D9348) to modify the real operating speed, but to change other parameters
above will be regarded as invalid.
When this instruction is completed by either the movement (generates pulses to make its present value PV equal to
the S 1 ) or the designated interrupt signal is input during the process to cause it immediately into the procedure of
gradually slow down then stop, that will let the positioning completed flag M9342 = “ON”.
If the condition contact M0 turns “OFF” during the pulse is output, the movement will be gradually slow down then
stop. Thus, that will not to turn the positioning completed ag M9342 “ON”.
This instruction can be written as many times as required and the points Y0~Y3 can be used to generate pulses
individually at the same time.
The example below uses Y0 output axis for the description of this instruction since the output axes Y1~Y3 have the
same function. The three devices between parentheses ( ) indicate those are corresponding to Y1~Y3 respectively.
M9340 indicates the Y0 is occupied by a positioning instruction. (M9360, M9380, M9400)
Any instruction uses the Y0 to generate pulse string and it is already activated, that will occupy the resource of Y0
axis consistently. However, turn the condition contact of this activated instruction “OFF” could release the resource.
Thus, before to activate this instruction should conrm the state of M9340.
If the M9340 = “ON”, that indicates the Y0 is BUSY to generate pulse string or other instruction still occupies the
resource of the Y0. Even though, the condition contact of this instruction is “ON”, the instruction will not execute.
If the M9340 = “OFF”, that indicates the Y0 is in the READY status (its resource is free to use), the Y0 can be used
for this instruction.
M9341 is the pulse output monitor of the Y0. (M9361, M9381, M9401)
When the Y0 is generating pulses, M9341 = “ON”.
M9342 is the positioning completed flag of the Y0. (M9362, M9382, M9402)
When the Y0's positioning instruction is completed by either the move target is arrived (present value PV equal to
the S 1 ) or the designated interrupt signal is input to cause it gradually slow down then stop, M9342 = “ON”.
Turn “OFF” the condition contact of the completed instruction will lead the flag M9342 “OFF”.
M9343 is the positioning abnormal stop ag of the Y0. (M9363, M9383, M9403)
Trigger any related compulsive stop ag or the forward / reverse limit switch during the unnished Y0 positioning
function, will cause Y0 stops to generate pulses and let the M9343 = "ON" to indicate this stop is abnormal.
Turn “OFF” the condition contact of the activated instruction will lead the ag M9343 “OFF”.
M9345 is the ag to stop the Y0 generating pulse string (by gradually slow down). (M9365, M9385, M9405)
When the M9345 is turned “ON”, the pulse generating at the Y0 will gradually slow down then stop.
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
M9346 is the ag to imminently stop the Y0 generating pulse string. (M9366, M9386, M9406)
When the M9346 is turned “ON”, the pulse generating at the Y0 will stop imminently (without to slow down).
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
M9350 is the flag to assign the Y0 interrupt input trigger mode. (M9370, M9390, M9410)
When the M9350 is “OFF”, the interrupt will be triggered by the rising edge of the designated input point.
When the M9350 is “ON”, the interrupt will be triggered by the falling edge of the designated input point.
Forward / Reverse limit switch (under the “Positioning parameter setting” of the Ladder Master S).
When the forward / reverse limit switch is active, that limits all the forward / reverse actions. That makes the
forward / reverse motor to slow down and stop.
At this moment, only the moving request of opposite direction can be accepted.
D9348 is the multiple ratio of the Y0 positioning speed. (D9368, D9388, D9408)
The actual operating speed at Y0 positioning is equal to the operating speed designated by the positioning
instruction multiplied by the value of the multiple ratio.
During the instruction is operating, to change the ratio could modify the Y0's actual operating speed.
Its available value range to be set is 1~30,000 (Unit: 0.1%), therefore the speed multiple ratio is 0.1%~3,000.0%.
D9351, D9350 display the positioning current speed of Y0. (DD9370, DD9390, DD9410)
When the instruction is active, this 32-bit special register shows the present value of operating speed
(by user unit).
D9355, D9354 display the positioning location (present value PV) of Y0. (DD9374, DD9394, DD9414) (by user unit)
When the power is turned from “OFF” to “ON”, the initial value of this 32-bit special register is 0. Afterward,
to operate any related positioning control instruction will affect to its content, it shows the location of Y0
(by user unit).

449
FNC 1 2 M 3
DPLSV S D1 D2 Variable Speed Pulse Output
311 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D1
D2
D1 = Y0~Y3 If the D2 is assigned to a Y, it must use Y0~Y7

S D1 D2 S : the operating speed (by user unit)


M0
PLSV D0 Y0 Y4 D1 : the output point of generated pulse string
D2 : the output point of direction control signal

Speed Acceleration time Deceleration time


(D9343) (D9344)

Maximum speed
(D9341, D9340)

Bias speed (D9342)


Time

Content value of D0 80,000 120,000 40,000

M0
Condition contact
M9340
READY/BUSY Flag
M9341
Pulse output monitor ag

When M0 = “ON”, as the diagram above, the Y0 uses operating speed S to generate pulses. The real output
operation speed is available by changing the value of S to modify during the positioning. However, the condition
contact M0 turns form “ON” to “OFF”, it will slow down then stop.
Assume that the rotational mode “Increase present value when forward” is selected. If the operating speed S is
a positive number, that needs to increase the present value, thus the instruction will turn the Y4 “ON” to drive motor
moves forward. On the other hand, the operating speed S is a negative number, that needs to decrease the
present value, thus the instruction will turn the Y4 “OFF” to drive motor moves backward.
S is for to assign the operating speed.
The serviceable range of the absolute value of S is from the bias speed (D9342) to the maximum speed
(D9341, D9340).
If the content value of this operating speed S > 0, it will move in the direction of to increase the present value.
Oppositely, if the content value of this operating speed S < 0, it will move in the direction of to decrease the
present value.
When the content absolute value of the operating speed S < the bias speed, it will be regarded as the bias
speed; when the content absolute value of the operating speed S > the maximum speed, it will be regarded
as the maximum speed.
D 1 is for to assign the output point of generated pulse string.
It can only appoint to a point between Y0~Y3, and must use a transistor or line driver output Main Unit.
D 2 is for to assign the output point of direction control signal.
When the output of direction control signal is “ON”, the motor moves forward; conversely, “OFF” moves reverse.
Besides, the “ON”/“OFF” status of the direction control signal is decided by both the +/– numerical value of the
operating speed S and the parameter of the rotational direction (increase present value when forward /
backward) are executed.
When the M0 turns from “OFF” to “ON”, this DLSV instruction uses the parameters of the bias speed (D9342), the
maximum speed (D9341, D9340), the acceleration time (D9343), the deceleration time (D9344), the operating speed
S and the speed multiple ratio (D9348) to decide the positioning procedures. During the instruction is in operation,
could change the value of the operating speed S or the speed multiple ratio (D9348) to modify the real operating
speed, but to change other parameters above will be regarded as invalid.

450
If the operating speed S changes and that +/– numerical value through this change is opposite, it will gradually
slow down then stop. After a brief pause, carry on the operation of the opposite direction immediately.
This instruction can be written as many times as required and the points Y0~Y3 can be used to generate pulses
individually at the same time.
The example below uses Y0 output axis for the description of this instruction since the output axes Y1~Y3 have the
same function. The three devices between parentheses ( ) indicate those are corresponding to Y1~Y3 respectively.
M9340 indicates the Y0 is occupied by a positioning instruction. (M9360, M9380, M9400)
Any instruction uses the Y0 to generate pulse string and it is already activated, that will occupy the resource of Y0
axis consistently. However, turn the condition contact of this activated instruction “OFF” could release the resource.
Thus, before to activate this instruction should conrm the state of M9340.
If the M9340 = “ON”, that indicates the Y0 is BUSY to generate pulse string or other instruction still occupies the
resource of the Y0. Even though, the condition contact of this instruction is “ON”, the instruction will not execute.
If the M9340 = “OFF”, that indicates the Y0 is in the READY status (its resource is free to use), the Y0 can be used
for this instruction.
M9341 is the pulse output monitor of the Y0. (M9361, M9381, M9401)
When the Y0 is generating pulses, M9341 = “ON”.
M9343 is the positioning abnormal stop ag of the Y0. (M9363, M9383, M9403)
Trigger any related compulsive stop ag or the forward / reverse limit switch during the unnished Y0 positioning
function, will cause Y0 stops to generate pulses and let the M9343 = “ON” to indicate this stop is abnormal.
Turn “OFF” the condition contact of the activated instruction will lead the ag M9343 “OFF”.
M9345 is the ag to stop the Y0 generating pulse string (by gradually slow down). (M9365, M9385, M9405)
When the M9345 is turned “ON”, the pulse generating at the Y0 will gradually slow down then stop.
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
M9346 is the ag to imminently stop the Y0 generating pulse string. (M9366, M9386, M9406)
When the M9346 is turned “ON”, the pulse generating at the Y0 will stop imminently (without to slow down).
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
Forward / Reverse limit switch (under the “Positioning Parameter Setup” of the Ladder Master S).
When the forward / reverse limit switch is active, that limits all the forward / reverse actions. That makes the
forward / reverse motor to slow down and stop.
At this moment, only the moving request of opposite direction can be accepted.
D9348 is the multiple ratio of the Y0 positioning speed. (D9368, D9388, D9408)
The actual operating speed at Y0 positioning is equal to the operating speed designated by the positioning
instruction multiplied by the value of the multiple ratio.
During the instruction is operating, to change the ratio could modify the Y0's actual operating speed.
Its available value range to be set is 1~30,000 (Unit: 0.1%), therefore the speed multiple ratio is 0.1%~3,000.0%.
D9351, D9350 display the positioning current speed of Y0. (DD9370, DD9390, DD9410)
When the instruction is active, this 32-bit special register shows the present value of operating speed
(by user unit).
D9355, D9354 display the positioning location (present value PV) of Y0. (DD9374, DD9394, DD9414) (by user unit)
When the power is turned from “OFF” to “ON”, the initial value of this 32-bit special register is 0. Afterward, to
operate any related positioning control instruction will affect to its content, it shows the location of Y0
(by user unit).

451
FNC 1 2 M 3
D T B L S1 S2 D1 D2 Data Table Positioning
312 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1 Using a Table Code Q0~Q31 (V, Z index modiable) or a Table Nickname (by user-dened 16 English characters)
S2
D1
D2
D1 = Y0~Y3 If the D2 is assigned to a Y, it must use Y0~Y7 The S2 occupies 4 components

S1 S2 D1 D2 S1 : the procedure table to describe the


M0
positioning orders
DTBL Y0_PROCEDURE_TBL D100 Y0 Y4
S2 : the working area for the instruction
D1 : the output point of generated pulse string
D2 : the output point of direction control signal

This DTBL instruction is to perform a continuous multi-speed positioning control and various multi-step positioning
control.
Speed Acceleration time Deceleration time
(D9343) (D9344)
Maximum speed (D9341, D9340)
1800
Speed #1
1200
Speed #0
600
Speed #2
1500 1000
Position #0 Position #1 1200
Position #2

Bias speed (D9342)


Time
Step #0 Step #1 Step #2
M0
Condition contact
M9347
Table positioning start signal
M9340
READY/BUSY Flag
M9341
Pulse output monitor ag
M9342
Positioning completed ag
M9029
Execution completed ag END, by the Control Code (0)

When the M0 = "ON", the DTBL instruction starts to sequentially control the Y0 by the prepared positioning table
"Y0_PROCEDURE_TBL". At the very beginning, that M-code register D9349 will be set to -1. Also the working area
D100~D103 will be occupied to store the state of instruction execution.
S 1 is the procedure table to describe the positioning orders.
The example table below is a series of procedures for the data table positioning, that is provided by the
programming tool Ladder Master S.

Control Code Position Data Speed Data M-code Data


Step No. Could use K, D or R Could use K, D or R Could use K, D or R Could use K, D or R
(by a 16-bit data) (by a 32-bit data) (by a 32-bit data) (by a 16-bit data)
Continuous relative positioning Position #0 Speed #0
0 Control Code (3) 1,500 1,200 –1

Continuous relative positioning Position #1 Speed #1


1 Control Code (3) 1,000 1,800 –1

Continuous relative positioning Position #2 Speed #2


2 Control Code (3) 1,200 –1
600
3 END, Control Code (0) –1 –1 –1

452
Control Code:
This code is to assign a positioning function for each step, which has 6 different functions to choose from.

Control Description
Control Function
Code
One procedure table can store many positioning steps (each step needs 4 components
to describe), then the END is the nish code to close this table.
0 END When the END code is executed, the Execution Completed Flag M9029 will "ON" for a
Scan Time to indicate all the steps in the procedure table are nished.
This relative positioning will stand-by when the step is completed, that moving distance
is dened by the content value at the Position Data and its +/- numerical value decides
Single relative
1 the moving direction.
positioning
During the instruction operates, could change its Speed Data to modify the operating
speed, but to change Position Data is invalid.
This absolute positioning will stand-by when the step's target is arrived, the target is
dened by the content value at the Position Data. Since the target is an absolute point
Single absolute relative to the zero point, the moving distance = (Position Data – PV ) and that calculated
2 positioning +/– numerical value decides the direction.
During the instruction operates, could change its Speed Data to modify the operating
speed, but to change Position Data is invalid.
This relative positioning will continue to the next step when the current step is completed.
Continuous Each step has its own Position Data and Speed Data, to orderly perform a series of steps
3 relative can become a multiple speed positioning.
positioning If a break is required during the continuous relative positioning, it will into stand-by when
this step is nished, then waiting for the restart condition to perform the next step.
This absolute positioning will continue to the next step when the target of current step is
Continuous arrived. Each step has its own Position Data and Speed Data, to orderly perform a series
4 absolute of steps can become a multiple speed positioning.
positioning If a break is required during the continuous absolute positioning, it will into stand-by
when this step is nished, then waiting for the restart condition to perform the next step.
Jump to the specic step to perform. At this function, its Position Data is used to appoint
5 JMP the destination step number.

To start a new step (not by continuous), it requires the M-code register D9349 = –1 (OFF) at the time. And at
the beginning, should trigger the Table positioning start signal M9347 = "OFF" → “ON".
The Single Relative Positioning and Single Absolute Positioning Functions
Here is using two single relative positioning and suppose its present value (PV) is 0 at the beginning.

Step No. Control Code Position Data Speed Data M-code Data
0 Single relative positioning(2) 5,000 800 100
1 Single relative positioning(2) 10,000 1,200 10,000
2 END(0) –1 –1 –1
1200(Speed #1)
800(Speed #0)
Speed 5000
5000 (Distance #0) (Distance #1)
=5000–0 =10000–5000 Time
0 Step #0 Step #1
M0
Condition contact
M9347
Table positioning start signal
M9340
READY/BUSY Flag
M9341
Pulse output monitor ag
M9342
Positioning completed ag
M9029
Execution completed ag END, by the Control Code (0)

D9349
M-code register –1 100 –1 10000 –1
M9348
M-code active ag
M9349
M-code clear command

453
The Continuous Relative Positioning and Continuous Absolute Positioning Functions
This example is using the continuous relative positioning

Step No. Control Code Position Data Speed Data M-code Data
0 Continuous relative positioning (3) D10 1,800 10,000
1 Continuous relative positioning (3) 2,000 1,200 –1
2 Continuous relative positioning (3) 1,000 600 10,002
3 Continuous relative positioning (3) 3,000 D20 –1
4 END(0) –1 –1 –1

1800 (D21,D20)
1200
Speed 600

(D11,D10) 2000 1000 3000 Time


Step #0 Step #1 Step #2 Step #3
M0
Condition contact
M9347
Table positioning start signal
M9340
READY/BUSY Flag
M9341
Pulse output monitor ag
M9342
Positioning completed ag
M9029
Execution completed ag END, by the Control Code (0)

D9349
M-code register –1 10000 –1 10001 –1 10002 –1
M9348
M-code active ag
M9349
M-code clear command

Position Data: (by user unit)


This data is related to the assigned Control Code. It is the moving distance for a relative positioning or the
moving target for an absolute positioning. When this data converts to the pulse unit for the positioning, the
pulse number must meet the range of a 32-bit data.
At the relative positioning, it is used to assign the moving distance. If the moving distance > 0, will control the
direction to increase the present value. If the moving distance < 0, will control the direction to decrease the
present value.
At the absolute positioning, it is used to assign the moving target. This target is an absolute point relative to
the zero point, thus the error = (moving target - present value PV). If the error > 0, will control the direction to
increase the present value. If the error < 0, will control the direction to decrease the present value.
At the jump (JMP) function, this Position Data is used to appoint the step number of the jumping destination.
This Position Data is a 32-bit data, can use a constant number K or register D, R. When the register is used,
that will occupy a pair of D or R. During the instruction is in operation, to change this data will be regarded as
invalid.

Speed Data: (by user unit)


It is used to assign the operating speed. The available range is from the bias speed (D9342) to the maximum
speed (D9341, D9340) after the convert.
When the operating speed < the bias speed, it will be regarded as the bias speed; when the operating speed
> the maximum speed, it will be regarded as the maximum speed.
This Speed Data is a 32-bit data, can use a constant number K or register D, R. When the register is used, that
will occupy a pair of D or R. During the instruction is in operation, to change this data could modify the real
operating speed.

454
M-code Data:
The M-code Data is the source of the M-code register, that mechanism can be used to connect the executive
status of the DTBL instruction with other applications. The available range at the M-code Data is -1~32,767.
The DTBL instruction can give a number into the M-code register and turn "ON" the M-code active ag to tell a
new event happening. By this mechanism, the user program can do the related control. After the step is
nished and stand-by, should trigger the M-code clear command "OFF" → "ON" to clear the M-code register
and the M-code active ag, hence the instruction is able to execute the next step.
In order to meet the actual requirements, the timing to give the M-code register and active ag can be
separated to the AFTER and WITH modes.
M-code Data Description
–1 This step will let the M-code register = –1 (OFF). The mechanism of the M-code is disabled.
The step is using the AFTER mode. When this step is nished, will copy this M-code Data to the
0 〜 9,999
M-code register and turn "ON" the M-code active ag.
The step is using the WITH mode. When the step is started, will copy this M-code Data to the
10,000 〜 32,767
M-code register and turn "ON" the M-code active ag.

AFTER mode (M-code Data = 0~9,999)

Speed

Time

D9349
M-code register –1 100 –1
M9348
M-code active ag
M9349
M-code clear command
Assume that M-code Data is 100 (by the AFTER mode). When the step is nished, the M-code register
changes from -1 to 100 and the M-code active ag turns "ON".

WITH mode M-code (M-code Data = 10,000~32,767)

Speed
Time

D9349
M-code register –1 10000 –1 10001 –1 10002

M9348
M-code active ag
M9349
M-code clear command

Assume the M-code Data for those 3 individual steps are 10,000, 10,001 and 10,002 (all by the WITH
mode). When every step is started, the M-code register changes from -1 to the step's M-code Data and
the M-code active ag turns "ON". Besides, trigger the M-code clear command "OFF" → "ON" can clear
the M-code register to –1 (OFF) and the M-code active ag "OFF".

Speed

Time

D9349
M-code register –1 10000 –1 10001 10002 –1
M9348
M-code active ag
M9349
M-code clear command
The picture above, those steps are continuous positioning and all by the WITH mode. The M-code
register will automatically follow the steps to change its content at the beginning.

455
S 2 is the working area for the instruction.

S2 Description
D100 To appoint the starting step number of the DTBL instruction.
D101 Displays a step number at the table of the DTBL instruction which is being performed.
D102 〜 D103 The working area is required for the system when this instruction is performed.

D 1 is for to assign the output point of generated pulse string.


It can only appoint to a point between Y0~Y3, and must use a transistor or line driver output Main Unit.

D 2 is for to assign the output point of direction control signal.


When the output of direction control signal is "ON", the motor moves forward; conversely, "OFF" moves reverse.
Besides, the "ON"/"OFF" status of the direction control signal is decided by both the +/– numerical value of the
distance to be move and the parameter of the rotational direction (increase present value when forward /
backward) are executed.

During the instruction is in operation, could change the value of the speed multiple ratio (D9348) to modify the real
operating speed.
When a single step or a series of continuous steps is nished, the Positioning completed ag M9342 will "ON".
After that, trigger the start signal M9347 = "OFF" → "ON" or turn "OFF" the instruction's condition contact will lead
the completed ag M9342 "OFF".
If the condition contact M0 turns “OFF” during the pulse is output, the movement will be gradually slow down then
stop. Thus, that will not to turn the positioning completed ag M9342 “ON”.
When the Control Code END (0) is executed, the Execution Completed Flag M9029 will "ON" for a Scan Time to
indicate all the steps in this procedure table are nished. Therefore, the programmer can use the M9029 to turn
"OFF" the condition contact of the DTBL instruction, then the output point could be used by another instruction.
This instruction can be used as many times as required and the points Y0~Y3 can be used to generate pulses
individually at the same time.
The example below uses Y0 output axis for the description of this instruction since the output axes Y1~Y3 have the
same function. The three devices between parentheses ( ) indicate those are corresponding to Y1~Y3 respectively.
M9340 indicates the Y0 is occupied by a positioning instruction. (M9360, M9380, M9400)
Any instruction uses the Y0 to generate pulse string and it is already activated, that will occupy the resource of Y0
axis consistently. However, turn the condition contact of this activated instruction “OFF” could release the resource.
Thus, before to activate this instruction should conrm the state of M9340.
If the M9340 = “ON”, that indicates the Y0 is BUSY to generate pulse string or other instruction still occupies the
resource of the Y0. Even though, the condition contact of this instruction is “ON”, the instruction will not execute.
If the M9340 = “OFF”, that indicates the Y0 is in the READY status (its resource is free to use), the Y0 can be used
for this instruction.
M9341 is the pulse output monitor of the Y0. (M9361, M9381, M9401)
When the Y0 is generating pulses, M9341 = “ON”.
M9342 is the positioning completed flag of the Y0. (M9362, M9382, M9402)
When a single step or a series of continuous steps is finished, the Positioning completed flag M9342 will "ON".
After that, trigger the start signal M9347 = "OFF" → "ON" or turn "OFF" the instruction's condition contact will lead
the completed flag M9342 "OFF".
M9343 is the positioning abnormal stop flag of the Y0. (M9363, M9383, M9403)
Trigger any related compulsive stop flag or the forward / reverse limit switch before the Control Code END (0) is
executed, that will cause Y0 stops to generate pulses and let the M9343 = "ON" to indicate this stop is abnormal.
Turn "OFF" the condition contact of the activated instruction will lead the flag M9343 "OFF".
M9345 is the ag to stop the Y0 generating pulse string (by gradually slow down). (M9365, M9385, M9405)
When the M9345 is turned “ON”, the pulse generating at the Y0 will gradually slow down then stop.
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
M9346 is the ag to imminently stop the Y0 generating pulse string. (M9366, M9386, M9406)
When the M9346 is turned “ON”, the pulse generating at the Y0 will stop imminently (without to slow down).
After the stop signal is discontinued, to make it move must release the positioning instruction then restart.
M9347 is the start signal for the Y0 to process the table positioning. (M9368, M9388, M9408)
To start a new (not by the continuous) step at the procedure table must trigger the Table positioning start signal
M9347 = "OFF" → "ON".
M9348 is the M-code active flag for to indicate the Y0's M-code is effective. (M9367, M9387, M9407)
When a step's designated event is happening, the axis's M-code active flag will turn "ON".
Therefore, should trigger the relative M-code clear command "OFF" → "ON" to clear the M-code active flag "OFF".

456
M9349 is the M-code clear command of the Y0. (M9369, M9389, M9409)
Trigger the M-code clear command “OFF” → “ON” can reset the M-code register become –1 (OFF) and the M-code
active flag "OFF".
Forward / Reverse limit switch (under the “Positioning Parameter Setup” of the Ladder Master S).
When the forward / reverse limit switch is active, that limits all the forward / reverse actions. That makes the
forward / reverse motor to slow down and stop.
At this moment, only the moving request of opposite direction can be accepted.
D9348 is the multiple ratio of the Y0 positioning speed. (D9368, D9388, D9408)
The actual operating speed at Y0 positioning is equal to the operating speed designated by the positioning
instruction multiplied by the value of the multiple ratio.
During the instruction is operating, to change the ratio could modify the Y0's actual operating speed.
Its available value range to be set is 1~30,000 (Unit: 0.1%), therefore the speed multiple ratio is 0.1%~3,000.0%.
D9349 is the M-code register of the Y0. (D9369, D9389, D9409)
When the DTBL instruction is“OFF” → “ON”, the M-code register will become –1 to indicate there is not have a
M-code.
When a step has a M-code Data and its indicated event is happening, the M-code Data will copy to the M-code
register D9349, hence that provides a useful symbol for the related control.
After the additional control is nished and this instruction is stand-by, should trigger the relative M-code clear
command “OFF” → “ON” to clear the M-code register to –1 (OFF), then a new step is allowed.
D9351, D9350 display the positioning current speed of Y0. (DD9370, DD9390, DD9410)
When the instruction is active, this 32-bit special register shows the present value of operating speed
(by user unit).
D9355, D9354 display the positioning location (present value PV) of Y0. (DD9374, DD9394, DD9414) (by user unit)
When the power is turned from “OFF” to “ON”, the initial value of this 32-bit special register is 0. Afterward,
to operate any related positioning control instruction will affect to its content, it shows the location of Y0
(by user unit).

457
FNC 1 2 M 3
DABS S D1 D2 Absolute Current Value Read
313 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D1
D2
S occupies 3 components D1 occupies 3 components D2 occupies 2 components

S D1 D2 S : the points to receive the signal from the servo drive


M0
DABS X10 Y10 D9352 D1 : the points to send the request signal to the servo drive
D2 : the device to store the decoded data (32-bit)

The actual wiring for the example above can be illustrated with the diagram below:
Programmable Controller Servo Drive
VSM-32MT MR-J2(S)-A MR-H-A MR- J3-A
ABS( bit0)
X10 DO1 4 PF 24 ABST 25

ABS( bit1)
X11 ZSP 19 ZSP 23 ABSB0 22
The communicate data
is ready to be sent
X12 TLC 6 TLC 25 ABSB1 23

S/S SG 10 SG 16 DOCOM 46

24V

COM2

SERVO ON
Y10 SON 5 SON 12 SON 15
ABS
transmission mode
Y11 ABSM 8 DI3 44 ABSM 17
ABS
transmission request
Y12 ABSR 9 DI4 45 ABSR 18

This instruction is for to read the present value of the built-in absolute positioning facility from a Mitsubishi servo drive.
When the M0 turns from “OFF” to “ON”, this ABS instruction starts to process the present value reading operation.
When the operation is completed, the M9029 will turn “ON” for a Scan Time. If the M0 turns “OFF” during the
operation, that will discontinue the reading action.
The reading result of this instruction is from the current position register in the servo drive, which is corresponded to
the present value of the connected axis (by the pulse unit). Therefore, the D 2 is often assigned to the D9352 (PV
of Y0 axis), D9372 (PV of Y1 axis), D9392 (PV of Y2 axis) or D9412 (PV of Y3 axis).
When the D 2 is assigned to one of the PV special registers above, it will ll the read value into the appointed
special register. Also, it will adopt the unit ratio of the axis to convert and write the value into the corresponding
special register by user unit. For example, it reads the position from the Y0's driver and store the pulse unit's result
into (D9353, D9352), then by the user dened ratio to convert and store the correlated user unit position into
(D9355, D9354).
This instruction is a 32-bit instruction. Therefore, be sure to input DABS in the program.
This instruction can only be used once in the program.
Program example: (assume this servo drive is connected with the Y0 axis)
M9000 Please use an always-ON condition contact for the instruction.
DABS X10 Y10 D9352 If its condition turns “OFF”, the SERVO ON signal will be cut thus
M0 the drive cannot operate.
K50
T0 The timer of reading operation time-out (5 sec.)
T0
M1 The reading process of the ABS instruction is abnormal.
M9029
SET M0 The reading process of the ABS instruction is completed.

458
FNC 1 2 M 3
M P G S1 S2 D1 D2 Handwheel Positioning
314 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S1
S2
D1
D2
S1 = 0~3 S2 occupies 3 components D1 = Y0~Y3 If the D2 is assigned to a Y, it must use Y0~Y7

S1 S2 D1 D2 S1 : to assign the combination of pulse input points


M0
MPG K0 D100 Y0 Y4 S2 : to assign work parameters, occupying 3 registers in total
D1 : the output point of generated pulse string
D2 : the output point of direction control signal

VS Series PLC
A-phase CK

Pulse output
Pulse input

pulse X0 Y0 Servo drive


M
DIR
B-phase X1
pulse Y4

When M0 = “ON”, the instruction is activated. As the diagram above, the A/B phase pulses from an electronic
handwheel are connected to a pair of the PLC's high speed input points (X0~X7). When the handwheel is rotated,
this instruction is based on the input pulses' speed and quantity to multiply with the electronic gear ratio then
generates a pulse string from the output point in proportion.
Number of pulses output = Number of pulses input × (Electronic gear ratio's numerator divided by its denominator)
= (Number of pulses input × D101) / D102
S 1 is for to assign the combination of pulse input points. It can be appoint to a number between 0~3.

S1 K0 K1 K2 K3
A-phase pulses input point X0 X3 X2 X6
B-phase pulses input point X1 X4 X5 X7

S 2 is the head register to assign the operational parameters of the instruction.

S2 Description
D100 The response time of the handwheel inputs. (Unit: ms.)
D101 The numerator of the electronic gear ratio
D102 The denominator of the electronic gear ratio

The response time: Can be appointed to 1~500 ms.; if the set value is exceeded, it will be regarded as 5 ms.
The response time refers to the delay between pulse input and pulse output. If the response time is set too
short, it may cause machinery vibration. In this case, can adjust it to a longer response time to improve that.
The electronic gear ratio:
Number of pulses output = The numerator of the electronic gear ratio
Number of pulses input × Electronic gear ratio =Number of pulses input ×
The denominator of the electronic gear ratio

The available range of the numerator of the electronic gear ratio is 1~32,767; it will be regarded as 1 if the
value exceeds to the range.
The available range of the denominator of the electronic gear ratio is 1~32,767; it will be regarded as 1 if the
value exceeds to the range.

D 1 is for to assign the output point of generated pulse string.


It can only appoint to a point between Y0~Y3, and must use a transistor or line driver output Main Unit.

D 2 is for to assign the output point of direction control signal.


When the output of direction control signal is “ON”, the motor moves forward; conversely, “OFF” moves reverse.
Besides, the “ON”/“OFF” status of the direction control signal is decided by the input order of A/B phase signals.
If the A-phase is input earlier than the B-phase, the direction control signal turns “ON” to make the motor forward.

459
The pulse output frequency of this instruction is proportionate to the frequency of pulses input and the electronic
gear ratio only, other parameters are ineffectual. The positioning speed multiple ratio will not affect to the output
frequency.
The number of output pulses of this instruction is proportionate to the number of input pulses and the electronic
gear ratio only, other parameters are ineffectual.
When the related forward / reverse limit switch is activated during the MPG instruction generates pulses, that will
cause the imminently stop.
The condition contact turns “OFF” during the MPG instruction generates pulses, it will slow down then stop.
This instruction can be written as many times as required and the points Y0~Y3 can be used to generate pulses
individually at the same time.
The example below uses Y0 output axis for the description of this instruction since the output axes Y1~Y3 have the
same function. The three devices between parentheses ( ) indicate those are corresponding to Y1~Y3 respectively.
M9340 indicates the Y0 is occupied by a positioning instruction. (M9360, M9380, M9400)
Any instruction uses the Y0 to generate pulse string and it is already activated, that will occupy the resource of Y0
axis consistently. However, turn the condition contact of this activated instruction “OFF” could release the resource.
Thus, before to activate this instruction should conrm the state of M9340.
If the M9340 = “ON”, that indicates the Y0 is BUSY to generate pulse string or other instruction still occupies the
resource of the Y0. Even though, the condition contact of this instruction is “ON”, the instruction will not execute.
If the M9340 = “OFF”, that indicates the Y0 is in the READY status (its resource is free to use), the Y0 can be used
for this instruction.
M9341 is the pulse output monitor of the Y0. (M9361, M9381, M9401)
When the Y0 is generating pulses, M9341 = “ON”.
Forward / Reverse limit switch (under the “Positioning Parameter Setup” of the Ladder Master S).
When the forward / reverse limit switch is active, that limits all the forward / reverse actions. That makes the
forward / reverse motor to slow down and stop.
At this moment, only the moving request of opposite direction can be accepted.
D9351, D9350 display the positioning current speed of Y0. (DD9370, DD9390, DD9410)
When the instruction is active, this 32-bit special register shows the present value of operating speed (by user unit).
D9355, D9354 display the positioning location (present value PV) of Y0. (DD9374, DD9394, DD9414) (by user unit)
When the power is turned from “OFF” to “ON”, the initial value of this 32-bit special register is set as 0. Afterward,
to operate any related positioning control instruction will affect to its content, it shows the location of Y0
(by user unit).

460
Program example:
This example uses an electronic handwheel which with an X/Y axis switch and an ×1/×10/×100 switch to perform
the 2-axis handwheel control.
Connect the MPG control operational switch to the input X7.
Connect the A-phase signal of the handwheel to the input X3.
Connect the B-phase signal of the handwheel to the input X4.
Connect the X or Y axis selecting switch to the input X10. If the X10 = ON, then the MPG instruction is used to
drive the X axis, else the X10 = OFF is to drive the Y axis.
Connect the ×1/×10/×100 gear ratio selecting switch to inputs X11, X12 and X13.

VSM-32MT-D
DC24V
S/S

X7 CK
Handwheel operational switch Y0
X axis
Servo drive M
DIR
X10 Y4
X/Y axis selecting switch
×1
X11
×10
X12
Gear ratio
selecting switch ×100 X13

A-phase CK
pulse X3 Y1
Y axis
Servo drive M
B-phase DIR
pulse X4 Y5

Electronic handwheel

M9002
MOV K5 D100 To set the response time = 5 ms.

MOV K1 D102 To set the denominator of the electronic gear ratio = 1


X10
MOV K0 Z0 When the X axis is selected, Z0 = 0 (let Y0 and Y4 to control the servo drive)
X10
MOV K1 Z0 When the Y axis is selected, Z0 = 1 (let Y1 and Y5 to control the servo drive)
X11
MOVP K1 D101 To set the numerator of the electronic gear ratio = 1
X12
MOVP K10 D101 To set the numerator of the electronic gear ratio = 10
X13
MOVP K100 D101 To set the numerator of the electronic gear ratio = 100
X7
Based on the value of Z0, the MPG instruction is to control
MPG K1 D100 Y0Z0 Y4Z0 the X axis (by Y0/Y4) or Y axis (by Y1/Y5).

461
FNC 1 2 M 3
DLIR S D Relative Linear Interpolation
315 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
The 16-bit instruction, S occupies 9 components The 32-bit instruction, S occupies 18 components
D = 0 or 1 (it uses Y0, Y1, Y4 and Y5 if D = 0; it uses Y2, Y3, Y6 and Y7 if D = 1)

S D S : the head register of the parameter block


M0
LIR D1000 K0 D : the parameter to set the executing output points

This instruction is for to reach the linear interpolation positioning between related two axes at a transistor or line
driver PLC. When the instruction starts to operate, the two axes start to generate pulses at the same time then
those will respectively produce the correspond numbers of pulses to achieve the axes' distance to be moved.
After the instruction reaches the target and stops the pulse generating, this positioning is completed.

When the M0 turns “ON”, this relative instruction will move the position from the start-up point (X0, Y0) to the target
point (X0+D1003, Y0+D1004). Thus, the output points Y0 (pulse string for X axis) and Y1 (pulse string for Y axis)
separately use the parameters of D1000 (Composite Initial speed), D1001 (Composite Operating speed) and
D1002 (Acceleration/Deceleration time) to generate pulses simultaneously. Also, the points Y4 (direction signal for
X axis) and Y5 (direction signal for Y axis) will control the moving directions of the axes.

Description of the parameter block S :

16-bit Instruction 32-bit Instruction Description Input Method


Composite initial speed (by user unit)
Available range: 0 ~ ES-30k (the equivalent speed of 30 kHz)
S S +1, S If the set value < 0, will be regarded as 0;
if it > ES-30k, will be regarded as ES-30k.
Composite operating speed (by user unit)
Available range: ES-10 (the equivalent speed of 10 Hz) ~ ES-Max
(the equivalent speed of 1 MHz @ VSM-28ML or
S +1 S +3, S +2 200 kHz @ VSM/VS3 or 50 kHz @ VS1/VS2)
If the set value < ES-10, will be regarded as ES-10;
if it > ES-Max, will be regarded as ES-Max. Designated
S +2 S +5, S +4 Acceleration/Deceleration time (Available range: 0~32,000 ms.) by
user program
Distance to be moved at the X-axis (by user unit)
The PLC will convert this distance to the pulse unit, thus the
S +3 S +7, S +6 converted pulse number must meet the range of a 32-bit data.
If the number is exceeded, will be regarded as an operating error
and M9067 = “ON”.
Distance to be moved at the Y-axis (by user unit)
The PLC will convert this distance to the pulse unit, thus the
S +4 S +9, S +8 converted pulse number must meet the range of a 32-bit data.
If the number is exceeded, will be regarded as an operating error
and M9067 = “ON”.
S +5 S +11, S +10 Bias speed at the X-axis (by user unit)
Result storage
S +6 S +13, S +12 Operating speed at the X-axis (by user unit) area, produced
S +7 S +15, S +14 Bias speed at the Y-axis (by user unit) by the
LIR instruction
S +8 S +17, S +16 Operating speed at the Y-axis (by user unit)
The designated composite initial speed must less than or equal to the composite operating speed.
The axis will not generate pulse if that calculated operating speed is less than 1 Hz.

Description of the parameter D that is used to set the executing output points:
X axis Y axis
D
Pulse string output Direction signal output Pulse string output Direction signal output
K0 Y0 Y4 Y1 Y5
K1 Y2 Y6 Y3 Y7

When the output of direction control signal is “ON”, the motor moves forward; conversely, “OFF” moves reverse.
Besides, the “ON”/“OFF” status of the direction control signal is decided by both the +/- numerical value of the
axis's distance to be moved and the parameter of the rotational direction (increase present value when forward /
backward)

462
For example, before the instruction executes, the current position CP of start-up point is (X0, Y0) = (2000,1000),
D1000 = K1000 (Composite initial speed Hz), D1001 = K3000 (Composite operating speed Hz), D1002 = K300
(Acceleration/Deceleration time ms.), D1003 = K4000 (Distance to be moved at the X-axis) and D1004 = K3000
(Distance to be moved at the Y-axis). When the M0 turns from “OFF” to “ON”, this LIR instruction will compute the
further parameters and ll D1005~D1008 up, then all the related signals of X-axis and Y-axis will start to output.
Those points use the data at the parameter block to move the positioning path from (2000,1000) to (6000,4000),
as shown below.
Y axis (Y1)
Target point
(X0+D1003,Y0+D1004)
=(6000,4000)

D1004
=K3000

Start-up point(X0,Y0)
=(2000,1000)

( 0,0 ) X axis (Y0)

D1003=K4000

The formulas to get the data at D1005~D1008 and the relationship diagram between the X-axis, Y-axis and timing:
( D1003) ( D1004)
D1005=D1000× ;D1007=D1000×
( D1003) 2 + ( D1004 ) 2 ( D1003) 2 + ( D1004 ) 2

( D1003) ( D1004)
D1006=D1001× ;D1008=D1001×
( D1003) 2 + ( D1004 ) 2 ( D1003) 2 + ( D1004 ) 2

Output speed of Acceleration / Acceleration /


X-axis (Y0) Deceleration time Deceleration time
(D1002) (D1002)

Operating speed of
X-axis (D1006)

(D1003)
Distance of X-axis
Bias speed of to be moved
X-axis (D1005)

Time
Output speed of
Y-axis (Y1)

Operating speed of
Y-axis (D1008)
(D1004)
Distance of Y-axis
Bias speed of to be moved
Y-axis (D1007)

Time
M0
Condition contact
M9340 and M9360
READY/BUSY Flag
M9341 and M9361
Pulse output monitor ag
M9342 and M9362
Positioning completed ag

463
During the instruction is in operation, to change any related parameter will be regarded as invalid. Therefore, all the
necessary data at the parameter block S should be set up completely before it starts.
When this instruction completes the movement of specic distances at both axes, that will let the positioning
completed ag M9342 and M9362 both = “ON”.
If the condition contact M0 turns “OFF” during the pulses are output, the movement of both axes will be gradually
slow down then stop. Thus, that will not to turn the positioning completed ag M9342 or M9362 “ON” neither.
The operation of this instruction will not be affected by the content values of the D9340~D9344, D9348,
D9360~D9364, D9368, D9380~D9384, D9388, D9400~D9404 and D9408.
When the distance to be moved at the X-axis and Y-axis are both equal to zero, this instruction will not execute.
The instruction will occupy two pulse output points at the same time ( D =K0 uses Y0+Y1; D =K1 uses Y2+Y3).
The example below uses (Y0+Y1) output axes for the description of this instruction. Since the output axes (Y2+Y3)
have the same function, the devices between parentheses () indicate those are corresponding to (Y2+Y3).
M9340/M9360 indicates that Y0/Y1 is occupied by a positioning instruction. (M9380/M9400)
Any instruction uses the Y0/Y1 to generate pulse string and it is already activated, that will occupy the resource of
Y0/Y1 axis consistently. However, turn the condition contact of this activated instruction “OFF” could release the
resource.
Thus, before to activate this instruction should conrm the states of M9340 and M9360 both.
If the M9340 = “ON”, that indicates the Y0 is BUSY to generate pulse string or other instruction still occupies the
resource of the Y0. Even though, the condition contact of this instruction is “ON”, the instruction will not execute.
If the M9360 = “ON”, that indicates the Y1 is BUSY to generate pulse string or other instruction still occupies the
resource of the Y1. Even though, the condition contact of this instruction is “ON”, the instruction will not execute.
If both the M9340 and M9360 = “OFF”, that indicates the Y0 and Y1 are in the READY status (these resources are
free to use), the Y0+Y1 can be used for this instruction.
M9341/M9361 is the pulse output monitor of the Y0/Y1. (M9381/M9401)
When the Y0/Y1 is generating pulses, both of the M9341/M9361 = “ON”.
M9342/M9362 is the positioning completed ag of the Y0/Y1. (M9382/M9402)
When the positioning instruction is completed, both of the M9342/M9362 = “ON”.
Turn “OFF” the condition contact of the completed instruction will lead the ag M9342/M9362 “OFF”.
M9343/M9363 is the positioning abnormal stop ag of the Y0/Y1. (M9383/M9403)
Trigger any related compulsive stop ag or the forward / reverse limit switch during the unnished Y0+Y1
positioning function, will cause both the Y0 and Y1 stop to generate pulses and let the M9343/M9363 = “ON” to
indicate this stop is abnormal.
Turn “OFF” the condition contact of the activated instruction will lead the ag M9343/M9363 “OFF”.
M9345/M9365 is the ag to stop the Y0 and Y1 generating pulse string (by gradually slow down). (M9385/M9405)
When either the M9345 or M9365 is turned “ON”, the pulse generating at both the Y0 and Y1 will gradually slow
down then stop.
After the stop signal is discontinued, to make the axes move must release the positioning instruction then restart.
M9346/M9366 is the ag to imminently stop the Y0 and Y1 generating pulse string. (M9386/M9406)
When either the M9346 or M9366 is turned “ON”, the pulse generating at both the Y0 and Y1 will stop imminently
(without to slow down).
After the stop signal is discontinued, to make the axes move must release the positioning instruction then restart.
Forward / Reverse limit switch (under the “Positioning Parameter Setup” of the Ladder Master S).
When either one of the related forward / reverse limit switch is activated, that limits both the actions of the Y0 and
Y1 to make the motors slow down and stop.
DD9350/DD9370 display the positioning current speed of the Y0/Y1. (DD9390/DD9410)
When the instruction is active, those 32-bit special registers show the present value of operating speeds
(by user unit).
DD9354/DD9374 display the positioning location (present value PV) of the Y0/Y1. (DD9394/DD9414) (by user unit)
When the power is turned from “OFF” to “ON”, the initial value of those 32-bit special registers are 0.
Afterward, to operate any related positioning control instruction will affect to the contents, they indicate the location
of the Y0 and Y1 (by user unit).

464
FNC 1 2 M 3
DLIA S D Absolute Linear Interpolation
316 ○ ○ ○ ○

Devices
Operand
X Y M S D.b R.b KnX KnY KnM KnS T C D,R V,Z UnG K,H E " $"
S
D
The 16-bit instruction, S occupies 9 components The 32-bit instruction, S occupies 18 components
D = 0 or 1 (it uses Y0, Y1, Y4 and Y5 if D = 0; it uses Y2, Y3, Y6 and Y7 if D = 1)

S D S : the head register of the parameter block


M0
LIA D1000 K1 D : the parameter to set the executing output points

This instruction is for to reach the linear interpolation positioning between related two axes at a transistor or line
driver PLC. When the instruction starts to operate, the two axes start to generate pulses at the same time then
those will respectively produce the correspond numbers of pulses to achieve the X/Y axes location (present values)
equal to target point. After the instruction reaches the target and stops the pulse generating, this positioning is
completed.

When the M0 turns “ON”, this absolute instruction will move the position from the start-up point (X0, Y0) to the
target point (D1003, D1004). Thus, the points Y2 (pulse string for X axis) and Y3 (pulse string for Y axis) separately
use the parameters of D1000 (Composite Initial speed), D1001 (Composite Operating speed) and D1002
(Acceleration/Deceleration time) to generate pulses simultaneously. Also, the points Y6 (direction signal for X axis)
and Y7 (direction signal for Y axis) will control the moving directions of the axes.

Description of the parameter block S :

16-bit Instruction 32-bit Instruction Description Input Method


Composite initial speed (by user unit)
Available range: 0 ~ ES-30k (the equivalent speed of 30 kHz)
S S +1, S If the set value < 0, will be regarded as 0;
if it > ES-30k, will be regarded as ES-30k.
Composite operating speed (by user unit)
Available range: ES-10 (the equivalent speed of 10 Hz) ~ ES-Max
(the equivalent speed of 1 MHz @ VSM-28ML or
S +1 S +3, S +2 200 kHz @ VSM/VS3 or 50 kHz @ VS1/VS2)
If the set value < ES-10, will be regarded as ES-10;
if it > ES-Max, will be regarded as ES-Max. Designated
S +2 S +5, S +4 Acceleration/Deceleration time (Available range: 0~32,000 ms.) by
user program
Target point at the X-axis (by user unit)
The target is an absolute position that is related to the zero point.
S +3 S +7, S +6 The PLC will convert this target to the pulse unit, thus the converted
pulse number must meet the range of a 32-bit data. If the number is
exceeded, will be regarded as an operating error and M9067=“ON”.
Target point at the Y-axis (by user unit)
The target is an absolute position that is related to the zero point.
S +4 S +9, S +8 The PLC will convert this target to the pulse unit, thus the converted
pulse number must meet the range of a 32-bit data. If the number is
exceeded, will be regarded as an operating error and M9067=“ON”.
S +5 S +11, S +10 Bias speed at the X-axis (by user unit)
Result storage
S +6 S +13, S +12 Operating speed at the X-axis (by user unit) area, produced
S +7 S +15, S +14 Bias speed at the Y-axis (by user unit) by the
LIA instruction
S +8 S +17, S +16 Operating speed at the Y-axis (by user unit)
The designated composite initial speed must less than or equal to the composite operating speed.
The axis will not generate pulse if that calculated operating speed is less than 1 Hz.

Description of the parameter D that is used to set the executing output points:
X axis Y axis
D
Pulse string output Direction signal output Pulse string output Direction signal output
K0 Y0 Y4 Y1 Y5
K1 Y2 Y6 Y3 Y7

When the output of direction control signal is “ON”, the motor moves forward; conversely, “OFF” moves reverse.
Besides, the “ON”/“OFF” status of the direction control signal is decided by both the +/- numerical value of the
axis's distance to be moved (Target point - Present value, PV) and the parameter of the rotational direction (increase
present value when forward / backward) are executed.

465
For example, before the instruction executes, the current position CP of start-up point is (X0, Y0) = (2000,1000),
D1000 = K1000 (Composite initial speed Hz), D1001 = K3000 (Composite operating speed Hz), D1002 = K300
(Acceleration/Deceleration time ms.), D1003 = K6000 (Target point at the X-axis) and D1004 = K4000 (Target point
at the Y-axis). When the M0 turns from “OFF” to “ON”, this LIA instruction will compute the further parameters and
ll D1005~D1008 up, then all the related signals of X-axis and Y-axis will start to output. Those points use the data
at the parameter block to move the positioning path from (2000,1000) to (6000,4000), as shown below.
Y axis (Y3)
Target point
(D1003,D1004)
=(6000,4000)

D1004
=K4000

Start-up point(X0,Y0)
=(2000,1000)

( 0,0 ) X axis (Y2)

D1003=K6000

The formulas to get the data at D1005~D1008 and the relationship diagram between the X-axis, Y-axis and timing:
( D1003–X 0 ) ( D1004–Y 0 )
D1005=D1000× ;D1007=D1000×
( D1003–X 0 ) 2 + ( D1004–Y 0 ) 2 ( D1003–X 0 ) 2 + ( D1004–Y 0 ) 2

( D1003–X 0 ) ( D1004–Y 0 )
D1006=D1001× ;D1008=D1001×
( D1003–X 0 ) 2 + ( D1004–Y 0 ) 2 ( D1003–X 0 ) 2 + ( D1004–Y 0 ) 2

Output speed of Acceleration / Acceleration /


X-axis (Y2) Deceleration time Deceleration time
(D1002) (D1002)

Operating speed of
X-axis (D1006)

(D1003–X0)
Distance of X-axis
Bias speed of to be moved
X-axis (D1005)

Time
Output speed of
Y-axis (Y3)

Operating speed of
Y-axis (D1008)
(D1004–Y0)
Distance of Y-axis
Bias speed of to be moved
Y-axis (D1007)

Time
M0
Condition contact
M9380 and M9400
READY/BUSY Flag
M9381 and M9401
Pulse output monitor ag
M9382 and M9402
Positioning completed ag

466
During the instruction is in operation, to change any related parameter will be regarded as invalid. Therefore, all the
necessary data at the parameter block S should be set up completely before it starts.
When this instruction completes the movement to the target point at both axes, that will let the positioning
completed ag M9382 and M9402 both = “ON”.
If the condition contact M0 turns “OFF” during the pulses are output, the movement of both axes will be gradually
slow down then stop. Thus, that will not to turn the positioning completed ag M9382 or M9402 “ON” neither.
The operation of this instruction will not be affected by the content values of the D9380~D9384, D9388,
D9400~D9404, D9408, D9420~D9424, D9428, D9440~D9444 and D9448.
When the distance to be moved at the X-axis and Y-axis are both equal to zero (Start-up point = Target point), this
instruction will not execute.
The instruction will occupy two pulse output points at the same time ( D =K0 uses Y0+Y1; D =K1 uses Y2+Y3).
The example below uses (Y0+Y1) output axes for the description of this instruction. Since the output axes (Y2+Y3)
have the same function, the devices between parentheses () indicate those are corresponding to (Y2+Y3).
M9340/M9360 indicates that Y0/Y1 is occupied by a positioning instruction. (M9380/M9400)
Any instruction uses the Y0/Y1 to generate pulse string and it is already activated, that will occupy the resource of
Y0/Y1 axis consistently. However, turn the condition contact of this activated instruction “OFF” could release the
resource.
Thus, before to activate this instruction should conrm the states of M9340 and M9360 both.
If the M9340 = “ON”, that indicates the Y0 is BUSY to generate pulse string or other instruction still occupies the
resource of the Y0. Even though, the condition contact of this instruction is “ON”, the instruction will not execute.
If the M9360 = “ON”, that indicates the Y1 is BUSY to generate pulse string or other instruction still occupies the
resource of the Y1. Even though, the condition contact of this instruction is “ON”, the instruction will not execute.
If both the M9340 and M9360 = “OFF”, that indicates the Y0 and Y1 are in the READY status (these resources are
free to use), the Y0+Y1 can be used for this instruction.
M9341/M9361 is the pulse output monitor of the Y0/Y1. (M9381/M9401)
When the Y0/Y1 is generating pulses, both of the M9341/M9361 = “ON”.
M9342/M9362 is the positioning completed ag of the Y0/Y1. (M9382/M9402)
When the positioning instruction is completed, both of the M9342/M9362 = “ON”.
Turn “OFF” the condition contact of the completed instruction will lead the ag M9342/M9362 “OFF”.
M9343/M9363 is the positioning abnormal stop ag of the Y0/Y1. (M9383/M9403)
Trigger any related compulsive stop ag or the forward / reverse limit switch during the unnished Y0+Y1
positioning function, will cause both the Y0 and Y1 stop to generate pulses and let the M9343/M9363 = "ON" to
indicate this stop is abnormal.
Turn “OFF” the condition contact of the activated instruction will lead the ag M9343/M9363 “OFF”.
M9345/M9365 is the ag to stop the Y0 and Y1 generating pulse string (by gradually slow down). (M9385/M9405)
When either the M9345 or M9365 is turned “ON”, the pulse generating at both the Y0 and Y1 will gradually slow
down then stop.
After the stop signal is discontinued, to make the axes move must release the positioning instruction then restart.
M9346/M9366 is the ag to imminently stop the Y0 and Y1 generating pulse string. (M9386/M9406)
When either the M9346 or M9366 is turned “ON”, the pulse generating at both the Y0 and Y1 will stop imminently
(without to slow down).
After the stop signal is discontinued, to make the axes move must release the positioning instruction then restart.
Forward / Reverse limit switch (under the “Positioning Parameter Setup” of the Ladder Master S).
When either one of the related forward / reverse limit switch is activated, that limits both the actions of the Y0 and
Y1 to make the motors slow down and stop.
DD9350/DD9370 display the positioning current speed of the Y0/Y1. (DD9390/DD9410)
When the instruction is active, those 32-bit special registers show the present value of operating speeds
(by user unit).
DD9354/DD9374 display the positioning location (present value PV) of the Y0/Y1. (DD9394/DD9414) (by user unit)
When the power is turned from “OFF” to “ON”, the initial value of those 32-bit special registers are 0.
Afterward, to operate any related positioning control instruction will affect to the contents, they indicate the location
of the Y0 and Y1 (by user unit).

467
8-4 Positioning Program Example
8-4-1 Positioning Program Example for the VS1 or VS2 Series PLC
This example uses the combination of the VS1 or VS2 transistor Main Unit and a stepper motor drive to complete a
positioning control system. This control example carries out the home position return, forward JOG, reverse JOG and
single-speed positioning functions. The brief diagram of the system is shown below.

VS1-32MT
X10 Home position return
X11 JOG+
CK Pulse output Y0
X12 JOG
Stepper motor drive
DIR Direction output Y1 X13 Move back to zero point
X14 Single-speed positioning
X15 Stop
X17 X2 X16

LSR DOG LSF


Reverse limit Near point Forward limit
switch signal switch

Direction of home positioning


Sliding table
Stepper
motor
Driving screw

Use the “Positioning Parameter Setup” function which is provided by the programming tools Ladder Master S to set the
relevant parameters about the Y0 axis. Select the “DOG Rear End home positioning” as the home return mode.
Then the settings will be written onto the PLC with the project.

468
The wiring example between the VS1 transistor Main Unit and a stepper servo drive

VS1-32MT Stepper motor drive

Near point signal


X2 (DOG)

X10 Home position return

X11 JOG+

X12 JOG
Stepper motor
X13 Move back to
zero point

X14 Single-speed positioning

X15 Stop

X16 Forward limit


switch AC110

X17 110V AC
Reverse limit
switch power
AC110

S/S
FG
24V DC
24V power
IN
2K 220Ω
CK+
Y0 CK

C0 2K 220Ω
DIR+
Y1 DIR

X15
M9345 Prevent the Y0 to generate the pulse string (by gradually slow down)
M9340 X10 M9342
ZRN K30000 K1000 Y0 Y1 The Home Position Return function
M0
M0 The Home Position Return function is operating (self holding contact)
X11
DDRVR K2147483647 K10000 Y0 Y1 The JOG+ action
X12
DDRVR K-2147483648 K10000 Y0 Y1 The JOG– action
M9344 M9340 X13 M9342 The function to move back to the zero point
DDRVA K0 K10000 Y0 Y1 (= home position when the D9346 = 0)
M1 The function to move back to the zero point is operating
M1 (self holding contact)
M9340 X14 M9342
DDRVR K50000 K10000 Y0 Y1 The function of single-speed positioning
M2 The function of single-speed positioning is operating
M2 (self holding contact)
M9343
SET Y10 The positioning function has been stopped abnormally

469
8-4-2 Positioning Program Example for the VSM or VS3 Series PLC
This example uses the combination of the VSM or VS3 transistor Main Unit and a Mitsubishi servo drive (MR-J2) to
complete a positioning control system. This control example carries out the home position return, forward JOG, reverse
JOG and single-speed positioning functions. The brief diagram of the system is shown below.

VSM-32MT
X10 Home position return
Pulse output Y0 X11 JOG+
X12 JOG
Servo motor drive Direction output Y1
X13 Move back to zero point
CLR
Clear signal Y7 X14 Single-speed positioning
X15 Stop
X17 X0 X16

LSN LSR DOG LSF LSP


Reverse limit Reverse limit Near point Forward limit Forward limit
switch switch signal switch switch

Direction of home positioning


Sliding table
Servo
motor
Driving screw

Use the “Positioning Parameter Setup” function which is provided by the programming tools Ladder Master S to set the
relevant parameters about the Y0 axis. Select the “DOG Rear End home positioning” as the home return mode.
Then the settings will be written onto the PLC with the project.

470
The wiring example between the VSM transistor Main Unit & Mitsubishi servo drive (MR-J2)

VSM-32MT MR-J2 series


servo motor drive
Near point signal
X0

electric power Servo motor


(DOG)
RA1 RD R

3-phase
S
X10 Home position RA2 INP
return T

X11 JOG+
RA3 ALM U
VDD V
X12 JOG COM W
SON
RES
X13 Move back to
zero point LSP
LSN
X14 Single-speed T L
positioning EMG
S G
X15 Stop
SON : Servo ON
RES : Alarm reset
X16 Forward limit LSP : Forward limit
switch switch Set its parameter Pr0 to
LSN : Reverse limit the position control mode
switch
X17 Reverse limit TL : Torque limit
switch switch
EMG : Emergency stop
S/S
P
C
24V DC Regenerative
24V power resistor
IN
OPC
S D Plate
Y0 P P

C0 S G

Y1 N P

C1 S G

Y7 C R

X15
M9345 Prevent the Y0 to generate the pulse string (by gradually slow down)
M9340 X10
SET M0 Set the condition contact of the Home Position Return function
M9344 X13
SET M1 Set the condition contact for to move back to the zero point
X14
SET M2 Set the condition contact of the single-speed positioning
X11
JOGF K300 K10000 Y0 Y1 The JOG+ function
X12
JOGR K300 K10000 Y0 Y1 The JOG – function
M0
DZRN K100000 K1000 Y0 Y1 The Home Position Return function
M1 The function to move back to the zero point
DDRVA K0 K100000 Y0 Y1 (= home position when the D9346=0)
M2
DDRVR K500000 K100000 Y0 Y1 The function of single-speed positioning
M9342
ZRST M0 M2 To clear all the function condition contacts when one of those is nished
M9343
SET Y10 The positioning function has been stopped abnormally

471
8-4-3 8 Axes Positioning Program Example
One VS series transistor or line driver Main Unit can support 4 axes position control. If the control is required more than
4 axes, one unit is not enough. However, we can use the character of the CPU LINK communication to immediately
transfer data to other PLCs. At the following example, that links two VS series PLCs to perform an 8 axes positioning.
In the same way, to control more axes are available.
The master station #0 is the main PLC to handle the communication procedure and make the positioning command,
the Station No. 1 become the real output PLC to control #5~#8 axes.
There are 3 sections to explame the control system.
Section 1: To plan the components which will be used for the data transfer between PLCs.
At the project of the master Station No. 0 to establish the CPU LINK communication table. The table is to
designate components to send the data from Station No. 0 to 1 and some are about to send data from No. 1
to 0. This example uses the D100~D114 to send the data from Station No. 0 to 1 for the #5 axis, and the
D115~D119 to send the feedback data from Station No. 1 to 0. The list below shows the related
components will be used by the #5~#8 axes.

The conguration for #5~#8 axes: By the purposes to establish the communication table “CPUL0”:
Item Station Device Range Disable
Axis No. From No. 0 to 1 From No. 1 to 0 No. No. Word / Bit Contact
#5 axis D100~D114 D115~D119 1 0 D100 – D114
#6 axis D120~D134 D135~D139 2 1 D115 – D119
#7 axis D140~D154 D155~D159 3 0 D120 – D134
#8 axis D160~D174 D175~D179 4 1 D135 – D139
5 0 D140 – D154
6 1 D155 – D159
7 0 D160 – D174
8 1 D175 – D179

The transfer purposes of related components: (below are for the #5 axis only, the rest may be inferred by analogy)
(D101, D100) — Set JOG speed
(D103, D102) — Set ZRN (Home Positioning) speed
(D105, D104) — Set ZRN (Home Positioning) creep speed
(D107, D106) — Set target position #1
(D109, D108) — Set target position #2
(D111, D110) — Set operation speed #1
(D113, D112) — Set operation speed #2

D114 — Operation command


b15~b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0

PLSV STOP
DVSA JOGF
DVSR JOGR
DV2I ZRN
DVIT DRVR
DV2A DRVA
DV2R

D115 — Operation status feedback


b15~b5 b4 b3 b2 b1 b0
Zero home positioning
READY/BUSY ag
had been completed
Pulse output status ag
Positioning abnormal stop ag Positioning completed ag

(D117, D116) — Current speed feedback


(D119, D118) — Current location feedback

472
Section 2: To complete the related setting at the Station No. 1 for the #5~#8 axes.
According to the positioning mission to ll in the parameters of the Y0~Y3 (#5~#8 axes).
The diagram and picture are the brief wiring and setup example for the Y0 (#5 axis).

VSM-32MT(Station No. 1)

Pulse output Y0

Servo motor drive Direction output Y4


CLR
Clear signal Y10

X11 X0 X10

LSN LSR DOG LSF LSP


Reverse limit Reverse limit Near point Forward limit Forward limit
switch switch signal switch switch

Direction of home positioning


Sliding table
Servo
motor
Driving screw

473
And then, edit the user program to control each axis.
Since the control procedure is according to the command from the Station No. 0, the program in this Station No. 1 is to
receive the command then generates the real control pulses. Also, the construct for all the Y0~Y3 are the same, the
tiny differences are the allocated components (please refer to the previous Section 1). This brief positioning example is
for to control the Y0 (#5 axis) only, but user can use the same shape to nish other positioning axis.

Y0 uses D100~D119
DD100=JOG spd; DD102=ZRN spd; DD104=ZRN creep spd; DD106=Target#1; DD108=Target#2;
DD110=Spd#1; DD112=Spd#2; D114=Command; D115=Status; DD116=Current spd; DD118=Current location

D115 delivers the operation status of Y0


b0=READY/BUSY ag; b1=Pulse output status ag; b2=Positioning completed ag;
b3=Positioning abnormal stop ag; b4=Zero home positioning had been completed

D114 transfers the operation command for the Y0 positioning


b0=STOP; b1=JOGF; b2=JOGR; b3=ZRN; b4=DRVR; b5=DRVA; b6=DV2R; b7=DV2A;
b8=DVIT; b9=DV2I; b10=DVSR; b11=DVSA; b12=PLSV

M9340
D115.0 For to deliver the READY/BUSY ag feedback to the master station
M9341
D115.1 For to deliver the pulse output status ag feedback to the master station
M9342
D115.2 For to deliver the positioning completed ag feedback to the master station
M9343
D115.3 For to deliver the positioning abnormal stop ag feedback to the master station
M9344
D115.4 For to deliver the ZRN completed ag feedback to the master station
M9000
MOV D114 K4M100 Transfer the commands from the master station to individual function contacts
M100
M9346 Force the Y0 axis immediately stop
M101
DJOGF K300 D100 Y0 Y4 Use the JOG speed from the master to perform the JOG+ operation
M102
DJOGR K300 D100 Y0 Y4 Use the JOG speed from the master to perform the JOG- operation
M103 Use the ZRN speed and ZRN creep speed from the master to
DZRN D102 D104 Y0 Y4 perform the ZRN operation
M104 Use the target #1 and speed #1 from the master to
DDRVR D106 D110 Y0 Y4 perform the relative positioning
M105 Use the target #1 and speed #1 from the master to
DDRVA D106 D110 Y0 Y4 perform the absolute positioning
M106 Use the targets and speeds from the master to
DDV2R D106 D110 Y0 Y4 perform the 2 stages relative positioning
M107 Use the targets and speeds from the master to
DDV2A D106 D110 Y0 Y4 perform the 2 stages absolute positioning
M108 Use the target #1 and speed #1 from the master to
DDVIT D106 D110 Y0 Y4 perform the interrupt constant quantity positioning
M109 Use the target #1 and speeds from the master to
DDV2I D106 D110 Y0 Y4 perform the 2 stages interrupt constant quantity positioning
M110 Use the target #1 and speed #1 from the master to
DDVSR D106 D110 Y0 Y4 perform the interrupt to stop or drive to relative positioning
M111 Use the target #1 and speed #1 from the master to
DDVSA D106 D110 Y0 Y4 perform the interrupt to stop or drive to absolute positioning
M112 Use the speed #1 from the master to
DPLSV D110 Y0 Y4 perform the variable speed pulse output
M9000
DMOV D9350 D116 For to deliver the current speed feedback to the master station

DMOV D9354 D118 For to deliver the current location feedback to the master station

474
Section 3: To edit the related program and setting at the master Station No. 0.
Create the communication table “CPUL0” for the CPU LINK and add the CPUL instruction into the program
of the master Station No. 0, thus the station No. 0 and No. 1 will transfer the related data to each other
automatically.
#5 axis uses D100~119
DD100=JOG spd; DD102=ZRN spd; DD104=ZRN creep spd; DD106=Target#1; DD108=Target#2
DD110=Spd#1; DD112=Spd#2; D114=Command; D115=Status; DD116=Current spd; DD118=Current location

#6 axis uses D120~139


DD120=JOG spd; DD122=ZRN spd; DD124=ZRN creep spd; DD126=Target#1; DD128=Target#2
DD130=Spd#1; DD132=Spd#2; D134=Command; D135=Status; DD136=Current spd; DD138=Current location

#7 axis uses D140~159


DD140=JOG spd; DD142=ZRN spd; DD144=ZRN creep spd; DD146=Target#1; DD148=Target#2
DD150=Spd#1; DD152=Spd#2; D154=Command; D155=Status; DD156=Current spd; DD158=Current location

#8 axis uses D160~179


DD160=JOG spd; DD162=ZRN spd; DD164=ZRN creep spd; DD166=Target#1; DD168=Target#2
DD170=Spd#1; DD172=Spd#2; D174=Command; D175=Status; DD176=Current spd; DD178=Current location

M9000
CPUL CPUL0 D0 K1

Next, edit the control program for the #5 axis. The following example program carries out the home position return,
forward JOG, reverse JOG and single-speed positioning functions.
User can try to edit a complex positioning program for study and test, also can use the same shape to add up control
program for the #6~#8 axes.
The brief diagram of the #5 axes is shown below.

CPU LINK

CP1( Station No. 1) CP1( Station No.0)


VSM-32MT VSM-32MT Home position
X10 return
Pulse output Y0 X11 JOG+
X12 JOG
Servo motor drive Move back to
Direction output Y4 X13 zero point
CLR X14 Single-speed
Clear signal Y10 positioning
X15 Stop
X11 X0 X10

LSN LSR DOG LSF LSP


Reverse limit Reverse limit Near point Forward limit Forward limit
switch switch signal switch switch

Direction of home positioning

Sliding table
Servo
motor
Driving screw

475
This brief positioning example is in the master Station No. 0 to control the #5 axis at the Station No. 1.
#5 axis uses D100~119
DD100=JOG spd; DD102=ZRN spd; DD104=ZRN creep spd; DD106=Target#1; DD108=Target#2;
DD110=Spd#1; DD112=Spd#2; D114=Command; D115=Status; DD116=Current spd; DD118=Current location

D115 delivers the operation status of #5


b0=READY/BUSY ag; b1=Pulse output status ag; b2=Positioning completed ag;
b3=Positioning abnormal stop ag; b4=Zero home positioning had been completed

D114 transfers the operation command for the #5 positioning


b0=STOP; b1=JOGF; b2=JOGR; b3=ZRN; b4=DRVR; b5=DRVA; b6=DV2R; b7=DV2A;
b8=DVIT; b9=DV2I; b10=DVSR; b11=DVSA; b12=PLSV

X15
M100 Force the #5 axis immediately stop
D115.0 X10
DMOV K100000 D102 Set the ZRN speed for the #5 axis

DMOV K1000 D104 Set the ZRN creep speed for the #5 axis

SET M103 Trigger the #5 axis to perform the ZRN operation


M9000
DMOV K10000 D100 Set the JOG speed for the #5 axis
X11
M101 Trigger the #5 axis to perform the JOG+ operation
X12
M102 Trigger the #5 axis to perform the JOG- operation
D115.0 D115.4 X13
DMOVP K0 D106 Set the target position for the absolute positioning at #5 axis

DMOVP K100000 D110 Set the operation speed for the absolute positioning at #5 axis

SET M105 Trigger the #5 axis to perform the absolute positioning


X14
DMOV K500000 D106 Set the target position for the relative positioning at #5 axis

DMOV K100000 D110 Set the operation speed for the relative positioning at #5 axis

SET M104 Trigger the #5 axis to perform the relative positioning


D115.2
To clear all the #5 axis's function trigger contacts when one of those
ZRST M103 M111
is nished
D115.3
SET Y14 The #5 axis's positioning function has been stopped abnormally
M9000 Transfer the trigger commands from the master Station No. 0 to the
MOV K4M100 D114 Station No. 1 for the #5 axis's positioning function contacts

476
477
Initial Index of Application Instructions

Initial

Initial

Initial
Page Page Page Page
Mnemonic Mnemonic Mnemonic Mnemonic
No. No. No. No.
D ADD P 150 D DV2R 438 D LD> 342 STMR 199
ANS 172 D DV2A 440 D LD< 342 SORT 203
ANR P 172 D DVIT 442 D LD<> 342 SEGD P 210
D ABSD 195 D D DV2I 444 D LD<= 342 SEGL 211
L
ALT P 200 D DVSR 446 D LD>= 342 D SIN P 273
ASC 212 D DVSA 448 D LIMIT P 344 D SWAP P 287
ASCI P 224 DTBL 452 D LIR 462 S D SORT2 288
D ASIN P 276 EI 134 D LIA 465 D STOH P 299
A D ACOS P 277 ENCO P 168 D MOV P 142 D STR P 322
D ATAN P 278 D ECMP P 256 D MUL P 152 SFR P 339
D AND= 342 D EZCP P 257 D MEAN P 171 SFL P 339
D AND> 342 D EMOV P 258 MTR 180 D SCL P 347
M
D AND< 342 D ESTR P 259 MBUS 290 D SCL2 P 347
D AND<> 342 D EVAL P 261 M I DR P 330 TTMR 198
D AND<= 342 D EBCD P 262 M I DW P 331 D TKY 206
E
D AND>= 342 D EBIN P 262 MPG 459 D TO P 215
D ABS 458 D EADD P 263 NEXT 137 TPID 246
N
BMOV P 145 D ESUB P 264 D NEG P 156 D TAN P 275
D BCD P 148 D EMUL P 265 D OR= 342 TCMP P 294
D BIN P 148 D EDIV P 266 D OR> 342 TZCP P 295
T
D BON P 170 D EXP P 267 D OR< 342 TADD P 296
O
BTOW P 284 D ESQR P 270 D OR<> 342 TSUB P 297
D BK P 318 D ENEG P 271 D OR<= 342 TRD P 300
D BK P 319 FEND 135 D OR>= 342 TWR P 301
B D BKCMP= P 320 FOR 137 D PLSY 187 TFT 307
D BKCMP> P 320 D FMOV P 146 PWM 189 TFH 308
D BKCMP< P 320 F D FLT P 175 D PLSR 190 TFK 309
D BKCMP<> P 320 D FROM P 214 PR 213 U UNI P 285
P
D BKCMP<= P 320 FDEL P 336 D PRUN P 223 V D VAL P 324
D BKCMP>= P 320 FINS P 337 PID 229 WDT P 136
D BAND P 345 D GRY P 305 POP P 338 D WAND P 155
G
D B I NDA P 350 D GBIN P 306 D PLSV 450 D WOR P 155
CJ P 132 D HSCS 181 D ROR P 158 D WXOR P 155
W
CALL P 133 D HSCR 183 D ROL P 158 WSFR P 161
D CMP P 140 D HSZ 184 D RCR P 159 WSFL P 162
D CML P 144 D HKY 207 D RCL P 159 D WSUM P 282
C
CCD P 226 H HEX P 225 REF P 178 WTOB P 283
CPUL 227 D HTOS P 298 R REFF P 179 X D XCH P 147
D COS P 274 D HOUR 304 RAMP 201 D ZCP P 141
CRC P 314 D HHCMV P 315 RS 218 ZRST P 166
DI 134 D HSCT 351 D RAD P 279 ZPUSH P 254
Z
D DIV P 153 IRET 134 RND P 312 ZPOP P 254
D DEC P 154 D INC P 154 R I GHT P 328 D ZONE P 346
DECO P 167 I INCD 197 SRET 133 D ZRN 430
DSW 209 D INT P 272 SMOV P 143 $ P 326
$
DBRD P 244 I NS TR P 333 D SUB P 151 $ MOV P 334
DBWR P 245 D JOGF 432 SFTR P 160
D J
DTRD P 253 D JOGR 432 SFTL P 160
D DEG P 280 LINK 240 S SFWR P 163
DIS P 286 D LOGE P 268 SFRD P 164
DUTY 313 D LOG10 P 269 D SUM P 169
L
D DABIN P 349 LEN P 327 D SQR P 174
D DRVR 434 LEFT P 329 D SPD 186
D DRVA 436 D LD= 342 D SER P 194

478

You might also like