VC PLC Programming Manual v1.1
VC PLC Programming Manual v1.1
Version: V1.1
Date: 2021-05-15
Suzhou Veichi Electric Co., Ltd. provides customers with a full range of technical support services. You can
contact the local office or customer service center of our company, or directly contact our headquarters.
All rights reserved.The content of the manualis subject to change without prior notice.
Address: No.1000 of Songjia Road, Guoxiang Street, Wuzhong Economic and Technological Development
Zone, Suzhou
Hotline: +86-0755-29685680
Website: www.veichi.com
VC Series Micro-PLC Programming Manual Preface
Preface
⚫ Intended readers
This manual is intended for automation technicians to help them master the programming, system design, and
commissioning of VEICHI programmable logic controllers (PLCs), providing reference for both new and senior learners of
PLC programming.
⚫ Content
This manual describes the programming principles, software and hardware programming resources, supported programming
languages, and detailed instructions of VC series PLCs; provides some technical reference, such as high-speed input/output
and communication information; and introduces the application methods of all functions with application instances provided.
⚫ Arrangement
The chapters in this manual are organized from the whole to details. The content of each chapter is independent from that
of another. You can read the manual through to gradually understand VC series PLCs to the full extent, or you can just read
some chapters at any time to get some technical reference.
⚫ Reading guide
1. For readers unfamiliar with PLCs
If you have never used PLCs before, it is recommended that you read chapters 1 to 4 first. These chapters explain the
basics of PLCs, including function descriptions, programming languages, program elements, data types, addressing
modes, soft element definitions, program annotation function and programming, application of main program and
subprograms.
2. For readers familiar with PLCs
If you are familiar with the basic concepts and programming tools of PLCs, you can directly read Chapter 5 "Basic
instructions" and Chapter 6 "Application instructions". These two chapters describe all the instructions of VEICHI VC
series PLCs. To understand how to use sequential function diagrams, high-speed I/O, interruption, and communication
functions, refer to chapters 7 to 10. To understand the functions of positioning control, refer to Chapter 11 "Positioning
function guide". In addition, Appendix K "Instruction order index table" and Appendix L "Instruction classification index
table" allow you to look up descriptions of corresponding instructions by instruction type and alphabetic ordering of the
English names of the instructions, respectively, which makes the reading easier.
⚫ Related documents and references
You can also refer to the following manuals:
• VC1 Series PLC User Manual
VC Series Micro-PLC Programming Manual Preface
Contents
Preface ............................................................................................................................................................................... 1
6.16.2 AND (=, <, >, <>, >=, <=): Integer comparison AND ※instruction ....................................................... 200
6.16.3 OR (=, <, >, <>, >=, <=): Integer comparison OR※instruction ............................................................. 201
6.16.4 LDD (=, <, >, <>, >=, <=): Long integer comparison LDD※instruction ................................................. 202
6.16.5 ANDD (=, <, >, <>, >=, <=): Long integer comparison ANDD※instruction ........................................... 203
6.16.6 ORD (=, <, >, <>, >=, <=): Long integer comparison ORD※instruction................................................ 204
6.16.7 LDR: Floating-point number comparison instruction ............................................................................ 205
6.16.8 ANDR: Floating-point number comparison instruction ......................................................................... 206
6.16.9 ORR: Floating-point number comparison instruction ............................................................................ 207
6.16.10 CMP: Instruction for setting integer comparison to ON ...................................................................... 209
6.16.11 LCMP: Instruction for setting long integer comparison to ON ............................................................. 209
6.16.12 RCMP: Instruction for setting floating-point number comparison to ON ............................................. 210
6.17 Bulk data processing instructions ....................................................................................................................210
6.17.1 BKADD: Bulk data addition operation instruction ................................................................................. 210
6.17.2 BKSUB: Bulk data subtraction operation instruction ............................................................................ 211
6.17.3 BKCMP=,>,<,<>,<=,>=: Bulk data comparison instruction ................................................................... 211
6.18 Datasheet instructions .....................................................................................................................................212
6.18.1 LIMIT: Upper/lower limit control instruction .......................................................................................... 212
6.18.2 DBAND: Deadband control instruction ................................................................................................. 213
6.18.3 ZONE: Zone control instruction ............................................................................................................ 213
6.18.4 SCL: Coordinatesetting instruction ....................................................................................................... 214
6.18.5 SER: Data search instruction ............................................................................................................... 215
VC Series Micro-PLC Programming Manual Preface
6.19 Character string instructions ............................................................................................................................216
6.19.1 STRADD: String combination instruction.............................................................................................. 216
6.19.2 STRLEN: Instruction for detecting the string length ............................................................................. 217
6.19.3 STRRIGHT: Instruction for reading a string from right ......................................................................... 217
6.19.4 STRLEFT: Instruction for reading a string from left .............................................................................. 218
6.19.5 STRMIDR: Instruction for reading any characters of a string ............................................................... 219
6.19.6 STRMIDW: Instruction for replacing any characters of a string ............................................................ 219
6.19.7 STRINSTR: String search instruction ................................................................................................... 220
6.19.8 STRMOV: String transmission instruction ............................................................................................ 221
6.20 Extension file register instructions ...................................................................................................................221
6.20.1 LOADR: Instruction for reading data from an extension file register .................................................... 221
6.20.2 SAVER: Instruction for writing data to an extension file register .......................................................... 222
6.20.3 INITR: Instruction for initializing an extension register ......................................................................... 223
6.20.4 LOGR: Instruction for logging on an extension register ........................................................................ 224
6.20.5 INITER: Instruction for initializing an extension file register.................................................................. 225
6.21 Positioning instructions ....................................................................................................................................227
6.21.1 ZRN: Zero return instruction ................................................................................................................. 227
6.21.2 PLSV:Variable speed pulse output instruction ..................................................................................... 228
6.21.3 DRVI: Relative position control instruction ........................................................................................... 229
6.21.4 DRVA: Absolute position control instruction ......................................................................................... 230
6.21.5 DSZR: Instruction for zero return with DOG ......................................................................................... 231
6.21.6 DVIT: Interrupt positioning instruction .................................................................................................. 232
6.21.7 STOPDV: Pulse output stop instruction................................................................................................ 233
6.21.8 LIN: Linear trajectory interpolation instruction ...................................................................................... 234
6.21.9 CW: Clockwise arc trajectory interpolation ........................................................................................... 237
6.21.10 CCW: Counterclockwise arc trajectory interpolation instruction ......................................................... 238
6.21.11 MOVELINK: Synchronous control instruction ..................................................................................... 241
6.21.12 GEARBOX: Electronic gear instruction .............................................................................................. 243
6.22 Data processing instructions ...........................................................................................................................244
6.22.1 MEAN: Mean instruction....................................................................................................................... 244
6.22.2 WTOB: Byte-unit data separation instruction ....................................................................................... 244
6.22.3 BTOW: Byte-unit data combination instruction ..................................................................................... 245
6.22.4 UNI: Instruction for combining 4bits of 16-bit data................................................................................ 246
6.22.5 DIS: Instruction for separating 4bitsof 16-bit data ................................................................................ 247
6.22.6 ANS: Signal alarm set instruction ......................................................................................................... 248
6.22.7 ANR: Signal alarm reset instruction ..................................................................................................... 249
6.23 Other instructions ............................................................................................................................................249
6.23.1 RND: Instruction for generating random numbers ................................................................................ 249
6.23.2 DUTY: Instruction for generating timed pulses ..................................................................................... 250
Chapter 7 SFC Tutor .......................................................................................................................................................251
This chapter briefly describes the product elements, programming software platform, and network configuration and application
of VC1 series PLCs.
Preface ............................................................................................................................................................................... 1
1
VC Series Micro-PLC Programming Manual Product overview
1
VC Series Micro-PLC Programming Manual Product overview
VC3 VC2
Name VC5(Planning) VC1 VC1S
(Planning) (Planning)
transi Y0–Y7: 7.2 W/24 Y0, Y1: 7.2
stor Inductive V DC Y0, Y1,Y2: 7.2 W/24 V DC W/24 V DC
12 W/24 V DC
outpu load Others: 12 W/24 Others: 12 W/24 V DC Others: 12
t V DC W/24 V DC
point
Y0–Y7: 0.9 W/24 Y0, Y1: 0.9
Lamp V DC Y0, Y1,Y2: 0.9 W/24 V DC W/24 V DC
load 1.5 W/24 V DC
Others: 1.5 W/24 Others: 1.5 W/24 V DC Others: 1.5
V DC W/24 V DC
User program 64 kstep (128 kB) 64 kstep (128 32 kstep (64 16 kstep (32 6 kstep (12
kB) kB) kB) kB)
Permanent
storage after Yes
power outage
Storage
Max. number of Bit element:
device Bit element:
elements for All the soft All the soft full range
All the soft full range
which data is elements except elements except Word
elements Word element:
saved at power R R element:
2000
outage 2000
Hardware support Backup battery Backup battery Backup battery EEPROM, EEPROM,
and endurance for storage of 3 for storage of 3 for storage of 3 permanent permanent
time years years years storage storage
100 ms precision: T0–T209 100 ms precision: T0–T209
2
VC Series Micro-PLC Programming Manual Product overview
VC3 VC2
Name VC5(Planning) VC1 VC1S
(Planning) (Planning)
Serial port-based
12 12 6 8
interruption
Interruption after
/ 8 3 2
PTO output
Interruption after
/ 1 / /
interpolation
Interruption when
passing a / 8 / /
position
Interruption at
1 1 / 1
power outage
Running time of
a basic 0.09μS 0.09μS 0.09μS 0.2μS 0.2μS
instruction
Supportin
ga
Supporting a Supporting a minimum
Supporting a
minimum of minimum of of
minimum of
Regular uninterrupted uninterrupted uninterrupt
Real-time clock uninterrupted None
output of 3 years output of 3 years ed output
output of 3 years
after power after power of 3 years
after power outage
outage outage after
power
outage
Analog
None None None None None
potentiometer
PORT0: RS232
PORT0: RS232 PORT0: RS232
PORT1: RS485
PORT1: RS485 PORT1: RS485
PORT2: RS485
PORT2: RS485 PORT2: RS485 PORT0:
PORT3: CAN
Communication PORT3: CAN PORT3: USB RS232
PORT4: Network
port PORT4: Network (Note :Port 2 is expansion of PORT1:
port
port communication port) RS485
PORT5: USB
PORT5: USB
Commu PORT : Network
nication port
EtherCAT
CANopen,
Modbus-TCP,
Communication
Modbus, free- Modbus, free-port, N:N, and programing port protocols
protocol
port, N:N,
programming
port protocol
Access Upload password
control Download password
Password type
and Monitoring password
user Subprogram password
progra Disable upload Supported
m
Disable
protecti Supported
formatting
on
3
VC Series Micro-PLC Programming Manual Product overview
VC3 VC2
Name VC5(Planning) VC1 VC1S
(Planning) (Planning)
Real-time clock,
Available A Available Available Available
None
clock instruction
Data and clock Available p Available Available Available
comparison p None
instruction
Floating-point Available l Available Available Available
number
i None
operation
instruction c
Positioning Available Available Available None
a None
instruction
Available t Available Available Available PLS
High-speed I/O instruction is
instruction
i not
o supported
Modbus and Available Available Available Available
inverter instruction n Available
Read/write i
EEPROM None None None None None
instruction n
Control and Available Available Available Available Support PID
s
calculation instruction
instruction t only
Character string Available Available None None None
r
instruction
Batch data Available u Available None None None
processing
instruction
c
Datasheet Available t Available None None None
instruction
None
i None None None None
Memory card o
instruction
n
200,000 hours, fixed on the ground, with mechanical stress approximating zero and
temperature and humidity control
Mean Relay output
100,000 hours, fixed on the ground, with mechanical stress approximating zero, no
time
temperature and humidity control
betwee
300,000 hours, fixed on the ground, with mechanical stress approximating zero and
n
temperature and humidity control
failures
Transistor output 150,000 hours, with mechanical stress approximating zero, no temperature and humidity
(MTBF)
control
Power
supply Input voltage
85 V AC–264 V AC (normal operation)
charact range
eristics
4
VC Series Micro-PLC Programming Manual Product overview
VC3 VC2
Name VC5(Planning) VC1 VC1S
(Planning) (Planning)
Notes:
1. For details about product specifications, installation instructions, and operation and maintenance of VC1 series PLCs,
refer to the VC Series PLC User Manual.
2. For details about product specifications, installation instructions, and operation and maintenance of VC2 series PLCs,
refer to the VC2 Series PLC User Manual.
3. For details about product specifications, installation instructions, and operation and maintenance of VC3 series PLCs,
refer to the VC3 Series PLC User Manual.
4. For details about product specifications, installation instructions, and operation and maintenance of VC5 series PLCs,
refer to the VC5 Series PLC User Manual.
5. The backup battery can support storage of 3 years in working environments of 25 °C.
Figure 1-1 Appearance and structure of VC1, and VC1 series main modules
PORT0 and PORT1 are communication ports. PORT0 adopts the RS232 level and the Mini DIN8 socket. PORT1 and PORT2 of
the VC1 series adopt the RS485 leve, PORT3 is Type-C port.
Auto Studio programming software is standard Windows software and a graphical PLC programming tool, operated by using a
mouse and keyboard. Three standard languages are available for programming: ladder diagram (LAD), instruction language (IL),
and sequential function chart (SFC).
The Auto Studio programming software is connected to a PLC by using a serial programming cable. Modbus network programming
can also be implemented through serial port conversion, and remote programming can be implemented through Modbus. For
details about Modbus programming and remote monitoring, refer to the Auto Studio Programming Software User Manual.
5
VC Series Micro-PLC Programming Manual Product overview
1.2.1 Basic configuration
The Auto Studio programming software operates on IBM PC microcomputers or compatibles, and needs to be installed ina
Microsoft Windows series operating system. Compatible operating systems include Windows 98, Windows Me, NT 4.0, Windows
2000, and Windows XP.
Table 1-2 describes the minimum and recommended configuration required by Auto Studio.
Table 1-2 Basic configuration conditions of Auto Studio
Item Minimum configuration Recommended configuration
CPU Equivalent to Intel's Pentium 233 or higher Equivalent to Intel's Pentium 1G or higher
Memory 64 MB 128 MB
Graphics Can operate at the resolution of 640 x 480 in Can operate at the resolution of 800 x 600 in
card 256-color mode 65535-color mode
Communicat An RS232 serial port provided by a DB9 type socket is required (or you can use the USB interface,
ion interface but a USB-RS232 converter is required).
Other
Programming cables designed for VEICHI PLCs
devices
The Auto Studio installation package released by Suzhou Veichi Electric Co.,Ltd. is a standalone executable program. Double-
click it to start the installation process and then install it step by step according to the installation wizard. You can choose an
installation path as required.
After the installation is complete, the VEICHI program group appearson the Start Menu, and the installer also generates a shortcut
icon of Auto Studio on the desktop. You can double-click the icon to run the program.
Uninstallation: The software can be uninstalled on the Windows Control Panel. To upgrade and install a new version of Auto Studio,
the earlier version needs to be uninstalled first.
The main interface of the program generally consists of seven parts: menu, toolbar, project manager window, instruction tree
window, message window, status bar, and workspace.
Refer to the Auto Studio Programming Software User Manual for details about how to use the Auto Studio programming software.
6
VC Series Micro-PLC Programming Manual Product overview
1.2.4 Programming cable
Customers can use the serial programming cable provided by VEICHI to program and perform commissioning on the PLC.
An VC series PLC can form a Modbus RS485 network with other intelligent instruments or devices, such as inverters and PLCs,
through the RS485 interfaces PORT1 and PORT2 or through PORT0 (when using PORT0, a RS232-RS485 converter is required).
The maximum communication distance is 1200 meters and the highest communication baud rate is 115200 bit/s. You can select
the RTU transmission mode.
An VC series PLC can be connected to an inverter, PLC, touch screen, or instrument through the RS232 interface PORT0. The
maximum communication distance is 15 meters and the highest communication baud rate is 115200 bit/s.
For details about Modbus communication,refer to Chapter 10"Communication function guide" and Appendix G "Modbus
communication protocols".
VC1S, VC1, VC2, VC3 and VC5 series PLCsare configured with the N:N communication protocol developed by VEICHI, which
can be applied to form an N:N communication network through the RS485 interfaces PORT1 and PORT2. With the conversion of
RS232 to RS485, the PORT0 port can also be used for N:N network connection.
The N:N communication protocol allows 2 to 32 PLC stations to exchange data with each other. The highest communication baud
rate is 115200 bps. This protocol can be applied to form a single-layer or double-layer network.
For details about N:N communication, refer to Chapter 10 "Communication function guide".
7
VC Series Micro-PLC Programming Manual Product overview
1.3.3 Free-port network
The free-port protocol is a protocol mode in which the communication is performed based on user-defined communication data
formats. It supports two data formats: ASCII and binary. In this communication port mode, a PLC can be used to communicate
with various devices that use user-defined formats, such as inverters, barcode scanners, instruments, and other intelligent devices
that adopt free communication protocols. A PLC can communicate with one device in RS232 or RS485 mode, and it can also form
an RS485 network with multiple devices.
For details about the free-port protocol communication, refer to Chapter 10 "Communication function guide".
8
VC Series Micro-PLC Programming Manual Function Description
This chapter briefly describes the programming resources and principles and system configuration method of VC series PLCs,
how to set the PLC running and operation mode, and the various functions and software tools related to system commissioning.
For details, refer to the Auto Studio Programming Software User Manual.
Chapter 2 Function Description .........................................................................................................................................11
11
VC Series Micro-PLC Programming Manual Function Description
External input- 16 (interruption triggering edges can be defined by users, corresponding to the rising and
based falling edges of the X0 to X7 terminals)
interruption
High-speed
counter-based 8
interruption
Interruption
Internal timed
resources 3
interruption
Serial port-
based 6
interruption
Interruption after
2
PTO output
Interruption at
None
power outage
Communication Two asynchronous serial communication ports: PORT0: RS232 PORT1
Communicatio interface One USD port
n function Communication Modbus, free-port, N:N (VEICHI proprietary protocol, which can be applied to form 1:N or N:N
protocol communication networks)
12
VC Series Micro-PLC Programming Manual Function Description
A maximum of 64 user subprograms and six levels of nested subprograms are allowed. Local
Subprogram call variables are supported, and each subprogram can provide a maximum of 16 parameters for
information transmission. Variable aliases are also supported.
Upload
password
Download Three types of passwords are provided. A password is no more than 8
password characters, and each character is alphanumeric and case sensitive.
Clock
User program
password
protection
Subprogram A password is no more than 16 characters, and each character is
Special
encryption alphanumeric and case sensitive.
function
Other
protective The functions of disabling formatting and upload are provided.
measures
Auto Studio
Programming
programming It needs to be installed and run on IBM PC microcomputer or compatibles.
modenote 5
softwarenote 6
Real-time clock Built-in, and power supply by backup battery.
13
VC Series Micro-PLC Programming Manual Function Description
Notes:
Note 1: The addresses of the X and Y elements are numbered in octal, for Application instance: Address X10 represents the 8 th
input point.
Note 2: Addresses of the T elements are classified into three categories according to timing precision:
VC1
Note 3: Addresses of the C elements are classified into three categories according to the width and function of count values:
VC1
Note 5: The element forcing function is provided to facilitate commissioning and user program analysis, and thus improve
commissioning efficiency. A maximum of 128 bit elements and 16 word elements can be forced simultaneously.
Note 6: The user program can be modified online when the PLC is running.
Note 7: Some internal soft element resources of PLCs have been reserved for internal use. Do not use these elements on the
user program, if possible. For details, refer to Appendix C"Reserved elements".
VC series PLC main modules operate according to the scan cycle model.
The system performs four tasks in the sequential and cyclical manner: executing the user program, communication, housekeeping,
and refreshing I/O. Each round of tasks is called a scan cycle.
Housekeeping
14
VC Series Micro-PLC Programming Manual Function Description
Output refresh phase: Switching the corresponding hardware output point on or off according to the value of the Y element
(ON or OFF).
Input refresh phase: Converting the on/off state of the hardware input point to the corresponding X element value (ON or
OFF).
The system monitors the running time of the user program in each scan cycle. Once detecting that the running time of the user
program exceeds the set value, the system stops the user program. You can set the watchdog time on the Set Time tab of the
system block dialog boxon the Auto Studio background software interface.
In the constant scan operation mode, the time of each scan cycle is the same when the system is running. You can activate the
constant scan mode and set the constant scan time on the Set Time tab of the system block dialog box of the Auto Studio
background software interface. The default constant scan cycle is 0, that is, constant scan is disabled. When the actual scan cycle
is longer than the constant scan cycle, the program runsin the actual scan cycle.
Note
The setting of the constant scan time cannot be longer than the watchdog time.
You can program and control a main module by downloading a specific user file to it.
There are four types of user files: user program files, data block files, system block files, and user assistance information files.
User assistance information files includeglobal variable tables and user data source files.
You can choose to download a user program file, data block file, or system block file. When a file is selected, the corresponding
user assistance information file is bundled and downloaded.
All user files of the VC1S and VC1 series are written into the FLASH area of the main module for permanent storage.
Note
1. Ensure that the power supply of the main module works properly in a period of time (longer than 30s) after the file is downloaded,
so that the file can be properly written into the main module.
When the PLC enters the running state (STOP→RUN), the device initializes the related soft elements according to the data saved
at power outage, data stored on EEPROM, data blocks, and element values. Table 2-6 describes the priorities of the data.
15
VC Series Micro-PLC Programming Manual Function Description
If the power outage backup file is correct after power-on, the values of the specified soft elements are restored to the values
saved at the last power outage.
After power-on, the system deletes the data values of the elements that are out of the storage range.
If the backup file is lost or incorrect, data of all elements are deleted.
⚫ Storage range setting
The range of elements for which data values are to be saved can be set in the Saving Range of the system block, as shown
in Figure 2-2.
The storage range of the VC1S and VC1 series can be set only to a group.
Note
1. When an VC1S/VC1 series PLC encounters a power outage, data of its elements set within the storage range is stored in
EEPROM.
Input points X0 to X7 of VC1S, VC1, VC2,VC3 and VC5 series main modules are configured with the digital filtering function which
can be used to filter the interfering signal of the ports. You can change the input filtering constant by configuring the Input Filter
in the system block.
VC1 series main modules can operate without batteries. When you select the no battery mode, the system reports no system
error caused by the lack of battery (loss of element data, loss of forcing tables, user program file error).
Refer to the description of the No battery mode configuration in the Advanced Settings of the system block.
VC Series PLCs are designed with multi-level password protection and other security strategies.
16
VC Series Micro-PLC Programming Manual Function Description
User program
Description
protection
Download
Used to restrict the download function
password
In the download operation, select the upload disabled option in the download dialog box, and then you
cannot upload the data later even you enter the upload password.
Disable upload
To enable upload, you need to download the user data again and select the upload enabled option in the
download dialog box.
Upload password Used to restrict the upload function
Clock password Used to restrict the clock function
Programmers can set passwords to encrypt the main program, subprograms and interruption subprograms.
When opening the project in the programming software, you cannot view and edit the content of the
encrypted programs. To view and edit it, you need to open the decryption dialog box and enter the correct
password for decryption.
Program password
Encryption method: Right-click the program to be encrypted, select Encrypt/Decrypt in the right-click
menu, and then enter the password and confirm the password.
Decryption method: Right-click the program to be decrypted, select Encrypt/Decrypt in the right-click
menu, and then enter the correct password.
Note
If you enter a wrong password for five consecutive times, the VC series micro-PLC disables password input for five minutes.
PLC configuration informationconfigured in a system block is compiled as a system block file, which is an important PLC user file.
Before operating a PLC, you need to compile and download a system block file.
⚫ Saving range (element saving range) ⚫ Output table (output table settings)
⚫ Set time (watchdog, constant scan time and power ⚫ Input filter
outage detection time) ⚫ Advanced settings (data block, element value
⚫ Input point (startup mode of the input point) retained, no battery mode, anddisable
⚫ Communication ports (communication ports and formatting)
protocol settings) ⚫ Special module configuration
⚫ Interrupt priority (interrupt priority configuration) ⚫ Communication module
⚫ Inverter configuration ⚫ CANopen configuration
⚫ Ethernet configuration
After configuring a system block, you can select PLC/Compile All menu to compile a system block file and then download it.
⚫ Saving range
Up on power outage, VC series PLCs can save data of the elements that are set within the storage range to the power-
outage storage area, and the data can be retained and used after the machine is powered on again.
Figure2-3 shows the address range of the elements for which data is to be saved on the first tab of the dialog box.
17
VC Series Micro-PLC Programming Manual Function Description
Figure 2-3 Configuring the address range of the elements for which data are to be saved
Note
The address ranges and groups of elements for which data can be saved vary according to PLC models.
By default, a certain storage range is automatically set for each of the D, M, S, T, and C elements.
You can change the address range of the elements for which data is to be saved on the tab as you need. Click the Clear
button on the right to set the number of the elements (for which data is to be saved) to zero.
Only one group can be set for each of the VC1S and VC1 series.
Note
For VC1S and VC1 series PLCs, no T element can be set within the storage range.
System operation at power outage: The PLC saves the data of the elements set within the storage range to the power-outage
backup file.
System operation at power-on: The PLC checks data in power-outage storage area. If the data saved in power-outage
storage area is correct, the storage area on SRAM remains unchanged. If the data is incorrect, the PLC deletes data of all
elements (including the elements that are within and out of the storage range) on SRAM.
⚫ Output table
Click the Output Table tab and then you can set the state an output point enters after the PLC is stopped, as shown in
Figure 2-4.
18
VC Series Micro-PLC Programming Manual Function Description
The output table setting function is used to set the state an output point enters after the PLC is stopped. An output point can
enter one of the following state after the CPU of the PLC is stopped:
(1) Disable:The PLC disables all the output points when switching from the running state to the stopped state.
(2) Freeze: The PLC freezes all the output points in their final state when being stopped.
(3) Configuration: The PLC sets all the output points to a known state when being stopped. The default state of all the output
points is off (0).
⚫ Set time
You can set the user program running watchdog time. The watchdog time is the allowed maximum time for the user program
to run. When the actual execution time of the user program exceeds the watchdog time, the PLC stops the execution of the
user program, turns on the program alarm indicator (red), and provides output according to the system configuration. The
watchdog time can be set from 0ms to 1000ms and the default value is 200ms.
19
VC Series Micro-PLC Programming Manual Function Description
Constant scan time is a constant time when the system scans a register. The system's constant scan time setting register is
read and the user program is scanned only once at the constant time. The constant time can be set from 0ms to 1000ms
and the default is 0ms. The default value is 0ms and constant scan time is not enabled.Enables the set constant scan time
when it is non-zero.
⚫ Input filter
Clicking the Input Filter tab to set an input filtering constant for the PLC input points. The external interfering signals
introduced by the input points can be filtered out by digital filtering. X0 to X7 are digital input points with the digital filtering
function. Other digital input points adopt hardware filtering. VC1S/VC1 series input filtering can be set separately for each
input port and the filtering constants can be set consecutively from 0us to 60ms. Figure 2-6 shows the input filtering settings
for the VC1 series.
When the Disable input point is not selected, you can set an input point (among X0 to X17) to force the PLC to enter RUN
state. The PLC switches from the STOP state to RUN state when it is detected that the input point is ON.
20
VC Series Micro-PLC Programming Manual Function Description
Select the Disable input point to disable the input point-based start function.
⚫ Advanced settings
The advanced settings include Datablock enabled, Element value retained, no battery mode, etc.
4. Datablock enabled
Select Datablock enabledand the PLC uses data blocks to initialize D elements when switching from STOP to RUN.
Select Element value retained,and the PLC does not initialize the element value but save them as image when switching
from STOP to RUN.
Note
When "Datablock enabled" and "Element value retained" are both valid, "Datablock enabled"prevails. For details, refer
to section 2.1.6 "Element initialization".
6. No battery mode
Select No battery mode, and the system does not report errors caused by loss of battery backup data or loss of forcing
tables upon backup battery failure.
⚫ Communication port
You can set three communication ports on the communication port tab of the system block. Figure 2-9 shows the
communication port settings. The item includes communication protocol selection and specific protocol parameter settings.
21
VC Series Micro-PLC Programming Manual Function Description
By default, PORT0 adopts the programming port protocol while PORT1 and PORT2 adopt no protocol. You can set PORT0,
PORT1, and PORT2 as you need.
By default, PORT0 adopts the programming port protocol, a dedicated protocol for the communication of the VC series PLC
programming software. With this protocol, you can set the communication baud rate between a PC and PORT0 through the
serial port configuration tool of Auto Studio.
2. Free-port protocol
The free-port protocol is a communication modeusing user-defined data file formats. The free-port communication mode
supports two data formats, namely ASCII and binary code. A PLC can adopt free-port communication only in the RUN state.
When adopting the free-port mode, the PLC cannot communicate with programming devices.
The configurable parameters include baud rate, data bit, parity check, stop bit, start character detection, end character
detection, intercharacter timeout, and interframe timeout.
Modbus communication devices include master and slave stations. A master station can communicate witha slave station
(such as an inverter) and send control frames to the slave station according to the function codes of the Modbus
communication protocol, and the slave station responds to the request of the master station.
PORT0 can be set as a slave station while PORT1 and PORT2 can be set as a master or slave station.
The configurable parameters include baud rate, data bit, parity check, stop bit, master-slave mode, station number,
transmission mode, and timeout time and retry times of the master mode.
N:N is an N:N communication protocol developed by Suzhou Veichi Electric Co.,Ltd. for micro-PLC networks. PLCs in the
N:N network can automatically exchange some of their D and M element values.
All of the PORT0, PORT1, and PORT2 can adopt the N:N communication protocol.
Note
For details about how to use the free-port, Modbus, and N:N protocols, refer to Chapter 10"Communication function guide".
You can set the module property on the expansion module configuration tab, as shown in Figure 2-10.
22
VC Series Micro-PLC Programming Manual Function Description
1. Module type
You can select the module type for VC-4AD,VC-4DA,VC-4PT,VC-4PT and other module, as shown in Figure 2-10.
2. Module property
After selecting the Module Type, the corresponding Module Property is activated and the following dialog box may be
displayed.
In the dialogue box shown in Figure 2-11, you can configure the channel for the special module, including Mode (signal
features), Digital value at zero, Upper limit of digital value, Average sampling and Current sampling value. For details
about the meanings and configuration methods of the parameters, refer to user manuals of the corresponding special
modules.
Data blocks are used to set the default values in D elements. If you download the compiled data block settings to a PLC, the PLC
uses the data block to initialize the related D elements upon the startup.
The data block editor enables you to assign initial data to a D register (data memory). You can assign data to words or double
words, but not to bytes. You can also add comments by inputting "//" to the front of a character string.
23
VC Series Micro-PLC Programming Manual Function Description
For details about operation instructions of data blocks, refer to the Auto Studio Programming Software User Manual.
Global variable is a meaningful symbol name defined for a certain PLC address, and it can be visited within the whole project
range, which is equivalent to using the corresponding element of the variable. Global variable is defined in the global variable
table. Global variable includes three attributes, namely Variable name, Variable address, and Comments.
The definition rule of global variable is: comprised of A–Z, a–z, 0–9, underline, and Chinese characters, and the variable name
cannot start with numbers nor can it be independent numbers. The name can be capitalized or lower-case, and the length cannot
exceed 8 bytes. No element type letters+numbers can be adopted as the name of the program and variable. There should be
neither blank space nor any name which is the same with keywords. The reserved keywords include basic data type name,
instruction name, and operation symbol in instruction list language.
VC1 series micro-PLCs are allowed to be downloaded no more than 140 global variables respectively (according to the maximum
comment amount). Otherwise, it can only be saved locally but cannot be downloaded. Figure 2-16 shows the global variable table.
2. Setting the startup mode of input points and external terminals in the system blocks, and controlled by the specified terminals.
3. Using the programming software to run or stop the PLC if the mode selection switch is set to ON.
⚫ RUN
When a main module is in Run state, a PLC executes the user program. That is to say, a scan cycle includes four tasks,
namely executing the user program, communication, housekeeping, and refreshing I/O.
⚫ STOP
When a main module is in Stop state, a PLC does not execute the user program, but executes other three tasks in each
scan cycle, namely communication, housekeeping, and refreshing I/O.
24
VC Series Micro-PLC Programming Manual Function Description
If the mode selection switch is set to ON and the PLC is reset (including system power-on reset), the system enters the RUN
state automatically.
Note
If the system configuration item of the Input point control mode in the main module is valid, the state of the corresponding
input terminal is ON. Otherwise, the system cannot enter the run state after reset.
The system is changed from STOP to RUN state when you set the mode selection switch from OFF to ON.
When system configuration item of Input point startup mode in system block tab is valid, the main module is changed from
STOP to RUN once the system detects that the specified input points (X0 to X17) change from OFF to ON.
Note
When you select the input point control mode, a mode selection switch should be set to ON at the same time, otherwise the
PLC cannot enter the run state.
If the mode selection switch is set to OFF, reset the PLC (including power-on reset),and the system enters RUN state
automatically.
Note
When the mode selection switch is set to ON, the system can also enter the stop state after reset if the system configuration
item of the Input point control mode is valid and the designated input point is in OFF.
2. Setting the mode selection switch manually
The system is change from RUN to STOP state when you set the mode selection switch from ON to OFF.
The system changes from RUN to STOP after executing the STOP instruction in the user program.
The system stops the execution of the user program when detecting that a serious error occurs (such as user program errors
oruser program execution timeout).
You can set the output state of the output point (Y) when the PLC is stopped. There are three modes for your choice:
Disable the output mode –When the PLC is stopped, all output points are OFF.
Freeze the output mode— When the PLC is stopped, all output points are frozen at the last state.
Configuration output mode— You can set the state of output points as needed when the PLC is stopped.
You can operate the above settings in the Output Table of the system block tab. For details, refer to the output table settings in
section 2.2.1 "System block".
⚫ Download
The download function is used to download a system block, data block, and user program generated by the Auto Studio
software to a PLC through serial ports, and the PLC is required to stop running when downloading.
25
VC Series Micro-PLC Programming Manual Function Description
When downloading, if the program is changed after last compilation, you are informed whether you need to recompile the
program, as shown in Figure 2-17.
Note
Selecting N button means that you have no need to recompile it and the software adopts the previous edited results, but the
running program downloaded to the PLC is different from the one displayed on the software interface.
When downloading a program, the software pops up a password window asking for entering a download password if it’s
configured with a download password and the downloading password has not been entered after starting the software. The
download starts after a password entered is verified successfully, otherwise, the system prompts you to re-enter your
password and click the Cancel button to exit the download.
⚫ Upload
The upload function is used to upload a system block, data block, and user program in a PLC to PC through serial ports,
and save them for new projects. When the battery backup data is valid, a file is selected and then the corresponding user
assistance information file is bundled and uploaded. Figure 2-18 shows the upload dialog box.
When uploading a program, you can upload the program directly if it’s not configured with a download password. The
software pops up a password window asking for entering an upload password if it’s configured with upload password and
an upload password has not been entered after starting the software. Upload starts after a password entered is correct,
otherwise, the software prompts you and returns to the upload dialog interface.
If you select the Disable Upload function when downloading a program, a PLC cannot upload the program later, unless you
enter a correct password to remove the Disable Upload function.
If multiple system errors occur at the same time, the system only writes the code of the most serious error in SD3.
When a serious system error occurs, a user program stops, and a ERR indicator on the main module turns on for a long time.
26
VC Series Micro-PLC Programming Manual Function Description
When the next application instruction is executed correctly, the SM20 is reset while SD20 still keeps the previous error code.
The system records the user program execution errors sequentially in a stack. Special data registers SD20 to SD24 form an
error stack that records error codes of the latest five user program execution errors.
When a user program execution error occurs and the current error code is different from one stored in SD20, the error code
is added to the error stack. Figure 2-19 shows the stack push process of error codes when a user program execution error
occurs.
Discard
27
VC Series Micro-PLC Programming Manual Function Description
The System error ID is the code of the system error stored in SD3 while the Execution error ID is the code of the user
program execution error stored in SD20. The relevant error descriptions displayed by both are for your reference.
Warning
On the occasions that casualties or property loss may occur, the online program modification function should be used by
professionals with sufficient protection measures.
⚫ Operation method
After making sure that PC-PLC communication has been set up successfully and the PLC is in the run state, you can click
the Debug ->Online modification in the Auto Studio main interface to enter the online modification state.
In the online modification state, you can modify the main program, subprogram and interrupt subprogram as usual. After the
modification, you click PLC->Download menu,and the modified program is compiled and downloaded to the PLC
automatically. When the download completes, the PLC executes the new downloaded program.
⚫ Limits
1. In the online modification state, the global variable table and local variable table of any program cannot be modified, nor
can add or delete any subprogram or interruption subprogram.
2. When a program is in the online modification state, Auto Studio automatically exits the online modification state if a PLC
is stopped.
The clearing operations include PLC element value clear, PLC program clear, and PLC data block clear.
Clearing the element values in the PLC causes the PLC to operate improperly or lose the intermediate working data, so you
need to use this function with caution. During the operation process, the software displays a confirmation window for you to
choose whether to continue or cancel the current operation.
Clearing the user programs in the PLC leads to no-execution of the user programs by PLC, so you need to use this function
with caution. During the operation process, the software displays a confirmation window for you to choose whether to
continue or cancel the current operation.
28
VC Series Micro-PLC Programming Manual Function Description
⚫ PLC information
The PLC information function can be used to obtain and display various operation data and important information of PLCs.
You can see the important information about the current operation of the PLC on the information display window, as shown
in Figure 2-21.
⚫ PLC time
The PLC time function can be used to display and set the current time of PLCs, as shown in Figure 2-22.
2.4.6 Element value writing and forcing, and element monitoring table
To execute the write or force function, you need to select the elements to be written or forced firstly, and right click the menu
to select Write or Force. Then a corresponding dialog box pops up and lists all the soft element addresses being referred to
by the selected elements. You can selectively write or force certain soft element values, after confirmation, these values are
29
VC Series Micro-PLC Programming Manual Function Description
sent to the PLC hardware. When these values take effect in the hardware, you can see the change results during the
subsequent commissioning process.
30
VC Series Micro-PLC Programming Manual Function Description
Figure 2-23 shows the dialog box for writing an element value.
Figure 2-24 shows the dialog box for forcing an element value.
The forced soft element carries a lock mark in LAD, as shown in Figure 2-25:
31
VC Series Micro-PLC Programming Manual Function Description
The element monitoring table works in two modes: editing and monitoring modes. In the editing mode, all editing functions
can be carried out but no monitoring function can be carried out. In the monitoring mode, both of the monitoring and editing
functions can be carried out.
In the monitoring mode, displayed element values are refreshed automatically, and then modified or forced element values
can be updated timely.
The element state monitoring table provides the functions includes editing, sequencing, searching, auto-refresh and display
of the current values of designated elements, writing element values, forcing element/variable values, and unforcing values.
The data values of 500 D registers (at most) read from PLC consecutively are displayed, and the results can be merged to the
data block or overlay the original data block.
Open the window for generating data blocks from RAM, as shown in Figure 2-28.
32
VC Series Micro-PLC Programming Manual Function Description
Entering the range of data blocks to be read, click the Read from RAM button, and data is read into the list after the instruction is
correctly executed.
You can select hex, decimal, octal, or binary in the field of display type to display the data.
After reading the data successfully, the Merge to datablock and Overwrite datablock button become available. Click the Merge
to datablock button to add the generated results to the rear part of the current data blocks and click the Overwrite datablock
button to replace the existed contents in the data block with the generated results. After exiting the register value reading window,
the software prompts that the data block has been changed and the data block window is open automatically.
33
VC Series Micro-PLC Programming Manual Soft element and data
This chapter detailedly describes the definition, classification and functions of the soft elements of VC series PLCs.
Chapter 3 Soft element and data .......................................................................................................................................34
34
VC Series Micro-PLC Programming Manual Soft element and data
PLCs are configured with a variety of virtual elements in the system design to replace the real generic relays, time relays, and
other devices in the relay control circuits.These virtual elements are collectively referred to as soft elements. PLCs adopt soft
elements for program operation and system function configuration to implement all operation and control functions. Due to their
virtual nature, the soft elements can be used repeatedly in the program without quantity limit the oretically (actually related to
the program capacity). Besides, the soft elements have no mechanical or electric problems of the real devices. Such features
make PLCs much more reliable than relay control circuits. In addition, it is easier to program and modify the logic.
The types and functions of VC series PLC soft elements are shown in the following figure.
User program
Auxiliary relay M
State relay S
Data register D
Timer T
Counter C
Local auxiliary relay LM
Indexing register Z
Local data register V
displaying devices
hardware circuit
hardware circuit
Output point Y
Input point X
Executing and
Soft elements
In this manual, soft elements are named according to their types. For example:
The soft elements of VC series micro-PLCs are compiled and classified according to their functions. Different elements execute
different functions and are easily accessible.
35
VC Series Micro-PLC Programming Manual Soft element and data
Numbered
VC1S VC1 VC2(Pianning) VC3(Pianning) VC5(Pianning)
in
2048 (M0– 10240 (M0– 10240 (M0–
Auxiliary relay 2048 (M0–M2047 2048 (M0–M2047) Decimal
M2047) M10239) M10239)
Local auxiliary Decimal
64 (LM0–LM63) 64 (LM0–LM63) 64 (LM0–LM63) 64 (LM0–LM63) 64 (LM0–LM63)
relaynote 5
Special 512 512 1024 (SM0– 1024 (SM0– 1024 (SM0– Decimal
auxiliary relay (SM0–SM511) (SM0–SM511) SM1023) SM1023) SM1023)
1024 (S0– 4096 (S0– 4096 (S0– Decimal
State relay 1024 (S0–S1023) 1024 (S0–S1023)
S1023) S4095) S4095)
256 256 256 512 512 ( Decimal
Timer
(T0–T255)note 2 (T0–T255)note 2 (T0–T255)note 2 (T0–T511)note 2 T0–T511)note 2
256 (C0– 264 256 307 (C0– 307 (C0– Decimal
Counter
C255)note 3 (C0–C263)note 3 (C0–C255)note 3 C307)note 3 C307)note 3
8000 (D0– 8000 (D0– Decimal
Data register 8000(D0–D7999) 8000 (D0–D7999) 8000 (D0–D7999)
D7999) D7999)
32768 (R0– 32768 (R0– Decimal
Data register R / / /
R32767) R32767)
Local data Decimal
64 (V0–V63) 64 (V0–V63) 64 (V0–V63) 64 (V0–V63) 64 (V0–V63)
registernote 5
Indexing Decimal
16 (Z0–Z15) 16 (Z0–Z15) 16 (Z0–Z15) 16 (Z0–Z15) 16 (Z0–Z15)
register
Special data 512 (SD0– 512 1024 1024 (SD0– 1024 (SD0– Decimal
register SD511) (SD0–SD511) (SD0–SD1023) SD1024) SD1024)
Notes:
Note 1: The addresses of X and Y elements are numbered in octal, for example, address X10 represents the 8th input point. The
max. value of I/O points here is the system capacity. The actual extendable hardware points should depend on the PLC system
configuration (including the available extension module types and points, power capacity limit, etc.).
Note 2: T element address is classified into three categories based on timing precision:
⚫ 100 ms precision: T0–T209
⚫ 10 ms precision: T210–T251
⚫ 1 ms precision: T252–T255
Note 3: C element address is classified into three categories based on the width and function of count values:
⚫ 16-bit increment counter: C0–C199
⚫ 32-bit increment and decrement counter: C200–C235
⚫ 32-bit high-speed counter: C236–C263
Note 4: Some internal soft element resources of PLCs have been reserved for internal use only. You should not use these elements
on the user program, if possible. For details, refer to Appendix C "Reserved elements".
Note 5: These two types of soft elements are local variables which cannot be defined in the global variable table. When the user
program calls subprograms or returns to the main program, they are rest to zero obtain the parameter values or states according to
the interface parameter transfer function.
36
VC Series Micro-PLC Programming Manual Soft element and data
⚫ Element mnemonic electrical control circuit. You can use them to store
M elements various intermediate states in the user program.
37
VC Series Micro-PLC Programming Manual Soft element and data
M elements are Boolean (the element values are ON or Power outage Data saved Date deleted
OFF). RUN → STOP Data saved Date deleted
STOP → RUN Unchanged Cleared
⚫ Available forms
Note: The storage range at power outage is set through the
NO and NC contacts system block. For details, refer to section 2.2.1 "System
⚫ Value assignment block".
1. Through the instruction operations. 2. Force or write Note
the state values during the system commissioning.
When using the N:N protocol, some M elementsare called
⚫ Saving dataat power outage by the system. You need to pay attention to it when
M elements for programming and modifying the program.
M elements for which
which data is not
State data is saved at
saved at power
power outage
outage
3.1.6 Timer
38
VC Series Micro-PLC Programming Manual Soft element and data
3.1.7 Counter
39
VC Series Micro-PLC Programming Manual Soft element and data
Two D or R elements can form a double-word element ⚫ Value assignment
that can store32-bit data, such as long integer data or 1. Data block initialization. 2. Through the instruction
floating-point data. operations. 3. Force or write the state values during the
Dn element system commissioning.
Sign bit MSB (n: 0-7999)
Single word D element
16 bits
LSB
⚫ Uninterrupted output after power outage
D elements for D elements for which
Dn element Dn+1 element
Sign bit MSB (n: 0-7998) (n: 0-7998)
LSB
State which data is saved data is not saved at
Double word D element
16 bits 16 bits at power outage power outage
Power outage Unchanged Cleared
Data range of single word D element:-32,168-+32,767
Data range of double word D element: -2,147,483,648- RUN → STOP Unchanged Unchanged
+2,147,483,647
STOP → RUN Unchanged Cleared
Figure 3-5 D or R elements Note: The storage range at power outage is set through the
system block. For details, refer to section 2.2.1 "System
Note block".
In a double-word D or R element, the higher 16-bit is in R elements cannot be saved at power outage
the first D or R element, and the lower 16-bit is in the
second D or R element.
Note
Some D elements are called by the system when inverter
⚫ Available forms
instruction or N:N protocol is adopted. You need to pay
D or R elements are used as operands in many attention to it when programming and modifying the
calculation and control instructions. program.
40
VC Series Micro-PLC Programming Manual Soft element and data
1. Through the instruction operations. 2. Force or write Note
state values during system commissioning. You cannot assign values to read-only SD elements.
⚫ Concept
The bit-string combined addressing mode,or Kn addressing mode, combines bit element strings into words or long words.
41
VC Series Micro-PLC Programming Manual Soft element and data
⚫ Method
The format is: "K (n) (U)", where the "n" is an integer among one to eight, indicating that the length of the bit string is n×4
bits. U indicates the start bit element address of the element string.
Application instance:
1. K1X0 indicates a word made up of a bit string of 4 bit elements (X0, X1, X2 and X3) starting from X0.
2. K3Y0 indicates a word made up of a bit string of 12 bit elements (Y0, Y01, Y02 and Y03), (Y04, Y05, Y06 and Y07), and
(Y10, Y11, Y12 and Y13) starting from Y0.
3. K4M0 indicates a word made up of a bit string of 16 bit elements: M0, M1, M2, M3… and M15.
4. K8M0 indicates a double word made up of a bit string of 32 bit elements: M0, M1, M2, M3… and M31.
MOV 2#10001001 K2M0 (which is the equivalent of MOV 16#89 K2M0, or MOV 137 K2M0). After the instruction is executed,
K2M0 is stored. The following table describes the specific storage format of K2M0.
Data MSB Intermediate bit LSB
K2M0 M7 M6 M5 M4 M3 M2 M1 M0
16#89 1 0 0 0 1 0 0 1
⚫ Note of the bit-string combined addressing mode
If the destination operand of the instruction uses the Kn addressing mode, while the width of the data to be stored in the
destination operand is greater than the width defined in the Kn addressing mode, the system keeps the LSB and discards
the MSB of the data.
For example:
After the instruction is executed, the operand 2 (K1M0) needs to store the calculation result 16#1c (28). However, the K1M0
is only 4-bit wide, which is not enough for 16#1c. By discarding the higher bits, the actual calculation result of operand 2 is
K1M0=16#c (12).
⚫ Concept of indexing
VC series PLCs provides the indexing mode (Z addressing mode). You can use Z elements (indexing registers) to get indirect
access to the target elements.
⚫ Z addressing method:
Target address=Basic element address+Address offset stored in Z element.
For example:
In the indexing mode, for D0Z0 (in which Z0=3), the target address is D3. D0 is the basic address, and the offset address
stored in element Z0 is 3.
Therefore, when Z0=3, the instruction "MOV 45 D0Z0" is equal to "MOV 45 D3" in effect, and in both cases D3 is assigned
the value 45 after the instruction is executed.
⚫ Indexing example
1. Bit element indexing example The preceding instructions are in effect equal to:
LD M01 LD M01
MOV 6 Z1 SFTR X6 M0 8 2
42
VC Series Micro-PLC Programming Manual Soft element and data
For example:
MOV D100Z20 D0
MOV D70 D0
3. You need to pay attentrion to the address range when using the Z addressing mode. For example, D7999Z0 (Z0=9) is
outside the address range of the D elements (The max. address of D elements is 7999.).
LD M1 Z10 = 3
43
VC Series Micro-PLC Programming Manual Soft element and data
VC series PLCs store the 32-bit data in the Big Endian mode, that is to say,the elements with small addressesare used to
store the higher bits of the 32-bit data, while the elements with big addresses are used to store the lower bits of the 32-bit
data.
For Application instance, unsigned long integer "16# FEA8_67DA" is stored in the element (D0, D1). The actual storage
format is as follows:
D0 0xFEA8
D1 0x 67DA
⚫ Addressing 32-bit data in D, R, and V elements
You can use a D or V element to locate a 16-bit data, such as an INT or WORD type data, or a 32-bit data, such as a DINT
or DINT data.
If a D, R, or V element address is used in an instruction operand, the operand data type determines whether the data is 16-
bit or 32-bit.
For example:
In the instruction "MOV 16#34 D0", the address D0 indicates a single D0 element, because operand 2 of the MOV instruction
is of the WORD data type.
In the instruction "DMOV 16# FEA867DA D0", the address D0 indicates two consecutive words: D0 and D1,because operand
2 of the DMOV instruction is of the DINT data type.
3.2 Data
All instruction operands are of a certain data type. There are altogether six data types, as listed in the following table.
Table 3-2 Operand data types
Data type Type description Data width Range
BOOL Bit 1 ON, OFF (1, 0)
INT Signed integer 16 -32768–+32767
Signed long
DINT 32 -2147483648–+2147483647
integer
Floating-point
REAL 32 ±1.175494E-38–±3.402823E+38
number
The element types used by instruction operands needs to match their data types. The correlations between the applicable
elements and data types are listed in the following table.
Table 3-3 Mapping between elements and data types
Data type Soft elements
C T
BOOL
X Y M S LM SM
Constant KnX KnY KnM KnS KnLM KnSM D SD C T V Z R
INT
REAL Constant D V R
44
VC Series Micro-PLC Programming Manual Soft element and data
Data type Soft elements
If an instruction uses an operand with an unsuitable data type, the instruction is deemed illegal. For example,instruction "MOV 10
X0" is illegal because operand 2 of the MOV instruction is of signed integer type, while the X0 element can store only Boolean
data.
Note
1. When the operand is of INT type, the applicable elements include KnX, KnY, KnM, KnS, KnLM, and KnSM, where 1 ≤ n ≤ 4.
2. When the operand is of DINT type, the applicable elements include KnX, KnY, KnM, KnS, KnLM, and KnSM, where 5 ≤ n ≤
8.
3. When the operand is of INT type, the applicable C elements are C0–C199.
4. When the operand is of DINT type, the applicable C elements are C200–C263
3.2.3 Constant
You can use constants as the instruction operands. VC series PLCs support a variety of constant mode inputs. Expressions of
constants are shown in the following table.
Table 3-4 Expressions of constants
Application
Constant type Valid range Remarks
instance
Decimal constant (16-bit signed
-8949 -32768–+32767
integer)
Decimal constant (32-bit signed
-2147483646 -2147483648–+2147483647
integer)
Hex constant (16-bit) 16#1FE9 16#0–16#FFFF Hex, octal, and binary constants
Hex constant (32-bit) 16#FD1EAFE9 16#0–16#FFFFFFFF have no positive or negative
Octal constant (16-bit) 8#7173 8#0–8#177777 meaning.
Octal constant (32-bit) 8#71732 8#0–8#37777777777 If you select hex, octal or binary
Binary constant (16-bit) 2#10111001 2#0–2#1111111111111111 constants used as operands,
positive and negative natures of
2#0–2#1111111111111111 these constants, and their sizes are
Binary constant (32-bit) 2#101110011111
1111111111111111 determined by data types of these
operands.
Compliance with the IEEE-754
standard.
-3.1415E-16 The programming software can
Single-precision floating-point
3.1415E+3 ±1.175494E-38–±3.402823E+38 display
constants
0.016 and input floating-point constants
with
7-bit effective precision.
45
VC Series Micro-PLC Programming Manual Programming concept
This chapter detailedly describes the contents of VC series micro-PLC programming, including the programming language and
programelements. The programming and usage of subprograms arealso introduced, and finally, it describes some general
explanation of instructions.
Chapter 4 Programming concept .......................................................................................................................................46
46
VC Series Micro-PLC Programming Manual Programming concept
4.1.1 LAD
⚫ Concepts
LAD is a widely-used graphical PLC programming language similar to the electrical (relay) control diagram. Its main features
include:
1. It is configured with the left bus, and the right bus is omitted.
2. All control output elements (coils) and function blocks (application instructions) share the same energy flow input terminal.
The electrical control diagram and LAD are equivalent to a certain degree, as shown in the following figure.
M
LS1 PB CR X0 T1 X1 Y0
( )
LS2 SS X2 X3
Figure 4-1 The equivalence between electrical control diagram and LAD
电气控制图 PLC梯形图
⚫ LAD basic programming elements
According to the principles in the electrical (relay) control diagram, several basic programming elements are abstracted for
theLAD:
1. Left bus: It corresponds to the control bus in electrical control diagram, and provides control power for the control circuit.
2. Connecting line ( ): It represents the electrical connection in the electrical control diagram, and is used to conduct
other inter-connected elements.
3. Contact ( ): It represents the input contact in the electrical control diagram, it controls the ON/OFF and direction of control
currents in the circuit. The parallel and serial connection of the contacts essentially represents the operational relationship
of the input logic of the control circuit, and controls the transmission of the energy flow.
5. Function block ( ): It is also known as the application instruction, and corresponds to the actuator or functional device
that completes the special functions in the electrical control diagram. It can perform the specific control functions or control
calculation functions (such as data transmission, data calculation, timer, counter, etc.).
⚫ Energy flow
Being an important concept in LAD, the energy flow is used to drive coil elements and application instructions, which is
similar tothe control current output by the driving coil, and executed by the execution unit in the electrical control diagram.
In LAD, the coils or the front end of the application instruction need to be connected to the energy flow. The coil element can
be output and the application instructions can be effectively executed only when the energy flow is valid.
The following figure demonstrates the energy flow transferin LAD and the drive of the energy flow to the coils or function
blocks.
47
VC Series Micro-PLC Programming Manual Programming concept
4.1.2 IL
The IL is a textual user program, or a set of the instruction sequences written by the users.
The user program stored in the PLC main module for execution is actually the instruction sequence recognizable by the main
module, and the system executes each instruction in the sequence one by one to realize the control function of the user program.
4.1.3 SFC
The SFC is a graphical design language for the user program framework that is commonly used to implement sequential control
functions.
Sequence control is a control process that can be divided into multiple procedures (processing steps) and proceed them according
to the certain working sequence.
48
VC Series Micro-PLC Programming Manual Programming concept
The user program designed with SFC is relatively straight forward and clear because its program structure is consistent with the
actual sequence control process.
programming.
The user program is the program code written by the user. It is compiled into an executable instruction sequence,downloaded to
the controller, and the controller executes the control function of the user program.
The user program consists of three program organization units (POU): main program (MAIN), subprogram (SBR) and interrupt
program (INT).
⚫ MAIN
The main program is the main body and framework of the user program. When the system is in RUN, the main program is
executed cyclically.
⚫ SBR
A subprogram is a structurally and functionally independent user program that can be called by other program bodies.
Subprograms generally have call operand interfaces that are executed only when being called.
⚫ INT
An interrupt program is a user program segment that handles a specific interrupt event. A specific interrupt event always
corresponds to aspecific interrupt program.
Upon the occurrence of an interrupt event, a normal scan cycle is interrupted, and the user program flow automatically jumps
to the execution of the interrupt program until the interrupt return instruction system returns to the normal scan cycle.
A user program can have random number of interrupt programs, or no interrupt program at all.
49
VC Series Micro-PLC Programming Manual Programming concept
The system block contains multiple system configuration options. You can modify, compile and download the system block to
configure the operation mode of the main module.
For details about how to use the system configuration items, refer tosection 2.2.1 "System block"in the manual or the related
description in Auto Studio Programming Software User Manual.
The data block contains the set value of D or R element. When the data block is downloaded to the controller, the designated D
or R element is assigned a set value, thereby achieving the purpose of batch setting the D or R element value.
If the "Datablock enabled" in the advanced settings tab of the system block, the D or R elements are initialized by the data block
before the user program is in RUN.
When programming, you can add the block comments to the program. Block comments textually describe the relevant programs.
Each block comment takes up an entire line of space.
In the program, right click and select Insert Row to insert a row above the current row. You can use an empty row toseparate two
program blocks.
To make a block comment, you need to first select an empty row, then right click and select Insert Block Comment, as shown
below.
Entering your comment into the block comment dialogue box that pops out and clicking the OK button.
The software automatically adds "/*" and "*/" to both sides of the entered text, and displays them in green color, as shown below:
50
VC Series Micro-PLC Programming Manual Programming concept
A block comment occupies a whole row. You cannot add a block comment to an occupied row, nor can a row occupiedby a
comment be used for other purposes.
You can define the variables in the global variable table and local variable table. (For details, refer to section 2.2.3 "Global variable
table" and section 4.4.3 "Definition of the SBR variable table"), and correctly defined variables can be used in the LAD. A variable
can stand for a
certain address to make the program more readable. Figure 4-7 shows some variables defined in a global variable table.
⚫ Symbol addressing
When the defined variables are used, you can switch between the variable name and the element address by selecting Symbol
addressing menu.
The following figure shows the same LAD in both display modes.
The following figure shows the state of the LAD when the Symbol Addressing is not selected.
The following figure shows the state of the LAD when the Symbol Addressing is selected.
51
VC Series Micro-PLC Programming Manual Programming concept
⚫ Elementcomment
You can control whether the element comments are displayed in the LAD by selecting the Element comment menu, as shown in
Figure4-10.
4.4 Subprogram
4.4.1 Concept
Being an optional part of the user program, a subprogram (SBR) is an independent program organization unit (POU) that can be
called by the main program or other SBRs.
1. Reduce the size of the user program. You can write a repeated program section as a SBR and call it whenever necessary.
2. Clarify the program structure, particularly the structure of the main program.
MAIN→SBR1→SBR2→SBR3→SBR4→SBR5→SBR6
(where the "→" represents calling the corresponding SBRs with the CALL instruction)
2. The PLCs do not support recursive call and cyclic call of SBRs.
The following two application instances show two illegal SBR callings.
52
VC Series Micro-PLC Programming Manual Programming concept
4. A maximum of 16 bit and 16 word types of variables can be defined in the variable table of a SBR.
5. When calling a SBR, you need to note that the operand type of the CALL instruction needs to match the variable type defined
in the variable table of theSBR, and the compiler checks whether the match is correct.
⚫ SBR variabletable
The SBR variable table is used to displays all SBR interface parameters and local variables (collectively referred to as
variables) and specify their properties.
1. Variable address
Based on the variable data type, the software automatically assign a fixed LM or V element address to each SBR variable
in sequence.
2. Variable name
You can give each SBR variable a name (alias). You can use a variable in the program by quoting its name.
3. Variable type
The SBR variables are classified into the four types:IN, OUT, IN_OUT, and TEMP.
• IN: The IN type variable is used to transfer the input value of the SBR when a SBR is being called.
• OUT: The OUT type variable is used to call the return value for transferring the SBR when a SBR returns.
• IN_OUT: The IN type variable is used to transfer the input value of the SBR when a SBR is being called, or call the
return value for transferring the SBR when a SBR returns.
• The TEMP type variables are only used as local variables that are valid only within scope of the SBR.
53
VC Series Micro-PLC Programming Manual Programming concept
4. Variable data type
The properties of the variable data types specify the data widthand range of the variables. The variable data types are listed
in the following table.
Table 4-1 Variable data types
Data type Description Occupied LM/V element address
BOOL Bit type One LM element address
INT Signed integer type One V element address
DINT Signed double integer type Two consecutive V element addresses
REAL Floating-point type Two consecutive V element addresses
If local input or output variables are defined in the SBR when a SBR is called in the main program, you need to input the
corresponding variable values, global or temporary variable elements into the SBR interface parameters. You need to note that
the local variable need to be of the same data type with the interface parameter.
1. Creating the SBR calling operand interface through the variable table of the SBR_1.
1) Defining variable 1: Naming it as IN1 (variable type: IN). It is used as the INT type data and sequentially assigned a V
elementaddress V0.
2) Defining variable 2: Naming it as IN2 (variable type: IN). It is used as the INT type data and sequentially assigned a V
elementaddress V1.
3) Defining variable 3: Naming it as OUT1 (variable type: OUT). It is used as the INT type data and sequentially assigned a
V elementaddress V2.
LD SM0
54
VC Series Micro-PLC Programming Manual Programming concept
Using the CALL instruction in the main program to call the SBR_1.
LD M0
CALL SBR_1 3 2 D0
You can use the parameters to transfer the corresponding relationship table and filling in the parameters that are brought in
or returned when the SBR is called.
Step 4: Compiling, downloading and running the user program to verify the logic of the subprogram.
55
VC Series Micro-PLC Programming Manual Programming concept
When M0 is ON, SBR_1 is called. Values 2 and 3 are transferred to the operands IN1 and IN2 to carry out the
addition operation. The result 5 is then returned to the main program, that is, D0 is 5.
There are some restrictions on the application of some instructions, some of which are listed below. For details, refer to the detailed
instructions of the relevant instructions.
Taking the high-speed counting instructions and SPD instruction for application instance. Any of these instructions can
occupy certain input points among X0–X7. The limited resources make it impossible to execute these instructions at the
same time.
⚫ Exclusive time
The execution of certain instructions may take a period of time. Therefore, when using these instructions, you need to ensure
that the instructions have enough time to complete the function. Only one can be executed at a certain time when the system
is running.
Taking the XMT instruction for application instance. Due to the timeliness of communication, the XMT instruction is sent to
the free port, and only one can be executed at the same time. Similarly, the free port can execute only one RCV instruction
once. Everytime when a Modbusinstruction is being executed, the communication channel is unavailable to other instructions
for a while. The same applies to other instructions such as high-speed output instruction, positioning instructions.
For example, the instruction pair MC/MCR cannot be used in the step state programmed by SFC.
56
VC Series Micro-PLC Programming Manual Basic instructions
This chapter detailedly describes basic instructions of VC series micro-PLCs, including the instruction format (form),
operand,influenced flag bit, function, application instance, and sequence diagram.
Chapter 5 Basic instructions ..............................................................................................................................................57
57
VC Series Micro-PLC Programming Manual Basic instructions
5.5.1 CTU: 16-bit increment counterinstruction ................................................................................................. 76
5.5.2 CTR: 16-bit cycliccountinginstruction ....................................................................................................... 76
5.5.3 DCNT:32-bit increment and decrement counting instruction .................................................................... 77
58
VC Series Micro-PLC Programming Manual Basic instructions
LAD: Applicable
VC1S VC1 VC2 VC3 VC5
LD model
Influenced flag
bit
IL: LD (S) Step length 1
Operand Type Applicable soft element Indexing
S BOOL X Y M S LM SM Dx.y C T
OUT Y0
Influenced flag
bit
IL: LDI (S) Step length 1
Operand Type Applicable soft element Indexing
S BOOL X Y M S LM SM Dx.y C T
59
VC Series Micro-PLC Programming Manual Basic instructions
S: Source operand LD M0
ANI M1
Function description
OUT Y0
Performing the "NOT" operation on the ON/OFF
When M0 is ON and M1 is OFF, the Y0 output is ON.
state of the designated contact (S), and then
performing the "AND" operation on the obtained
result and the current energy flow value, and
assigning the obtained result to the current energy
flow.
OR
S: Source operand
LD M0
Function description OR M1
OUT Y0
60
VC Series Micro-PLC Programming Manual Basic instructions
Performing the "OR" operation on the ON/OFF When M0 or M1 is ON, the Y0 output is ON.
state of the designated contact (S) and the
current energy flow, and assigning the obtained
result to thecurrent energy flow.
Influenced flag
bit
ORI
S: Source operand
LD M1
Function description ORI M2
OUT Y0
Performing the "NOT" operation on the ON/OFF
state of the designated contact (S), and then When M1 is ON or M2 is OFF, the Y0 output is ON.
performing the "OR" operation on the obtained
result and the current energy flow value, and
assigning the obtained result to the current energy
flow.
S: Source operand LD M1
Function description OUT Y0
When M1 is ON, the Y0 output is ON.
Assigning the value of the current energy flow to the
designated coil (D).
61
VC Series Micro-PLC Programming Manual Basic instructions
ANB
Influenced flag
bit
Function description LD M0
OR M1
Conducting "AND"operation on the
LD M2
energy flow values of two energy
OR M3
flow blocks, and then assigning the
ANB
obtained result tothe current
OUT Y0
energy flow.
When either M0 or M1 is on, and either M2 or M3 is ON, the Y0
output is ON.
Influenced flag
ORB bit
Energy flow
block 2
Function description LD M1
AND M2
Conducting "OR" operation on the
LD M3
energy flow values of two energy
AND M4
flow blocks, and then assigning
ORB
the obtained result to the current
OUT Y0
energy flow.
When both M1 and M2 are ON, or both M3 and M4 are ON, the Y0
output is ON.
62
VC Series Micro-PLC Programming Manual Basic instructions
MPS
Influenced flag
bit
Pushing and storing the current It is not allowed to use MPS instructions(without MPP instructions
energy values for the energy flow among them) for over 8 consecutive times in only one ladder diagram
calculation of subsequent output network,otherwise the energy flow output stack may overflow.
branches.
5.1.11 MRD: Instruction for reading output energy flow stack top value
LAD: Applicable model VC1S VC1 VC2 VC3 VC5
Influenced flag
bit
MRD
Function description
Assigning the top value of the energy flow output stack to the current energy flow.
Influenced flag
bit
MPP
IL: MPP Step length 1
63
VC Series Micro-PLC Programming Manual Basic instructions
64
VC Series Micro-PLC Programming Manual Basic instructions
1. In two consecutive scan cycles, the states In LAD, the rising edge contact andfalling edge contact
of M2 contact are OFF and ON respectively, instructions need to be used in series rather than in
and the EU instruction detects a rising edge parallel with other contact elements.
change, so that Y2 outputs an ON state with a
In LAD, the rising edge contact and falling edge contact
scancycle width.
instructions cannot be connected to the left energy flow
2. In two consecutive scan cycles, the states bus directly.
of M2 contact are ON and OFF respectively,
The following figure shows an example of incorrect use of
and the ED instruction detects a falling edge
EU and ED instructions in LAD.
edge, so that Y3 outputsan ON state with a
scan cycle width.
X X
Applicable
LAD: VC1S VC1 VC2 VC3 VC5
model
Influenced flag
bit
IL: LD (S) Step length 1
Operand Type Applicable soft element Indexing
S BOOL X Y M S LM SM C T
Applicable
LAD: VC1S VC1 VC2 VC3 VC5
model
Influenced flag
bit
IL: LD (S) Step length 1
Operand Type Applicable soft element Indexing
S BOOL X Y M S LM SM C T
65
VC Series Micro-PLC Programming Manual Basic instructions
Applicable
LAD: VC1S VC1 VC2 VC3 VC5
model
Influenced flag
bit
IL: LD (S) Step length 1
Operand Type Applicable soft element Indexing
S BOOL X Y M S LM SM C T
Applicable
LAD: VC1S VC1 VC2 VC3 VC5
model
Influenced flag
bit
IL: LD (S) Step length 1
Operand Type Applicable soft element Indexing
S BOOL X Y M S LM SM C T
66
VC Series Micro-PLC Programming Manual Basic instructions
The ANDF instruction is to participate in When M0 is ON, the M1 output is ON. At this time,If M1 changes
the AND operation of the falling edge of from ON to OFF and remains valid for 1 scanning cycle, D0
the contact. performs increase 1. In the next scanning cycle, M1 will be
invalid and D0 remains 1.
LAD: Applicable
VC1S VC1 VC2 VC3 VC5
model
Influenced flag
bit
IL: LD (S) Step length 1
Operand Type Applicable soft element Indexing
S BOOL X Y M S LM SM C T
67
VC Series Micro-PLC Programming Manual Basic instructions
Applicable
LAD: VC1S VC1 VC2 VC3 VC5
model
Influenced flag
bit
IL: LD (S) Step length 1
Operand Type Applicable soft element Indexing
S BOOL X Y M S LM SM C T
Applicable
LAD: VC1S VC1 VC2 VC3 VC5
model
Influenced flag
bit
IL: LD (S) Step length 1
Operand Type Applicable soft element Indexing
S BOOL X Y M S LM SM C T
68
VC Series Micro-PLC Programming Manual Basic instructions
Influenced flag
INV bit
Performing the "INV" operation on the current energy flow value and then assigning the obtained result to the current energy
flow.
Note
In LAD, the INV instruction needs to be used in series rather than in parallel with other contact elements.
INV cannot be used as the first instruction in the parallel input branches.
In LAD, the INV instruction cannot be directly connected to the left energy flow bus.
The following figure shows an example of incorrect use of the INV instruction in LAD.
X
X X
S: Source operand LD M0
SET M1
Function description
69
VC Series Micro-PLC Programming Manual Basic instructions
S: Source operand LD M0
RST M1
Function description
Note
Resetting the specified bit element (D) to
zero when the energy flow is valid. If D is a C element, the corresponding count value is
deleted. If D is a T element, the corresponding timing value
is deleted.
S: Source operand
70
VC Series Micro-PLC Programming Manual Basic instructions
LD M0
MC 0
LD SM0
OUT Y0
MCR 0
When M0 = ON, instructions in the MC 0–MCR 0 structure are
executed, and Y0 = ON. When M0 = OFF,instructions in the MC 0–
MCR 0 structure are not be executed,and the bit element Y0 Note: It cannot be used in SFC
designated by the destination operandof the OUT instruction in the programming.
structure is deleted, Y0 = OFF.
71
VC Series Micro-PLC Programming Manual Basic instructions
D:Destination operand Setting the state of the specified step (D) to be valid when the
energy flow is valid, and setting the current valid step to be
invalid to complete the state transition.
D:Destination operand Setting the state of the specified step (D) to be valid when the
energy flow is valid, and setting the current valid step to be
invalid to complete the state jump.
D: Destination operand Setting the state of the specified step (D) to be invalid when the
energy flow is valid.
72
VC Series Micro-PLC Programming Manual Basic instructions
Indicating the end of a segment of the SFC program. It can be used only in the main program.
D: Destination operand LD M0
TON T1 4
S: Source operand
LD T1
Function description OUT Y0
1. Timing the specified T element (D) when the Sequence chart of the application instance
energy flow is valid and the timing value is less than
32,767 (the timing value increases with the time),
and remaining in 32,767 after it is reached.
73
VC Series Micro-PLC Programming Manual Basic instructions
Consta
S INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
D: Destination operand LD M0
TONR T1
S: Source operand
5
Function description LD T1
OUT Y0
1. Timing the specified T element (D) when the
energy flow is valid and the timing value is less than Sequence chart of the application instance
32,767 (the timing value increases with the time),
ON ON
and remaining in 32,767 after it is reached.
OFF
M0
2. Setting the timing coil output of the designated T 0.3 s 0.2 s ON
74
VC Series Micro-PLC Programming Manual Basic instructions
D: Destination operand LD M0
TOF T1
S: Source operand
5
Function description LD T1
when the energy flow changes from ON to OFF Sequence chart of the application instance
(falling edge change). ON ON
2. Keeping timing when the energy flow is OFF but OFF OFF
M0
the specified timer T has been started, and setting ON ON
the timing coil output of the T element to OFF when OFF OFF
the timing value reaches the preset value (S), and T1 timing coil 0. 5 s
T1 = 5
then remaining in the preset value.
T1 = 0 T1 = 0
T1 timing value
3. Not timing when the timing has not started but
the energy flow input is OFF.
D: Destination operand LD M0
TMON T1 5
S: Source operand
LD T1
Function description OUT Y0
75
VC Series Micro-PLC Programming Manual Basic instructions
D: Destination operand LD M0
CTU C0
S: Source operand
3
Function description LD C0
C (D) by 1 when the input energy flow changes from OFF Time sequence diagram instance
to ON (rising edge change).
ON ON
2. Remaining in the count value when it reaches 32,767.
OFF
M0
3. Setting the counting coil to ON when the count value is ON
larger than or equal to the preset point (S). OFF
C0 counting coil
Note C0=3
C0=1 C0=2
C0=0
Setting the address of the 16-bit counter C (D) to a value C0 count value
76
VC Series Micro-PLC Programming Manual Basic instructions
Consta
S INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
D: Destination operand LD M0
CTR C0 3
S: Source operand
Sequence diagram of the Application instance
Function description
OFF OFF
3. Setting the count value to 1, and the counting coil to M0
ON ON
OFF when the count value reaches the preset point
OFF OFF
(S),and the input energy flow changes from OFF to ON C0 counting coil
77
VC Series Micro-PLC Programming Manual Basic instructions
D: Destination operand LD M0
DCNT C235
S: Source operand
D0
Function description
Sequence diagram of the application instance
1. Increasing or decreasing the count value of
the specified 32-bit counter C (D) by 1 when the
input energy flow changes from OFF to ON
(rising edge change) (the increase and
decrease depend on the corresponding SM flag
bit).
coil to OFF when the count value is less than or OFF OFF
M0
equal to the preset point (S). ON
OFF OFF
4. Changing the count value to –2147483648 C235 counting coil
Note
78
VC Series Micro-PLC Programming Manual Application instructions
This chapter detailedly describes the application instructions of VC series micro-PLCs, including the instruction format (form),
operand, influenced flag bit, function, application instance, and sequence diagram.
Chapter 6 Application instructions .....................................................................................................................................79
79
VC Series Micro-PLC Programming Manual Application instructions
6.3.15 DINC: Long integer plus one instruction ............................................................................................... 104
6.3.16 DDEC: Long integer minus one instruction .......................................................................................... 105
6.3.17 DVABS: Instruction for obtaining the absolute value of a long integer ................................................. 105
6.3.18 DNEG: Long integer negation instruction ............................................................................................. 106
6.3.19 SUM: Integeraccumulation instruction .................................................................................................. 106
6.3.20 DSUM: Long integer accumulation instruction ..................................................................................... 108
6.4 Floating-point arithmetic operation instructions .................................................................................................108
6.4.1 RADD: Floating-point numberaddition instruction .................................................................................. 108
6.4.2 RSUB: Floating-point numbersubtraction instruction .............................................................................. 109
6.4.3 RMUL: Floating-point numbermultiplication instruction .......................................................................... 109
6.4.4 RDIV: Floating-point numberdivision instruction..................................................................................... 110
6.4.5 RSQT: Instruction for extracting the square root of a floating-point number .......................................... 110
6.4.6 RVABS: Instruction for obtaining the absolute value of a floating-point number .................................... 111
6.4.7 RNEG: Floating-point number negation instruction ................................................................................ 111
6.4.8 SIN: Instruction for obtaining SIN of a floating-point number.................................................................. 111
6.4.9 COS: Instruction for obtaining COS of a floating-point number .............................................................. 112
6.4.10 TAN: Instruction for obtaining TAN of a floating-point number ............................................................. 112
6.4.11 POWER: Instruction for exponentiation of a floating-point number ...................................................... 113
6.4.12 LN: Instruction for obtaining the natural logarithm of a floating-point number ...................................... 113
6.4.13 EXP: Instruction for obtaining the natural number power of a floating-point number............................ 114
6.4.14 RSUM: Floating-point number accumulation instruction ...................................................................... 114
6.4.15 ASIN: Instruction for obtaining ASIN of a floating-point number ........................................................... 115
6.4.16 ACOS: Instruction for obtaining ACOS of a floating-point number ....................................................... 115
6.4.17 ATAN: Instruction for obtaining ATAN of a floating-point number ........................................................ 115
6.4.18 LOG: Instruction for obtaining the common logarithm of a floating-point number................................. 116
6.4.19 RAD: Instruction for floating-point number angle-radian conversion .................................................... 116
6.4.20 DEG: Instruction for floating-point number radian-angle conversion .................................................... 116
6.5 Value conversion instructions ............................................................................................................................117
6.5.1 DTI: Instruction for converting a long integer to an integer ..................................................................... 117
6.5.2 ITD: Instruction for converting an integer to a long integer ..................................................................... 117
6.5.3 FLT: Instruction for converting an integer to a floating-point number ..................................................... 118
6.5.4 DFLT: Instruction for converting a long integer to a floating-point number ............................................. 118
6.5.5 INT: Instruction for converting a floating-point number to an integer ...................................................... 118
6.5.6 DINT: Instruction for convert a floating-point number to a long integer .................................................. 119
6.5.7 BCD: Instruction for converting a word to a 16-bit BCD code................................................................. 119
6.5.8 DBCD: Instruction for converting a double word to a 32-bit BCD code .................................................. 120
6.5.9 BIN: Instruction for converting a 16-bit BCD code to a word .................................................................. 120
6.5.10 DBIN: Instruction for converting a 32-bit BCD code to a double word .................................................. 121
6.5.11 GRY: Instruction for converting a word to a 16-bit gray code ............................................................... 121
6.5.12 DGRY: Instruction for converting a double word to a 32-bit gray code ................................................. 121
6.5.13 GBIN: Instruction for converting a 16-bit gray code to a word .............................................................. 122
6.5.14 DGBIN: Instruction for converting a 32-bit gray code to a double word ................................................ 122
6.5.15 SEG: Instruction for converting a word to a 7-segment code ............................................................... 123
6.5.16 ASC: ASCII code conversion instruction .............................................................................................. 123
6.5.17 ITA: Instruction for convertinga 16-bit hex data to an ASCII code ........................................................ 124
6.5.18 ATI: Instruction for converting an ASCII code to a 16-bit hex data ....................................................... 124
6.5.19 LCNV: Project conversion instruction ................................................................................................... 125
6.5.20 RLCNV: Floating-point project conversion instruction .......................................................................... 126
6.6 Word logic operation instructions.......................................................................................................................127
6.6.1 WAND: Word AND instruction ................................................................................................................ 127
80
VC Series Micro-PLC Programming Manual Application instructions
6.6.2 WOR: INT OR instruction ....................................................................................................................... 129
6.6.3 WXOR: Word XOR instruction ............................................................................................................... 129
6.6.4 WINV: Word INV instruction ................................................................................................................... 130
6.6.5 DWAND: Double word AND instruction .................................................................................................. 130
6.6.6 DWOR: Double word OR instruction ...................................................................................................... 130
6.6.7 DWXOR: Double word XOR instruction ................................................................................................. 131
6.6.8 DWINV: Double word negation instruction ............................................................................................. 131
6.7 Bit shift and rotate instructions ..........................................................................................................................132
6.7.1 ROR: 16-bit rotate right instruction ......................................................................................................... 132
6.7.2 ROL: 16-bit rotate left instruction ............................................................................................................ 132
6.7.3 RCR: Instruction for 16-bit rotate right with carry flag bit ........................................................................ 133
6.7.4 RCL: Instruction for 16-bit rotate left with carry flag bit ........................................................................... 134
6.7.5 DROR: 32-bit rotate right instruction ...................................................................................................... 134
6.7.6 DROL: 32-bit rotate left instruction ......................................................................................................... 135
6.7.7 DRCR: Instruction for 32-bit rotate right with carry flag bit ..................................................................... 135
6.7.8 DRCL: Instruction for 32-bit rotate left with carry flag bit ........................................................................ 136
6.7.9 SHR: 16-bit shift right instruction ............................................................................................................ 136
6.7.10 SHL:16-bit shift left instruction.............................................................................................................. 137
6.7.11 DSHR: 32-bit shift right instruction ....................................................................................................... 138
6.7.12 DSHL: 32-bit shift left instruction .......................................................................................................... 138
6.7.13 SFTR: Bit string shift right instruction ................................................................................................... 139
6.7.14 SFTL: Bit string shift left instruction ...................................................................................................... 139
6.8 Peripheral instructions .......................................................................................................................................141
6.8.1 FROM: Instruction for reading words from a special module buffer register........................................... 141
6.8.2 DFROM: Instruction for reading double words from a special module buffer register ............................ 141
6.8.3 TO: Instruction for writing words from a special module buffer register.................................................. 142
6.8.4 DTO: Instruction for writing double words from a special module buffer register ................................... 143
6.8.5 VRRD: Instruction for readingthe value of an analog potentiometer ...................................................... 143
6.8.6 REFF: Instruction for setting input filtering constant ............................................................................... 144
6.8.7 REF: Instruction for immediately refreshing I/O ...................................................................................... 144
6.8.8 EROMWR: EEPROM write instruction ................................................................................................... 145
6.8.9 PR: Printing instruction ........................................................................................................................... 145
6.8.10 TKY: Numeric key input instruction ...................................................................................................... 146
6.9 Real-time clock instructions ...............................................................................................................................148
6.9.1 TRD: Real-time clock read instruction .................................................................................................... 148
6.9.2 TWR: Real-time clock write instruction ................................................................................................... 149
6.9.3 TADD: Clock addition instruction ............................................................................................................ 150
6.9.4 TSUB: Clock subtraction instruction ....................................................................................................... 151
6.9.5 HOUR: Chronograph instruction ............................................................................................................ 152
6.9.6 DCMP: (=、<、>、<>、>=、<=)Date comparison instruction ............................................................... 153
6.9.7 TCMP: (=、<、>、<>、>=、<=)Time comparison instruction ............................................................... 154
6.9.8 HTOS: Instruction for converting hour-minute-second data to seconds ................................................. 155
6.9.9 STOH: Instruction for converting seconds to hour-minute-second data ................................................. 155
6.10 High-speed I/O instructions .............................................................................................................................156
6.10.1 HCNT: Instruction for driving the high-speed counter .......................................................................... 156
6.10.2 DHSCS: Instruction of setting the high-speed count comparison ......................................................... 156
6.10.3 DHSCI: Instruction for triggering interrupt based on comparison of high-speed count ......................... 157
6.10.4 DHSPI:Triggering interrupt Instruction based on comparison of absolute high-speed output positions159
6.10.5 DHSCR: Instruction for resetting the high-speed count comparison .................................................... 160
6.10.6 DHSZ: High-speed count range comparison instruction ...................................................................... 161
81
VC Series Micro-PLC Programming Manual Application instructions
6.10.7 DHST: High-speed count table comparison instruction ........................................................................ 162
6.10.8 DHSP: Instruction for pulse output based on high-speed count table comparison ............................... 164
6.10.9 SPD: Frequency measuring instruction ................................................................................................ 166
6.10.10 PLSY: High-speed pulse output instruction ........................................................................................ 167
6.10.11 PLSR: Instruction for count pulse output with acceleration/deceleration ............................................ 168
6.10.12 PLS: Envelopepulse output instruction ............................................................................................... 171
6.10.13 PWM: Pulse output instruction ........................................................................................................... 172
6.11 Control calculation instructions ........................................................................................................................174
6.11.1 PID: Function instruction ...................................................................................................................... 174
6.11.2 RAMP: Ramp signal output instruction ................................................................................................. 178
6.11.3 HACKLE: Sawtooth wave signal output instruction .............................................................................. 179
6.11.4 TRIANGLE: Triangle wave signal output instruction ............................................................................ 180
6.11.5 ABSD: Cam absolute control instruction .............................................................................................. 181
6.11.6 DABSD: Double word cam absolute control instruction ....................................................................... 183
6.11.7 ALT: Alternate output instruction .......................................................................................................... 184
6.12 Communication instructions ............................................................................................................................184
6.12.1 MODBUS: Master station communication instruction ........................................................................... 184
6.12.2 XMT: Free-port sending instruction ...................................................................................................... 185
6.12.3 RCV: Free-port receiving instruction .................................................................................................... 186
6.12.4 MODRW: Modbus read/write instruction .............................................................................................. 187
6.13 Check instructions ...........................................................................................................................................191
6.13.1 CCITT: Check instruction ..................................................................................................................... 191
6.13.2 CRC16: Check instruction .................................................................................................................... 191
6.13.3 LRC: Check instruction......................................................................................................................... 192
6.14 Enhanced bit processing instructions ..............................................................................................................193
6.14.1 ZRST: Instruction for resetting bits to 0 in batch .................................................................................. 193
6.14.2 ZSET: Instruction for resetting bits in batch.......................................................................................... 193
6.14.3 DECO: Decoding instruction ................................................................................................................ 193
6.14.4 ENCO: Encoding instruction................................................................................................................. 194
6.14.5 BITS: Instruction for counting on bit in word ......................................................................................... 194
6.14.6 DBITS: Instruction for counting on bit in double word .......................................................................... 195
6.14.7 BON: Instruction for judging on bit in word ........................................................................................... 195
6.15 Word contact instructions ................................................................................................................................195
6.15.1 BLD: Word bit contact LD instruction ................................................................................................... 195
6.15.2 BLDI: Word bit contact LDI instruction ................................................................................................. 196
6.15.3 BAND: Word bit contact AND instruction.............................................................................................. 196
6.15.4 BANI: Word bit contact ANI instruction ................................................................................................. 197
6.15.5 BOR: Word bit contact OR instruction .................................................................................................. 197
6.15.6 BORI: Word bit contact ORI instruction ................................................................................................ 198
6.15.7 BOUT: Word bit coil output instruction ................................................................................................. 198
6.15.8 BSET: Word bit coil setinstruction ........................................................................................................ 198
6.15.9 BRST: Word bit coil reset instruction .................................................................................................... 199
6.16 Comparison contact instructions......................................................................................................................199
6.16.1 LD (=, <, >, <>, >=, <=): Integer comparison LD※instruction ............................................................... 199
6.16.2 AND (=, <, >, <>, >=, <=): Integer comparison AND ※instruction ....................................................... 200
6.16.3 OR (=, <, >, <>, >=, <=): Integer comparison OR※instruction ............................................................. 201
6.16.4 LDD (=, <, >, <>, >=, <=): Long integer comparison LDD※instruction ................................................. 202
6.16.5 ANDD (=, <, >, <>, >=, <=): Long integer comparison ANDD※instruction ........................................... 203
82
VC Series Micro-PLC Programming Manual Application instructions
6.16.6 ORD (=, <, >, <>, >=, <=): Long integer comparison ORD※instruction................................................ 204
6.16.7 LDR: Floating-point number comparison instruction ............................................................................ 205
6.16.8 ANDR: Floating-point number comparison instruction ......................................................................... 206
6.16.9 ORR: Floating-point number comparison instruction ............................................................................ 207
6.16.10 CMP: Instruction for setting integer comparison to ON ...................................................................... 209
6.16.11 LCMP: Instruction for setting long integer comparison to ON ............................................................. 209
6.16.12 RCMP: Instruction for setting floating-point number comparison to ON ............................................. 210
6.17 Bulk data processing instructions ....................................................................................................................210
6.17.1 BKADD: Bulk data addition operation instruction ................................................................................. 210
6.17.2 BKSUB: Bulk data subtraction operation instruction ............................................................................ 211
6.17.3 BKCMP=,>,<,<>,<=,>=: Bulk data comparison instruction ................................................................... 211
6.18 Datasheet instructions .....................................................................................................................................212
6.18.1 LIMIT: Upper/lower limit control instruction .......................................................................................... 212
6.18.2 DBAND: Deadband control instruction ................................................................................................. 213
6.18.3 ZONE: Zone control instruction ............................................................................................................ 213
6.18.4 SCL: Coordinatesetting instruction ....................................................................................................... 214
6.18.5 SER: Data search instruction ............................................................................................................... 215
6.19 Character string instructions ............................................................................................................................216
6.19.1 STRADD: String combination instruction.............................................................................................. 216
6.19.2 STRLEN: Instruction for detecting the string length ............................................................................. 217
6.19.3 STRRIGHT: Instruction for reading a string from right ......................................................................... 217
6.19.4 STRLEFT: Instruction for reading a string from left .............................................................................. 218
6.19.5 STRMIDR: Instruction for reading any characters of a string ............................................................... 219
6.19.6 STRMIDW: Instruction for replacing any characters of a string ............................................................ 219
6.19.7 STRINSTR: String search instruction ................................................................................................... 220
6.19.8 STRMOV: String transmission instruction ............................................................................................ 221
6.20 Extension file register instructions ...................................................................................................................221
6.20.1 LOADR: Instruction for reading data from an extension file register .................................................... 221
6.20.2 SAVER: Instruction for writing data to an extension file register .......................................................... 222
6.20.3 INITR: Instruction for initializing an extension register ......................................................................... 223
6.20.4 LOGR: Instruction for logging on an extension register ........................................................................ 224
6.20.5 INITER: Instruction for initializing an extension file register.................................................................. 225
6.21 Positioning instructions ....................................................................................................................................227
6.21.1 ZRN: Zero return instruction ................................................................................................................. 227
6.21.2 PLSV:Variable speed pulse output instruction ..................................................................................... 228
6.21.3 DRVI: Relative position control instruction ........................................................................................... 229
6.21.4 DRVA: Absolute position control instruction ......................................................................................... 230
6.21.5 DSZR: Instruction for zero return with DOG ......................................................................................... 231
6.21.6 DVIT: Interrupt positioning instruction .................................................................................................. 232
6.21.7 STOPDV: Pulse output stop instruction................................................................................................ 233
6.21.8 LIN: Linear trajectory interpolation instruction ...................................................................................... 234
6.21.9 CW: Clockwise arc trajectory interpolation ........................................................................................... 237
6.21.10 CCW: Counterclockwise arc trajectory interpolation instruction ......................................................... 238
6.21.11 MOVELINK: Synchronous control instruction ..................................................................................... 241
6.21.12 GEARBOX: Electronic gear instruction .............................................................................................. 243
6.22 Data processing instructions ...........................................................................................................................244
6.22.1 MEAN: Mean instruction....................................................................................................................... 244
6.22.2 WTOB: Byte-unit data separation instruction ....................................................................................... 244
6.22.3 BTOW: Byte-unit data combination instruction ..................................................................................... 245
6.22.4 UNI: Instruction for combining 4bits of 16-bit data................................................................................ 246
83
VC Series Micro-PLC Programming Manual Application instructions
6.22.5 DIS: Instruction for separating 4bitsof 16-bit data ................................................................................ 247
6.22.6 ANS: Signal alarm set instruction ......................................................................................................... 248
6.22.7 ANR: Signal alarm reset instruction ..................................................................................................... 249
6.23 Other instructions ............................................................................................................................................249
6.23.1 RND: Instruction for generating random numbers ................................................................................ 249
6.23.2 DUTY: Instruction for generating timed pulses ..................................................................................... 250
84
VC Series Micro-PLC Programming Manual Application instructions
⚫ Application instance
LD SM1
MOV 0
D0
LD M2
EU
FOR 100
LD SM0
INC D10
NEXT
The initial conditions of the operation are: D0=0, and
M2=OFF. When M2 changes from OFF to ON, the
instructions within the FOR-NEXT structure are
85
VC Series Micro-PLC Programming Manual Application instructions
⚫ Note
1. The FOR-NEXT instruction must be used in pairs in a
program body (POU), otherwise the user program cannot
be compiled correctly.
2. Supporting the nesting of multiple FOR-NEXT
structures. The CPU unit of the VC2 series supports the
nesting of a maximum of 8 FOR-NEXT structures. (The
following figure shows the nesting of 3 FOR-NEXT
structures.) 4. It is prohibited to use the CJ statement to jump into the
next cycle body, and the LAD below cannot be compiled
correctly:
Note
The execution of the FOR-NEXT cycle is time-consuming. The more the cycle times are, or the more the instructions are contained
in the cycle body, the longer time it takes. To prevent the operation timeout error, you need to use the WDT instruction within a
time-consuming cycle body.
⚫ Operand description 2. Two labels with a repetitive definition are not allowed
S:Labeling value in one POU, otherwise the user program cannot be
compiled. However, repetitive label definitionsare
⚫ Function description
allowed in different POUs (for example, different
1. Defining a label whose labeling value is S.
subprograms).
2. Not used for actual operation. It only indicates the
specific jumping position for the CJ instruction. ⚫ Application instance of wrong program
⚫ Note
1. Range of labeling value S: 0≤S≤127。
86
VC Series Micro-PLC Programming Manual Application instructions
87
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description LD M0
S: Labeling value CJ 0
⚫ Function description LD SM0
1. When the energy flow is valid, the user program jumps MOV 100
to execute the instruction numbered S, a legal label. D0
2. When the energy flow is invalid, there is no jump Jump to LBL 0 CFEND
operation, and the system executes the instruction after LBL 0
CY in order. LD M1
⚫ Note MOV
1. The label S (0 ≤ S ≤ 127) to be jumped by the CJ
200 D0
instruction shall be a valid, and defined label, otherwise
the user program cannot be compiled correctly. 1. When the initial condition is M0=OFF and M1=ON, the
2. It is not allowed to use the CJ instruction to jump to a CJ 0 instruction is not jumped, and D0=100. After
FOR-NEXT structure. executing the CFEND instruction, the program exits the
main program in advance, instructions of LD M1 and
3. It is allowable to use the CJ instruction to jump out of
MOV 200 D0 are not executed.
or jump into the MC-MCR structure or SFC state.
2. When M0=ON, M1=ON, the program executes the CJ
However, such operation damages the logic of the MC-
0 instruction, skips over the MOV 100 D0 and CFEND
MCR structure and SFC state and makes the program
instructions. After jumping to the LBL 0 instruction, the
complex. Thus, such operation is not recommended.
program executes the MOV 200 D0 instruction, and now
⚫ Application instance D0=200.
89
VC Series Micro-PLC Programming Manual Application instructions
LAD: Applicable
VC1S VC1 VC2 VC3 VC5
CALL (SBR_NAME) (PARAM1) (PARAM2) (...) model
Influenced
flag bit
IL: CALL (subprogram name) (subprogram parameter 1) Step Determined by the parameters
(subprogram parameter 2) … length carried by the subprogram
⚫ Function description
When the energy flow is valid, the system calls the designated subprogram for execution, and after execution, returns to the
instructions following the CALL instruction to continue the execution.
⚫ Note
1. The subprogram called by the CALL instruction needs to be defined in the user program in advance. If an undefined
subprogram occurs in the CALL instruction, the program cannot be compiled.
2. The element type of the operands in the CALL instruction needs to match with the data type defined in the local variable
table of the subprogram, otherwise the program cannot be compiled.
The following application instance demonstrates some illegal matches.
Application instance 1: In the local variable table of the SBR1 subprogram, the data type of operand 1 is
DINT/DWORD.
The following usages are illegal:
• CALL SBR1 Z0 (The data type of Z element cannot be DINT/DWORD)
• CALL SBR1 C199 (The data type of C0 to C199 element cannot be DINT/DOWRD)
• CALL SBR1 K2X0 (Kn addressing 1≤n≤3, the data type cannot be DINT/DWORD)
Application instance 2: In the local variable table of the SBR1 subprogram, the data type of operand 1 is
INT/WORD.
The following usages are illegal:
• CALL SBR1 C200 (The data type of C200 to C255 elements cannot be INT/WORD)
• CALL SBR1 K2X0 (Kn addressing 4≤n≤8, the data type cannot be INT/WORD)
3. The element type of the operands in the CALL instruction needs to match with the data type defined in the local variable
table of the subprogram, otherwise the program cannot be compiled.
The following application instance demonstrates some illegal matches.
Application instance: In the local variable table of the SBR1 subprogram, the data type of operand 1 is OUT or
IN_OUT.
The following usages are illegal:
• CALL SBR1 321 (the constant cannot be changed, so it does not match with the OUT or IN_OUT type of the
operand)
• CALL SBR1 K4X0 (K4X0 is read-only, so it does not match with the OUT or IN_OUT type of the operand)
• CALL SBR1 SD0 (SD0 is read only, so it does not match with the OUT or IN_OUT type of the operand)
4. The number of the operands in the CALL instruction need to match with the local variable table of the subprogram,
otherwise the program cannot be compiled.
⚫ Function description
When the energy flow is valid, the system exits the current subprogram and return to the previous-level subprogram.
90
VC Series Micro-PLC Programming Manual Application instructions
Indexin
Operand Type Applicable soft element
g
Consta
S INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
D INT KnY KnM KnS KnLM D SD C T V Z R √
91
VC Series Micro-PLC Programming Manual Application instructions
Assigning the
LDcontent
X0 of (D0, D1) to (D10, D11) when X0=ON. In this case,
(D10, D11)=50000.
DMOV D0 D10
⚫ Operand description starting from D and keeping the content of S2 units starting from S1 when
S1: Source operand, start unit of data the energy flow is valid.
block ⚫ Application instance
D: Destination operand, start unit of LD X0
data block BMOV D0 D100
S2: Size of the data block 10
⚫ Function description Assigning the content of 10 units starting from D0 to 10 units starting from
Assigning the content of S2 D100 when X0=ON. In this case, D100=D0, D101=D1, ……, D109=D9
unitsstarting from S1 to S2 units
92
VC Series Micro-PLC Programming Manual Application instructions
Consta
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
D INT KnY KnM KnS KnLM D C T V R √
Consta
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
⚫ Operand description
93
VC Series Micro-PLC Programming Manual Application instructions
D: Destination operand, the word swopped into D when the energy flow is valid.
element whose most significant byte ⚫ Application instance
(MSB) and least significant byte (LSB)
LD X0
are swopped
SWAP D0
⚫ Function description
Storing the value obtained after the MSB and LSB of the content of
Storing the value obtained after the
D0=0x1027 (4135) are swapped into D0 when X0=ON. In this case,
MSB and LSB of the content of D are
D0=0x2710 (10000).
⚫ Operand description When using the Kn addressing mode, the Kn in D1 and D2 should be the
D1: Destination operand 1 same.
D2: Destination operand 2 ⚫ Application instance
⚫ Function description LD X0
Exchanging the content of D1 with XCH D0 D10
the content of D2 and then storing the Exchanging the content of D0 with D10 when X0=ON. Before execution:
obtained value into D1 and D2 units D0=5000, D10=1000.
when the energy flow is valid.
After execution: D0=1000, D10=5000.
⚫ Note
⚫ Operand description When using the Kn addressing mode, the Kn in D1 and D2 should be the
D1: Destination operand 1; same.
D2: Destination operand 2 ⚫ Application instance
⚫ Function description LD X0
Exchanging the content of D1 with DXCH D0 D10
the content of D2 and then storing the
Exchanging the content of (D0,D1)with(D10,D11) when X0=ON. Before
obtained value into D1 and D2 units
execution: (D0,D1) =5000000, (D10,D11) =1000000. After execution: (D0,D1)
when the energy flow is valid.
=1000000, (D10,D11) =5000000.
⚫ Note
94
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description 1. When the stack is defined to be illegal (for example, when the size of the
S1: Push value stack is no more than 0, the number of elements in the stack is less than 0
D: Number of elements in the storage or the size of the stack is beyond the limit), the system reportsan error,
stack. An element No. indicates the indicating the definition of the stack operated is invalid.
position of a stack bottom. 2. The size of the stack does not include the stack bottom element(the
S2: Size of the stack element designated by D).
3. S2 indicates the size of the stack and the range is greater than 0.
⚫ Function description
1. Pushing the value of S1 into the ⚫ Application instance
stack top whose stack bottom isD LD M0
and increasing the value of D by 1 PUSH D0 D100 10
when the energy flow is valid. In this Stack
case, the No. of the stack top unitis pointer
No. of D+the value of D. D0 D110 D109 D108 D107 D106 D105 D104 D103 D102 D101 D100
⚫ Operand description 2. Setting the zero flag bit (SM80) to 1 when D1 is 0, that is, the
D1: Number of elements in the stack, and the stack is empty.
initial element of the stack is its element number ⚫ Note
plus 1. 1. When the stack is defined to be illegal (for example, when the
D2: Storage register for popped value size of the stack is no more than 0, the number of elements in
S: Size of the queue the stack is less than 0 or the size of the stack is beyond the
limit), the system reports an error, indicating the definition of the
⚫ Function description
stack operated is invalid.
1. Assigning the initial value of the word stack
starting from D1(the content of the unit after D1) 2. The size of the stack does not include the stack bottom
to D2, subtracting the value of D1 by 1, moving element(the element designated by D1).
the content of S units after D1 forward and filling 3. S indicates the size of the stack and the range is greater than
0 in the last unit when the energy flow is valid. 0.
⚫ Application instance
95
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description 2. The size of the stack does not include the stack bottom
D1: Number of elements in the queue, and the initial element(the element designated by D1).
element of the stack is its element number plus 1 3. S indicates the size of the stack and the range is
D2: Storage register for popped value greater than 0.
S: Size of the queue ⚫ Application instance
⚫ Function description
1. Assigning the content of the stack top with D1 as the
LD M0
stack bottom to D2 and subtracting the value of D1 by 1
when the energy flow is valid. LIFO D100 D0 10
2. Setting the zero flag bit (SM80) to 1 when D1 is 0, that Stack
pointer
is, the stack is empty. D0 D110 D109D108 D107D106 D105 D104 D103 D102 D101 D100
⚫ Note
1. When the stack is defined to be illegal (for example,
1. Assigning the content of D110 to D0 and keeping the
when the size of the stack is no more than 0, the number
content of D101 to D110 when M0=ON.
of elements in the stack is less than 0 or the size of the
2. Before execution: D0=0, D100=10, D101=1000,
stack is beyond the limit), the system reportsan error,
D102=2000, ……, D109=9000, D110=10000.
indicating the definition of the stack operated is invalid
3. After execution: D0=10000, D100=9,D101=1000,
D102=2000, ……, D109=9000, D110=10000.
96
VC Series Micro-PLC Programming Manual Application instructions
Consta
S3 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
⚫ Operand description
S1: Source operand
D: Destination operand, start element of a word string LD X0
S2: Size of destination word queue WSFR D0 D100 10 3
S3: Number of words filled when shifting a word string D2 D1 D0
rightward
⚫ Function description D109 D108 D107 D106 D105 D104 D103 D102 D101 D100
Shifting the content of S2 units starting from Drightward by
S3 units in the unit of word, discarding the S3 data on the
rightmost side, and shifting the content of S3 unitsstarting 1. Shifting the content of 10 units starting from D100
from S1 to the left end of the word string when the energy rightward by three units in the unit of word, discarding the
flow is valid. data of D102 to D100 units on the rightmost side, and
shifting the content of the three units starting from D0 to the
⚫ Note
left end of the word string when M0=ON.
1. Left and right order. The elements with small numbers
2. Before execution: D2=300, D1=200,
are at the right, and the elements with large numbers are at
D0=100.D109=10000, D108=9000, D107=8000,
the left.
D106=7000, D105=6000, D104=5000, D103=4000,
2.Both of S2 and S3 is no less than 0.
D102=3000, D101=2000, D100=1000.
3. S2 is no less than S3.
3. After execution: keeping the content of D0 to D2. D2=300,
4. When S1 and D both use the Kn addressing, Kn needs
D1=200, D0=100. D109=300, D108=200, D107=100,
to be the same. D106=10000, D105=9000, D104=8000, D103=7000,
⚫ Application instance D102=6000, D101=5000, D100=4000.
97
VC Series Micro-PLC Programming Manual Application instructions
⚫ Function description D2 D1 D0
Shifting the content of S2 units
starting from D leftward by S3 units D109 D108 D107 D106 D105 D104 D103 D102 D101 D100
in the unit of word, discarding the
S3 data on the leftmost side, and
shifting the content of S3 units 1. Shifting the content of 10 units starting from D100 leftward by three units in
starting from S1 to the right end of the unit of word, discarding the data of D109 to D107 units on the leftmost side,
the word string when the energy and shifting the content of the three units starting from D0 to the right end of
flow is valid. the word string when X0=ON.
⚫ Note 2. Before execution: D0=100, D1=200, D2=300. D109=10000, D108=9000,
1. Left and right order. The D107=8000, D106=7000, D105=6000, D104=5000, D103=4000, D102=3000,
elements with small numbers are D101=2000, D100=1000.
at the right, and the elements with 3. After execution: Keeping the content of D0 to D2. D2=300, D1=200, D0=100.
large numbers are at the left. D109=7000, D108=6000, D107=5000, D106=4000, D105=3000, D104=2000,
2.Both of S2 and S3 is no less than D103=1000, D102=300, D101=200, D100=100.
0.
Indexin
Operand Type Applicable soft element
g
Consta
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
Consta
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
D INT KnY KnM KnS KnLM D C T V Z R √
⚫ Operand description flag bit (SM82) when the operation result is less than -
S1: Source operand 1 32768.
S2: Source operand 2 ⚫ Application instance
D: Destination operand
⚫ Function description
1. Increasing S1 by S2 and assigning the operation result LD X0
to D when the energy flow is valid. ADD D0 D1 D10
2. Setting the carry flag bit (SM81) when the operation Increasing D0 (1000)by D1 (2000), and assigning the
result (D) is larger than 32767. Setting the zero flag bit operation result toD10 when X0=ON. In this case,
(SM80) when the operation result is 0. Setting the borrow D10=3000.
98
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description flag bit (SM82) when the operation result is less than -
S1: Source operand 1 32768.
S2: Source operand 2 ⚫ Application instance
D: Destination operand
⚫ Function description
1. Subtracting S1 by S2 and assigning the operation LD X0
result to D when the energy flow is valid. SUB D0 D1 D10
2. Setting the carry flag bit (SM81) when the operation SubtractingD0 (1000)by D1 (2000), and assigning the
result (D) is larger than 32767. Setting the zero flag bit operation result toD10 when X0=ON. In this case, D10=
(SM80) when the operation result is 0. Setting the borrow -1000.
Indexin
Operand Type Applicable soft element
g
Consta
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
Consta
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
D DINT KnY KnM KnS KnLM D C V R √
99
VC Series Micro-PLC Programming Manual Application instructions
Influenced flag
bit
IL: DIV (S1) (S2) (D) Step length 7
Indexin
Operand Type Applicable soft element
g
Consta
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
Consta
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
D INT KnY KnM KnS KnLM D C T V Z R √
Operand Indexin
Type Applicable soft element
g
Consta
S INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
D INT KnY KnM KnS KnLM D C T V Z R √
⚫ Operand description bit (SM82) when the operation result is rounded off.
S: Source operand ⚫ Note
D: Destination operand If S ≥ 0, the system reports an operand error and does not execute the
⚫ Function description square root extraction.
1. Extracting the square root of S and ⚫ Application instance
assigning the operation result to D LD X0
when the energy flow is valid. SQT D0 D10
2. Setting the zero flag bit (SM80) Assigning the square root result of D0 (1000) to D10 when X0=ON. In this
When (D) is 0. Setting the carry flag case, D10=31.
100
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description This instruction is cyclic minus instruction, and the range is from -32768 to
D: Destination operand 32767.
⚫ Operand description The range of S needs to be from -32767 to 32767. When the value of S is -
S: Source operand 32768, the system reportsan error, indicating the value of the instruction
D: Destination operand operand is invalid, and the instruction does not generate any action.
101
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description The range of S needs to be from -32767 to 32767. When the value of S is -
S: Source operand 32768, the system reports an error, indicating the value of the instruction
D: Destination operand operand is invalid, and the instruction does not generate any action.
Operand
Type Applicable soft element Indexing
Consta
S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
Consta
S2 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
D DINT KnY KnM KnS KnLM D C V R √
102
VC Series Micro-PLC Programming Manual Application instructions
Operand
Type Applicable soft element Indexing
Consta
S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
Consta
S2 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
D DINT KnY KnM KnS KnLM D C V R √
Operand Indexin
Type Applicable soft element
g
Consta
S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
Consta
S2 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
D DINT KnY KnM KnS KnLM D C V R √
⚫ Operand description Please note that the operation result of DMUL instruction is a 32-bit data,
S1: Source operand 1 which may cause an outflow.
S2: Source operand 2 ⚫ Application instance
D: Destination operand LD X0
⚫ Function description DMUL D0 D2 D10
Multiplying S1 by S2 and assigning Multiplying the value (83000) of (D0,D1) by the value (2000) of (D2,D3), and
the operation result to D when the assigning the operation result to (D10,D11)when X0=ON. In this case,
energy flow is valid. (D10,D11)=1660000000.
⚫ Note
103
VC Series Micro-PLC Programming Manual Application instructions
Consta
S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
Consta
S2 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
D DINT KnY KnM KnS KnLM D C V R √
6.3.14 DSQT: Instruction for extracting the square root of a long integer
Operand
Type Applicable soft element Indexing
Consta
S DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
D DINT KnY KnM KnS KnLM D C V R √
Operand Indexin
Type Applicable soft element
g
D DINT KnY KnM KnS KnLM D C V R √
104
VC Series Micro-PLC Programming Manual Application instructions
Operand Indexin
Type Applicable soft element
g
D DINT KnY KnM KnS KnLM D C V R √
6.3.17 DVABS: Instruction for obtaining the absolute value of a long integer
Operand
Type Applicable soft element Indexing
Consta
S DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
D DINT KnY KnM KnS KnLM D C V R √
105
VC Series Micro-PLC Programming Manual Application instructions
Operand Indexin
Type Applicable soft element
g
Consta
S DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
D DINT KnY KnM KnS KnLM D C V R √
Operand
Type Applicable soft element Indexing
106
VC Series Micro-PLC Programming Manual Application instructions
Accumulating the data of 5 units
starting from D0, and assigning the
obtained result to (D100,D101) when
X0=ON.In this case,
(D100,D101)=D0+……+D4=15000.
107
VC Series Micro-PLC Programming Manual Application instructions
Operand
Type Applicable soft element Indexing
⚫ Operand description 2. Setting the carry flag bit (SM81) when the operation result (D) is larger
S1: Source operand 1 than 1.701412e+038 or less than -1.701412e+038. Setting the zero flag
S2: Source operand 2 bit (SM80) when the operation result is 0.
D: Destination operand ⚫ Application instance
⚫ Function description LD X0
1. Increasing S1 by S2 and assigning RADD D0 D2 D10
the operation result to D when the
energy flow is valid.
108
VC Series Micro-PLC Programming Manual Application instructions
Increasingthe value (-10000.2) of (D2,D3),and assigning the operation result to (D10,D11)when X0=ON. In this
(D0,D1) bythe value (2000.5) of case, (D10,D11)=-7999.7.
Indexi
Operand Type Applicable soft element
ng
Consta
S1 REAL D V R √
nt
Consta
S2 REAL D V R √
nt
D REAL D V R √
109
VC Series Micro-PLC Programming Manual Application instructions
6.4.5 RSQT: Instruction for extracting the square root of a floating-point number
⚫ Operand description If S≥0, the system reports an operand error and does not execute square
S: Source operand root extraction.
D: Destination operand ⚫ Application instance
⚫ Function description LD X0
1. Extracting the square root of S and RSQT D0 D10
assigning the operation result to D Extracting the square root of the value (10000.2)of (D0,D1), and assigning
when the energy flow is valid. the square root result to (D10,D11)when X0=ON. In this case,
2. Setting the zero flag bit (SM80) (D10,D11)=100.000999.
When (D) is 0.
⚫ Note
110
VC Series Micro-PLC Programming Manual Application instructions
6.4.6 RVABS: Instruction for obtaining the absolute value of a floating-point number
⚫ Operand description
S: Source operand
D: Destination operand LD X0
RVABS D0 D10
⚫ Function description
Taking an absolute value (-10000.2) of (D0,D1), and
Taking an absolute value of S and assigning the obtained
assigning the obtained result to (D10,D11) when X0=ON.
result to D when the energy flow is valid.
In this case, (D10,D11)=10000.2.
⚫ Application instance
⚫ Operand description
S: Source operand
LD X0
D: Destination operand
RNEG D0 D10
⚫ Function description
Taking the negative of the value (10000.2) of (D0,D1),
Taking the negative of S and assigning the obtained
and assigning the obtained result to (D10,D11) when
result to D when the energy flow is valid.
X0=ON. In this case, (D10,D11)=-10000.2.
⚫ Application instance
111
VC Series Micro-PLC Programming Manual Application instructions
1. Obtaining the SIN value of S (unit: radian), and
assigning the obtained result to D when the energy flow
is valid. LD X0
2. Setting the zero flag bit (SM80) when the operation SIN D0 D10
result (D) is 0.
Taking the SIN value (1.57) of (D0,D1), and assigning the
⚫ Application instance obtained result to (D10,D11) when X0=ON. In this case,
(D10,D11) =1.
⚫ Operand description 2. Setting the zero flag bit (SM80) when the operation result (D) is 0.
S: Source operand ⚫ Application instance
D: Destination operand LD X0
COS D0 D10
⚫ Function description
1. Obtaining the COS value of S (unit: Taking the COS value (3.14) of (D0,D1), and assigning the obtained result to
radian), and assigning the obtained (D10,D11) when X0=ON. In this case, (D10,D11) =-0.999999.
result to D when the energy flow is
valid.
⚫ Operand description 2. Setting the carry flag bit (SM80) when the operation result (D) is larger
S: Source operand than 1.701412e+038 or less than -1.701412e+038. Setting the zero flag bit
D: Destination operand (SM81) when the operation result is 0.
112
VC Series Micro-PLC Programming Manual Application instructions
⚫ Function description value error and does not executes the operation.
1. Obtaining the S2 power of S1, and ⚫ Application instance
then assigning the operation result to LD X0
D when the energy flow is valid. POWER D0 D2 D10
2. Setting the carry flag bit (SM81) Obtaining the (D2,D3) power of (D0,D1), namely (the 3.0 power of 55.0), and
when the operation result (D) is assigning the result to (D10,D11) when X0=ON. In this case, (D10,D11)
larger than 1.701412e+038 or less =166375.0.
than -1.701412e + 038. Setting the
zero flag bit (SM81) when the
operation result is 0.
6.4.12 LN: Instruction for obtaining the natural logarithm of a floating-point number
⚫ Operand description larger than 1.701412e+038 or less than -1.701412e+038. Setting the zero
S: Source operand flag bit (SM80) when the operation result is 0.
D: Destination operand ⚫ Application instance
⚫ Function description LD X0
1. Obtaining the LN value of S, and LN D0 D10
assigning the operation result to D Taking the LN value (1000.0) of (D0,D1),and assigning the obtained result to
when the energy flow is valid. (D10,D11) when X0=ON. In this case, (D10,D11) =6.907755.
2. Setting the carry flag bit (SM81)
when the operation result (D) is
113
VC Series Micro-PLC Programming Manual Application instructions
6.4.13 EXP: Instruction for obtaining the natural number power of a floating-point number
⚫ Operand description larger than 1.701412e+038 or less than -1.701412e+038. Setting the zero
S: Source operand flag bit (SM80) when the operation result is 0.
D: Destination operand ⚫ Application instance
LD X0
⚫ Function description
EXP D0 D10
1. Obtaining the EXP value of S, and
assigning the operation result to D Taking the EXP value (10.0) of (D0,D1), and assigning the obtained result to
when the energy flow is valid. (D10,D11) when X0=ON. In this case, (D10,D11) =22026.464844.
2. Setting the carry flag bit (SM81)
when the operation result (D) is
S1 REAL D V R √
Consta
S2 INT KnX KnY KnM KnS KnLM KnSM D V R √
nt
D REAL D V R √
114
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description If S>1 or S<-1, the system reports an operand error, does not perform the
S: Source operand conversion operation and keeps the content of D.
D: Destination operand ⚫ Application instance
⚫ Function description LD SM0
1. Obtaining the COS-1 value of S, ACOS D0 D10
and assigning the operation result to
Taking the COS-1 value (0.500000) of (D0,D1), and assigning the obtained
D when the energy flow is valid.
result to (D10,D11) when SM0=ON. In this case, (D10,D11) =1.047198.
2. Setting the zero flag bit (SM80)
when the operation result (D) is 0.
⚫ Note
115
VC Series Micro-PLC Programming Manual Application instructions
D REAL D V R √
⚫ Operand description 2. Setting the zero flag bit (SM80) when the operation result (D) is 0.
S: Source operand ⚫ Application instance
D: Destination operand LD SM0
⚫ Function description ATAN D0 D10
1. Obtaining the TAN-1 value of S, Taking the TAN-1 value (3.14)of (D0,D1), and assigning the obtained result
and assigning the operation result to to (D10,D11) when SM0=ON. In this case, (D10,D11) =1.262481.
D when the energy flow is valid.
6.4.18 LOG: Instruction for obtaining the common logarithm of a floating-point number
⚫ Operand description 2. Setting the carry (overflow) flag bit (SM81) when the operation result (D)
S: Source operand overflows. Setting the zero flag bit (SM80) when the operation result is 0.
D: Destination operand
⚫ Function description ⚫ Application instance
1. Obtaining the LOG value of S, and LD SM0
assigning the operation result to D LOG D0 D10
when the energy flow is valid. LOG is Taking the value (3.0)of D0(D1), and assigning the obtained result to
a common logarithm operation based D10(D11)when SM0=ON. In this case, D10(D11) =0.477121.
on 10.
116
VC Series Micro-PLC Programming Manual Application instructions
Operand
Type Applicable soft element Indexing
Consta
S DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
D INT KnY KnM KnS KnLM D C T V Z R √
⚫ Operand description If S>32767 or S<-32768, the system reports an operand error, does not
S: Source operand execuate the conversion operation and keeps the content of D.
D: Destination operand ⚫ Application instance
⚫ Function description LD X0
Converting S from a long integer to DTI D0 D10
an integer, and assigning the Converting (D0, D1) =10000 from a long integer to an integer, and assigning
operation result to D when the the operation result to D10 when X0=ON. In this case, D10=10000.
energy flow is valid.
⚫ Note
117
VC Series Micro-PLC Programming Manual Application instructions
⚫ Application instance Converting D0=1000 from an integer to a long integer, and assigning the
operation
LD X0 result to D10 when X0=ON. In this case, (D10,D11)=1000.
ITD D0 D10
Operand
Type Applicable soft element Indexing
Consta
S INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
D REAL D V R √
Operand
Type Applicable soft element Indexing
Consta
S DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
D REAL D V R √
Operand
Type Applicable soft element Indexing
118
VC Series Micro-PLC Programming Manual Application instructions
Consta
S REAL D V R √
nt
D INT KnY KnM KnS KnLM D C T V Z R √
⚫ Operand description rounded off. Setting the carry flag bit (SM81) when the result exceeds the
S: Source operand data range of the long integer data.
D: Destination operand ⚫ Note
⚫ Function description When S>32767, D=32767. When S<-32768, D=-32768, and set the carry
1. Converting S from a floating-point (overflow) flag bit(SM81).
number to an integer, and ⚫ Application instance
assigningthe operation result to D LD X0
when the energy flow is valid. INT D0 D10
2. This instruction affects zero
Converting (D0,D1)=10000.5from a floating-point number to an integer, and
flagand borrow flag. Setting the zero
assigning the operation resultto D10 when X0=ON. In this case, (D0,D1)
flag bit(SM80) when the conversion
=10000.5.
result is 0. Setting the borrow flag
when the decimals of the result are
Operand
Type Applicable soft element Indexing
Consta
S REAL D V R √
nt
D DINT KnY KnM KnS KnLM D C V R √
⚫ Operand description Setting the carry (overflow) flag bit (SM81) when the result exceeds the data
S: Source operand range of the long integer data.
D: Destination operand ⚫ Note
⚫ Function description When S > 2147483647, D=2147483647. When S < -2147483648, D=-
1. Converting S from a floating-point 2147483648, and set the carry (overflow) flag (SM81) bitsimultaneously.
number to a long integer, and ⚫ Application instance
assigning the operation result to D LD X0
when the energy flow is valid. DINT D0 D10
2. Setting the zero flag bit (SM80) Converting (D0,D1)=100000.5from a floating-point number to a long integer,
when the conversion result is 0. and assigning the operation resultto (D10,D11) when X0=ON. In this case,
Setting the borrow flag when the (D10,D11)=100000.
decimals of the result are rounded off.
119
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description If S>9999, the system reports an operand error, does not execute the
S: Source operand, ≤9999 conversion operation, and keeps the content of D.
D: Destination operand ⚫ Application instance
⚫ Function description LD X0
Converting S from an integer to a 16- BCD D0 D10
bit BCD code, and assigning the Converting D0=0x0D05 (3333) from an integer to a 16-bit BCD code, and
obtained result to D when the energy assigning the operation resultto D10 when X0=ON. In this case,
flow is valid. D10=0x3333 (13107).
⚫ Note
6.5.8 DBCD: Instruction for converting a double word to a 32-bit BCD code
⚫ Operand description If S>99999999, the system reports an operand error, does not execute the
S: Source operand, ≤99999999 conversion operation, and keeps the content of D.
D: Destination operand ⚫ Application instance
⚫ Function description LD X0
Converting S from a long integer to a DBCD D0 D10
32-bit BCD code, and assigning the Converting (D0,D1)=0x3F940AA (66666666) from a long integer to a 32-bit
obtained result to D when the energy BCD code, and assigning the operation resultto (D10,D11) when X0=ON. In
flow is valid. this case, (D10,D11)=0x66666666 (1717986918).
⚫ Note
120
VC Series Micro-PLC Programming Manual Application instructions
assigning
BINtheD0operation
D10 resultto D10 when X0=ON. In this case,
Converting D0=0x5555 (21845) from D10=0x15B3 (5555).
a 16-bit BCD code to an integer, and
6.5.10 DBIN: Instruction for converting a 32-bit BCD code to a double word
⚫ Operand description If the data format of S does not comply with BCD code format, the system
S: Source operand reports an operand error, does not execute the conversion operation, and
D: Destination operand keeps the content of D.
6.5.12 DGRY: Instruction for converting a double word to a 32-bit gray code
121
VC Series Micro-PLC Programming Manual Application instructions
6.5.14 DGBIN: Instruction for converting a 32-bit gray code to a double word
⚫ Operand description Converting S from a 32-bit gray code to a long integer, and assigning the
S: Source operand obtained result to D when the energy flow is valid.
D: Destination operand ⚫ Application instance
⚫ Function description LD X0
DGBIN D0 D10
122
VC Series Micro-PLC Programming Manual Application instructions
Converting (D0,D1)=0xCCCCCCCC the operation result to (D10,D11) when X0=ON. In this case,
(3435973836) from a 32-bit gray (D10,D11)=0x88888888 (2290649224).
code to a long integer, and assigning
123
VC Series Micro-PLC Programming Manual Application instructions
6.5.17 ITA: Instruction for convertinga 16-bit hex data to an ASCII code
⚫ Operand description
S1: Source hex data to be converted 3. If S1 is a constant, when S2≥4, the system default is
D: Destination operand S2=4 and the system does not report an operand error
S2: Number of ASCII codes (1≤S2≤256) once the default is adopted.
6.5.18 ATI: Instruction for converting an ASCII code to a 16-bit hex data
Applicable model VC1S VC1 VC2 VC3 VC5
LAD: Zero flag, carry flag, and borrow
Influenced flag
flag
bit
124
VC Series Micro-PLC Programming Manual Application instructions
Consta
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
D INT KnY KnM KnS KnLM D C T V Z R √
Consta
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
125
VC Series Micro-PLC Programming Manual Application instructions
standard value is generated by applying below formulato LDI M1
source data, in which S n is the original input data, and MOV 282 D1000
⚫ Operand description When adopting the analog input module to read the
S1: The start address of the source operand to be external analog signal, you can use this instruction to
converted convert the original analog read value into the
S2:The start address of conversion table corresponding project read value.
D: The start address that stores the conversion result When temperature or analog modulesare used for
temperature or analog measurement applications, if the
S3: Number ofdata to be converted (1≤S3≤64)
temperature or project read value measured by the PLC
⚫ Function description deviates from the result measured by the standard
126
VC Series Micro-PLC Programming Manual Application instructions
thermometer or relevant standard instruments, this LDI M1
instruction can be used to make linear modification to RMOV 282 D1000
calibrate the actual measurement. RMOV 3530 D1002
Filling the conversion table with four parameters, namely RMOV 260 D1004
low point measurement value VML , high point RMOV 3650 D1006
measurement value VMH and corresponding low point LDI M4
standard value VSL and high point standard value VSH . RMOV 282 D100
RMOV 3530 D102
When the linear conversion is executed, the target
RMOV 1906 D104
standard value is generated by applying below formulato
source data, in which S n is the original input data, and RMOV 0 D106
RMOV 5000 D108
Dn is conversion result data.
RMOV -115 D110
A = (VSL − VSH ) /(VML − VMH ) *10000 LD M2
RLCNV D100 D1000 D200 6
B = VSL − (VML * A / 10000 )
Executing the RLCNV instruction when M2=ON. The
Dn = ( S n * A / 10000 ) + B results generated according to data storage mode are
listed below:
⚫ Note
D200(D201) = 260
These four data in the conversion table has their actual
D202(D203) = 3650
meanings,for instance, the low point measurement value
should be less than the high point measurement value. D204(D205) = 1955
The result is inaccurate if the conversion result exceeds D206(D207) = -34.3288
the integer range. If Dn is larger than 32767, it is 32767; D208(D209) = 5184.267
⚫ Application instance
127
VC Series Micro-PLC Programming Manual Application instructions
Step length 7
IL: WAND (S1) (S2) (D)
Operan Indexi
Type Applicable soft element
d ng
Const
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
ant
Const
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
ant
D INT KnY KnM KnS KnLM D C T V Z R √
128
VC Series Micro-PLC Programming Manual Application instructions
Const
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
ant
Const
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
ant
D INT KnY KnM KnS KnLM D C T V Z R √
Const
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
ant
Const
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
ant
D INT KnY KnM KnS KnLM D C T V Z R √
129
VC Series Micro-PLC Programming Manual Application instructions
Step length 7
IL: WINV (S) (D)
Operan
Type Applicable soft element Indexing
d
Const
S INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
ant
D INT KnY KnM KnS KnLM D C T V Z R √
130
VC Series Micro-PLC Programming Manual Application instructions
Con
S1 DINT stan KnX KnY KnM KnS KnLM KnSM D SD C V R √
t
Con
S2 DINT stan KnX KnY KnM KnS KnLM KnSM D SD C V R √
t
D DINT KnY KnM KnS KnLM D C V R √
131
VC Series Micro-PLC Programming Manual Application instructions
Con
S DINT stan KnX KnY KnM KnS KnLM KnSM D SD C V R √
t
D DINT KnY KnM KnS KnLM D C V R √
Applicable
LAD: VC1S VC1 VC2 VC3 VC5
model
⚫ Operand description LD M0
ROR D0 D10 3
S1: Source operand 1
D: Destination operand Before the execution Rotate rightward by 3 bits
MSB LSB
S2: Source operand 2 1 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1
⚫ Function description
Cyclically shifting the data of S1 SM181
rightward by S2 bits, assigning the After the execution
obtained result to D, and storingthe MSB LSB
destination bit in the carry flag bit 1 0 1 1 1 0 0 1 1 0 1 1 0 0 1 0
⚫ Note
S2 is greater than or equal to 0. Cyclically shifting D0=2#1100110110010101 (52629) rightward by 3 bits, assigning
When S1 uses Kn addressing, Kn the obtained result to D10, and storing the destination bit in the carry flag bit when
needs to be equal to 4. M0=ON. In this case, D10=2#1011100110110010 (47538) and SM81=ON.
⚫ Application instance
132
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description Cyclically shifting the data of S1 leftward by S2 bits, assigning the obtained
S1: Source operand 1 result to D, and storingthe destination bit in the carry flag bit (SM81)when the
D: Destination operand energy flow is valid.
S2: Source operand 2 ⚫ Note
S2 is greater than or equal to 0. When S1 uses Kn addressing, Kn needs to be
⚫ Function description
equal to 4.
⚫ Application instance Cyclically shiftingD0=2#1100110110010101 (52629)
LD M0 leftward by 15 bits, assigning the obtained result to D10,
ROL D0 D10 15 and storing the destination bit in the carry flag bit when
M0=ON. In this case, D10=2#1110011011001010
Before the execution Rotate leftward by 15 bits
MSB LSB (59082) and SM81=OFF.
1 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1
SM181
0 SM181
6.7.3 RCR: Instruction for 16-bit rotate right with carry flag bit
133
VC Series Micro-PLC Programming Manual Application instructions
⚫ Application instance Cyclically shifting D0=2#1100110110010101 (52629) with the carry flag bit
(SM81=OFF) rightward by 5 bits, and assigning the obtained result to D10 when
LD M0=ON.In
M0 this case, D10=2#0101011001101100 (22124) and SM81=ON.
RCR D0 D10 5
Before the execution Rotate with the carry flag rightward by 5 bits
MSB LSB
1 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1
SM181 (0)
After the execution
MSB LSB
0 1 0 1 0 1 1 0 0 1 1 0 1 1 0 0
SM181 1
6.7.4 RCL: Instruction for 16-bit rotate left with carry flag bit
⚫ Operand description LD M0
RCL D0 D10 16
S1: Source operand 1
D: Destination operand Before the execution Rotate with the carry flag leftward by 16 bits
MSB LSB
S2: Source operand 2 1 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1
⚫ Function description
SM181 (1)
Cyclically shifting the data of S1 with
the carry flag bit (SM81) leftward by
After the execution
S2 bits, and assigning the obtained
MSB LSB
result to D when the energy flow is 1 1 1 0 0 1 1 0 1 1 0 0 1 0 1 0
valid.
1 SM181
⚫ Note
S2 is greater than or equal to 0.
Cyclically shifting D0=2#1100110110010101 (52629) with the carry flag bit
When S1 uses Kn addressing, Kn
(SM81=ON) rightward by16 bits, and assigning the obtained result to D10 when
needs to be equal to 4.
M0=ON. In this case, D10=2#1110011011001010 (59082) and SM81=ON.
⚫ Application instance
134
VC Series Micro-PLC Programming Manual Application instructions
Con
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
stant
6.7.7 DRCR: Instruction for 32-bit rotate right with carry flag bit
135
VC Series Micro-PLC Programming Manual Application instructions
Con
S1 DINT stan KnX KnY KnM KnS KnLM KnSM D SD C V R √
t
D DINT KnY KnM KnS KnLM D C V R √
Con
S2 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t
6.7.8 DRCL: Instruction for 32-bit rotate left with carry flag bit
136
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description
Before the execution Rotate rightward by 5 bits
S1: Source operand 1 MSB LSB
D: Destination operand 0 1 1 1 1 0 1 0 1 1 0 1 1 1 0 0
S2: Source operand 2
After the execution
⚫ Function description
MSB
Shifting the data of S1 rightward by S2 bits, and assigning the
0 0 0 0 0 0 1 1 1 1 0 1 0 1 1 0
obtained result to D when the energy flow is valid.
⚫ Note
S2 is greater than or equal to 0. When S1 uses Kn addressing, Kn
needs to be equal to 4.
Shifting D0=2#0111101011011100 (31452)
⚫ Application instance rightward by 5 bits, and assigning the obtained
LD M0 result to D10 when M0=ON. In this case,
SHR D0 D10 5 D10=2#0000001111010110 (982).
137
VC Series Micro-PLC Programming Manual Application instructions
138
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description
S1: Source operand 1
D: Destination operand
S2: Source operand 2
139
VC Series Micro-PLC Programming Manual Application instructions
S3: Source operand 3
⚫ Note
1. Left right order, elements with large element No. areon the left, and elements with small element No. areon the right.
2. Both S2 and S3 are greater than or equal to zero.
⚫ Function description
Shifting the content of the S2 units starting from D rightward by S3 units, discarding the S3 data on the leftmost end, and
shifting the content of S3 units starting from S1 to the right end of the word string when the energy flow is valid.
⚫ Application instance
LD M0
SFTL X0 M10 10 3
X2 X1 X0
M19 M18 M17 M16 M15 M14 M13 M12 M11 M10
1. Shifting the content of 10 units starting from M10 leftward by 3 units, discarding M17 to M19 on the leftmost end, and
shifting the content of 3 units starting from X0 to the right end of the bit string when M0=ON.
2. Before execution: X0=1, X1=0, X2=1。M10=0, M11=1, M12=1, M13=0, M14=0, M15=1, M16=0, M17=0, M18=0, and
M19=1。
3. After execution: The contents of X0 to X2 are kept. M10=1, M11=0, M12=1, M13=0, M14=1, M15=1, M16=0, M17=0,
M18=1, and M19=0.
140
VC Series Micro-PLC Programming Manual Application instructions
6.8.1 FROM: Instruction for reading words from a special module buffer register
⚫ Operand description S3: Number of the consecutive BFM buffers (single word) to be read
S1: SN of the special modules visited Data range: 1 to 32767. When accessing an invalid address of the BFM
Settable range: 0 to 7. When buffer, the system reports that the BFM buffer of the assessed special
accessing a special module that module exceeds the range.
does not exist in the system, the ⚫ Function description
system reports that the special Reading consecutively S3 word data starting from S2 buffer in the
module address is invalid. designated BFM of designated special module (SN: S1), and consecutively
S2: The start address of the BFM storing these data in S3 word elements starting from D.
buffer of the special module to be ⚫ Note
read The execution time of the FROM instruction is relatively long, and related to
Settable range: 0 to 32767. When the value of S3.
accessing an invalid BFM address,
⚫ Application instance
the system reports that BFM unit of
LD M0
the assessed special module FROM 0 3 D100 2
exceeds the range.
Reading consecutively 2 data starting from the buffer 3 in the BFM of No. 0
D: The element where the data read
special module, and storing these data in D100 and D101 respectively when
from the special module is stored.
M0 is ON.
6.8.2 DFROM: Instruction for reading double words from a special module buffer register
141
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description Data range: 1 to 32767. When accessing an invalid address of the BFM buffer,
S1: SN of the special modules the system reports that the BFM buffer of the assessed special module
visited exceeds the range.
Settable range: 0 to 7. When ⚫ Function description
accessing a special module that Reading consecutively S3 word data starting from S2 buffer in the designated
does not exist in the system, the BFM of designated special module (SN: S1), and consecutively storing these
system reports that the special data in S3 double word elements starting from D.
module address is invalid. ⚫ Note
S2: The start address of the BFM The execution time of the DFROM instruction is relatively long, and related
buffer of the special module to be to the value of S3.
read
⚫ Application instance
Settable range: 0 to 32767. When
accessing an invalid BFM address,
the system reports that BFM unit of
the assessed special module LD M0
exceeds the range. DFROM 0 3 D200 1
D: The element where the data read Reading1 double data starting from the buffer 3 in the BFM of No. 0 special
from the special module is stored. module, and storing these double data in D200 and D201 respectively when
S3: Number of the consecutive BFM M0 is ON.
buffers (double word) to be read
6.8.3 TO: Instruction for writing words from a special module buffer register
142
VC Series Micro-PLC Programming Manual Application instructions
6.8.4 DTO: Instruction for writing double words from a special module buffer register
⚫ Operand description Data range: 1 to 32767. When accessing an invalid address of the BFM buffer,
S1: SN of the special modules visited the system reports that the BFM buffer of the assessed special module
Settable range: 0 to 7. When accessing exceeds the range.
a special module that does not exist in ⚫ Function description
the system, the system reports that the Writingthe data from consecutiveS4 double word units starting from S3 into
special module address is invalid. S4 double word elements starting fromthe designated BFM buffer (address is
S2: The start address of the BFM buffer S2)of the designated special module (SN: S1).
of the special module to be written ⚫ Note
Settable range: 0 to 32767. When The execution time of the DTO instruction is relatively long, and related to the
accessing an invalid BFM address, the value of S4.
system reports that BFM unit of the ⚫ Application instance
assessed special module exceeds the LD SM0
range. DTO 0 8 16711935 1
S3: Data to be written into the special Writing one double word data (16711935)into BFM #8 and BFM #9
modules buffers(they can constitute one double word) of No. 0 special module when
S4: Number of the consecutive BFM the PLC is running.
buffers (double word) to be written.
⚫ Operand description D: The element where the read analog potentiometer value is stored.
S: Designated analog potentiometer Range:0–255.
No. ⚫ Function description
Settable range:: 0 to 255. If S is set Reading the value of the designated analog potentiometer, and storing it into
outside this range, the system the designated element.
reports an operand error. ⚫ Application instance
LD M0
143
VC Series Micro-PLC Programming Manual Application instructions
VRRD 0 D10 putting the read value into D10 when M0 is ON.
Reading the value of No. 0 analog
potentiometer in the system, and
⚫ Operand description 1. The subscript number of input port (Xn, Yn) should be
D: The start X or Y element to be refreshed an integer multiple of 8.
Designating the start soft element No. as an integral 2. Number of the refreshed (port) should also be an
multiple of 8. For example, X0, X10, X20…or Y0, Y10, integer multiple of 8.
Y20…. The min. bit is 0. 3. Generally, the REF instruction is used to refresh I/O
S: Number of I/O ports to be refreshed immediately between the FOR-NEXT instruction and the
CJ instruction.
It should always be a multiple of 8, for example, 8,
16, ……, 256, and so on. Other values(except a multiple 4. You can also use the REF instruction to obtain the
of 8) are wrong. latest input information and output the operation result
without delay during the execution of the interrupt
⚫ Function description
subprogram with I/O.
Generally, the PLC does not refresh its I/O points before
5. To refresh arelay output, you need to consider the
the user program ends. However, if it is required to read
response time.
the latest input state or immediately refresh the output
state during the operation process, you can use the REF ⚫ Application instance
instruction. LD M0
⚫ Note REF Y0 8
144
VC Series Micro-PLC Programming Manual Application instructions
Immediately outputting the statesat Y0 to Y7 regardless
of the scan cycle when M0 is ON.
⚫ Operand description
S1: The start address of the elements
being written(Range:D6000–D6999)
S2: Number of the elements being
LD M1
written (S2 < 16, and S1 + S2 < SET M1000
D7000) RST M1
⚫ Note MOV 16 D6016
MOV 32 D6032
One EEPROM instruction operation
LD SM1
makes the scan cycle 2-5 ms longer.
SET M1
It is recommended to set S1 to 6000 LD M1000
plus an integer multiple of 16, such EROMWR D6016 2
as D6000, D6016 and D6032. LD M1001
⚫ Function description EROMWR D6032 16
LD M1000
1. Generally, partial PLC data can be
SET M1001
stored throughusing the function for
saving data at power outage.
However, during the calculation, you
can save the intermediate data into
EEPROM with the ERPROM
In the preceding example, two sets of D elements are stored in the EEPROM.
instruction.
SM1 and M1 makes M1000 generate a rising edge in the second scan cycle,
2. This instruction is executed upon
and triggers the execution of the first EROMWR instruction. M1001 makes
the rising edge.
the second rising edge, and triggers the execution of the second EROMWR
⚫ Application instance instruction.
Applicable
LAD: VC2 VC3 VC5
model
PR (S) (D) Influenced flag
bit
IL: PR (S) (D) Step length 5
Operan Indexi
Type Applicable soft element
d ng
S INT D C T R √
D BOOL Y
⚫ Note
1. This instruction is applicable only to transistor output
modules.
2. This instruction is executed with the scan cycle.
3. Only one instruction can be executed at a time. When
the printing is done, SM79 is reset.
LAD: Applicable
VC2 VC3 VC5
model
Influenced flag
bit
IL: TKY (S) (D1) (D2) Step length 7
Operan Inde
Type Applicable soft element
d xing
S BOOL X Y M S SM LM
D2 BOOL Y M S SM LM
146
VC Series Micro-PLC Programming Manual Application instructions
Numeric keys 0 1 2 3 4 5 6 7 8 9
⚫ Application instance
LD M0
TKY X0 D7999
M1000
When you press X2, X1, X3, and X0 in sequence, the
S S S S S s S S S S
24V 0V s/s
+1 +2 +3 +4 +5 +6 +7 +8 +9 content of D7999 becomes 2130. After X2 is pressed,
M1002 is set to ON until another key is pressed,and so
PLC is the case when other keys are pressed. After any one
of the keys is pressed, the keypad detection output
S ④ M1010 is ON only during the pressing time.
⚫ Note
S+1 ②
1. When multiple keys are pressed simultaneously, only
S+2 ① the information input by the key pressed first is valid.
S+3 ③ 2. When the energy flow is OFF, the content of D1 does
not change, but D2 to D2+10 are set to OFF.
S+9
3. If the inputted data exceeds 9999, the MSB overflows
first.
D2
4. After an input key is pressed, the keypad detection
D2+1 output D2 corresponding to the key is set to ON until
another input key.
D2+2
5. Only one TKY instruction can be used in the program,
D2+3 and but you can use it multiple times through indexing.
D2+9
D2+10 ① ② ③ ④
147
VC Series Micro-PLC Programming Manual Application instructions
148
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description
S: The soft element where the system time is to be written
Element Project Clock data Element Project
――――――→
D10 Year 2000–2099 SD60 Year
――――――→
D11 Month 1–12 SD61 Month
――――――→
Data for clock setting D12 Day 1–31 SD62 Day
――――――→
D13 Hour 0–23 SD63 Hour
――――――→
D14 Minute 0–59 SD64 Minute
――――――→
D15 Second 0–59 SD65 Second
――――――→
D16 Week 0–6 SD66 Week
1. Writing the time set values into 7 consecutive units starting from D10 upon
detecting the rising edge of X10.
2. Writing the values of 7 consecutive units starting from D10 into the system
time upon detecting the rising edge of X11.
3. Reading the system time and storing it in D20 when M0 is ON.
149
VC Series Micro-PLC Programming Manual Application instructions
The time data in the operation need 2. Increasing the three storage units starting from D10 by the three storage
to conform to the time format: units starting from D20, and storing the obtained result in the three storage
units starting from D30 when M0 is ON.
Setting range of”Hour”: 0–23.
3. Setting the carry flag (SM81) to ON and the zero flag (SM80) to OFF.
150
VC Series Micro-PLC Programming Manual Application instructions
⚫ Function description 1. Sending the time data to the three storage units starting from D10 and the
Performing the subtraction operation three storage units starting from D20 when X10 is ON.
on the data with the time format, and 2. Subtracting the three storage units starting from D10 by the three storage
executing the operation rule in the units starting from D20, and storing the obtained result in the three storage
time format. units starting from D30 when M0 is ON.
⚫ Note 3. Setting the carry flag (SM82) to ON and the zero flag (SM80) to OFF.
The time data in the operation need
toconform to the time format:
Setting range of "Hour": 0–23
Setting range of "Minute": 0–59
Setting range of "Second": 0–59
151
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description present data can be used after PLC power is cut off. If normal soft element
S: Hour comparison data. Data range: unit is used, current data will be cleared when PLC power is cut off or RUN
0–32767 → STOP operation is being carried out.
2. Even if the alarm output D2 is ON, it can continue counting.
D1: Time storage unit
3. This instruction hour is 16-bit integer data. When the hour data is larger
The data unit of D1 stores hours
than 32767, starts from 0 again.
while the data unit of D1+1 stores
⚫ Application instance
seconds.
D2: Alarm output address LD M0
MOV 1000 D100
When the data of D1 is greater than
LD M1
or equal to the data designated by S, HOUR D100 D200 M10
the alarm point is changed to ON LD M10
output. OUT Y10
⚫ Function description 1. Setting the comparison data of the HOUR instruction when M0 is ON.
Making the judgment on the time 2. HOUR performs the time accumulation operation on the input contacts
when the input contact is in the ON when M1 is ON.
state (unit: hour).
3. When the accumulation time, that is, time of keeping M1 in the ON state,
⚫ Note is greater than or equal to 1000, M10 is in the ON state.
1. Designate D1 as the soft element
unit for power-off storage to ensure
152
VC Series Micro-PLC Programming Manual Application instructions
IL:
DCMP= (S1) (S2) (D)
DCMP< (S1) (S2) (D)
DCMP> (S1) (S2) (D)
Step length 7
DCMP<> (S1) (S2) (D)
DCMP>= (S1) (S2) (D)
DCMP<= (S1) (S2) (D)
Operan
Type Applicable soft element Indexing
d
S1 INT D SD V R √
S2 INT D SD V R √
D BOOL Y M S LM C T
⚫ Operand description The date data starting from S1 and S2 need to comply with the format of the
S1: Date comparison data 1, which solar calendar, otherwise,the system reports an operand error(eg: 2004, 9,
occupies the start three word units 31 and 2003, 2,29 are illegal).
designated by S1. Data of these ⚫ Application instance
three units need to comply with the
format of solar calendar, otherwise
the system reports an operand error. LD SM0
MOV 2004 D0
S2: Date comparison data 2, which
MOV 10 D1
occupies the start three word units
MOV 25 D2
designated by S2. Data of these MOV 2004 D10
three units need to comply with the MOV 10 D11
format of solar calendar, otherwise MOV 24 D12
the system reports an operand error. LD X0
D: Comparison state output. When DCMP= D0 D10 M0
DCMP< D0 D10 M1
the data comply with the comparison
DCMP> D0 D10 M2
condition, setting D to ON, otherwise,
DCMP<> D0 D10 M3
it is OFF. DCMP>= D0 D10 M4
⚫ Function description DCMP<= D0 D10 M5
Conducting the BIN comparison on
the date data starting from S1 and S2
respectively, and assigning the Conducting the BIN comparison on the date data starting from D0 and D10
comparisonresult to D. respectively, and assigning the comparison result to the destination data (M0,
⚫ Note etc.).
153
VC Series Micro-PLC Programming Manual Application instructions
IL:
TCMP= (S1) (S2) (D)
TCMP< (S1) (S2) (D)
TCMP> (S1) (S2) (D)
Step length 7
TCMP<> (S1) (S2) (D)
TCMP>= (S1) (S2) (D)
TCMP<= (S1) (S2) (D)
Operan
Type Applicable soft element Indexing
d
S1 INT D SD V R √
S2 INT D SD V R √
D BOOL Y M S LM C T
⚫ Operand description The time data starting fromS1 and S2 need to comply with the 24-hour time
S1: Time comparison data 1, which format, otherwise,the system reports an operand error(eg: 24, 10, 31 and 13,
occupies the start three word units 59, 60 are illegal).
designated by S1. Data of these ⚫ Application instance
three units need to comply with the
24-hour time format, otherwise the
system reports an operand error. LD SM0
S2: Time comparison data 2, which MOV 20 D0
MOV 31 D1
occupies the start three word units
MOV 1 D2
designated by S2. Data of these
MOV 20 D10
three units need to comply with the MOV 30 D11
24-hour time format, otherwise the MOV 59 D12
system reports an operand error. LD X0
D: Comparison state output. When TCMP= D0 D10 M0
the data comply with the comparison TCMP< D0 D10 M1
TCMP> D0 D10 M2
condition, setting D to ON, otherwise,
TCMP<> D0 D10 M3
it is OFF.
TCMP>= D0 D10 M4
⚫ Function description TCMP<= D0 D10 M5
Conducting the BIN comparison on
the time data starting fromS1 and S2
respectively, and assigning the Conducting the BIN comparison on the time data starting from D0 and D10
comparisonresult to D. respectively, and assigning the comparison result to the destination data (M0,
⚫ Note etc.).
154
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description
S: Number of the soft element that stores the time data to be converted.
D: Number of the start soft elementthat stores the converted time data.
⚫ Function description
Converting the second data of S into hours, minutes, and seconds, and storing the obtained result in D, D+1, and D+2
respectively.
⚫ Note
⚫ Application instance
LD M1
STOH D0 D10
1. Converting the second data of D0 into the time data (hours, minutes, and seconds), and storing the obtained result in
three units starting from D10 when M1=ON.D10=0, D11=16, and D12=40 when D0=1000.
155
VC Series Micro-PLC Programming Manual Application instructions
156
VC Series Micro-PLC Programming Manual Application instructions
Consta
S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
S2 DINT C
D BOOL Y M S
⚫ Operand description instructions are not effective and therefore not executed.
S1: Data to be compared by the high- 4. The max. frequency supported by the high-speed counter of the PLCs. If
speed counter, 32-bit DINT data, you use the DHSCS, DHSCI, DHSCR, DHSZ, DHSP, or the DHST instruction,
ranging from -2147483648 to it is limited by the max. response frequency and comprehensive frequency.
+2147483647. For details, refer to Chapter 8"Operating guide for high-speed input function".
S2: High-speed counter. The ⚫ Function description
applicable range: C236–C263 1. A high-speed counter counts in interrupt mode only when it is driven by
D: Bit element output object, the HCNT instruction and the counting input changes from OFF to ON. When
immediately setting the output of Y, M, the value of the high-speed counter is equal to S1 in the DHSCS instruction,
and S regardless of the scan period. the bit element designated by D is set immediately, or in the case of a Y
element, the Y element is outputted immediately.
⚫ Note
2. This instruction can be used to immediately output the comparison result
1. The DHSCS instruction needs to
based on the comparison setting for the current value of the high-speed
work together with the HCNT
counter.
instruction. DHSCS can be executed
correctly only when the high-speed ⚫ Application instance
counter is driven by HCNT. LD M1
OUT SM236
2. The result compared by the
LD M0
DHSCS instruction takes effect when
HCNT C236 1000
external pulses of the high-speed LD M2
counter are inputted. Therefore, the DHSCS 2000 C236 Y10
DHSCS instruction does not LD C236
generate any action even if the high- OUT Y11
speed counter value is changed 1. When M1 is ON, C236 counts in the interrupt mode when X0 changes
through the DMOV or MOV from OFF to ON (for the input frequency of X0, refer to the instruction for
instruction. high-speed I/O). When C236 changes from 999 to 1000, the C236 contact is
3. Like general instructions, multiple set, and when C236 changes from 1001 to 1000, the C236 contact is reset.
DHSCS (DHSCI, DHSCR, DHSZ, When Y11 is driven by C236, the execution of Y11 is determined by the scan
DHSP, and DHST) instructions can cycle of the user program.
be used simultaneously, but the total 2. When M2 is ON and the DHSCS high-speed instruction meets the
number of these instructions cannot requirements stated in the preceding "Note", Y10 is outputted immediately if
exceed 8. The first 8 instructions are C236 reaches 2000, regardless of the scan cycle.
executed in order, and the 9th or later 3. When M0 is ON, SM236 is driven, and the C236 counter counts down.
When M0 is OFF, SM236 is not driven, and the C236 counter counts up.
6.10.3 DHSCI: Instruction for triggering interrupt based on comparison of high-speed count
⚫ Operand description
157
VC Series Micro-PLC Programming Manual Application instructions
S1: Data to be compared by the high- be used simultaneously, but the total number of these instructions cannot
speed counter, 32-bit DINT data, exceed 8.The first 8 instructions are executed in order, and the 9th or later
ranging from -2147483648 to instructions are not effective and therefore not executed.
+2147483647. 4. The max. frequency supported by the high-speed counter of the PLCs. If
S2: High-speed counter. The you use the DHSCS, DHSCI, DHSCR, DHSZ, DHSP, or the DHST instruction,
applicable range: C236–C263 it is limited by the max. response frequency and comprehensive frequency.
S3: Interrupt number. Range of the For details, refer to Chapter 8"Operating guide for high-speed input function".
interrupt number: 33-40 ⚫ Application instance
⚫ Function description The User main program is shown as below:
A high-speed counter can count in LD M1
interrupt mode only when it is driven OUT SM236
by the HCNT instruction and the LD M0
counting input changes from OFF to DHSCI 2000 C236 20
LD C236
ON. When the value of the high-
OUT Y11
speed counter is equal to S1 in the
DHSCS instruction, it enters into the The interrupt program whose user interrupt No. is 20 is shown as below:
interrupt subprogram designated by LD M10
S3. You can write a program to be OUT Y20
executed immediately in the interrupt LD>= D0 100
OUT Y12
subprogram.
MOV 0 D0
⚫ Note
1. When M1 is ON, C236 counts in the interrupt mode when X0 changes
1. The DHSCI instruction needs to
from OFF to ON (for the input frequency of X0, refer to the instruction for
worktogether with the HCNT
high-speed I/O). When C236 changes from 999 to 1000, the C236 contact is
instruction. DHSCI can be executed
set, and when C236 changes from 1001 to 1000, the C236 contact is reset.
correctly only when the high-speed
When Y11 is driven by C236, the execution of Y11 is determined by the scan
counter is driven by HCNT.
cycle of the user program.
2. The result compared by the DHSCI
2. When M2 is ON and the DHSCI high-speed instruction meets the
instruction takes effect when external
requirements stated in the preceding "Note", the interrupt subprogram whose
pulses of the high-speed counter are
interrupt No. is 20 responds immediately and executes the user program in
inputted. Therefore, the DHSCI
the interrupt program when C236 reaches 2000.
instruction does not generate any
3. When M1 is ON, SM236 is driven, and the C236 counter counts down.
action even if the high-speed counter
When M1 is OFF, SM236 is not driven, and the C236 counter counts up.
value is changed through the DMOV
4. Entering into the No.20 interrupt program when C236 has the pulse input
or MOV instruction.
and C236 is 2000. Driving Y20 when M10 is ON. But the output of Y20 is
3. Like general instructions, multiple
related to the scan cycle of the user program. Meanwhile, driving Y12 and
DHSCI (DHSCS, DHSCR, DHSZ,
clearing the data of D0 when D0 is detected to be larger than 100.
DHSP, and DHST) instructions can
158
VC Series Micro-PLC Programming Manual Application instructions
6.10.4 DHSPI: Triggering interrupt Instruction based on comparison of absolute high-speed output positions
159
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description external pulses of the high-speed counter are inputted. Therefore, the
S1: Data to be compared by the high- DHSCR instruction does not generate any action even if the high-speed
speed counter, 32-bit DINT data, counter value is changed through the DMOV or MOV instruction.
ranging from -2147483648 to 3. Like general instructions, multiple DHSCR (DHSCI, DHSCS, DHSZ, DHSP,
+2147483647. and DHST) instructions can be used simultaneously, but the total number of
S2: High-speed counter. The these instructions cannot exceed 8.The first 8 instructions are executed in
applicable range: C236–C263. order, and the 9th or later instructions are not effective and therefore not
executed.
D: Bit element output object,
4. The max. frequency supported by the high-speed counter of the PLCs. If
immediately resetting the output of Y,
you use the DHSCS, DHSCI, DHSCR, DHSZ, DHSP, or DHST instruction, it
M, S, and C regardless of the scan
is limited by the max. response frequency and comprehensive frequency. For
period. If D is a C element, it shall be
details, refer toChapter 8"Operating guide for high-speed input function".
S2.
⚫ Application instance
⚫ Function description
LD SM255
A high-speed counter can count in
OUT Y10
interrupt mode only when it is driven
LD M1
by the HCNT instruction and the HCNT C255 1000
counting input changes from OFF to LD C255
ON. When the value of the high- OUT Y20
speed counter is equal to S1 in the LD M2
DHSCR instruction, the bit element DHSCR 2000 C255 Y1
designated by D is reset immediately, 1. When M1 and X7 are both ON, C255 counts the phase difference of X3
or in the case of a Y element, the Y and X4 in the interrupt mode (for the input frequency of X0, refer to the
element is outputted immediately.2. instruction for high-speed I/O). When C255 changes from 999 to 1000, the
This instruction can be used to C255 contact is set, and when C255 changes from 1001 to 1000, the C255
immediately output the comparison contact is reset. When Y20 is driven by C255, the execution of Y20 is
result based on the comparison determined by the scan cycle of the user program.
setting for the current value of the 2. When M2 is ON and the DHSCR high-speed instruction meets the
high-speed counter. requirement stated in the preceding "Note", Y1 is outputted immediately if
⚫ Note C255 reaches 2000, regardless of the scan cycle.
1. The DHSCR instruction needs to 3. When the input pulse of X3 is ahead of the one of X4, SM255 is ON; when
work together with the HCNT the input pulse of X4 is ahead of the one of X3, SM255 is OFF.
instruction. DHSCR can be executed 4. When X7 (start signal of C255) is OFF, the C255 counter cannot count.
correctly only when the high-speed 5. When M1 and X7 are both ON, if X5 is ON, the C255 counter is cleared
counter is driven by HCNT. and the C255 auxiliary contact is also cleared.
2. The result compared by the
DHSCR instruction takes effect when
160
VC Series Micro-PLC Programming Manual Application instructions
161
VC Series Micro-PLC Programming Manual Application instructions
(1) C249<1500: Y10: ON; Y11, Y12: The outputs of Y10, Y11 and Y12 are not affected by the scan cycle.
OFF。 3. When M0 is ON, if X2 counts up from OFF to ON,SM249 is reset. If X3
(2) 2000≥C249≥1500: Y10, Y12: counts down from OFF to ON, SM249 is set.
OFF; Y11: ON。
(3) C249>2000: Y10, Y11: OFF; Y12:
ON。
⚫ Application instance
The table data is shown as below:
Comparison data
Output Y number Set/Reset Operation process
MSB LSB
162
VC Series Micro-PLC Programming Manual Application instructions
D100=0 D101=100 D102=0 D103=1 1↓
D104=0 D105=200 D106=1 D107=0 2↓
D108=0 D109=300 D110=2 D111=1 3↓
4↓
D112=0 D113=300 D114=3 D115=1
Return to 1
The LAD is shown as below:
LD SM1
DMOV 100 D100
MOV 0 D102
MOV 1 D103
DMOV 200 D104
MOV 1 D106
MOV 0 D107
DMOV 300 D108
MOV 2 D110
MOV 1 D111
DMOV 100 D112
MOV 3 D114
MOV 1 D115
LD M0
HCNT C244 1000
LD M1
DHST D100 4 C244
LD M2
OUT SM244
LD C244
OUT Y10
1. Assigning the initial value to D100–D115, and generating the table to be compared in the first scan cycle of the user
program.
2. When M0 is ON, C244 counts when X0 changes from OFF to ON (for the input frequency of X0, refer to the instruction
for high-speed I/O). When C244 changes from 999 to 1000, the C244 is set and when C244 changes from 1001 to 1000,
the C244 is reset. When Y10 is driven by C244, the execution of Y10 is determined by the scan cycle of the user program.
3. When M1 is ON and the DHST high-speed instruction meets the requirements stated in the preceding "Note", the DHST
high-speed instructionstarts from No.1 record of the table and enters the comparison of No.2 record only after No. 1 record
is completed. The comparison of the next record can be entered onlyafter the previous instruction is completed. When the
comparison of the last record is completed, it returns to the comparison of the first record again and sets SM83. SD90
indicates the record No. to be compared currently while SD88 and SD89 indicate the data to be compared currently. The
comparison result is outputted immediately, regardless of the scan cycle.
4. When M2 is ON, SM244 is ON, and C244 counts down. If M2 is OFF, SM244 is OFF, and C244 counts up.
163
VC Series Micro-PLC Programming Manual Application instructions
6.10.8 DHSP: Instruction for pulse output based on high-speed count table comparison
⚫ Application instance
Table data is shown as below:
Comparison data Data outputted to SD86 and SD87 Operation process
164
VC Series Micro-PLC Programming Manual Application instructions
MSB LSB MSB LSB
D100=0 D101=100 D102=0 D103=1 1↓
D104=0 D105=200 D106=0 D107=2 2↓
D108=0 D109=300 D110=0 D111=3 3↓
4↓
D112=0 D113=100 D114=0 D115=4 Return from 1
LD SM1
DMOV 100 D100
MOV 0 D102
MOV 1 D103
DMOV 200 D104
MOV 0 D106
MOV 2 D107
DMOV 300 D108
MOV 0 D110
MOV 3 D111
DMOV 100 D112
MOV 0 D114
MOV 4 D115
LD M0
HCNT C244 1000
LD M1
DHSP D100 4 C244
LD M2
OUT SM244
LD C244
OUT Y10
LD M3
PLSY SD86 0 Y0
1. Assigning the initial value to D100–D115, and generating the table to be compared in the first scan cycle of the user
program.
2. When M0 is ON, C244 counts when X0 changes from OFF to ON (for the input frequency of X0, refer to the instruction
for high-speed I/O). When C244 changes from 999 to 1000, the C244 is set and when C244 changes from 1001 to 1000,
the C244 is reset. When Y10 is driven by C244, the execution of Y10 is determined by the scan cycle of the user program.
3. When M1 is ON and the DHSP high-speed instruction meets the requirements stated in the preceding "Note", the DHSP
high-speed instructionstarts from the record No.1 of the table and enters the comparison of No.2 record only after No. 1
record is completed. The comparison of the next record can be entered onlyafter the previous instruction is completed. When
the comparison of last record is completed, it returns to the comparison of first record again and sets SM83. SD90 indicates
the record No. to be compared currently while SD88 and SD89 indicate the data to be compared currently. The comparison
result is outputted immediately, regardless of the scan cycle. The output operands obtained after the comparison are put into
SD86 and SD87, which is not affected by the scan cycle. If you want to stop at the last row in the comparison table, you
need to set the data sent to SD86 and SD87 by the final table to 0.
4. When M2 is ON, SM244 is ON, and C244 counts down. If M2 is OFF, SM244 is OFF, and C244 counts up.
165
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description M0
S1: Input point. Settable range: X0–X7
X0
S2: Time unit for input point detection. Unit: ms. Operand
S2>0
D: Pulse detection data storage unit. When the count D11: Current value
D10: Measured
value
value exceeds 65535, an automatic overflow is
performed.
⚫ Function description 1000 ms 1000 ms
N (fpn)
Proximity switch
LD SM0
n Pulse/round
PLSY 10000 0 Y0
LD M0 1. Counting the input pulse designated by X0 within
1000ms, and storing the count result to the storage unit
SPD X0 1000 D10
of D10 when M0 is ON, in which D11 is the current count
The time sequence operation of program is shown as
value within 1000ms, and D12 is the elapsed time within
below:
1000ms.
2. Data of D10 is proportional to the rotation speed in the
above diagram.
3. Counting whenever X0 changes from OFF to ON, and
storing the counting values in D10 at every 1000ms.
166
VC Series Micro-PLC Programming Manual Application instructions
Load
resistance
PLC LD M1
External power supply PLSY 1000 10000 Y1
PLSY 1000 10000 Y0
100 mA
4. With the large load current, the OFF time of the transistoris
relatively long. When executing the PWM, PLSY and PLSR
167
VC Series Micro-PLC Programming Manual Application instructions
Pulses
3. SM270 is used to control the output of Y0 while
Y0 SM290 is used to control the output of Y1, and
Frequency (1000) when SM290 is 1, the output pulse of Y1 is
disabled.
Pulses
Y1
4. SM271 and SM291 indicate the output flags of
Frequency (1000) Y0 and Y1 respectively. The flag is cleared when
the output is completed or M0 is OFF.
1. When M1 is ON, 10000 pulses are output through Y0 and Y1 5. SD160 indicates the MSB of the number of the
ports at the frequency of 1000 Hz. and pulse output is stopped Y0 output pulses in PLSY and PLSR instructions.
after 10000 pulses are outputted. When M1 changes from OFF
SD161 indicates the LSB of the number of the Y0
to ON, the next round of output starts. When M1 is OFF, the port
output pulses in PLSY and PLSR instructions.
output is OFF.
SD180 indicates the MSB of the number of the Y1
2. The duty cycle of the pulse is 50% ON, and 50% OFF. The
output pulses in PLSY and PLSR instructions.
output control is not affected by the scan cycle and is handled
SD181 indicates the LSB of the number of the Y1
by the interrupts. At the high frequency output, the output duty
output pulses in PLSY and PLSR instructions.
cycle at the Y ports is related to the load. The waveforms
6. SD160–SD180 can be modified through
obtained from the output terminals are related to the user's
output load. When the load cannot exceed the rated load "DMOV ××× SD160"or"MOV ×××
current, the smaller the load, the closer the output waveform is SD180", or through the monitoring.
to the set operand. 7. If you want to use the number of input pulses to
control the output pulse frequency of PLSY, refer
to the DHSP instruction for details
169
VC Series Micro-PLC Programming Manual Application instructions
The operation process is shown in the following figure:
⚫ Note
1. The output frequency of this instruction is 10–20000Hz. If the pulses are outputted. When M0 changes from
speed variation during acceleration/deceleration exceeds this OFF to ON, the next round of pulse output starts.
range, the operand is adjusted automatically within the range. When M0 is OFF, the port output is OFF.
This instruction is not affected by the scan cycle. 2. All operandsare not changed during the
2. The PLCs need to use the transistor output. During the high- execution of the instruction, they are processed
speed pulse output, the output transistor is connected according according to the operand which is valid first. The
to the specified load current. The waveforms obtained from the new operand becomes valid only when M0
output terminals are related to the user's output load. When changes from ON→OFF→ON.
the load cannot exceed the rated load current, the smaller the 3. SM270 is used to control the output of Y0 while
load, the closer the output waveform is to the set operand. SM290 is used to control the output of Y1, and
3. Whenthe high-speed instruction is executed effectively when SM270 or SM290 is 1, output pulses
(including output completion), other operations on the same corresponding to the output points are disabled.
portare invalid. Only when the high-speed pulse output 4. SM271 and SM291 indicate the output flags of
instruction is invalid can other instructions operate this port. Y0 and Y1 respectively. The corresponding
4. Usingtwo PLSR instructions can obtain separate high-speed SM271 or SM291 is OFF when the output is
pulse output at output points, or using the PWM (or PLSR) completed or M0 is OFF. The corresponding
instruction to obtain separate high-speed pulse output at SM271 or SM291 is ON when the output is going
different output points. on.
5. When multiple PWM, PLSY or PLSR instructions operate on 5. SD160–SD180 correspond to:
the same port, the first valid instruction controls the output state 1) SD160: The MSB of the number of the Y0
of the portand the later valid instructions do not affect the state output pulses in PLSY and PLSR
of the output points. instructions.
6. Similar to other high-speed instructions (DHSCS, 2) SD161: The LSB of the number of the Y0
DHSCR,DHSZ, DHSP, DHST, and HCNT), the PLSR instruction output pulses in PLSY and PLSR
needs to meet the requirements for high-speed input and high- instructions.
speed pulse output in the system.
3) SD180: The MSB of the number of the Y1
⚫ Application instance output pulses in PLSY and PLSR
instructions.
4) SD181: The LSB of the number of the Y1
output pulses in PLSY and PLSR
LD M0 instructions.
PLSR 10 110 1000 Y1 6. SD160–SD180 can be modified through
PLSR 10 110 1000 Y0 "DMOV ××× SD160"or"MOV ×××
1. When M0 is ON, pulses are output through Y0 and Y1 ports SD180", or through the monitoring.
at the set frequency, and pulse output is stopped after 110
170
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description
S1: Start address of D element designated by the DMOV Max. speed Dn+4M
parameter MOV Min. speed Dn+4M+2
S2: Number of the output segments. Range: 0–255.
MOV Acc eleration time Dn+4M+3
D1: High-speed pulse output point.
MOV Deceleration time Dn+4M+4
⚫ Function description
⚫ Note
1. Using the Auto Studio instruction wizard to generate
1. It is recommended to use the PLS instruction
the PLS instruction, which can be called like
generated by the PTO instruction wizard. If you write
subprograms. When the energy flow is turned on, the
the PLS instruction manually, note that the number of
system outputsthe corresponding pulses according to
pulses in each procedure cannot be too small. At the set
the configuration. You can control ON or OFF of the
acceleration speed, the number of pulses in each
pulse generator and set the frequency and pulse number.
procedure must be larger than the min. number of pulses
2. There is no output when the segment number is 0.
required for the frequency conversion.
3. High-speed pulse output can be turned off by setting
2. P indicates the number of pulses in a certain
SM270,SM290 and SM310 to ON, and other flag bits are
procedure, FN indicates the frequency of the N segment,
shared with high-speed outputs.
Fmax and Fmin indicate the max. speed and min. speed,
4. The contents of the subprogram PLS_SET generated
by the Auto Studio software are as follows (set n as its D and Tup and Tdown indicate the acceleration and
element number and M as the total number of the deceleration time in ms.
segments): 1) When the speed of the procedure N is larger than
LD SM0 that of procedure N-1, the number of the pulses in
DMOV Frequency of the first segment procedure the procedure N need to meet the following
Dn conditions:
DMOV Pulse number of the first segment ( FN + FN −1 ) ( FN − FN −1 ) Tup
P
procedure Dn+2 2000 ( Fmax − Fmin )
DMOV Frequency of the second segment 2) When the speed of procedure N is less than that
procedure Dn+4 of procedure N-1, the number of the pulses in the
DMOV Pulse number of the second segment procedure N need to meet the following conditions:
( FN + FN −1 ) ( FN − FN −1 ) Tdown
procedure Dn+6 P
2000 ( Fmax − Fmin )
DMOV Frequency of the third segment procedure
3. In particular:
Dn+8
1) When N=1, the frequency of the procedure N-1
DMOV Pulse number of the third segment
procedure Dn+10 takes Fmin , and then Fmin is put into the above
formula.
………
2) When the number of procedures is 1, namely
DMOV Frequency of the M segment procedure Dn
there is only one segment, the number of the pulses
+4M-4
needs to meet the following condition:
DMOV Pulse number of the M segment procedure
Dn+4M-2
171
VC Series Micro-PLC Programming Manual Application instructions
( F1 + Fmin ) ( F1 − Fmin ) (Tup + Tdown ) to the user's output load. When the load cannot exceed
P
2000 ( Fmax − Fmin ) the rated load current, the smaller the load, the closer the
output waveform is to the set operand.
3) The number of the pulses in the last procedure
needs tomeet the following formula: 5. When the high-speed instruction is executed
( FM + FM −1 ) ( FM − FM −1 ) (Tup + Tdown ) effectively (including output completion), other
P operations on the same portare invalid. Only when the
2000 ( Fmax − Fmin )
high-speed pulse output instruction is invalid can other
4) The frequency designated in each procedure
instructions operate this port.
needs to be within the setting range of the max. or
min.speed. 6. PLSY, PLSR, PLS, and positioning instructions can
output the high-speed pulses through ports. It is not
4. The PLCs need to use the transistor output. During the
allowed to use these instructions for high-speed pulse
high-speed pulse output, the output transistor is
output on the same port at the same time.
connected according to the specified load current. The
waveforms obtained from the output terminalsare related
1. When S1 is 0, the high-speed output port output is always OFF. 6. Similar to other high-speed instructions
When S1=S2, the high-speed output port output is always ON. (DHSCS, DHSCR,DHSZ, DHSP, DHST, and
172
VC Series Micro-PLC Programming Manual Application instructions
HCNT), the PWM instruction needs to meet the requirements for Where "t" is pulse width and T0 is pulse cycle.
high-speed I/O in the system. 1. When M0 is ON, Y0 and Y1 output the PWM
⚫ Application instance pulseswith the width of 40ms and the cycle of
200 ms. When M0 is OFF, theoutput is OFF.
The output state is not affected by the scan
cycle.
LD M0 2. SM270 is used to disable the output of Y0,
PWM 40 200 Y0 while SM290 is used to disable the output of Y1.
When SM270 and SM290 are ON, the output is
PWM 40 200 Y1
stopped.
t
Control t/TO 3. SM271 and SM291 indicate the output flag
Y0
instruction in
the left figure
of Y0 and Y1 respectively. When M0 is OFF,
To SM271 and SM291 are OFF.
t
Control t/TO
instruction in
Y1
the left figure
To
173
VC Series Micro-PLC Programming Manual Application instructions
S3+18
6. Action direction: Setting the forward (positive feedback) and reverse Lower limit
No output
With output limit
actions (adverse feedback) of the system via bit 0 of S3+1. Time
EV n = PVnf − 1 − SV
Positive
action Dn =
TD
(PVnf + PVnf − 2 − 2 PVnf − 1) + αD TD Dn − 1
TS+ αD TD TS+ αD TD
MVn = ΔMV
EV n = SV − PVnf − 1
Reverse
action Dn =
TD
(2 PVnf − 1 − PVn f − PVnf − 2 ) + αD TD Dn − 1
TS+ αD TD TS+ αD TD
MV n = ΔMV
⚫ Application instance
// PID initialization, if the control operands are the same, you can initialize the operands only once.
LD SM1 //Initialization, executed once only
MOV 1000 D500 //Setting the target value
175
VC Series Micro-PLC Programming Manual Application instructions
MOV 500 D510 //Sampling time (Ts). Range: 1–32767 (ms). It needs to be larger than the
//calculation time
MOV 7 D511 //Action direction
MOV 70 D512 //Input filtering constant (α). Range: 0–99[﹪]. When it is 0, there is no input filtering
MOV 100 D513 //Proportional gain (Kp). Range: 1–32767[﹪]
MOV 25 D514 //Integral time (TI). Range: 0–32767 (×100ms). When it is 0, it is processed as
//∞ (no integral)
MOV 0 D515 //Differential gain (KD). Range: 0–100[﹪]. When it is 0, there is no differential gain
MOV 63 D516 //Differential time (TD). Range: 0–32767 (×10 ms). When it is 0, it means no differential
//processing
FMOV 0 D517 8 //Clearing the area for storing the transit data of PID operation
MOV 2000 D525 //Alarm set value of the input variation (positive change). Range: 0–32767
MOV 2000 D526 //Alarm set value of the input variation (negative change). Range:0–32767
MOV 2000 D527 //Alarm set value of the output variation (positive change). Range: 0–32767
MOV 2000 D528 //Alarm set value of the output variation (negative change). Range:0–32767
//PID instruction execution operation
LD M0 //User-controlled PID operation program
PID D500 D501 D510 D502 //PID instruction: PID S1 S2 S3
The LAD of the above instruction is shown below: 1. For D, you need to designate it into the data register
outside of the Saving Range. Otherwise, it needs tobe
cleared (LD SM0 MOV 0 D**** ) in the first operation.
2. The PID instruction needs to occupy 20 consecutive
data registers starting from S3.
3. The max. error of sampling time TS is - (one
scancycle+1ms)–+ (one scan cycle). When the value
of TSis relatively small, the PID effect is affected. It is
recommended to use the PID instruction in timed
interrupt.
4. When you set the PID output upper/lower limit to be
valid, if the value of upper limit is less than that of the
lower limit, the system reports an operand error, and
does not execute the PID operation.
5. When you set the alarm of I/O variation to be valid, the
set value of S3 + 15 – S3 + 18 cannot be negative,
otherwise the system reports an operand error, and does
not execute the PID operation.
6. When bit 2 and bit 5 of S3+1 are set to ON, the system
determines that the setting is invalid (it is equivalent of
that bit 2 and bit 5 are set to OFF), and therefore does
not report alarms for upper limit, lower limit, or variation
The PLCs initialize the PID operands only in the first scan exceeding.
cycle. When M0 is ON, the current measured value is 7. When the set value of the PID control operand (S3–
read from the external A/D modules (the actual situation S3+6 unit) is outside the valid range, the system reports
could be different), assigned to the measurement value an operand error, and does not execute the PID
unit D501, and the PID operation is executed. The operation.
operation result is converted into analog signals through
8. When the sampling time is less than or equal to one
the external D/A modules (the actual situation could be
scan cycle, if there is data overflow or result overflow
different), and fed to the controlled system.
during the operation, no alarm occurs, and the PID
⚫ Note operation continues.
9. All PID operands need to be initialized before the initial
execution of the PID instruction. If the operands remain
176
VC Series Micro-PLC Programming Manual Application instructions
the same during the operation, and the related operand transit data registers are changed during the PID
elements are not covered by other programs, you can operation, the operation result is incorrect.
initialize the PID operands only once. If the data in the
177
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description
S1: Startvalue
D1
S2: End value
D1: Output value
S3: Number of steps (S3 > 0, otherwise the system
D2
reports an operand error, and does not execute the
operation)
D2: Output state 0
SM15
⚫ Function description
When a rising edge occurred to the energy flow and S3
178
VC Series Micro-PLC Programming Manual Application instructions
D10=D1=2000, D10 keeps unchanged, and
M0=ON.During the generation process of the ramp
function, if the energy flow falls, the output state D2 is
OFF, the output value D1 keeps its current state until the
next rising edge arrives, D10=D0, and a new ramp
1. When X0=ON, D10 (in the first cycle,D10=D0=0) process starts.
increases by 2 (2000/1000) in each scan cycle. When 2. You can use an external special module to convert the
data into the analog waveform.
⚫ Operand description
S1: Startvalue pf
⚫ Note
1. If the result is not divisible when calculating the step
length, you can adopt the "rounding-off" method.
179
VC Series Micro-PLC Programming Manual Application instructions
2. The instruction generates a series of consecutive sawtooth TO 0 1 D10 1
wave data as long as the energy flow is valid. The LAD of the above instructions is shown as follows.
3. When S1=S2, D1=S2, and D2=ON (no counting pulse).
4. The total number of RAMP, HACKLE, and TRIANGLE
instructions cannot exceed 100 in the program.
⚫ Application instance
//Initializing the register upon the first scan cycle after the
power-on
1. When X0=ON, D10 (in the first cycle,D10=D0=0)
LD SM1
increases by 2 (2000/1000) in each scan cycle. When
MOV 0 D0 D10=D1=2000, M0=ON. In the next scan cycle, if X0
MOV 2000 D1 keeps ON, D10=D0=0, and M0=OFF, the next sawtooth
//Executing the sawtooth wave function instruction when wave process starts. If the energy flow falls during the
X0=ON operation, the output state D2 is OFF, the output value
LD X0 D1 keeps its current state until the next rising edge
HACKLE D0 D1 D10 1000 M0 arrives, the output value D1 is initializedas S1, and a new
//Sending the output value of ramp function to the external DA sawtooth wave process starts.
module when X1=ON, so as to generate sawtooth waveforms 2. You can use an external special module to convert the
LD X1 data into the analog waveform.
⚫ Operand description the state output bit (D2) is set to ON. In the next scan cycle,
S1: Startvalue if the energy flow keeps ON, the state output bit (D2) is set
S2: End value to OFF, and the next triangle wave is generated. During the
generation process of triangle wave function, if afalling
D1: Output value
edge occurs to the energy flow, the output state (D2) is OFF
S3: Number of steps (S3>0, otherwise the system reports
and the output value (D1)remains in the current state. When
an operand error, and does not execute the operation) a rising edge occurs to the energy flow again, the output
D2: Output state value (D1) is initialized to S1 and a new triangle wave
⚫ Function description generation process starts, as shown below.
When theenergy flow is valid, the increment and current
output value (D1) are determined for each scan cycle pf
according to the height and steps of the triangle wave (D1). S2
When the output value reaches S2, the first half slope of
S1
triangle wave has been completed, and the increment D1
direction of the output valueis changed to continue the last
half slope. When the output value (D1) reaches S1 again, D2
180
VC Series Micro-PLC Programming Manual Application instructions
pf: state of the energy flow MOV 2000 D1
The execution process of a triangle wave instruction is //Executing the triangle wave function instruction when
shown as follows (S3=5). X0=ON
LD X0
TRIANGLE D0 D1 D10 1000 M0
D1
//Sending the output value of ramp function to the external
DA module when X1=ON, so as to generate the triangle
waveform
D2
LD X1
TO 0 1 D10 1
SM15
The LAD of the above instructions is shown below:
(S3 -1)*2
⚫ Note
1. If the result is not divisible when calculating the step
length, you can adopt the "rounding-off" method.
1. When X0=ON, D10 (in the first cycle,D10=D0=0)
2. The instruction generates a series of consecutive triangle
increases by 2 (2000/1000) in each scan cycle.When
wave data as long as the energy flow is valid.
D10=D1=2000, half triangle wave is completed, and D10
3. When S1=S2, D1=S2, and D2=ON (no counting pulse). decreases by 2 in each scan cycle that follows. When
4. The cycle of the triangle wave is (S3-1) ×2. D10=D0=0, a complete triangle wave is completed, and
5. The total number of RAMP, HACKLE, and TRIANGLE M0=ON. In the next scan cycle, if X0 keeps ON, and
instructions cannot exceed 100 in the program. M0=OFF, the next triangle wave process starts. If the
⚫ Application instance energy flow falls, the output state D2 is OFF, the output
//Initializing the register upon the first scan cycle after the value D1 is initialized as S1, and a new triangle wave
power-on process starts.
Applicable
VC2 VC3 VC5
LAD: model
ABSD (S1) (S2) (D) (S3) Influenced flag
Zero flag, carry flag, and borrow flag
bit
3. Firstly writing the data shown below into S1–S1+2n ⚫ Application instance
+1: Outputting ON/OFF by rotating the platform once (0–
Value 360 degrees, rotation angle signal that indicates 1
Rising Value Falling
exampl Output degree per pulse).
point example point
e
S1 40 S1+1 140 D
S1+2 100 S1+3 200 D+1
S1+4 160 S1+5 60 D+2
S1+6 240 S1+7 280 D+3
… … … Among them, M0 is the energy flow input, and X1 is a
… …
S1+2n S1+2n+1 D+n-1 rotation angle signal indicating 1 degree per pulse.
4. After the instruction input is ON, the n point starting ⚫ Note
from D also changes as follows. 1. When the bit number of the bit soft elements is
40 140 designated in S1, k=4.
D
2. When the counter number is designated in S2, C0–
100 140 C199 need to be designated for S2.
D+1
3. This instruction is affected by the scan cycle.
60 160
D+2
240 280
D+3
0 180 360
182
VC Series Micro-PLC Programming Manual Application instructions
Applicable
VC2 VC3 VC5
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
⚫ Operand description 4. After instruction input is ON, the n point starting with D
S1: Start element number of storing the table data (rising will also change as below shows.
edge, and falling edge). n=8. 40 140
D
S2: Number of the counter used for monitoring the
current value compared with the table data. Range: 100 140
D+1
C200–C255, and C256–C263.
60 160
D: Outputting the number of the start bit element. D+2
S3: Number ofrows in the table and number of points of 240 280
the outputted bit elements. Range: 1≤S3≤64. D+3
183
VC Series Micro-PLC Programming Manual Application instructions
Applicable
VC2 VC3 VC5
LAD: model
ALT (D) Influenced flag
Zero flag, carry flag, and borrow flag
bit
⚫ Operand description
D: Alternately outputted element Energy flow input ON ON ON
address
⚫ Function description D ON ON
When the energy flow is valid, soft ⚫ Application instance
elementsin each scan cycle act
reversely, which is shown as below.
⚫ Operand description
S1: Designated communication channel checksum are not stored. In the transmission process, the
S2: Start address of data to be transmitted required start character, end character, and check bit are
S3: Start address for storing the received data automatically added to the data.
⚫ Function description 2. You do not need to set the length for the data to be
1. When being as a master station, and the input conditions transmitted. The system automatically transmits the data
are met, the system transmits the data stored in the address according to the internally specified length based on the
unit starting from S2, receives data, and stores it to the instruction, as shown below:
address unit starting from S3. Slave address
S2
2. When being a slave station, the system needs no
S2+1 Function code
instruction for receiving and transmitting data.
S2+2 Data 1
3. This instruction is executed upon the rising edge.
⚫ Note ... ...
1. Data is transmitted through Modbus. Whether you set the S2+N+1 Data N
184
VC Series Micro-PLC Programming Manual Application instructions
RTUformat. That is, when you set the mode to ASCII, the 1. Storing the data sent through the Modbus instruction into
system automaticallyconvertsthe data to the hex format, the element starting from D0.
removes the startand end characters, and saves them in 2. Storing the received data in the elements starting from
thedata area starting from S3. D100.
4. The sent and received data are stored in LSB of the word 3. After receiving the data through Modbus, the system
element, and MSB are not used. conducts CRC check, address check, and function code
⚫ Application instance check. If there is any error, the error flag (SM136) is set, and
the error details are recorded in the special register SD139.
4. Serial idle flags of SM114 and SM124 can also be used
in Modbus to indicate the communication state of Modbus.
Modbus communication error code tableis shown as follows.
Abnormal
Meaning of abnormal code
code
0x01 Illegal function code
0x02 Illegal register address
0x03 Wrong number of data
LD SM1 Communication timeout. The communication
0x10
time exceeds the preset communication time limit
MOV 3 D0
0x11 Error in receiving data frame
MOV 1 D1 Operand error, operand (mode ormaster/slave)
0x12
MOV 0 D2 setting error
MOV 10 D3 0x13
Error occurs when the local station number is the
same as the one set by the instruction.
MOV 5 D4
For details about the application instance,refer to Chapter
AND SM124
10"Communication function guide".
Modbus 1 D0 D100
185
VC Series Micro-PLC Programming Manual Application instructions
MOV 16#1 D3
MOV 16#2 D4
RST SM122
XMT 1 D0 5
LD SM122
INC D100
,
The routine is to send one data frame at 10s interval.
The following data are sent through the serial port 1:
01 00 01 01 02
1. First, setting port 1 in the system block as the free port,
and setting the baud rate, parity check, data bit, and stop
bit.
2. Writing the data to be sent into the transmission buffer
LD SM0 area. For VC2, only low bytes of the word element are
TON T0 100 sent.
LD T0 3. Clearing the transmission completion flag (SM122)
RST T0 before sending the data.
MOV 16# 1 D0 4. Setting the transmission completion flag
MOV 16#0 D1 (SM122)when the transmission is done.
MOV 16#1 D2
186
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description receiving is over, and reset when the current receiving is
S1: Designated communication channel. For VC1S, the terminated.
value range is 1 and 2. SM113 (SM123): Receiving the completion flag. When
D: Start address for storing the received data receiving is done, the receiving completion flag is set.
S2: Max. number of received bytes SM114 (SM124): Idle flag. this flag is set when there is
⚫ Function description no communication task on the serial port, and it can be
When the energy flow is turned on and the used as the check bit for the communication.
communication conditions are met, the data are received SD111 (SD121): Start character which can be set in the
through the designated channel and address. system block.
⚫ Note SD112 (SD122): End character which can be set in the
1. Size of the communication frame: The end character system block.
of the frame received cannot exceed D7999 or SD113 (SD123): Inter-character timeout time, namely the
V63,depending on the selected element type (D or V). max. interval between receiving two characters, which
2. In the case of a shutdown, the receiving is stopped. can be set in the system block.
SD114 (SD124): Frame time-out time, namely the time
3. The value range of S1: 0, 1, and 2.
from when the energy flow is conducted to the time when
⚫ Application instance
the receiving ends, which can be set in the system block.
SD115 (SD125): Receiving completion information code.
The definitionsof the data bits are shown below:
Flag
Reserv
LD SM1 for
Flag ed (You
RCV 1 D20 5 Flag receivi (Frame
for Inter- do not
for ng the ) Parity
LD SM123 receivi charact need to
ending maxim receivi check
INC D100 ng the er take
user um ng error
specifi timeout them
1. When the energy flow is conducted, the RCV receivi numbe timeout flag
ed end flag into
instruction is valid continuously. If you want to receive the ng r of flag
word conside
data only once, you can use a rising edge or a special charact
ration.)
ers
register that is valid only once, such as SM1, as the
Bit 6–
energy flow input. Bit 0 Bit 1 Bit 2 Bit 3 Bit 4 Bit 5
15
2. For details about the application instance, refer to
SD116 (SD126): The characters currently received
Chapter 10"Communication function guide".
SD117 (SD127): Total number of the characters currently
⚫ Special registers
received.
SM111 (SM121):Receiving the enable flag. This bit is set
when the RCV instruction is used, cleared after the
Applicable
VC1S VC1 VC2 VC3 VC5
LAD: model
MODRW (S1)(S2)(S3)(S4)(S5)(D) Influenced
flag bit
IL: MODRW (S1) (S2) (S3) (S4) (S5) (D) Step length 14
Operan Indexin
Type Applicable soft element
d g
Consta
S1 INT
nt
Consta
S2 INT D V R √
nt
Consta
S3 INT D V R √
nt
Consta
S4 INT D V R √
nt
Consta
S5 INT D V R √
nt
D INT D R √
187
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description The number of the word and bit elements cannot exceed
S1:Designated communication channel, For VC1, the 16 respectively, and all the bit elements are stored as one
value range is 0, 1, and 2 word.
S2: Address (Setting range of the slaveaddress: 1–247, D1: Storage address of to-be-read/written elements. For
and the broadcast address is applicable to the write details about the number of elements required by VC1,
element). refer to the above table.
S3: Function code. VC1S/1L supports 01 (read coil), 02 ⚫ Function description
(read discrete input), 03 (read register), 04 (read input Sending the message and receiving the returned data
register), 05 (write single coil), 06 (write single register), when the energy flow is valid.
15 (write multiple coils) , 16 (write multiple registers) ⚫ Note
VC2/3/5 support 01 (read coil), 03 (read register), 15 1. The number of elements cannot exceed 16.
(write multiple coils), and 16 (write multiple registers). 2. Reading a maximum of 16 bit elements. The bit
S4: Start address of to-be-read/written inverter elements. elements with small addresses are stored in LSB, and
S5: Number of to-be-read/written elements. Number of one byte stores 16 bits.
to-be-read/written elements of VC1S/1L is limited by the 3. The returned abnormal code is the same as the
max frame length (256) of RTU, as shown below. Modbus instruction.
Number Number ⚫ Application instance
Functio
Name of ofrequired D * The following application instance is currently only valid
n code
elements elements
for the VC1 series PLCs.
01 Read coils 1–2000 (S5+15)/16
1. Standard polling
Read discrete
02 1–2000 (S5+15)/16 This instance is a simple polling instance, sets M0, M1,
input
03 Read registers 1–125 S5 and M2, and three MODRW instruction access the
Read input device in turn according to the settings.
04 1–125 S5
registers At runtime, if any one of M elements is reset, its
Write single corresponding MODRW instruction exits polling, but
05 0(fixed) 1
coil other MODRWs are still executed in polling mode. For
Write single instance, if M2 is reset, then the MODRW instructions
06 0(fixed) 1
register
corresponding to M0 and M1 access the device in turn.
Write multiple
15
coils
1–1968 (S5+15)/16 Similarly, it is viable to insert one MODRW instruction
Write multiple during running. For instance, if M2 is set again, thenthree
16 1–123 S5
registers MODRW instructions access the device in turn.
*The value of 05, 06 and S5 must be 0
188
VC Series Micro-PLC Programming Manual Application instructions
17 Reserved
Parameter (mode or
Parameter setting
18 master/slave) setting
error
error
The station no. is the
Parameter S2 error,
same with the one set
namely slave
19 by the instruction, or
address parameter
address overlimit error
error
occurs
Element address
overflows (The amount
Parameter D error,
of the received or
20 namely element
transmitted data
address overflow
exceeds the storage
space of the element)
Instruction
21
execution failed
The received slave
address does not match
Address does not the requested slave
22
match address, and error code
element stores the
received slave address
The received function
code does not match
Function code does the requested function
23
not match code, and the error
code element stores the
received function code
Info frame error: it
means element starting
address does not
24 Info frame error match, the error code
element stores the
received element start
address
The received data
length does not comply
with protocol or the
Data length does
25 element number
not match
exceed the max limit
specified by this
function code
CRC/LRC check
26
error
27 Reserved
When an error occursin the MODRW instruction,SM126 is Parameter S3 error, Setting error in the start
set, SD133 indicate its error codes.The values of SM126, namely parameter address of the
28
SD133 can be changed by other MODRW instructions, so error of the element instruction parameter
their state need to be recorded before the next MODRW address element
Parameter S4 error, Instruction parameters
instruction is executed.
namely parameter set unsupported
MODRW instruction error code is listed as below: 29
error of the function function codes or illegal
Code Error name Detailed description codes function codes
1 Illegal function code Parameter S5 error,
Setting error in the
2 Illegal address namely setting error
30 instruction parameter
3 Illegal data in the number of the
elements
4-15 Reserved elements
The communication 31 Reserved
Communication time exceeds the max. The parameter is The parameter is non-
16 32
timeout communication time set non-modifiable modifiable
by the user
189
VC Series Micro-PLC Programming Manual Application instructions
The parameter is non- T3
The parameter is
modifiable during T2 = ( INT ( ) + 1))Ts
33 non-modifiable Ts
running (only EV3000
during running
support) In which, Ts is the max. scan cycle of the PLC.
Parameter is The parameter is
34 protected by a protected by a T3 = T4 + T5 + T6 + T7 + T8 + T9
password password
T4 , T8 and T9 require less than 1 ms time.
2. Link time ,
Number of bytes to be sent Character length
You can use the following LAD to realize a communication T5 = 1000 (ms) + 1ms
Baud rate (bps)
between a Modbus master and slave stations. For a
complete communication, the required time for each stage T6 : The waiting time of the master station depends on the
is shown below: slave station, which cannot exceed the timeout timeof the
preset master mode.
Number of bytes to be received Character length
T7 = 1000 (ms) +1ms
Baud rate (bps)
M0
T12 requires less than 1 ms time
SM30 For instance: Setting the communication specification as
SM135 19200, even parity, 8-bit data bit, 1-bit stop bit, RTU
T1 T2
Interfr
ame
transmission mode, 10 characters to be sent, and 20
characters to be received. Then the processing time of the
space Execut
e the
instruct
ion Send
data
20 10
tion
instruc
T3
T7 = 1000+1 = 11.4ms
tions Execute the
next
T4 T5 T6 T7 T8 T9 Modbus
instruction
19200
T4 = T8 = T9 1ms
Receiv
e data Other
Suppose T6 = 35 ms , then
treatm
ents Process
slave
station
Send
T11 T12 data
T10
T3 = 1 + 6.2 + 35 + 11 .4 + 1 + 1 = 55 .6ms
Suppose the max. scan cycle is 10 ms
Tm = T1 + T2
Then
In which, T1 is guaranteed by the user, according to the 55.6
Modbus communication protocol, the inter-frame interval T2 = ( INT ( ) + 1))15 = 60ms
15
time needs to be 3.5 character at least.
The processing time of the slave station
The length of one character is: Start bit (1 bit)+data length
T10 = 6.2 + 15 + 1 + 11 .4 = 33 .6ms
(7 bits or 8 bits)+check (0 bit or 1 bit)+stop bit (1 bit or 2
bits).
190
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description the high byte is taken as 0, and the check result is 16bits.
S1: Start unit ofdata to be checked ⚫ Application instance
S2: Number of data to be checked (S2≥0,
otherwise the system report an operand error)
D: Check result LD SM1
MOV 16#00 D0
⚫ Function description
MOV 16#11 D1
1. Performing the CCITT check operation on MOV 16#22 D2
S2 data starting from (S1) , and assigning the MOV 16#33 D3
operation result to D. MOV 16#44 D4
2. The polynomial of the CCITT check MOV 16#55 D5
MOV 16#66 D6
algorithm is: X^16+X^12+X^5+1.
MOV 16#77 D7
⚫ Note LD X0
1. The system usually brings the content of D MOV 0 D100
before the instruction execution into the CCITT D0 8 D100
operation when executing the instruction each
time, so D needs to be initialized before
executing the instruction. Performing the CCITT check operation on 8 data starting from D0,
2. Data in the data check area starting from S2 and assigning the obtained result to D100 when X0=ON.
unit are stored in byte mode by default, that is,
⚫ Operand description 1. Performing the CRC16 check operation on S2 data starting from
S1: Start unit ofdata to be checked (S1) , and assigning the operation result to D.
S2: Number ofdata to be checked (S2≥0, otherwise 2. The polynomial of the CRC16 check algorithm is: X^16+X^15+
the system report an operand error) X^2+1.
D: Check result ⚫ Note
⚫ Function description
191
VC Series Micro-PLC Programming Manual Application instructions
1. The system usually brings the content of D before
the instruction execution into the operation when
executing the instruction each time, so D needs to LD SM1
be initialized before executing the instruction. MOV 16#00 D0
MOV 16#11 D1
2. Assigning 16#FFFF to the initial value of D
MOV 16#22 D2
element (checksum), and swopping the high/low MOV 16#33 D3
bytes (high 8 bits and low 8 bits) when you use the MOV 16#44 D4
standard Modbus CRC check. MOV 16#55 D5
3. Data in the data check area starting from S2 unit MOV 16#66 D6
are stored in byte mode by default, that is, the high MOV 16#77 D7
LD X0
byte is taken as 0, and the check result is 16bits.
MOV 0 D100
⚫ Application instance CRC16 D0 8 D100
192
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description 1. Clearing the counter value in C element when the C element is
D: Destination operand cleared.
S: Source operand 2. Clearing the timing value in T element when the T element is cleared.
⚫ Function description ⚫ Application instance
Clearing S consecutive bit elements starting from LD SM0
ZRST M10 10
D when the energy flow is valid.
Clearing the data of 10 units starting from M10 (namely M10, M11,
⚫ Note
M12…M19) when SM0=ON.
193
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description 2. When S is larger than 15 or less than 0, and the energy flow is valid, the
S: Source operand value of D is not changed, but the system reports a value error of the
instruction operand.
D: Destination operand
⚫ Function description ⚫ Application instance
LD SM0
Setting the bit S in the word element
DECO 2 D9
D to 1, and clearing other bits when
the energy flow is valid. Setting the bit 2 in D9 to 1, and clearing other bits when the energy flow is
valid.
⚫ Note
1. The valid range of S is 0 to 15.
⚫ Operand description When the value of multiple bits in S are "1", the smallest position number will
S: Source operand; be written to D, as shown in the following figure.
D: Destination operand
⚫ Function description
⚫ Application instance
Writing the bit number whose value is
LD M0
"1" in the word element S into D when ENCO 2#0010 D0
the energy flow is valid.
Operand 1 is 2#0010, and the bit 1 is "1", hence the result is 1, which is
⚫ Note written into D0 when the energy flow is valid.
194
VC Series Micro-PLC Programming Manual Application instructions
Counting the state of the bit S2 in the word When the energy flow is valid, S1 in the BON instruction is a constant
S1, and outputing the obtained result to D D0, and its fifth bit state (ON) is output to D (Y0).
when the energy flow is valid.
195
VC Series Micro-PLC Programming Manual Application instructions
S2: Designated bit,0≤S2≤15, otherwise the system reports BLD D0 5
an operand error. OUT Y0
⚫ Application instance
LADnote:
Applicable model VC1S VC1 VC2 VC3 VC5
⚫ Operand description connection with other nodes to drive the subsequent operation.
S1: Source operand ⚫ Application instance
S2: Designated bit (0≤S2≤15, LD X0
BAND D0 5
otherwise the system reports an
OUT Y0
operand error)
Taking the state of the bit 5 (ON) in D0 (1000: 2#0000001111101000), and
⚫ Function description
using the obtained value in serial connection with other nodes (X0=ON) to
Taking the state of the bit S2 in S1,
determine the output state ofY0 in the subsequent operation.
and using the obtained value in serial
196
VC Series Micro-PLC Programming Manual Application instructions
LADnote:
Applicable model VC1S VC1 VC2 VC3 VC5
Note: The logical relationship has been manifested in the diagram, so Influenced flag bit
the BANI instruction is displayed as BLDI in LAD
⚫ Operand description connection with other nodes to drive the subsequent operation.
S1: Source operand ⚫ Application instance
S2: Designated bit (0≤S2≤15, LD X0
otherwise the system reports an BANI D0 5
OUT Y0
operand error)
Performing the NOT operation (OFF) on the state of the bit 5 (ON) in
⚫ Function description
D0(1000: 2#0000001111101000), and using the obtained value in serial
Performing the NOT operation on the
connection with other nodes (X0=ON) to determine the output state of Y0 in
state of the bit S2 in S1, and using
the subsequent operation.
the obtained value in serial
197
VC Series Micro-PLC Programming Manual Application instructions
LADnote:
Applicable model VC1S VC1 VC2 VC3 VC5
⚫ Operand description Assigningthe state of the current energy flow to the bit S of D.
S1: Source operand ⚫ Application instance
S2: Designated bit (0≤S2≤15, otherwise the LD X0
system reports an operand error) BOUT D0 4
⚫ Function description Assigning the state of the current energy flow(X0=ON) to the bit 4
in D0 (1000:2#0000001111101000). After execution: D0=1016
(2#0000001111111000).
198
VC Series Micro-PLC Programming Manual Application instructions
the system reports an operand error) Setting thebit 15 in D0 (1000: 2#0000001111101000) when the energy
⚫ Function description flow is valid. After execution, D0=33768 (2#1000001111101000).
Setting the bit S of D element.
system reports an operand error) Clearing thebit 8 in D0 (1000: 2#0000001111101000) when the
⚫ Function description energy flow is valid. After execution, D0=744 (2#0000001011101000).
Clearing the bit S of D element.
6.16.1 LD (=, <, >, <>, >=, <=): Integer comparison LD※instruction
199
VC Series Micro-PLC Programming Manual Application instructions
Cons
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
tant
Cons
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
tant
6.16.2 AND (=, <, >, <>, >=, <=): Integer comparison AND ※instruction
200
VC Series Micro-PLC Programming Manual Application instructions
Conducting
OUT the BIN Y3 comparison on the data of D0 and D1, and using the
comparison result
LD X4 in serial connection with other nodes to determine the
AND>= D0subsequent
output state of the D1 elements.
OUT Y4
LD X5
AND<= D0 D1
OUT Y5
6.16.3 OR (=, <, >, <>, >=, <=): Integer comparison OR※instruction
⚫ Operand description
S1: Comparison parameter 1
S2: Comparison parameter 2
⚫ Function description
Conducting the comparison on the
content of S1 and S2, and using the
comparison result in parallel
connection with other nodes to drive
the subsequent operation.
⚫ Application instance
201
VC Series Micro-PLC Programming Manual Application instructions
Conducting
LD X0 the comparison on the data of D0 and D1, and using the
comparisonresult in parallel connection with other nodes to determine the
OR= D0 D1
OUT Y0 state of the subsequent elements.
output
LD X1
OR< D0 D1
OUT Y1
LD X2
OR<> D0 D1
OUT Y2
LD X3
OR>= D0 D2
OUT Y3
LD X4
OR>= D0 D1
OUT Y4
LD X5
OR<= D0 D1
OUT Y5
6.16.4 LDD (=, <, >, <>, >=, <=): Long integer comparison LDD※instruction
202
VC Series Micro-PLC Programming Manual Application instructions
6.16.5 ANDD (=, <, >, <>, >=, <=): Long integer comparison ANDD※instruction
⚫ Operand description LD X0
LDD= D0 D2
S1: Comparison parameter 1
OUT Y0
S2: Comparison parameter 2 LD X1
⚫ Function description LDD< D0 D2
Conducting the comparison on the OUT Y1
content of S1 and S2, and using the LD X2
LDD<> D0 D2
comparison result in serial
OUT Y2
connection with other nodes to drive
LD X3
the subsequent operation. LDD<> D0 D2
OUT Y3
⚫ Application instance LD X4
LDD>= D0 D2
OUT Y4
LD X5
LDD<= D0 D2
OUT Y5
Conducting the comparison on (D0,D1) and(D2,D3), and using the
comparisonresult in serial connection with other nodes to determine the
output state of the subsequent elements.
203
VC Series Micro-PLC Programming Manual Application instructions
6.16.6 ORD (=, <, >, <>, >=, <=): Long integer comparison ORD※instruction
⚫ Operand description LD X0
S1: Comparison parameter 1 ORD= D0 D2
S2: Comparison parameter 2 OUT Y0
LD X1
⚫ Function description
ORD< D0 D2
Conducting the comparison on the OUT Y1
content of S1 and S2, and using the LD X2
comparison result in parallel ORD<> D0 D2
connection with other nodes to drive OUT Y2
the subsequent operation. LD X3
ORD>= D0 D2
⚫ Application instance
OUT Y3
LD X4
ORD>= D0 D2
OUT Y4
LD X5
ORD<= D0 D2
OUT Y5
204
VC Series Micro-PLC Programming Manual Application instructions
205
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description LD X0
ANDR= D0 D2
S1: Comparison parameter 1
OUT Y0
S2: Comparison parameter 2 LD X1
⚫ Function description ANDR< D0 D2
Conducting the comparison on the OUT Y1
content of S1 and S2, and using the LD X2
ANDR<> D0 D2
comparison result in serial
OUT Y2
connection with other nodes to drive
LD X3
the subsequent operation. ANDR<> Y3
⚫ Application instance LD X4
ANDR>= D0 D2
OUT Y4
LD X5
ANDR<= D0 D2
OUT Y5
Conducting the comparison on (D0,D1) and(D2,D3), and using the comparison
result in serial connection with other nodes to determine the output state of the
subsequent elements.
206
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description
LD X0
S1: Comparison parameter 1 ORR= D0 D2
S2: Comparison parameter 2 OUT Y0
⚫ Function description LD X1
ORR< D0 D2
Conducting the comparison on the
OUT Y1
content of S1 and S2, and using the LD X2
comparison result in parallel ORR> D0 D2
connection with other nodes to drive OUT Y2
the subsequent operation. LD X3
⚫ Application instance ORR<> D0 D2
OUT Y3
LD X4
ORR>= D0 D2
OUT Y4
LD X5
ORR<= D0 D2
OUT Y5
207
VC Series Micro-PLC Programming Manual Application instructions
Conducting the comparison on
(D0,D1) and (D2,D3), and using the
comparison result in parallel
connection with other nodes to
determine the output state of the
subsequent elements.
208
VC Series Micro-PLC Programming Manual Application instructions
Applicable
LAD:
VC2 VC3 VC5
model
CMP (S1) (S2) (D) Influenced flag
bit
Applicable
LAD:
VC2 VC3 VC5
model
LCMP (S1) (S2) (D) Influenced flag
bit
⚫ Operand description Executing the instruction, and comparing S1 and S2 when the energy flow is
S1: Comparison value 1. valid. Making one of (D) (D+1) (D+2) ON according to its result (less,
S2: Comparison value 2. equal, or larger).
209
VC Series Micro-PLC Programming Manual Application instructions
Applicable
LAD:
VC2 VC3 VC5
model
RCMP (S1)(S2)(D) Influenced flag
bit
⚫ Operand description Executing the instruction, and comparing S1 and S2 when the energy flow is
S1: Comparison value 1. valid. Making one of (D) (D+1) (D+2) ON according to its result (less,
equal, or larger).
S2: Comparison value 2.
⚫ Application instance
D: Number of the start element that is
used to output the result. LD m2
RCMP 500.3400 200.4000
⚫ Function description
Y7
Applicable
VC3 VC5
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
⚫ Operand description
S1: Number of the start soft element for savingthe data 1. Executing the instruction, increasing S3 units 16-bit
on which the addition operation is to be performed data starting from S1 byS3 units 16-bit data (BIN) starting
S2: Constant for performing the addition operation, or from S2, and storing the operation result in S3 units
number of the start soft element that saves data on which starting from D when the energy flow is valid.
the addition operation is to be performed 2. You can directly specify a 16-bit constant in S2.
D: Number of the start soft element for saving the Sequentially performing, when S2 is a constant, the
operation result addition operation on S3 units16-bit data starting from S1
S3: Data quantity and S2, and storing the operation result in S3 units
⚫ Function description starting from D.
210
VC Series Micro-PLC Programming Manual Application instructions
⚫ Note Sequentially increasing the contents of 5 units starting
When the operation result overflows, the carry flag bit is from D10 by that of 5 units starting from D100, and
not setto ON. storing the operation results in 5 units starting from
⚫ Application instance D1000 when M1=ON. In this case, D1000=D10+D100,
D1001=D11+D101,……, D1004=D14+D104.
LD M1
BKADD D10 D100 D1000 5
Applicable
VC3 VC5
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
⚫ Operand description from S1 and S2, and storing the operation result in S3
S1: Number of the start soft element for savingthe data units starting from D.
on which the subtraction operation is to be performed ⚫ Note
S2: Constant for performing the addition operation, or When the operation result overflows, the carry flag bit is
number of the start soft element that saves data on which not setto ON.
the subtraction operation is to be performed ⚫ Application instance
D: Number of the start soft element for saving the
operation result
S3: Data quantity LD M1
⚫ Function description BKSUB D10 D100 D1000 5
1. Executing the instruction, subtracting S3 units 16-bit Sequentially subtracting the contents of 5 units starting
data starting from S1 by S3 units 16-bit data (BIN) from D10 by that of 5 units starting from D100, and
starting from S2, and storing the operation result in S3 storing the operation results in 5 units starting from
units starting from D when the energy flow is valid. D1000 when M1=ON. In this case, D1000=D10-D100,
2. You can directly specify a 16-bit constant in S2. D1001=D11-D101, ……, D1004=D14-D104.
Sequentially performing, when S2 is a constant, the
subtraction operation on S3 units 16-bit data starting
LAD: Applicable
VC3 VC5
model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
211
VC Series Micro-PLC Programming Manual Application instructions
Consta
S1 INT D SD C T V R √
nt
S2 INT D SD C T V R √
D BOOL Y M S LM SM
Consta
S3 INT D V R
nt
⚫ Operand description When the operation result overflows, the carry flag bit is
S1: Number of the start soft element to be compared or not set ON.
saved ⚫ Application instance
S2: Number of the startsoft element that stores the
comparison source
D: Number of the start soft elementthat saves
thecomparison result
LD M1
S3: Data quantity
BKCMP= D10 D100 Y0 4
⚫ Function description
LD SM188
1. Comparing the S3 units 16-bit data starting from S1
SET Y10
with S3 units 16-bit data (BIN) starting from S2, and
storing the operation result in S3 units starting from D. When M1=ON, the contents of the four units starting from
D10 are compared with the contents of the four units
2. You can directly specify a 16-bit constant in S1.
starting from D100, and the result is stored in the four
Sequentially performing, when S1 is a constant, the
units starting from Y0. In addition, when the comparison
comparison on S3 units16-bit data starting from S1 with
result is all ON, Y10 turns ON.
that of S2, and storing the operation result in S3 units
starting from D. Sequentially comparing the contents of 4 units starting
from D10 by that of 4 units starting from D100, and
3. Settingthe comparison set flag bit of the data block
storing the operation results in 4 units starting fromY0
(SM188) when S3 units comparison results starting from
when M1=ON. In this case, Y0 is set ON.
D are ON.
⚫ Note
Applicable
VC3 VC5
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
⚫ Operand description D: Number of the start soft element that stores the output value
S1: Lower limit value that has been controlled by the upper and lower limits
S2: Upper limit value
S3: Input value to be controlled by the upper
and lower limits
212
VC Series Micro-PLC Programming Manual Application instructions
⚫ Function description ⚫ Application instance
You can judge whether the input value specified
in S3 is within the range of the upper and lower LD M1
limits specified by S1 and S2 so as to control
LIMITD0 D10 D100 D1000
and save the value in D. In this case, when
S3<S1, D=S1; when S3>S2, D=S2; when S1 Performing the limit control of D0–D10 on the content of D100,
<=S3<=S2, D=S2. and storing the obtained result in D1000 when M1=ON.In this case,
Output (Output) D D0(10)<=D100(30)<=D10(100), and D1000=30.
S1 (Lower limit)
Input S2 (Upper limit)
Applicable
VC3 VC5
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
Applicable
VC3 VC5
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
213
VC Series Micro-PLC Programming Manual Application instructions
Consta
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
nt
Consta
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
nt
S3 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √
Applicable
VC3 VC5
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
⚫ Operand description 3. The coordinates are set through the conversion table.
S1: Input value on which coordinates are set, or number Points of the coordinates S2
of the soft element that stores the inputted value. X coordinate S2+1
Point 1
Y coordinate S2+2
S2: Number of the start table conversion soft element
X coordinate S2+3
that is used to set the coordinates. Point 2
Y coordinate S2+4
D: Number of the soft element that stores the output … … …
value on which coordinates have been set. X coordinate S2+2n-1
Point n (End)
⚫ Function description Y coordinate S2+2n
1. Setting the coordinates on the input values specified ⚫ Note
by S1 according to the specified conversion 1. The X data of the data table needs to be arranged in
characteristics, and storing the obtained results in the ascending order. If only part of the data is not arranged
soft element numbers specified by D. in ascending order and the detection is started from
2. The conversion for setting the coordinates is button, and the operation before this part is still executed;
performed based on the data table stored in soft 2. S1 must be within the range set by the data table;
elements, of which the start soft element is specified by ⚫ Application instance
S2. However, when the outputted data is not an integer
value, the data is outputted after rounding off the first
decimal place.
214
VC Series Micro-PLC Programming Manual Application instructions
X coordinate D107 50
Point 4
Y coordinate D108 40
LD M1 X coordinate D109 60
Point 5
SCL D10 D100 D1000 Y coordinate D110 0
Y
Setting the coordinates on the content of D10, and
storing the obtained results in D1000 when M1=ON.
Points of the coordinates D100 5
Point 3(30,60)
X coordinate D101 10
Point 1
Y coordinate D102 0 D(40) Point 4(50,40)
X coordinate D103 20
Point 2 Point 2(20,20)
Y coordinate D104 20
X coordinate D105 30 Point 5 (60,0)
Point 3 Point 1(10,0) S1(25) X
Y coordinate D106 60
Applicable
VC3 VC5
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
LD M1
SER D0 D10 D100 D1000 8
Searchingthe contents of 8 unit starting from D10, and storing the search results in5 units starting from D1000 when M1=ON.
The element value
The element value
value to be compared Data position Search result D Value
to be searched S1
S2
D10 100 100 0 D1000 3
D11 78 1 D1001 0
D12 92 2 D1002 7
D13 100 3 D1003 5
215
VC Series Micro-PLC Programming Manual Application instructions
D14 110 4 D1004 6
D15 -20 5
D16 145 6
D17 100 7
Applicable
VC3 VC5
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
216
VC Series Micro-PLC Programming Manual Application instructions
Applicable
VC3 VC5
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
⚫ Operand description When '00H' does not appear in the corresponding soft
S: The string unit element range of the string unit starting from S, the
system reports the "The element number of the
D:The length of the string unit
instruction operand is out of range" error.
⚫ Function description
⚫ Application instance
1. Detecting the length of the S string, and storing the
obtained value in D when the energy flow is valid.
2. The valid data of a string unit indicates the data
LD M1
starting from the specified soft element for the string unit
STRLEN D10 D100
to the first data in which "00H" is detected.
⚫ Note Detecting the length of the string unit starting from D10,
and storing the obtained result in D100 when M1=ON.
Applicable
VC3 VC5
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
⚫ Operand description 3. Adding '00H'to the high byte of the soft element that holds the
S1: The string unit last character when the number of extracted characters is an odd
number. Adding '0000H' to the next element of the soft element
D: Storing the extracted string unit
that holds the last character when it is even.
S2: Number of the extracted characters
4. The valid data of a string unit indicates the data starting from the
⚫ Function description
specified soft element for the string unit to the first data in which
1. Extracting S2 characters starting from the
"00H" is detected.
last valid character of the S1 string (not
⚫ Note
counting '00H'), and storing them in the soft
1. When '00H' does not appear in the corresponding soft element
element starting from D when the energy flow
range of the string unit starting from S1, the system reports the
is valid;
"The element number of the instruction operand is out of range"
2. Storing "00H" in D soft element when S2 is
error.
equal to zero;
2. S2 is greater than or equal to 0.
217
VC Series Micro-PLC Programming Manual Application instructions
3. S2 needs to be less than or equal to the Extracting 3 characters from the right side of the string unit starting
character number of the S1 string. from D10, and storing them in the unit starting from D100 when
⚫ Application instance M1=ON.
B15---b8 b7---b0 B15---b8 b7---b0
D10 0x32 0x31 D100 0x35 0x34
LD M1 D11 0x34 0x33 D101 0x00 0x36
D12
STRRIGHT D10 D100 3 0x36 0x35
D13 0x00 0x00
Applicable
VC3 VC5
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
element of the soft element that holds the last character Extracting 3 characters from the left side of the string unit
when it is even. starting from D10, and storing them in the unit starting
4. The valid data of a string unit indicates the data from D100 when M1=ON.
starting from the specified soft element for the string unit B15---b8 b7---b0 B15---b8 b7---b0
to the first data in which "00H" is detected. D10 0x32 0x31 D100 0x32 0x31
D11 0x34 0x33 D101 0x00 0x33
D12 0x36 0x35
D13 0x00 0x00
218
VC Series Micro-PLC Programming Manual Application instructions
Applicable
VC3 VC5
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
2. Adding '00H'to the high byte of the soft element that ⚫ Application instance
holds the last character when the number of extracted
characters is an odd number. Adding '0000H' to the next
element of the soft element that holds the last character LD M1
when it is even. STRMIDR D10 D100 D0
3. The valid data of a string unit indicates the data Reading D1 (D1=3) characters from D0 (D0=2) of the
starting from the specified soft element for the string unit string unit starting from D10, and storing them in the unit
to the first data in which "00H" is detected. starting from D100 when M1=ON.
4. Performing no action when n is 0. B15---b8 b7---b0 B15---b8 b7---b0
5. Extractingall character data of the S1 string, and D10 0x32 0x31 D100 0x33 0x32
storing them in the soft element starting from D when n D11 0x34 0x33 D101 0x00 0x34
is -1. D12 0x36 0x35
D13 0x00 0x00
Applicable
VC3 VC5
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
219
VC Series Micro-PLC Programming Manual Application instructions
S2+1: Number of characters to be replaced (n) 4. When the number of characters for replacement exceeds the
⚫ Function description last character of the string unit starting from D, the extra characters
1. Replacing n character data starting from the are not saved.
S2 character of the D string with n characters 5. When '00H' does not appear in the corresponding soft element
data of S1 string when the energy flow is valid; range of the string unit starting from S1 and D, the system reports
2. The valid data of a string unit indicates the the "The element number of the instruction operand is out of
data starting from the specified soft element for range" error.
the string unit to the first data in which "00H" is ⚫ Application instance
detected.
3. Performing no action when n is 0. LD M1
1. S2 needs to be less than or equal to the D10 0x32 0x31 D100 0x35 0x34 D100 0x31 0x34
D11
character number of the S1 string. 0x34 0x33 D101 0x37 0x36 D101 0x33 0x32
D12
2. n is greater than 2. 0x00 0x35 D102 0x39 0x38 D102 0x39 0x38
3. S2 is greater than or equal to 1. D103 0x00 0x61 D103 0x00 0x61
Applicable
VC3 VC5
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
220
VC Series Micro-PLC Programming Manual Application instructions
D10, and storing the search results in D100 when
M1=ON.
LD M1
“45”
STRINSTR "45" D10 D100 2 B15---b8 b7---b0
Applicable
VC3 VC5
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
1. When '00H' does not appear in the corresponding soft Transferring the character string data starting from D10
element range of the string unit starting from S, the to the unit starting from D100 when M1=ON.
system reports the "The element number of the B15---b8 b7---b0 B15---b8 b7---b0
instruction operand is out of range" error. D10 0x32 0x31 D100 0x32 0x31
2. When the number of characters of the S string unit is D11 0x34 0x33 D101 0x34 0x33
D12 0x36 0x35
even, '00H' is stored in LSB, and both MSB and LSB of D102 0x36 0x35
D13 0x00 0x00 0x00 0x00
the corresponding position in D stores '00H'. D103
6.20.1 LOADR: Instruction for reading data from an extension file register
Applicable model
LAD:
Influenced flag
Zero flag, carry flag, and borrow flag
bit
221
VC Series Micro-PLC Programming Manual Application instructions
Consta
S2 INT D
nt
LD M1
LOADR R0 16
Applicable model
LAD:
Influenced flag
Zero flag, carry flag, and borrow flag
bit
⚫ Operand description 3. Setting the instruction execution end flag SM189 when
S1: Soft element unit of the extension register for storing the execution of the instruction execution ends.
data(only the start address of soft elements in the ⚫ Note
segment can be specified) 1. When S2=2048, the execution time of the instruction
S2: Number of data that has been written per operation is about several hundredms. You need to set the
cycle (1 ≤ S2 ≤ 2048) watchdog time correctly.
D: Storing number of data that has been written 2. You need to execute the INITER or INITR instruction
⚫ Function description to initialize the operated segments before driving the
SAVER instruction. If the data written to the extension file
1. Writing data from S1 – S1+2047 in the extension
register do not match those of the extension register, the
register to the same unit in the storage box by 2048/S2
system reports that the operation on the memory card is
(if 20148 is not divisible by S2, the quotient is increased
incorrect.
by 1) operation cycle.
3. When a value of 0 is specified in S2, it is executed
2. Storing number of data that has been written in D
according to S2 = 2048.
during the writing process.
4. Data in S1 need to be number of the start soft elementin the extension register segment. Number of the start soft elementin
each segment is as follows.
Number of the Range of writing to the Number of the Range of writing to the
Segment Segment
start soft memory card R backup start soft memory card R backup area
number number
element area element
222
VC Series Micro-PLC Programming Manual Application instructions
LD M1
Applicable
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
223
VC Series Micro-PLC Programming Manual Application instructions
2. When the memory card is not used, the initialization of ⚫ Application instance
the extension file register is not performed.
3. If the memory card is connected,and hardware writing
protection is performed for the memory card, the system LD M1
reports a memory card operation error. INITR R0 1
4. The instruction can only initialize one segment for each Initializing the extension registers R–R2047 in segment
execution. When the memory card is used, the operation 0 when M1=ON. In the case of using a memory card, the
time of initializing each segment is about 100ms. In extension file registers ER–ER2047 are also initialized.
actual application, You need to set the watchdog time
correctly.
Applicable
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
224
VC Series Micro-PLC Programming Manual Application instructions
7 R14336 R14336–R16383 15 R30720 R30720–R32767
3. If there is memory hardware protection, the system reports that the operation on the memory card is incorrect.
4. Login data format
The storage address of the first
S3–S3+S2-1 logined data D=S2
S3 – S3+S2-1
The storage address of the second Data write area
S3+S2–S3+2S2-1 logined data D=2S2 1926×S4
S3 – S3+S2-1
S3+2S2–S3+3S2-
D=3S2
1
………… ………… …… Login data storage area
Writing intothe location management
area
When using the data write area of
Management
S3+1926×S4-1 one word, the sequence is changed
area
–S3+2048×S4-1 from ON to OFF from 0 bits of
122 × S4
S3+1926×S4-1, and the next soft
element S3+1926×S4 is used when
S3+1926×S4-1 is all OFF.
⚫ Application instance LD M1
LOGR D0 5 R0 1 D100
Logging the data of the D0–D4 unit in the R0–R2047 unit
of the segment 0, and recording the number of logined
data in D100 when M1=ON.
Applicable
LAD: model
Influenced flag
Zero flag, carry flag, and borrow flag
bit
225
VC Series Micro-PLC Programming Manual Application instructions
2 R4096 R4096–R6143 10 R20480 R20480–R22527
3 R6144 R6144–R8191 11 R22528 R22528–R24575
4 R8192 R8192–R10239 12 R24576 R24576–R26623
5 R10240 R10240–R12287 13 R26624 R26624–R28671
6 R12288 R12288–R14335 14 R28672 R28672–R30719
7 R14336 R14336–R16383 15 R30720 R30720–R32767
4. The instruction can only initialize one segment for each INITER R0 1
execution, and the operation time of initializing each Initializing the extension file registers ER0–ER2047 in
segment is about 100 ms. In actual application, You need segment 0 when M1=ON.
to set the watchdog time correctly.
226
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description 2. During the zero return process, the value of the current
S1: Zero return speed, specifying the speed at which the value register decreases.
zero return starts. 3. The min. output pulse frequency that can be outputted
32-bit instruction. actually, is determined by the formula below:
S2: Crawling speed, the lower speed after the specified Fmax 500
Fmin_ acc =
near-point dog signal (DOG) is turned ON. T
S3: DOG to be inputted in X element. In the above formula, Fmax indicates the max. speed
When an element other than the input relay (X) is while T indicates the acceleration/deceleration time
specified, the position offset of the zero point increases withthe unit of ms. The calculation result Fmin_ acc is the
due to the influence of the PLC calculation cycle. limit value of min. output frequency.
D: Start address of the high-speed pulse output. 4. For the pulse output frequency, the calculated
⚫ Function description frequency is output even if a value less than the
Taking Y0 as an example. When SM276 clearing signal calculated one is assigned. The frequency of the starting
is valid, and elements specified by the SM281 clearing section of ACC and end part of DEC cannot be less than
signal are invalid, Y10 is the output port of the clearing the above calculation result. If the max. speed is lower
signal. When elements specified by the SM281 clearing than the above calculation result, there is not pulse
signal are invalid, Y (N) specified by SD175 is the output output.
port of the clearing signal. 5. Crawling speed needs to be larger than zero and less
⚫ Note than one tenth of the max. speed.
1. Because the ZRN instruction is incapable of searching 6. For details, refer to Chapter 11 "User Guide for
for DOG automatically, it is required to start the zero Positioning Function".
return operation further than the front end of DOG
detection device.
⚫ Time sequence diagram
227
VC Series Micro-PLC Programming Manual Application instructions
228
VC Series Micro-PLC Programming Manual Application instructions
229
VC Series Micro-PLC Programming Manual Application instructions
230
VC Series Micro-PLC Programming Manual Application instructions
Applicable
LAD:
VC1 VC2 VC3
model
DSZR (S1) (S2) (D1) (D2) Influenced flag
bit
Applicable
LAD: VC1
model
DVIT (S1) (S2) (D1) (D2) Influenced flag
bit
232
VC Series Micro-PLC Programming Manual Application instructions
instruction soft elements, in which the LSB of SD176 In the above formula, Fmax indicates the max. speed,
correspond to the interrupt input used by the pulse output while T indicates the acceleration/deceleration time,
Y0, and the MSB corresponds to the interrupt input used withthe unit of ms. The calculation result Fmin_ acc is the
by the pulse output Y1. limit value of min. output frequency.
Set Setting content 3. For the pulse output frequency, the calculated
value frequency is output even if a value less than the
0 Designating X0 as the interrupt input signal calculated one is assigned. The frequency of the starting
1 Designating X1 as the interrupt input signal section of ACC and end part of DEC cannot be less than
…… ……
the above calculation result. If the max. speed is lower
7 Designating X7 as the interrupt input signal
than the above calculation result, there is not pulse
8×1 Designating the user interrupt instruction soft
output.
element×1 as the interrupt input signal
4. When the number of output pulses is less than the
Pulse output soft User interrupt
element instruction soft number of pulses required for deceleration, the
element frequency can be decelerated.
Y0 SM285 5. For details, refer to Chapter 11 "User Guide for
Y1 SM305 Positioning Function".
Y2 SM325 ⚫ Application instance
⚫ Note
Applicable
VC3
LAD: model
STOPDV (S1) (S2) (S3) (D)
Influenced flag
bit
233
VC Series Micro-PLC Programming Manual Application instructions
decelerates to the base speed, and stops the output 6. For details, refer to Chapter 11 "User Guide for
action when the base speed is reached. Positioning Function".
3. The base speed and acceleration/deceleration time ⚫ Application instance
are also set in the special data register of the output axis. In the main program, you can try out the PLSY instruction
The execution of the instruction does not change the to drive Y0. The energy flow is controlled by the M0
setting of the special data register. The base speed and element:
acceleration/deceleration time during the execution of
the instruction are executed according to the set
instruction operand instead of using the configuration in
Setting the interrupt source for the interrupt subprogram,
the special data register.
for example:
4. The direction signal of the output axis does not need
to be specified, and the direction signals specified in the
original PLSY, PLS, and positioning instructions are
automatically recognized. The ON/OFF state of the
direction signal is not changed during the execution of
the instruction.
⚫ Note
Applicable
VC3
LAD: model
LIN (S) (D1) (D2) (D3) (D4)
Influenced flag
bit
234
VC Series Micro-PLC Programming Manual Application instructions
S DINT D
D1 BOOL Y
D2 BOOL Y
D3 BOOL Y
D4 BOOL Y
235
VC Series Micro-PLC Programming Manual Application instructions
Configuration
code
Initial speed
Max. speed
Acceleration/de
celeration time
X-axis moving
distance
Y-axis moving
distance
236
VC Series Micro-PLC Programming Manual Application instructions
Applicable
VC3
LAD: model
CW (S) (D1) (D2) (D3) (D4)
Influenced flag
bit
237
VC Series Micro-PLC Programming Manual Application instructions
4. It is not allowed to use multiple PLSY, PLS, or You can adopt the incremental type, the displacement of
positioning instructions on the same high-speed pulse the end point to the start point is (4000, -4000), and the
output port at the same time.
displacement of the center to the start point is (4000, 0).
5. The coordinates of the passing point specified in the
You can program like this:
passing position mode refer to the passing position of the
entire circle, but the user-defined trajectory path may not
pass through this point. Configuration code
interrupt.
⚫ Application instance Y-axis moving distance
following figure:
Relative position of Y-axis of the circle center
End point
(6000,1000)
X-axis (SD200)
Applicable
VC3
LAD: model
CCW (S) (D1) (D2) (D3) (D4)
Influenced flag
bit
⚫ Operand description D2: The output point number corresponding to the X-axis
S: The start address of the parameter table storage area. direction signal (or negative pulse signal). Only Y1 can
be specified.
D1: The output point number corresponding to the X-axis
pulse signal (or positive pulse signal). Only Y0 can be D3: The output point number corresponding to the Y-axis
specified. pulse signal (or positive pulse signal). Only Y2 can be
specified.
238
VC Series Micro-PLC Programming Manual Application instructions
D4: The output point number corresponding to the Y-axis signals) in the instruction must be used in groups. When
direction signal (or negative pulse signal). Only Y3 can the output group can only designatedas Y0 and Y2, Y1
be specified. and Y3 are used in combination with Y0 and Y2
⚫ Function description respectively to provide the direction signal or negative
1. Moving to the target position along the arc trajectory in pulse output signal.
the counter clock wise direction at the specified line 2. The output group (Y0 and Y2) can be specified as
speed. "Pulse + direction" mode or "Positive pulse+ negative
2. Parameter table definition pulse" mode, and the max. speed is 200k.
D Content 3. The setting range of the moving distance for each axis
eleme is -8388608-8388607 pulses.
nt 4. It is not allowed to use multiple PLSY, PLS, or
Arc formation method positioning instructions on the same high-speed pulse
Con Mode
figur output port at the same time.
S atio 5. The coordinates of the passing point specified in the
n
0 Center position designation passing position mode refer to the passing position of the
1 Passing position designation entire circle, and the user-defined trajectory path may not
Action mode and output logic relationship pass through this point.
(configuration code in decimal)
Con Mode Output logic 6. The range of acceleration and deceleration time is 5-
figur 5000ms.
atio
n 7. Only trapezoidal acceleration/deceleration is
Increment
Pulse+direction supported, and the deceleration time cannot be set alone.
00 (Forward:
S+1 al type
ON/reverse: OFF) 8. The completion interrupt only supports one (Y0Y1)
Increment Forward interrupt.
01
al type pulse+reverse pulse
Absolute Pulse+direction
10 value (Forward:
type ON/reverse: OFF)
Absolute
Forward
11 value
pulse+reverse pulse
type
S+2 Resultant speed initial speed (MSB)
S+3 Resultant speed initial speed (LSB)
S+4 Resultant speed (MSB)
S+5 Resultant speed (LSB)
S+6 Acceleration/deceleration time T (ms) (MSB)
S+7 Acceleration/deceleration time T (ms) (LSB)
X-axis moving distance (target position)
S+8
(MSB)
S+9 X-axis moving distance (target position) (LSB)
Y-axis moving distance (target position)
S+10
(MSB)
S+11 Y-axis moving distance (target position) (LSB)
X-axis coordinate of the circle center
S+12
position/passing point (MSB)
X-axis coordinate of the circle center
S+13
position/passing point (LSB)
Y-axis coordinate of the circle center
S+14
position/passing point (MSB)
Y-axis coordinate of the circle center
S+15
position/passing point (LSB)
Among which:
(1) In the incremental mode, the trajectory target
adopts the relative address, which refers to the
moving distance from the current position to the X
and Y axes during the target period.
(2) In the absolute value mode, the trajectory target
adopts an absolute address, which refers to the
absolute position coordinates of the target position
on the X and Y axes.
⚫ Note
1. The output point numbers D1 and D3 corresponding
to the two output axis pulse signals (or forward pulse
239
VC Series Micro-PLC Programming Manual Application instructions
⚫ Application instance displacement of the center to the start point is (0, 4000).
Assuming the current position value of the SD element is You can program like this:
(6000, 1000), and you want to draw the arc shown in the
following figure:
Configuration code
Y-axis (SD320)
240
VC Series Micro-PLC Programming Manual Application instructions
Applicable
LAD: model
MOVELINK (S1) (S2) (S3) (S4) (S5) (S6)
Influenced flag
bit
IL: MOVELINK (S1) (S2) (S3) (S4) (S5) (S6) Step length 17
Operan
Type Applicable soft element Indexing
d
Const
S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V √
ant
Const
S2 DINT KnX KnY KnM KnS KnLM KnSM D SD C V √
ant
Const
S3 DINT KnX KnY KnM KnS KnLM KnSM D SD C V
ant
Const
S4 DINT KnX KnY KnM KnS KnLM KnSM D SD C V
ant
S5 BOOL Y
S6 BOOL Y C
⚫ Operand description
S1: Total number of pulses generated by the slave axis
Total movement
when it follows the spindle axis. Movement Movement
before after
S2: Total number of pulses generated by the spindle axis synchronizati synchronizati
when it is followed by the slave axis. on on
241
VC Series Micro-PLC Programming Manual Application instructions
when defined as an input axis, operand S6 is set 1. It is not allowed to use multiple PLSY, PLS, or
toC236–C263. positioning instructions on the same high-speed pulse
4. When the energy flow of the instruction is turned on, output port at the same time.
the slave axis starts running. This instruction supports 2. The output point number D corresponding to the high-
the calling mode and subprogram, and the interrupt speed pulses can be specified as: Y0, Y2, Y4, Y5, Y6, Y7.
program calling methodin the main program. Y1 and Y3 are used in combination with Y0 and Y2
5. The direction signal of the output axis does not need respectively to provide the direction signal or negative
to be specified, and the ON/OFF state of the direction pulse output signal.
signal is not changed during the following process. ⚫ Application instance
⚫ Note
242
VC Series Micro-PLC Programming Manual Application instructions
Applicable
LAD: model
GEARBOX (D1) (S1) (D2) (S2)
Influenced flag
bit
243
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description
S1: Number of the start soft element that stores data to be separated in byte unit
S2: Number of byte data to be separated (S2 ≥ 0)
D: Number of the start soft element that stores the result that has been separated in byte unit
⚫ Function description
1. Separating the 16-bit data stored in S2/2 soft elements from S1 into S2 bytes, storing them in the low bytes of S2 soft
elements starting from D, and clearing the high bytes.
244
VC Series Micro-PLC Programming Manual Application instructions
S . +0 MSB LSB
D . +0 00H MSB
… … +2 00H MSB
Store H00
2. When S2 is odd, only the high byte (8 bits) is the object data in the last data of the separated source.
For example, when n=5, the data of the low bytes of S–S+2 are stored in D–D+4.
b15 -- -- -- -- -- --b8 b7 -- -- -- -- -- -- b15 -- -- -- -- -- --b8 b7 -- -- -- -- -- --
b0 b0
S . +0 12H 39H D . +0 00H 12H
Store H00.
LD M1
WTOB D0 D10 6
Separating three units of data starting from D0 into six units of data according to the high and low bytes, and storing the
obtained data in six units starting from D10 when M1=ON. When D0=0x102, D1=0x304, and D2=0x506, D10=0x01,
D11=0x02, D12=0x03, D13=0x04, D14=0x05, and D15=0x06.
⚫ Operand description
245
VC Series Micro-PLC Programming Manual Application instructions
S1: Number of the start soft element stores data to be combined in byte unit
S2: Number of byte data to be combined (S2 ≥ 0)
D: Number of the start soft element that stores the result that has been combined in byte unit
⚫ Function description
1. Combining the least significant bytes (8 bits) of S2 16-bit data starting from S1 into 16-bit data, and storing these data in
S2/2 soft elements starting from D. The most significant bytes (8 bits after S1) of the 16-bit data in the data source are
ignored.
2. When S2 is odd, the least significant byte that is combined finally is cleared.
b15 -- -- -- -- -- --b8 b7 -- -- -- -- -- -- b0 b15 -- -- -- -- -- --b8 b7 -- -- -- -- -- -- b0
MSB is omitted.
LD M1
BTOW D0 D10 6
Combining six unitsof data starting from D0 into three units of data, and storing the obtained data in three units starting from
D10 when M1=ON. When D0=0x01, D1=0x02, D2=0x03, D3=0x04, D4=0x05, and D5=0x06, D10=0x102, D11=0x304, and
D12=0x506.
⚫ Operand description
246
VC Series Micro-PLC Programming Manual Application instructions
S1: Number of the start soft element that stores data to be combined
S2: Number of the combined data (when the range of S2 is 0-4, and S2=0, there is no processing)
D: Number of the soft element that stores the combined data
⚫ Function description
1. Storing S2 16-bit data starting from S1 in S2 soft elements starting from D.
b15 -- -- -- -- -- -- -- b4 b3 -- -- -- -- b0
S . Least significant
+0
4 bits
Least significant
1
4 bits
Least significant
2
4 bits
Least significant
3
4 bits D .
Data to be
Omitted
combined
2. When S2 is ranging from 1 to 3, the ones of the LSB {4 × (4-S2)} of D are zero.
b15 -- -- -- -- -- -- -- b4 b3 -- -- -- -- b0
S . Least significant
+0
4 bits
Least significant
+1
4 bits
Least significant
+2
4 bits
D .
Data to be
Omitted
combined
0 when n =3.
3. When the range of S2 is 1-4, and S2=0, the instruction is not executed.
4. The source and destination operands cannot overlap.
⚫ Application instance
LD M1
UNI D0 D10 4
Combining the lower four bits of four units of data starting from D0, and storing them in D10. When D0=0x01, D1=0x02,
D2=0x03, and D3=0x04, D10=0x1234.
⚫ Operand description
247
VC Series Micro-PLC Programming Manual Application instructions
S1: Number of the start soft element that stores data to be separated
S2: Number of the separated data (when the range of S2 is 0-4, and S2=0, there is no processing)
D: Number of the soft element that stores the separated data
⚫ Function description
1. Storing S2 16-bit data starting from S1 in S2 soft elements starting from D.
Least significant
S . D . +0 4 bits
Least significant
+1 4 bits
Least significant
+2 4 bits
Least significant
+3
4 bits
2. The valid range of S2 is 1-4, and the rest of the data do not execute the instruction.
3. The upper 12 bits of S2 soft elements starting from D are cleared.
4. The source and destination operands cannot overlap.
⚫ Application instance
LD M1
DIS D0 D10 4
Separating every 4 bits of the data in the D0 unit, and storing these data in four units starting from D10 when M1=ON. When
D0=0x1234, D10=0x01, D11=0x02, D12=0x03, and D13=0x04.
248
VC Series Micro-PLC Programming Manual Application instructions
249
VC Series Micro-PLC Programming Manual Application instructions
⚫ Operand description
S1: ON scanning times
S2: OFF scanning times
D: Destination address of timed pulse output
⚫ Function description
1. The timed pulse output unit D changes with the ON and OFF scanning times (specified in S1 and S2, respectively).
2. SM unit. Range: SM430-SM434.
Destination address of Soft elements for counting
timed pulse output the number of scans
SM430 SD430
SM431 SD431
SM432 SD432
SM433 SD433
SM434 SD434
3. This instruction can be used for 5 times, but the same timing clock output destination address cannot be used in multiple
DUTY instructions.
⚫ Application instance
When M1=ON, 10 scans are ON, and 10 scans are OFF in SM430, and the count value of the scan times is saved in D430
at the same time.
⚫ Note
When the operation starts at the rising edge of the instruction, the energy flow does not stop even if it is cut off. It stops in
STOP or upon power outage.
250
VC Series Micro-PLC Programming Manual SFC Tutor
This chapter introduces the basic programming concepts, basic and complex programming methods, and note ofSFC.
Chapter 7 SFC Tutor .......................................................................................................................................................251
251
VC Series Micro-PLC Programming Manual SFC Tutor
The Sequential Function Chart, or SFC, is a programming language that developed and got popular in recent years. SFC can turn
a PLC programming project into a structured flow chart. By using the programming elements and language structure compliant
with IEC61131-3 standard, it divides a complex systematic process into sequential multi-step procedures and transitions between
the procedures, and thus implements sequential control.
The SFC programming is direct and sequential. Each procedure and conversion condition after decomposition is a relatively
simple program process, which isideal for the sequential control application. These advantages explain why it has been widely
used.
The SFC of VC series PLCs is a programming language used by VEICHI's VC series PLC products. In addition to the standard
SFC functions, one or more LAD program blocks can be built in the SFC of VC series PLCs.
The program written with SFC of VC series PLCs can be converted into corresponding LAD or IL program.
The SFC of VC series PLCs can also support a maximum of 20 independent processes. These independent processes can be
run independently, that is to say, the step state within each process are scanned and transferred separately by process. Jumping
among the independent procedures is enabled.
The SFC has two basic concepts: step state and transfer. Other concepts, such as jump, branch and multiple independent
processes, are derived from these two basic concepts.
⚫ Stepstate
1. Definition of step state
A step state is actually an independent program, representing a working state or an operation in the sequence control process.
Putting multiple step states together in a organic way can form a complete SFC program.
A step state is valid when it is being executed. For a valid step state, the state of its corresponding S element is ON, and the
PLC scans and executes all of the instruction sequences within it. A step state is invalid when it is not executed. For an
invalid step state, the state of its corresponding S elementis OFF, and the PLC does not scan and execute its instruction
sequences.
⚫ Transfer
The sequence control process is actually a series of step state switching processes. A PLC that is executing a step state
leaves the current step state, and enter and execute a new step state if certain logic conditions are met. This switching
process is called the transfer of the step state.
The logical condition that triggers the transfer is called the step transfer condition.
⚫ Programming symbols
The VC series PLC SFC programming language consists of the following basic programming symbols:
252
VC Series Micro-PLC Programming Manual SFC Tutor
Symbol name Symbol Description
An initial step state, numbered as Sn. The "n" cannot be repeated. The
execution of a SFC program needs to start with an initial step symbol. The
Initial step
address range of S soft element corresponding to an initial step symbol is
S0–S19
A normal step state, numbered as Sn. The "n" cannot be repeated. The
Normal step address range of S soft element corresponding to a normal step symbol is
S20--S991
A jump symbol, used after the transfer symbol. It can set the specified S
Jump element to ON when the transfer conditions are met. It is used to cycle or
jump among the step state.
A reset symbol, used after the transfer symbol. It can set the specified S
Reset element to OFF when the transfer conditions are met. It is used to end the
SFC program.
Multiple independent transfer conditions, used after a step symbol. When the
transfer condition of one branch is met, the last step state ends, and the next
Selection branch step state of the corresponding branch starts.It is used to select one of
multiple step branches. After selecting one branch, no other branches can be
selected.
Connected after a step symbol, and the subsequent parallel branches share
Parallel branch the same transfer condition. When the transfer condition is established, the
subsequent parallel branches are validated and executed at the same time.
The LAD block is used to represent LAD instructions other than the SFC
LAD block
flow. It can be used to start the initial step and other general operations.
3. A normal step symbol can only be connected with a transfer symbol. The normal step symbol cannot exist alone in the
diagram.
4. The reset and jump symbols need to be preceded by transfer symbols and followed by nothing.
5. Neither a transfer symbol nor a jump symbol can exist alone in a program.
The process structure of a SFC is classified into three types: simple sequential structure, selection branch structure and parallel
branch structure. Besides, the jump structure is also a special form of the selection structure.
253
VC Series Micro-PLC Programming Manual SFC Tutor
In a simple structured SFC program, when the step transfer conditions are met, the program is sequentially transferred from
the current step state to the next step state without any branch structure.At the last step, when the transfer conditions are
met, the SFC program section either ends or transfers to the initial step state.
1. LAD block
The LAD block is used to start the SFC program section. To be specific, setting the S element of the initial step symbol to
ON. In the preceding figure, the program uses the power-on startup mode.
The LAD block can also be used in other general program sections except the SFC program.
2. Initial step state
As shown in above figure, the initial step state is started by a LAD block. The range of S elements for initialstep stateis 0–
19.
3. Normal step symbol
The normal step symbol is used for programming in sequential processes. The range of S elements for normalstep state is
20–1023.
4. Transfer or reset
The last transfer symbol of the program shown in the above figure is connected with a jump symbol, which leads the program
to jump to the initial step state. This is a cyclic program.
However, the last transfer symbol of the program can be connected with a reset symbol, which can reset the last step state.
After the reset, the program ends, andwaits for the next round of execution.
254
VC Series Micro-PLC Programming Manual SFC Tutor
1. Selection branch
The step state of a branch is validated when its corresponding transfer conditions are met. You need to ensure that the
transfer conditions of different branches are all exclusive, so as to make sure that each time only one branch is selected.As
shown in the preceding figure, S27 and S28 in row N12 of LAD program are transferred from conditions M20 and M21
respectively. The conditions M20 and M21 must not be set at the same time in order to ensure that S27 and S28 are not be
selected at the same time.
2. Selection merge
The selection merge is the structure where all selection branches merge to the same step state. The transfer conditions
areset respectively. As shown in the preceding figure, the transfer condition in the step state S27 in row N13 is that time is
up for T12,while that in the step state S28 in row N14 is that time is up for T13. However, the results are the same: step state
S29 starts.
1. Parallel branch
When the transfer conditions of the parallel branch structure are met, each step state connected to the parallel branch
structure is simultaneously activated. This is also a common sequential control structure, which enables the PLC to process
multiple procedures at the same time. As shownin row N5 program of the preceding figure, S30 and S31 are validated at the
same time when transfer conditionM30 is met and M30 is set.
2. Parallel merge
When the transfer conditions of the parallel merge structure are met, each step state connected to the parallel merge
structure becomes invalid at the same time. As shownin row N6 program of the preceding figure, when the program is running
both S30 and S31 at the same time, and M31 is set, the program starts S32 and ends S30 and S31.
The transfer condition for the parallel mergeis that the transfer action can be executed only when all individual steps are
finished before merging.
⚫ Jump structure
The jump structure is often used for the following purposes: to omit certain step states, to cyclically return to the initial step
state or the normal step state, andto jump to other processes.
255
VC Series Micro-PLC Programming Manual SFC Tutor
1. Omitting certain step states
In a process, when sequential execution is not required under certain transfer conditions, the program can jumps directly to
the needed step state and omits the unnecessary step states, as shown in the following figure, with LAD on and left and SFC
on theright.
In the SFC program shown in the preceding figure, the jump symbol S21 is used as the jump, while the step state S20 is
skipped. In fact, a branch structure is selected before the jump is performed.
In the LAD, the second branch in row N0 is a jump instruction, which adopts the form of an OUT coil instead of an form of
the SET instruction that issequentially transferred. When running in the step state S0 and M1 is ON, the program jumps to
the step state S21.
2. Cycling
In a process, when it is necessary to cycle a part or all of the step states under certain transfer conditions, you can use a
jump symbol to implement the cycle function. At the end of this process, a part of the step states can be cycled if the program
jumps to the previous normal step symbol, or all step states can be cycled if the program jumps to thei nitial step symbol.
The following figure shows a program that realizes the above two cycle structures at the same time, with LAD on the left and
SFC on theright.
In the SFC, when the step state S22 is valid and one of the transfer conditions is met, the program jumps to S21 and re-run
the step state S21. Under another transfer condition, the program jumps to the initial step state S0 and re-run allstep states.
In LAD, these two kinds of jumps are realized in row N3, where you can see the OUT coil of the jump instruction.
3. Jumping among different independent processes
The SFC of VC series PLCs support multiple independent processes at the same time, and jumping among these processes
is enabled. You can set certain transfer conditions in an independent process, and when the conditions are met, it is directly
transferred to another independent process, or it jumps to a random step state (initial ornormal) of another independent
process.
Note
Jumping among multiple independent processes complicates the PLC program. You need to use it with prudence.
The following figure shows a program that realizes a jump from one independent process to another, with LAD on the left
and SFC on the right.
256
VC Series Micro-PLC Programming Manual SFC Tutor
In the SFC, when the step state S0 in the first process is valid, the program can jump to the step state S23 in the second
process
under certain transfer conditions; while the step state S1 in the second process is valid, the program can also jump to the
step state S20 in the first process under certain transfer conditions.
As shown in the preceding figure, the jump is based on a selection branch structure. When the program jumps to another
process, all step states in the original process become invalid. As shown in the example, if the program jumps to the step
state S23 in the second process from the step state S20 in the first process, the S20 is set to OFF and all step states (S0,
S20, and S21) in thefirst process become invalid (OFF).
The similarity between the execution of a SFC program and that of a LAD program is that they both carry out the continuously
cyclic scanning from up to down and from left to right.
On the other hand, their difference lies in: in a SFC program, the step states’ validity can change according to the sequence
conditions, and only internal instruction sequences in the valid step states can be scanned and executed. While in the main
program of a normal LAD, all programs are scanned and executed in each scan cycle.
As shown in the following figure, the program on the right is the LAD counterpart of the SFC program on the left. When the step
state S20 is valid, the T2 timer is scanned and starts timing. The step states S21 and S22 are not be executed before T2 timer
reaches the preset value, and S23 is not executed when M13 is OFF.
257
VC Series Micro-PLC Programming Manual SFC Tutor
The state of S elements is switch between ON and OFF according to the transfer conditions, thus making the program transfer
from one step state to another. When a S element changes from ON to OFF, the output elements of the corresponding step state
are reset or cleared. For details, refer to section 5.3.1 "STL: SFC state loading instruction".
Note
1. The SFC program of VC series PLCs usually contains SFC and LAD blocks. The LAD blocks are used to handle operations
outside the process, including starting the SFC. The LAD blocks are not controlled by the S elements, and the program rows of
these LAD blocks scanned by the PLCs are executed in every scan cycle.
2. The state change of the S element affects the built-in instructions of the corresponding step states, and the switch-over between
two step states takes some time, so it is necessary to observe certain rules on the operation of certain soft elements and usage
of the instructions during the SFC programming.
In a LAD, the SFC symbols are replaced with various corresponding SFC instructions, while the corresponding processes are
represented by various structures.
In a LAD, a step state is started by a STL instruction.All step states are represented by S elements.
The following diagram on the left is a LAD program of a simple sequential structure, and the diagram on the right is it
scorresponding SFC program.
As shown in the LAD program, the step state S2 starts with a STL instruction, and the following TON instruction is the internal
instruction sequence of S2. An internal instruction of the step state can be made up of multiple statements, which is actually a
relatively complete program section, and almost consistent with the normal LAD counterpart.
The difference between an initial step state and a normal step state only lies in the range in which the S elements are selected.
258
VC Series Micro-PLC Programming Manual SFC Tutor
For details about the STL instruction, refer to section 5.3.1 "STL: SFC state loadinginstruction". You need to note that when the
step state changes from ON to OFF, the destination operands corresponding to the built-in instructions (OUT, TON, TOF, PWM,
HCNT, PLSY, PLSR, DHSCS, SPD, DHSCI, DHSCR, DHSZ, DHST, DHSP, and BOUT)are cleared.
Note
Because the PLCs run in continuous scan cycles, after a step state transfer, those built-in statements of the original step state are
not be affected by the transfer of ON to OFF until the next scan. For details, refer to section 7.4.1 "Common programming errors".
As shown in the preceding diagram, the transfer symbols in the SFC program on the right are realized through the SFC state
transfer instruction.
The transfer conditions consist of the NO contacts before the SET statements. The NO contacts are controlled by built-in
instruction statements or through the external operations.
Setting the specified step state to be valid when the energy flow of the SFC state transfer instructionis valid, and setting the current
valid step state to be invalid to complete the state transition.
As shown in the preceding diagram, the SFC program on the right starts with a S2 initial step symbol, and returns to S2 after
passing two ordinary step symbols. While in the LAD, the end of a segment of the SFC program needs to be marked with the RET
instruction.
As shown in the preceding diagram, the jump to S2 is realized in LAD by the N3 row, which uses an OUT instruction. The
destination operand of the OUT(jump) instruction can be in any independent procedure.
If the reset symbol S26 is used, line N3 in the LAD is a RST instruction, which can reset the last step state S26.
For details about LAD counter part of SFC selection branches, refer to selection branch structure of section 7.1.5 "SFC program
structure".
For details about LAD counterpart of SFC parallel branches, refer to parallel branch structure of section 7.1.5 "SFC program
structure".
The structure of a SFC program is classified into three types: simple sequential structure, selection branch structure and parallel
branch structure. Besides, the jump structure is also a special form of the selection branch structure.To program with SFC, the
first step to do is to determine the structure of the flow. For example, a single object passing through a sequential flow is a simple
sequential structure. Multiple objects with different parameters to be processed asynchronously needs a selection branch structure.
While a cooperation of multiple independent mechanical elements may need a parallel branch structure.
2. Determining the major procedures and transfer conditions to draw a draft of the flow chart
After determining the structure, you need to figure out the major procedures and transfer conditions. By dividing the work flow into
smaller operation stages, you can get the procedures. Ending each procedure with a transfer condition,and then you can get a
draft of the work flow.
259
VC Series Micro-PLC Programming Manual SFC Tutor
Using the SFC programming language in Auto Studio to make a SFC program out of a draft of the flow chart. By now you have
got an executable PLC program, but the program needs to be improved.
4. Making a list of I/O pointsand determining the object of each procedure and actual transfer conditions
Generally, the input points are mostly transfer conditions while the output points are mostly operation objects. In addition, with the
list, you can further modify the SFC.
In the SFC programming interface, you can right click a SFC symbol and select Embedded LAD item in the shortcut menu. Then
you are able to open the built-in LAD editing workspace of this symbol, and input the LAD programs and transfer condition.
You need to remember to program some program blocks that provide general functions, such as start, stop and alarm functions
of the sequence process. Such program blocks need to be placed in LAD blocks.
Note
The start and stop operations are crucial for personal and equipment safety. Considering the special features of SFC program,
you need to make sure that all outputs that should be stopped are shut down when the PLCs are stopped.
In the same PLC program, each step state symbol used for sequential control programming corresponds to a unique S element
and cannot be reused.
You need to note this requirement when editing a SFC program using the LAD editor.
Setting conditioned branches after a transfer condition is disabled in SFC programming, as shown in the left diagram below.
Because M1 has become a transfer condition and cannot be branched. Instead, you can change it into the right diagram below,
which can be compiled correctly.
When a NO or NC contact instruction is used in a branch, the output coils in the subsequent branches are prohibited to connect
the internal bus, as shown in the left diagram below. Instead, you can change the branch order into the one shown in the right
diagram below, which can be compiled correctly.
260
VC Series Micro-PLC Programming Manual SFC Tutor
When the PLCs execute the program, the instructions are cyclically scanned by their display orders. When the program shifts
from the previous step state to the next step state, the sequence of instructions in the previous step state just ends the scan, and
the sequence of instructions in the next step state has also been turned on to form a control output.
Therefore, when the STL instruction is turned from OFF to OFF, certain internal elements of the instruction are reset (For details,
refer to section 5.3.1 "STL: SFC state loading instruction"), but the reset can only be carried out during the next scan cycle. That
is to say, at the moment of transferring the step state, the internal elements of the last step state retains their original data and
states until the step state is scanned in the next cycle.
As shown in the following diagram, the two neighboring step states use the same timer: T2. When the step state is shifted from
S0 to S20,the T2 element keeps its timing value and state, rendering the step state S20 unable to perform the timing operation
as it is originally designed by the user. The program will jump directly to S21 and S22. Therefore, you need to note that reusing
soft elements in a program is not prohibited, but it is best not to reuse them in the neighboring step states, otherwise unexpected
results may occur.
During the SFC programming, certain soft elements may become contradictory to each other under some special transfer
conditions of the step states. At this time, inter-locking isnecessary.
Taking the following forward and backward operation program as an example, where Y0 and Y1 are respectively forward and
backward control output. X0 is forward operation, X1 is backward operation, and X2 is stop button. It is required that Y0 and Y1
are interlocked, that is to say, they cannot be ON at the same time.However, in this example, when the device runs forward, and
X1 is turned ON to shift the step state from S5 to S33, Y0 and Y1 are both ON in one program scan cycle.
Forward operation
Reverse operation
Forward
Stop button
261
VC Series Micro-PLC Programming Manual SFC Tutor
Therefore, you need to add the interlock statements to the program by adding a Y0 NC contact before the Y1 output coil, as shown
in the following diagram.
Forward operation
Reverse operation
Forward
Stop button
Jumps are mostly used between different processes and non-neigh boring step states, while transfers are used between the
neighboring step states. It is prohibited to change an output coil into a SET instruction statement where a jump should be used,
or change a SET instruction statement into an output coil where a transfer should be used.
7. Selecting a parallel branch structure as the branch transfer point, causing the failure to end the process
A branch is selected from multiple ones. If parallel branches are included, the process may never be ended, as shown in the
following figure. In the program on the left,when process 1 runs to the step state S41, the transfer condition is a parallel branch,
and therefore the system does not run process 2,causing the failure to implement the transfer condition, and thus causing a
process error.
Process 2
Process 1
Modify
The modification method is shown in the program on the right, you need to add a step state S42 whose function is the same as
S41. Then you need to add an empty step state S43 that serves as a programming structural element without actual function. The
transfer conditions of S38, S41, and S43 need to be designed by the programmers, for example, all of them can adopt the transfer
conditions of the original S41.
262
VC Series Micro-PLC Programming Manual SFC Tutor
You can use empty step states to deal with the branches with grammatical problems. The empty step states do not provide actual
operation, but a necessary node in structure before the next transfer. You can see the following example.
In the left diagram below, the selection merge is connected immediately with another selection branch structure, which is prohibited.
You can modify it by adding an empty step stateas shown in the right diagram.
Modify
Inexecutable branch
structure
Add a empty step state
263
VC Series Micro-PLC Programming Manual SFC Tutor
In the left diagram below, the selection merge is connected immediately with a parallel branch structure, which is prohibited too.
You can also modify it by adding an empty step state as shown in the right diagram.
Modify
Inexecutable
Add a empty step
branch structure
state
You can address other tricky structures, such as parallel merge connected with parallel branches, or parallel branches connected
with selection branches, by adding an empty step state.
Some branches that seem complicated are actually caused by improper designand can be merged or simplified appropriately.
As shown in the following diagram, the designer set a selection branch first, and then set two selection branches. In fact, only one
selection branch of four branches can achieve the same, and the two levels of transfer symbols of the original design can be
merged into one.
Mergeable
conditions Combine the mergeable
conditions before the
modification
Modify
The values of S elements can be kept by the function for saving data at power outage. In this way, after the power on, the program
can rerun from the step state when the power outage occurred.
264
VC Series Micro-PLC Programming Manual SFC Tutor
The following example is a workpiece tray lifting and conveying machine. This machine uses cylinder lifting devices and conveying
rollers to convey the workpiece tray from one conveying belt to another. The following figure shows a top view of the machine.
Conveying Conveying
belt belt
Height OK In lift 2
Left-side lift
cylinder
In lift 1 Lift Conveying Lift Limit switch
Right-side lift
rollers
cylinder
Cylinder/solenoid valve
After the machine is started, the workpiece tray is conveyed along the convey or belt at the left sideto the entrance of the machine
and triggers the "Tray in" limit switch. If no other tray is occupying the machine, the "Baffle plate" lowers down to let the work
piecetray enter the machine. When the tray has completely entered the left lift, it triggers the "In lift 1" limit switch, the lift raises
the tray until the "Height OK" limit switch is triggered. The rollers then act to convey the tray to the lift on the rightside until the "In
lift 2" limit switch is triggered. The lift then lowers to put the tray to the conveying belt on the right.When the "Convey complete"
limit switch is reset, a complete lifting and conveying process is over and the machine is ready for the next round.
265
VC Series Micro-PLC Programming Manual SFC Tutor
The following diagrams are the SFC program and its LAD counterpart.
Use XO as the transfer condition, and S20-S23 as the limit to prevent the next tray from entering
before the current operation ends
Lower the baffle plate to let the tray in lift 1. Delay: 1s
Delay (1 s) time is up and start the next step
Lifting cylinders (Y1 and Y2) act till Hight OK switch (X2) acts. Delay: 0.8 s.
Mixing pot
Stirring paddle
Y4 evacuation valve
To start the operation, the first step is to select the product type, A or B through the touch screen for the next batch of products,
and then start production. The second step is to add the major ingredients until the weight of the added ingredient reaches 2000kg.
The third step is to add minor ingredients, namely adding A minor ingredients for type A product or B minor ingredients for type B
product until the added A or B minor ingredient reaches 500kg respectively. The forth step is to mix the ingredients for 20 minutes.
The fifth step is to evacuate the materials until the remaining material is less than 20kg and the delay time is up. Once these steps
are complete, the machine is ready for the next round.
If it is the first time for the machine to start production, or the product type of the previous batch is different from what is going to
be produced, you need to open the deionized water valve and evacuation valve to rinse the machine for 5 minutes before adding
the major ingredients.
266
VC Series Micro-PLC Programming Manual SFC Tutor
The following diagrams are the SFC program and its LAD counter part.
Initial step
267
VC Series Micro-PLC Programming Manual SFC Tutor
/*Reset M1-M3*/
268
VC Series Micro-PLC Programming Manual SFC Tutor
/*When the left material is less than 20 kg and half-minute has passed, enter the next step.*/
The following example is a bottle packager. This packager seals the bottles and sticks labels to them. Meanwhile, it examines the
bottle caps and labels, so that the flawed products are eliminated in the third procedure, while the qualified products continue to
the next work flow.If no bottle is sent from the last work flow, the packager does not conduct any sealing or labeling. These three
procedures are carried out at the same time, and each bottle moves from one position to another each time the rotary plate
rotates.The following figure shows the illustration of the packager.
269
VC Series Micro-PLC Programming Manual SFC Tutor
Eliminating
Labelling cylinder Y3
cylinder Y2 Labelling cylinder
Capping cylinder
Capping rod BACK X10 rod BACK X11 Eliminating cylinder
cylinder Y1 rod BACK X12
Labelling cylinder
Capping cylinder rod OUT X6 Eliminating cylinder
rod OUT X7
rod OUT X5
Cap
Rotary plate of the
packing machine
of
e
at g
p l ki n
y c
ar a ne
ot p hi
R the ac ng th
e
Entrance of rotary m ni of te Rotary plate station
un
plate R tion pla proximity switch X0
c y
re a r
El lin
d i ro t
im de
cy
in r Y
at 3
in
g
Cap in position Rotary plate motor Y0
detection switch X2 Exit of
X3 tion
Labelling cylinder Y2 disqualified
itch tec
products
sw g d e
C
llin
ap
pi
be
ng
La
cy
lin
Bottle in position
de
detection switch X1
rY
1
During the operation, the rotary plate rotates one step each time, which is detected by the X0 limit switch. The rotary plate stays
at each step long enough for all the three procedures, driven by cylinders, finished. The cylinder rod OUT signal and cylinder rod
BACK signal are monitored respectively.
In the program, M1-M3 are the qualification flags for the procedures of capping, labeling and eliminating respectively.
When the capping procedure runs to S22, X2 checks whether the capping is qualified or not. If yes, the corresponding qualification
flag M1 is set. When the labeling procedure runs to S25, X3 checks whether the labeling is qualified or not. If not, M2 is reset.
After all the procedures are complete, at step S29, the M2 state is transferred to M3, and M1 state is transferred to M2.
The capping procedure acts according to X1 state. If X1 indicates that no bottle is in position, the capping does not proceed. The
labeling procedure acts according to M2 state. If M2 is OFF, it indicates that the bottle in position is disqualified, and the labeling
does not proceed. The eliminating procedure acts according to M3. If M3 is ON, it indicates that the bottle is qualified, and the
elimination does not proceed, and vice versa. In both cases, M3 is reset in S32 to prepare for the next procedure.
270
VC Series Micro-PLC Programming Manual SFC Tutor
Initial step
When a X0 rising edge is The labelling
detected procedures The eliminating
The capping procedures
M2 qualification
procedures
flag
M3 qualification
flag
Transfer
conditions
Parallel merge
Transfer the qualification flag states
from M1 to M2 and M2 to M3
Emergency switch
/*Initial step. Transfer condition: rising edge of X0, indicating rotary plate in position.*/
Plate in position
/*Capping*/
Bottle in position
Bottle in position
271
VC Series Micro-PLC Programming Manual SFC Tutor
Capping
cylinder
Capping
cylinder rod
Capping Capping
check qualified
Capping rod
back
/*Labelling*/
Labelling
qualified
Labelling
qualified
Labelling
cylinder
Labelling rod
cut
Labelling Labelling
detection qualified
Labelling rod
back
/*Elimination*/
Elimination
success
Elimination
success
Eliminating
cylinder
Eliminating rod
out
Eliminating rod
back
Elimination
success
272
VC Series Micro-PLC Programming Manual SFC Tutor
Elimination
Labelling success
qualified
Labelling
qualified
Labelling
Capping
qualified
qualified
Capping
qualified
273
VC Series Micro-PLC Programming Manual Operating guide for high-speed input function
This chapter detailedly describes the usages and notes about the high-speedinput function, including high-speed counters and
pulse capture.
Chapter 8 Operating guide for high-speed input function ................................................................................................274
274
VC Series Micro-PLC Programming Manual Operating guide for high-speed input function
8.1.1 Configuration
The built-in high-speed counter for VC series micro-PLCs are configured as follows:
VC5 VC2
Counter X0 X1 X2 X3 X4 X5 X6 X7 VC3 VC1 VC1S
Up/Do
C236 wn
Up/Do
C237 wn 50
Up/Do
C238 wn
Up/Do
Sin C239 wn
gle- Up/Do
pha C240 wn
se
Up/Do
one
C241 wn 10 10
poin
Up/Do
t
C242 wn
inpu
t Up/Do
mod C243 wn 10 /
e Up/Do
C244 wn Reset 50
Up/Do
C245 wn Reset 10
Up/Do
C246 wn Reset Start 50
Up/Do
C247 wn Reset Start 200 10 10
C248 Up Down 30
Sin C249 Up Down 5 10
gle-
pha C250 Up Down 5 /
se C251 Up Down 5
bidir
ecti C252 Up Down Reset 30
onal
cou C253 Up Down Reset 5
nt C254 Up Down Reset Start 30
inpu
t C255 Up Down Reset Start 200 5 10
A B
C256 phase phase 30 5
A B
C257 phase phase
A B
C258 phase phase
A B
Two C259 phase phase 5 /
- A B
pha C260 phase phase Reset 30
se A B
cou C261 phase phase Reset 5
nt A B
inpu C262 phase phase Reset Start 30
tmo A B
de C263 phase phase Reset Start 200 5 5
Input Input Input Input Input Input Input Input 200 10
point point point point point point point point
SPD instruction 10
Input Input Input Input Input Input Input Input
Pulse capture
point point point point point point point point
function
275
VC Series Micro-PLC Programming Manual Operating guide for high-speed input function
External interrupt
number 0/8 1/9 2/10 3/11 4/12 5/13 6/14 7/15
In the modes listed in the preceding table, the high-speed counters act according to certain input and handle high-speed
action according to interrupts. The counting action is unrelated to the PLC scan cycle.
This kind of high-speed counters are of the 32-bit bi-directional counting type. According to their different counting up/down
switch over methods, they can be divided into the following four categories:
Counting mode Counting action
Single-phase one port
Counters C236–C247 count down/up when SM236–SM247 are ON/OFF.
count input
Single-phase Corresponding to the action of counting up or down input, the counters C248–C255 are automatically
bidirectional count incremented/decremented. You can know the current count direction of the corresponding counter through
input SM248–SM255. The counter counts up when the SM element is OFF, or counts down when OFF.
When SM100–SM103 is set to OFF, counters C256–C263 are automatically incremented and
decremented according to the two-phase input. You can know the current count direction of the
corresponding counter through SM256–SM263. The counter counts up when the SM element is OFF, or
counts down when OFF. The count direction is defined as follows:
Two-phase count +1 +1 -1 -1
input ON
A
OFF
ON
B
OFF
When SM100–SM103 is set to ON, counters C256–C263 are automatically quadrupled up and down
according to the two-phase input. You can know the current count direction of the corresponding counter
through SM256–SM263. The counter counts up when the SM element is OFF, or counts down when OFF.
The count direction is defined as follows:
+1 +1 +1 +1 -1 -1 -1 -1
Two-phase quad
ON
frequency count input A
OFF
ON
B
OFF
+1 +1 +1 +1 -1 -1 -1 -1
⚫ Special auxiliary relay for controlling count direction ⚫ Special auxiliary relay for controlling quad-frequency
Type Counter SN Up/down control Quad-frequency
Type Counter SN
C236 SM236 setting
C237 SM237 C256 SM100
C238 SM238 C257 SM101
C239 SM239 C258 SM102
C240 SM240 Two-phase count C259 SM103
Single-phase one C241 SM241 input C260 SM100
point count input C242 SM242 C261 SM102
C243 SM243 C262 SM100
C244 SM244 C263 SM102
C245 SM245
C246 SM246
C247 SM247
⚫ Special auxiliary relay for monitoring count direction
Type Counter SN Up/down monitor
C248 SM248
Single-phase C249 SM249
bidirectional C250 SM250
count input C251 SM251
C252 SM252
276
VC Series Micro-PLC Programming Manual Operating guide for high-speed input function
Type Counter SN Up/down monitor
C253 SM253
C254 SM254
C255 SM255
C256 SM256
C257 SM257
C258 SM258
Two-phase count C259 SM259
input C260 SM260
C261 SM261
C262 SM262
C263 SM263
277
VC Series Micro-PLC Programming Manual Operating guide for high-speed input function
The time sequence chart of the contact actions in the program is shown in the following figure.
278
VC Series Micro-PLC Programming Manual Operating guide for high-speed input function
The time sequence chart of the contact actions in the program is shown in the following figure.
262
262
262
279
VC Series Micro-PLC Programming Manual Operating guide for high-speed input function
The time sequence chart of the contact actions in the program is shown in the following figure.
⚫ How to use the two-phase quad frequency count input high-speed counters
Characteristics: A two-phase quad frequency count input high-speed counter starts to count when the pulse input changes
from OFF to ON or ON to OFF, and the count direction is determined by the phase difference between the two input points.
The state of the high-speed counter is determined by its corresponding special auxiliary relay SM.
280
VC Series Micro-PLC Programming Manual Operating guide for high-speed input function
The time sequence chart of the contact actions in the program is shown in the following figure.
Total input frequency when multiple software high-speed counters, or when high-speed counters and the SPD instruction,
are used at the same time, is shown in the following table.
conditions of usage Total input frequency
DHSCS, DHSCR, DHSCI, DHSZ, DHSP, and DHSTare not used ≤60 kHz
DHSCS, DHSCR, DHSCI, DHSP, DHST are used ≤30 kHz
DHSZ is used ≤20 kHz
⚫ Max. frequency of hardware counters
Counters C236, C237 and C256 are hardware counters. Among which:
• C236 and C237 are single-phase counters with max. counting frequency of 50kHz.
The high speed counters used in DHSCS, DHSCR, DHSCI, DHSP or DHST instructions works in the software counter mode.
The max. input frequency for the single-phase counters and two-phase counters are 10kHz and 5kHz respectively.
When used in the DHSZ instruction, the max. input frequency for the single-phase counters and two-phase counters are 5
kHz and 4 kHz respectively.
Note
1. When the external input points change from OFF to ON, the SM soft elements of the corresponding portsare set to ON.
2. SM90–SM97 are cleared when the user programstarts.
3. When using the pulse capture, the counters need to observe the sum limit of the input pulse frequency of each PLC series,
otherwise an abnormality may occur.
4. When the high-speed counter or SPD instruction corresponding to HCNT are used on the same input point, the pulse capture
becomes invalid after the first scan cycle, regardless of whether the instructionis valid or not.
282
VC Series Micro-PLC Programming Manual Using Interrupts
This chapter detailedly describes the mechanisms, processing procedures, and usages of various interrupts.
Chapter 9 Using Interrupts ...............................................................................................................................................283
283
VC Series Micro-PLC Programming Manual Using Interrupts
The system provides many kinds of programmable interrupt resources. Each kind of interrupt resource can trigger a type of
interrupt events, and each type of interrupt eventsis independently numbered.
In order to deal with a certain interrupt event, you must compile a processing program, that is, an interrupt program,
An event number needs to be designated for each interrupt program in order to link the user interrupt program with the interrupt
events designated with the event number. When responding to the interrupt request of the interrupt event, the system calls the
corresponding user interrupt program based on the interrupt event number.
The following list shows the interrupt resources provided by the VC series micro-PLCs:
284
VC Series Micro-PLC Programming Manual Using Interrupts
Event
Event Interrupt enabling
Interrupt event Enabling SM numbe Interrupt event
number SM
r
X0 input rising edge High-speed counter interrupt
0 SM25 33 SM58
interrupt 0
X1 input rising edge High-speed counter interrupt
1 SM26 34 SM58
interrupt 1
X2 input rising edge High-speed counter interrupt
2 SM27 35 SM58
interrupt 2
X3 input rising edge High-speed counter interrupt
3 SM28 36 SM58
interrupt 3
X4 input rising edge High-speed counter interrupt
4 SM29 37 SM58
interrupt 4
X5 input rising edge High-speed counter interrupt
5 SM30 38 SM58
interrupt 5
X6 input rising edge High-speed counter interrupt
6 SM21 39 SM58
interrupt 6
X7 input rising edge High-speed counter interrupt
7 SM32 40 SM58
interrupt 7
X0 input falling edge Interpolation completion
8 SM33 41 SM69
interrupt interrupt 1
X1 input falling edge Interpolation completion
9 SM34 42 SM69
interrupt interrupt 2
X2 input falling edge Interpolation completion
10 SM35 43 SM69
interrupt interrupt 3
X3 input falling edge Interpolation completion
11 SM36 44 SM69
interrupt interrupt 4
X4 input falling edge Position-based interrupt 0 of
12 SM37 45 SM61
interrupt high-speed output
X5 input falling edge Position-based interrupt 1 of
13 SM38 46 SM62
interrupt high-speed output
X6 input falling edge Position-based interrupt 2 of
14 SM39 47 SM105
interrupt high-speed output
X7 input falling edge Position-based interrupt 3 of
15 SM40 48 SM106
interrupt high-speed output
285
VC Series Micro-PLC Programming Manual Using Interrupts
PTO (Y3) output
28 SM53
completion interrupt
PTO (Y4) output
29 SM54
completion interrupt
PTO (Y5) output
30 SM55
completion interrupt
PTO (Y6) output
31 SM56
completion interrupt
PTO (Y7) output
32 SM57
completion interrupt
(1) If the system detects that any request in the interrupt queue, it stops the normal execution of the user program.
(2) The system reads the head record in the interrupt request queue, which records the number of the interrupt event that
occurred first. The user interrupt program corresponding to the event number is called and executed.
(3) When the corresponding interrupt program has been executed (the interrupt return instruction has been executed), the
interrupt request is processed, the corresponding head record of the request queue is deleted from the queue, and all the
following records takes one step forward.
(4) The system detects again whether the interrupt request queue is empty. If it is not empty, the system repeats the above
procedures until the queue is empty.
(5) When the interrupt request queue is empty, the system continues to execute the interrupted main program.
3. The system can handle only one interrupt request at one time. When the system is processing an interrupt request,a new
interrupt event is added to the interrupt request queue rather than being responded immediately. The system processes it after all
the requests ahead of it in the queue are processed.
4. When there are 8 records in the interrupt request queue, the system automatically masks the new interrupt eventso that no new
request is added to the queue. The mask is not cancelled until all the requests in the queue have been processed and the
interrupted main program has been executed.
Note
1. The interrupts should be brief, or abnormalities may occur, including the mask of other interrupt events (missing of
interruptrequests), system scan overtime and low execution efficiency of the main program.
2. It is prohibited to call other subprograms in the interrupt program.
3. If you want to refresh I/O immediately during the interrupt, you can use the REF instruction. You need to note that the execution
time of the REF instruction is related to the number of the I/O points to be refreshed.
4. An interrupt event can generate an interrupt request only when the corresponding interrupt event flag is enabled (each type of
interrupt event enable/disable control corresponds to the related SM elements. To enable some type of interrupt events
requiressetting the corresponding SM element to ON), and the global interrupt enable flag is turned on.
5. When an interrupt request with no corresponding interrupt program in the user program is generated, the system responds to
the interrupt request, but no operation.
The timed interrupt program is mainly applicable to the situation that requires timed and immediate processing by the
system,such as the timed sampling of analog inputs, and timed analog output updating based on certain waveforms.
286
VC Series Micro-PLC Programming Manual Using Interrupts
You can set the intervals (unit: ms) for the timed interrupts by setting the corresponding SD elements. The system generates
the interrupt event only when the set time interval is reached (recommended mini.interval: > 4ms).
The ON/OFF state of certain SM elements can enable/disable the corresponding timed interrupts.
The VC Series PLCs provides you with three timed interrupt resources as follows.
Note
1. Setting of enable control elements cannot affect the execution of the timed interrupts in the interrupt request queue.
2. The timing for a re-enabled interrupt starts from zero.
To change the interval of the timed interrupt when the program is running, it is recommended to follow the following
procedures:1. To disable the timed interrupt.2. To change the interval.3. To enable the timed interrupt.
287
VC Series Micro-PLC Programming Manual Using Interrupts
288
VC Series Micro-PLC Programming Manual Using Interrupts
3. Setting the interval for the timed interrupt and enabling the timed interrupt in the main program (MAIN).
The highest response frequency of the system to the external event is 1K. The external events over 1K may be lost.
The rising edge interrupt and falling edge interrupt cannot be used on the same port simultaneously. All the external interrupts
are only valid when the global interrupt control EI and corresponding enabling SM are valid.
289
VC Series Micro-PLC Programming Manual Using Interrupts
1. Writing the interrupt program to upset the state of Y0 once upon every interrupt and output immediately. To use an
interrupt,you should select its corresponding interrupt number. For details, you can see the specific operation in the following
figure.
2. Writing the EI instruction in MAIN, and setting SM25, the interrupt enabling flag corresponding to X0 input rising edge
interrupt, to be valid.
290
VC Series Micro-PLC Programming Manual Using Interrupts
In the application instance, the system uses the high-speed counter interrupt instruction of X0 to respond to the interrupt
program (number 33) when the value of the externalcounter C236 reaches the value specified through the DHSCI instruction.
1. Writing the interrupt subprogram. To use an interrupt subprogram, you need to select its corresponding interrupt number.
For details, you can see the specific operation in the following figure.
2. Writing the EI instruction in MAIN, and setting SM58, the interrupt enabling flag corresponding to the high-speed counter
interrupt, to be valid. Driving the high-speed counter C236 and high-speed counter interrupt instruction.
1. Writing the interrupt program (INT_1): Writing a program for the interrupt code to realize the control. To use an interrupt
subprogram, you need to select its corresponding interrupt number. For details, you can see the specific operation in the
following figure.
291
VC Series Micro-PLC Programming Manual Using Interrupts
2. Writing the functions in MAIN: Enabling the global interrupt of the system and setting the PTO output completion interrupt
enable flag SM50 to be valid. Using the PLS instruction.
For each serial port, the system provides two interrupt resources for you. The serial port-based interrupt programis mainly
applicable to the scenario that requires special processing on the receiving and sending of character/frame (XMT and RCV)
at the serial port andtimely processing by the system. It can immediately respond to the processing requirements after a
character or frame is transmitted or received, regardless ofthe scan time.
You can set the ON/OFF state of the corresponding SM elements to enable or disable the serial port-based interrupt. When
the serial port-based interrupt is disabled, the ones that have been added to the interrupt queue continue to be executed.
The XMT instruction cannot be called in the character transmission interrupt processing subprogram when the power flow is
normally on. Otherwise, it may lead to the interrupt subprogram nesting and thus block the execution of the user program.
Frame receiving and sending interrupts refer to the interrupt events that are triggered after the XMT and RCV instructions
are executed.
292
VC Series Micro-PLC Programming Manual Using Interrupts
Interrupt number Interrupt event Interrupt enabling SM
17 Frame receiving interrupt of PORT0 SM42
18 Frame sending interrupt of PORT1 SM43
19 Frame receiving interrupt of PORT1 SM44
20 Frame sending interrupt of PORT2 SM45
21 Frame receiving interrupt of PORT2 SM46
⚫ Application instance of theserial port-based interrupt
In the example, with the serial port-based frame sending function, the system upsets the Y3 output once when aframe is
sent out and generate flashing effect based on the frequency of the character sending frame.
1. Writing the interrupt program and the processing code when the serial port sending frame is completed and the interrupt
is triggered.
2. Specifying the corresponding interrupt event number for the interrupt program:
3. Writing the code of enabling serial port sending frame interrupt in MAIN.
293
VC Series Micro-PLC Programming Manual Using Interrupts
For details about the application instance of the serial port interrupt, refer to Chapter 10"Communication function guide"
294
VC Series Micro-PLC Programming Manual Communication function guide
This chapter detailedly introduces the communication functions of the VC series micro-PLCs, including the communication
resources and communication protocols, and uses application instances to illustrate.
Chapter 10 Communication function guide ......................................................................................................................295
295
VC Series Micro-PLC Programming Manual Communication function guide
10.3.1 Introduction
The free-port protocol is a communication mode with user-defined data file format, which can realizes data sending and receiving
through the instructions. It supports two data formats: ASCII and binary. The free-port communication is available only when the
PLC is in RUN state.
The free-port communication instructions include XMT (free-port sending instruction) and RCV (free-port receiving instruction).
SelectingCommunication Port in the system block dialogue box, and selecting Free port protocol in he corresponding setting
area to enable the Free port setting button, as shown in the following figure.
296
VC Series Micro-PLC Programming Manual Communication function guide
Clicking any one of the free port setting buttons to enter the Freeport parameter setting interface, as shown in the following figure.
297
VC Series Micro-PLC Programming Manual Communication function guide
Interframe timeout
Enabled or disabled (default) -
enable
When the energy flow is turned on and the
communication conditions are met, that is, the timing
starts when the communication serial port starts to
Interframe timeout 0–65535 ms
receive frames. If the receiving of one frame is
finished when the time is up, the receiving is
terminated.
⚫ Note
The free-port instructions XMT and RCV can be used to send/receive data to/from the designated communication port.For
details about the usage of the free-port instructions, refer to section 6.12.11 "XMT: Free-port sending instruction" and section
6.12.12 "RCV: Free-port receiving instruction".
You need to note that to use the free-port instruction on a certain port, you need to set the free-port protocol and
communication parameter for the communication port through the system block of Auto Studio. After setting, you need to
download the system setting to the PLCs and restart it.
⚫ Application instance
Example 1: Sending a 5-byte data, and then receiving a 6-byte data through PORT1.
Data to be sent: 01 FF 00 01 02 Data to received 01 FF 02 03 05 FE
Storing the received data in D elements starting from D10. Each byte occupies one D element, as shown below:
01 FF 02 03 05 FE
D10 D11 D12 D13 D14 D15
Example 2: Sending the data through PORT1, and then receiving the data.
298
VC Series Micro-PLC Programming Manual Communication function guide
10.4.1 Introduction
For the serial communication of the VC series micro-PLCs, Modbus communication protocol is available. RTU mode is supported.
The PLCs can be set as the master or slave station.
(2) Transmission rate: 1200, 2400, 4800, 9600, 19200, 38400, 57600, and 115200
3. Networking configuration: a maximum of 31 sets of equipments. Address range: 1–247. Broadcast is supported.
1. Hex data.
2. The interval between two characters shall not be less than the time of 1.5 characters.
3. There is no frame head or tail, and the interval between two frames is at least the time of 3.5 characters.
5. The max. length of the RTU frame is 256 bytes and the structure of a frame is shown as follows:
Structure Functio
Address Data CRC
of a frame n code
Number of
1 1 0–252 2
bytes
6. Calculation of interval among characters:
299
VC Series Micro-PLC Programming Manual Communication function guide
If the communication baud rate is 19200, the interval of 1.5 characters is 1/19200×11×1.5×1000 = 0.86ms.
Supported Modbus function codesinclude 01, 02, 03, 05, 06, 08, 15, and 16.
300
VC Series Micro-PLC Programming Manual Communication function guide
Eleme Protocol Supported
Type Physical element Remark
nt address function code
Double
C C256–C306 10000-10101 03 and 16 Current value of C element (DINT)
word
R Word R0–R32767 13000-45767 03, 06, and 16
Note:
The protocol address is the address used on data transmission and corresponds with the logic address of Modicon data. The
protocol address starts from 0 while the logic address of Modicon data starts from 1, that is, protocol address + 1 = logic address
of Modicon data. For example, if M0 protocol address is 2000, and its corresponding logic address of Modicon data is 0:2001.
In practice, the read and write of M0 is completed through the protocol address, for example, frame for reading M0 element (sent
by the master station).
01 01 07 D0 00 01 FD 47
CRC check code
Number of read elements
Start address. The decimal value of 07D0 is 2000
Function code
Station No.
Modbus slave station responds to the master station according to the received message of local addressing, rather than sending
out message actively. The slave station only supports Modbus function codes 01, 02, 03, 05, 06, 08, 15, and 16, and the other
codes are "illegal function codes"(except broadcast frame).
All the function codes supported except 08 are used for reading and writing elements. In principle, in one frame, there are 2000
bit elements and 125 word elements for reading, 1968 bit elements and 120 word elements for writing at most. However,
theactual protocol addresses for different types of elements are different and discontinuous (for example, Y377's protocol
addressis 255 while X0's protocol address is 1200). Therefore, when reading or writing an element, the element read at one time
can only be the same type, and the max. number of the read elements depends on the number of the elements thatare actually
defined. For example, when reading Y element (Y0 – Y377, 256 points in total), the protocol address ranges from 0 to 255, the
corresponding logic address of Modicon data is from 1 to 256, and the max. number of the Y elements that can be readis 256.
01 – address; 01- function code; 00 00 – starting address; 01 00 – number of read elements; 3D 9A – check
The master station reads 01 01 (257) elements starting from 0000, which is beyond the defined number of Y elements.
The response of the slave station is illegal data value, because 257>256, and 256 is the allowed max. number of Y elements.
00 64 (decimal 100) is the start address for themaster station to read, and 00 A0 (decimal 160) is the number of elements.
The response of the slave station is illegal data address, because there are only 156 Y elements which are defined to the protocol
address 100, but 160>156, so 160 is illegal.
Note
1. X element does not support the write operation (that is, the write of element X is invalid). For details about the writable properties
of SM and SDelements, refer to Appendix A "Special auxiliary relay" and Appendix B "Special data register" (if the element is un-
writable,the write operation is invalid).
2. The address of the slave station is 01, the last two bytes are CRC check codes and the second byte is function code.
The current count value of C element is word or double word element. The values from C200 to C255 are double word elements,
which are read and written through the function codes (03 and 16) of read/write registers. The address of every two registers
corresponds to one C double word element, and the registers can only be read or written in pair.
For example, reading the RTU frame of three C double word elements from C200 to C202.
01 03 25 E4 00 06 8E F3
Check code
Number of read elements
Start address 9700
Function code
Station No.
In the returned data, two addresses 9700 and 9701 indicate the contents of C200. 9700 is MSB, and 9701 is LSB.
When reading a double word element, if the start address for reading is not an even number, then the system responds with
errorcode of illegal address. If the number of the read registers is not an even number, the system responds with error code of
illegal data.
For example:
The start address for the reading of master station: 4 word elements of 25 E5 (decimal 9701)
The start address for the master station reading: 5 word elements of 25 E5
One LONG INT data can be saved in two D elements. For example, if a LONG INT data is saved in D3 and D4, the VEICHI PLC
thinks that MSB are stored in D3 and LSB are stored in D4. When the master station reads the LONG INT data through Modbus,
the 32-bit data shall be regrouped based on the LONG INT storage principle of VEICHI PLC after reading the data.The storage
principle of FLOAT is the same as the storage principle of LONG INT.
The diagnostic function code is used for testing the communication between the master and slave station, and various internal
error conditions of the slave station. The supported diagnostic subfunction codes are shown in the following table:
302
VC Series Micro-PLC Programming Manual Communication function guide
Function Subfunctio Function Subfunctio
Name of the subfunction code Name of the subfunction code
code n code code n code
Return the bus communication
08 00 Return the query data 08 12
error count
Return the bus exceptional
08 01 Restart the communication option 08 13
error count
Return the slave message
08 04 Forced listen only mode 08 14
count
Return the slave station no
08 10 Clear the counter 08 15
response count
Return the bus character
08 11 Return the bus message count 08 18
overrun count
Applicable to the VC2/VC3 series
When the instruction sent from the master station is in the normal response state, the slave station returns data or statistic value
in the data field. But in the abnormal response state, the server returns error codes in the data field. The error codes are shown
in the following table.
Error code Meaning of error code
0x01 Error function code
0x02 Error register address
0x03 Error data
In addition, if the slave station receives data under the following situations, no message is returned:
(1)When there are errors in the broadcast frame, such as data error, address error, etc.
(2)When the character is overrun, no message is returned. For example, the RTU frame is more than 256 bytes;
(3)When in the RTU transmission mode, the interval between characters times out, which is equivalent to receiving an error
frame,and no message is returned;
(4) When the slave station is in the listen-only mode, no message is returned.
(5)The slave station received ASCII error frame, including frame tail error and character range error.
Note
Read station is configured with compulsory elements. What is read is the value run by the program, which may be inconsistent
with the compulsory value.
303
VC Series Micro-PLC Programming Manual Communication function guide
Item Setting content
Timeout time of the
The time for waiting the slave response by the master station exceeds the preset time
master mode
Note: After the operand is set and downloaded in the system block, it is valid only after one operation.
When a PLC is used as a Modbus master station, the Modbus data frame can be sent/received through the Modbus instruction
provided by the system. For details about the use of the Modbus instruction, refer to section 6.12.1 "Modbus: Master station
communication instruction".
If a PLC is set to be a master station, there is a timeout item in the master mode when setting the Modbus parameter in the system
block. To ensure the correctness of the received data, the timeout time shall be longer than a scan cycle of the Modbus slave
station and with reasonable margin. For example, if a VC1 series PLC is used as a slave station, and a scan cycle of the VC1
series PLCs is 300ms,the master mode timeout of the master station shall be over 300ms. It is proper to set the timeout to be
350ms.
Application program
Example 1: When a VC1 series PLC is a Modbus master and slave station, it reads the bit element state of 5# station. The
protocol address of the slave station read by the master station is the bit values ranging from 11 to 39. Assuming that the read
data are as follows, the storage location for the received data starts from D100, D100 saves the address, D101 saves the function
code, D102 saves the number of registers, and the units starting from D103 save the read bit element values.
42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27
X X X 0 0 1 1 0 0 0 0 1 0 1 1 0
D106 D105
26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11
1 1 0 0 0 1 1 0 1 1 1 0 0 0 0 1
D104 D103
When the number of registers read is not a multiple of 8, the insufficient upper bits are filled with zero. In the example, the three
upper bits (40, 41, and 42) of D106 are filled with zeros.
304
VC Series Micro-PLC Programming Manual Communication function guide
Note
1. When the logic address is used for addressing the bit elements of the VC1 series PLCs, the logic address 1 is the protocol
address 0. In the above example, to read the values of 11–39 bit elements (protocol address) in the slave station, the logic address
shall be started from 12.
2. The failure of this communication does not affect the next communication, that is, if there are two Modbus XMT instructions
inone user program, the first communication fails and has error code, it does not affect the data sending of the second Modbus
instruction. Thus, in the example, the error code in SD139 is placed in D202, so the code can be observed through D202.
3. For the message sending of the slave station, if the master station is in listen-only mode, there is no data to be returned and
the system sets the error flag. Therefore, when you use the Modbus network of the VC1 series, if the VC1 is used as the master
station, the user shall clearly know which PLC slave station is under listen-only mode, so as to ensure that the failure of the
communication is not caused by the listen-only mode of the slave station.
Example 2: When an VC1 series PLC is a Modbus master and slave station, it reads the states of the bit elements 2000–2017 of
5# station protocol address.
The read datas are as follows. The received frame starts from D100, D100 saves the address, D101 saves the function code,
D102 saves the number of registers, and the units starting from D103 save the read bit element values.
1. Designating 5 as the
address of the slave station
to be accessed (it is saved
to D0).
2. Designating 1 as the
function code (it is saved to
D1).
3. The start address of the
register to be read is 07D0
(hex) (it is saved to D2/D3
according to MSB and LSB).
4. The number of the
registers to be read is 29 (it
is saved to D4/D5 according
to MSB and LSB).
5. The received data is
saved to D100.
6. Adding 1 to D200 if the
receiving is completed
(SM135 is set).
7. Adding 1 to D201, and
saving the error code to
D202 if the communication
fails (SM136 is set).
8. SM124 is the idle flag of
the communication port.
Example 3: When an VC1 series PLC is a Modbus master and slave station, it reads the values of the word elements 40–43 of
5# station protocol address.
MSB of LSB of MSB of LSB of MSB of LSB of MSB of LSB of
element 40 element 40 element 41 element 41 element 42 element 42 element 43 element 43
D103 D104 D105 D106 D107 D108 D109 D110
305
VC Series Micro-PLC Programming Manual Communication function guide
N:N is a micro-PLC network developed by Suzhou Veichi Electric Co.,Ltd. The physical layer of N:N adopts RS485, so the PLCs
can be directly connected through PORT1 or connected through PORT0 by a RS-232/RS-485 converter to N:N network. The
PLCs that are connected to N:N can automatically exchange thevalues between certain D and M elements, which makes the
access to the other PLC elements in the network as simple and convenient as accessing its own element. In N:N, the data access
between the PLCs is completely equivalent (N:N communication network).
It is convenient to configure N:N. Most parameters of N:N only need to be configured for No.0 PLC. In addition,N:N supports the
online modification of the network parameters, and is able to detect the newly added PLCs automatically in the network. If any
PLC is disconnected from the network, the other PLCs continue to exchange the data. It isalso able to monitor the communication
state of the whole network through the relevant SM elements of any PLC inN:N.
There are two kinds of messages in N:N tokens issued by the master station, and broadcast by each PLC to its own data.
The token is uniformly issued by the master station. The master station first holds the token. After the data is broadcasted, the
token is cyclically and sequentially issued to each slave station. Only the slave station that receives the token can broadcast to
other PLCs (including the master station).
306
VC Series Micro-PLC Programming Manual Communication function guide
Figure 10-1–Figure 10-5 show the main processes of network communication. In the figure, 1# stands as the master station. It
needs to be noted that in general, 0# is amaster station by default while 1# is a standby master station (when the master station
communication error or power failure occurs, it is switched to the master station).
Token
1# Data 1# Data 1# Data
RS485
RS485
Figure 10-1 Master station broadcasts Figure 10-2 Master station sends the token to 2#
slave station
2# Data
Token
Slave
station (2#)
2# Data 2# Data
Slave Slave Slave
)
station (2#) station (3#) station (N#)
RS485
Slave Slave
station (3#) station (N#)
Figure 10-4 Master station sends the token to 3#
RS485
slave station
Figure 10-3 2#slave station broadcasts
3# Data
Slave
station (3#)
Slave Slave Slave
3# Data 3# Data station (2#) station (N#)
station (3#)
RS485
N:N supports two kinds of networks: single-layer network and multiple-layer network, as shown in the following figures.
307
VC Series Micro-PLC Programming Manual Communication function guide
In the single-layer network, each PLC is connected to N:N through only one port. In the multi-layer network, the layer-to-layer PLC
(intermediate node) shall be connected, and the two communication ports of the PLC are respectively connected to different layers.
The single-layer network can support a maximum of 32 PLCs, and each layer of the multi-layer network can support a maximum
of 16 PLCs.
The PLCs connected to N:N can automatically exchange between parts of D elements and M elements in the network. The
quantity and No. of these D and M elements are fixed, and these elements are called "Elements Sharing Area". If the PLC uses
N:N, the value of the Elements Sharing Area keeps refreshing automatically, so as to keep the value consistency of the Elements
Sharing Area for each PLC in the network.
0# XMT area (W) 0# RCV area (W) 0# RCV area (W) 0# RCV area (W)
1# RCV area (W) 1# XMT area (W) 1# RCV area (W) 1# RCV area (W)
2# RCV area (W) 2# RCV area (W) 2# XMT area (W) 2# RCV area (W)
3# RCV area (W) 3# RCV area (W) 3# RCV area (W) 3# RCV area (W)
4# RCV area (W) 4# RCV area (W) 4# RCV area (W) 4# RCV area (W)
5# RCV area (W) 5# RCV area (W) 5# RCV area (W) 5# RCV area (W)
6# RCV area (W) 6# RCV area (W) 6# RCV area (W) 6# RCV area (W)
7# RCV area (W) 7# RCV area (W) 7# RCV area 7# XMT area (W)
((W)
308
VC Series Micro-PLC Programming Manual Communication function guide
As shown in the above figure, each PLC connected to N:N has a writable sending area in the Element Sharing Area. N:N
automatically sends the information (values of designated D and M elements) of the writable sending area to other PLCs, receives
the information from other PLCs, and saves it to the read-only sending area.
The number of elements in the Element Sharing Area is fixed (a total of 64 D components and 512 M components can be shared),
and these elements are distributed to more than one PLC. Therefore, the fewer PLCs are connected to the network, the more
elements can be distributed to each PLC. This relationship is defined by N:N refresh mode table.
(1) In mode 1, the D elements distributed to the sending zone assigned by 0# station are D7700–D7701. The 0# station PLC
can write values to D7700 and D7701, and other stations (1#-–31#) can directly read the values of D7700 and D7701.
(2) In mode 2, the D elements distributed to the sending zone assigned by 0# station are D7700–D7703. The 0# station PLC
can write values to D7700, D7701, D7702, D7703, and other stations (1#-–15#) can directly read the values of D7700–
D7704.
309
VC Series Micro-PLC Programming Manual Communication function guide
Distribution of M
elements in Mode 1 Mode 2 Mode 3 Mode 4 Mode 5
sending area
M1448–M1463 #3
M1464–M1479 #4
#2
M1480–M1495 #5
#1
M1496–M1511 #6
#3
M1512–M1527 #7
M1528–M1543 #8
#4
M1544–M1559 #9
#2
M1560–M1575 #10
#5
M1576–M1591 #11
#1
M1592–M1607 #12
#6
M1608–M1623 #13
#3 #0
M1624–M1639 #14
#7
M1640–M1655 #15
M1656–M1671 #16
#8
M1672–M1687 #17
#4
M1688–M1703 #18
#9
M1704–M1719 #19
#2
M1720–M1735 #20
#10
M1736–M1751 #21
#5
M1752–M1767 #22
#11
M1768–M1783 #23
#1
M1784–M1799 #24
#12
M1800–M1815 #25
#6
M1816–M1831 #26
#13
M1832–M1847 #27
#3
M1848–M1863 #28
#14
M1864–M1879 #29
#7
M1880–M1895 #30
#15
M1896–M1911 #31
For example:
(1) In mode 1, the Melements distributed to the sending zone assigned by 0# station are M1400–M1415. The 0# station
PLC can write values to M1400–M1415, and other stations (1#-–31#) can directly read the values of M1400–M1415.
(2) In mode 2, the Melements distributed to the sending zone assigned by 0# station are M1400–M1431. The 0# station PLC
can write values to M1400–M1431, and other stations (1#-–31#) can directly read the values of M1400–M1431.
310
VC Series Micro-PLC Programming Manual Communication function guide
For example:
In mode 6, the D elements distributed to the sending zone assigned by 0# station are D7700–D7701. The 0# station PLC
can write values to D7700–D7701, and other stations (1#-–15#) can read directly the value of D7700–D7701.
In mode 10, the D elements distributed to the sending zone assigned by 0# station (layer 1) are D7732–D7733. The 0#
station PLC can write values to D7732–D7733, and other stations (1#-–15#) can read directly the value of D7732–D7733.
For example:
In mode 6, the M elements distributed to the sending zone assigned by 0# station (layer 0) are M1400–M1415. The 0#
station PLC can write values to M1400–M1415, and other stations (1#-–15#) can read directly the value of M1400–M1415.
311
VC Series Micro-PLC Programming Manual Communication function guide
Distribution of M
elements in sending Mode 10 Mode 11 Mode 12 Mode 13
area
M1656–M1671 #0
#0
M1672–M1687 #1
#0
M1688–M1703 #2
#1
M1704–M1719 #3
#0
M1720–M1735 #4
#2
M1736–M1751 #5
#1
M1752–M1767 #6
#3
M1768–M1783 #7
M1784–M1799 #8
#4
M1800–M1815 #9
#2
M1816–M1831 #10
#5
M1832–M1847 #11
#1
M1848–M1863 #12
#6
M1864–M1879 #13
#3
M1880–M1895 #14
#7
M1896–M1911 #15
For example:
In mode 10, the M elements distributed to the sending zone assigned by 0# station (layer 1) are M1656–M1671. The 0#
station PLC can write values to M1656–M1671, and other stations (1#-–15#) can read directly the value of M1656–M1671.
Note
Once the PLC is configured with the N:N communication protocol,D7700–D7763 and M1400–M1911 are used as the public
resources for network data exchange. You need to pay attention to these elements when using them in the program!
To support more elements sharing, the VC series micro-PLCs offer modes 14–18. These modes are only applicable to the
single-layer structure, or situations where there are many shared components. M components and D components have been
expanded on the original basis (M1400-M1911 and D7500–D7755).
312
VC Series Micro-PLC Programming Manual Communication function guide
M1784-M1799 #24
#12
M1800-M1815 #25
#6
M1816-M1831 #26
#13
M1832-M1847 #27
#3
M1848-M1863 #28
#14
M1864-M1879 #29
#7
M1880-M1895 #30
#15
M1896-M1911 #31
The D element areas (256) are shown in the following table:
Distribution of D elements Mode 14 Mode 15 Mode 16 Mode 17 Mode 18
D7500–D7507 #0
#0
D7508–D7515 #1
#0
D7516–D7523 #2
#1
D7524–D7531 #3
#0
D7532–D7539 #4
#2
D7540–D7547 #5
#1
D7548–D7555 #6
#3
D7556–D7563 #7
#0
D7564–D7571 #8
#4
D7572–D7579 #9
#2
D7580–D7587 #10
#5
D7588–D7595 #11
#1
D7596–D7603 #12
#6
D7604–D7611 #13
#3
D7612–D7619 #14
#7
D7620–D7627 #15
D7628–D7635 #16
#8
D7636–D7643 #17
#4
D7644–D7651 #18
#9
D7652–D7659 #19
#2
D7660–D7667 #20
#10
D7668–D7675 #21
#5
D7676–D7683 #22
#11
D7684–D7691 #23
#1
D7692–D7699 #24
#12
D7700–D7707 #25
#6
D7708–D7715 #26
#13
D7716–D7723 #27
#3
D7724–D7731 #28
#14
D7732–D7739 #29
#7
D7740–D7747 #30
#15
D7748–D7755 #31
Selecting the Communication Port item in the System block, and selecting the N:N protocol in the PLC communication port
1 setting to enable the corresponding N:N setting button as shown below.
313
VC Series Micro-PLC Programming Manual Communication function guide
Clicking the N:N setting button to enter the N:N Protocol setting interface, as shown below.
As shown in the preceding figure, the N:N parameters are set through the system block. The Station no.shall be set starting from
0#, and set in order. Several PLCs cannot share the same station number. 0#station is used for starting and setting the whole
network. The setting of Max number of stations, Additional delay time, Retry times, Mode can be realized through 0#station.
For the stations with other station numbers, except that the baud rate and parity check shall be consistent with those of 0#station,
they only need to set their own station number, as shown in the following figure.
The maximum number of inspection stations refers to the total number of PLCs used in the network. If you use a total of 6 PLCs,
you need to set the maximum number of inspection stations to 6, and set the station number of these 6 PLCs to 0-5. If you want
to add another two PLCs to the network without any interruption of the network, you can set the maximum number of inspection
stations to 8 and the PLC stations to be added in the future to 6 and 7respectively. When 6 and 7 are connected to the network,
they are automatically detected by N:N within one second and included into the data exchange with 0-5.
314
VC Series Micro-PLC Programming Manual Communication function guide
0# station is a master station by default. Only 0#station can initialize and start the entire network. The settings about N:N, such
as refresh mode, additional delay time, and retry times, needs to be configured only through the 0# station. When 0#
stationmodifies the relevant configuration online and the standby master station takes over the network during the process of
downloading the system blocks. When 0#station completes the downloading of the system block, the standby master station
givesthe place of the master station to 0#station.
Master station strategy in the network: The station with the mini. station number acts as the master station.
When setting the max. number of the inspection stations, it is recommended to set the max. number of the inspection stations to
the total number of PLCs included in the actual network, and set the station number starting from 0# in turn. When the max.
number of the inspection stations is set to N#, the network only manages the stations ranging from 0# to N-1#. In particular, when
the max. number of the inspection stations set by the user is incorrect, that is, when the maximum number of inspection stations
is smaller than the number of PLCs included in the actual 485 network, PLCs with station numbers that are greater than or equal
to the max. number of the inspection stations cannot broadcast their data but can receive the broadcast data of the PLCs with
station numbers that are less than the max. number of the inspection stations.
A network of multi-master and multi-slave structures can be builtby using N:N. The meaning of "master" and "slave" here is:
"master" indicates a PLC that cannot only write its own M and D elements, but also read M and D elements of other stations;
"slave" indicates a PLC that can only read M and D elements of other stations. Under the set maximum number of inspection
stations (this number is also subject to the refresh mode), the PLC whose station number is less than the number of inspection
stations can be used as the "master" while the PLC whose station number is greater than the number of inspection stations can
only be used as the "slave". The slave station can only read the relevant M and D elements of the master station. These M and D
elements have the corresponding relationship with each master station according to the refresh mode in the master station. You
can refer to the N:N shared M and D element table. There are no corresponding M and D elements for the slave station in these
tables.
There are 5 PLCs in total, and the station number ranges from 0# to 4#. You can select 3 for the refresh mode 3. If you want to
store the sum of D100 in 0#PLC and D305 in 2#PLC in D500 of 4#PLC, you can program as follows:
Description: This example show the N:N single-layer network. There are 5 PLC stations on the network and the refresh mode is
set to 3. Each station can be distributed with 8 D elements and 64 M elements. The D elements distributed to 0# station ranges
from D7700 to D7707, the ones distributed to 2# station ranges from D7716 to D7723, and the ones distributed to 4# station
ranges from D7732 to D7739. Storing the D100 value of 0# station in a write common area D7700 distributed by the network, and
the D305 value of 2# station in a write common area D7716 distributed by the network. Executing the sum operation of D7700
and D7716 in 4#PLC and storing the sum in the local element D500.
315
VC Series Micro-PLC Programming Manual Positioning function guide
316
VC Series Micro-PLC Programming Manual Positioning function guide
The absolute position system obtains the absolute position data of the servo motor on the stroke by detecting the current position
data of the servo motor encoder and total number of running turns. According to this principle, an absolute coordinate system can
be established on the mechanical stroke. The following figure is a functional block diagram of an absolute position system.
AC
Other I/Os Serv
Instruction direction output
Scan the o
Reset pulse output moto
program
Absolute position value r
Origin data contr
communication
ol
Store the
Backup Absolute position
absolute
-
battery detection
position data
Current position
Power Keep
data
supply Accumulated
turns
In the above figure, unlike the conventional incremental encoder, the current position data and accumulated turns of the encoder
of the absolute position system can be maintained. These data can be maintained by the power supply of a backup battery. Even
in the event of a power failure, the servo drive can obtain the current absolute position data through being powered on again.
After the PLC is powered on, the absolute position data can be obtained from the servo drive through communication or other
special methods, and the stroke coordinate position is determined. The PLC uses the positioning instruction to control the servo
drive and the motor, thereby achieving the precise positioning on the stroke, and automatically refreshing the absolute position
data automatically. In this way, a working system based on the absolute position coordinates can be formed.
The following diagram is a simplified mechanical example of an absolute position system built on the VC series PLC positioning
instructions.
Speed
ZRN speed
Crawling
speed Position
Return to the start point
Reverse limit point Forward limit point
Reverse DOG detection (front end)
direction Forward direction
DOG signal
(back detection device
Origin
Reverse limit switch end) Table Forward limit switch
Lead screw
DOG signal ON ON
state
OFF
OFF Table
position
317
VC Series Micro-PLC Programming Manual Positioning function guide
The system drives the lead screw with a servo motor to drive the table. The position of the table in the stroke is detected by an
absolute encoder. During the zero return process,when the DOG signal device detects the front end of the table (set), the servo
motor decelerates to the crawling speed; when the DOG signal device detects that the rear end of the table (reset), it is an original
position arriving signal, and the PLC stops the high-speed pulse output. The forward limit switch and the reverse limit switch must
be set. Because the ZRN instruction is incapable of searching for DOG signal automatically, it is required to start the ZRN operation
further than the front end of DOG detection device. You can perform the inching operation to manually adjust the position of the
table through the design and programming.
The positioning control system can be divided into open-loop control system, semi-closed loop control system and closed-loop
control system according to different control modes.
The open-loop control system is a control system in which the regulating system does not accept the control of the feedback, and
only controls the output, also known as the no feedback control system. The open-loop control system is mostly composed of a
controller, stepping driver, and stepping motor. The controller sends a pulse instruction to the stepping driver, and then the stepping
motor drives the table to move a certain distance. This kind of system is relatively simple, stable in operation, and easy to grasp,
but it cannot detect errors, nor can it correct errors. Its control accuracy and the performance of suppressing interference are
relatively poor, and it is sensitive to the changes in system parameters. Therefore, it is generally only used in applications where
the external influence is not considered, or the inertia is small, or the accuracy is not high.
The closed-loop control system is an automatic control system in which a closed loop consists of a signal forward path and
feedback path, also known as a feedback control system. The closed-loop control system generally consists of a controller, servo
drive, servo motor, detector, etc. The system automatically detects the actual displacement of the table and feeds back to the
controller for the closed-loop control. This kind of system has the high positioning accuracy, but the system is complicated, and
difficult to debug and maintain, and its price is relatively expensive. It is mainly used for the high-precision applications and large
CNC machines.
The semi-closed loop control system works similarly to the closed-loop control system except that the detector is not mounted on
the table but mounted on the shaft of the servo motor. The accuracy, speed and dynamic characteristics of this system are superior
to the open-loop control system. Its complexity and cost are lower than that of the closed-loop control system. They are mainly
used for medium-precision applications and most of small and medium-sized CNC machines.
318
VC Series Micro-PLC Programming Manual Positioning function guide
Start
Refer to chapters
Confirm the related soft elements 11.4 Special elements related to the positioning
instructions
Refer to chapters
Write the use program 11.5 Application instance
End
Table 11-1 Overview of positioning functions of the VC series PLC main module
Name VC3(Planning) VC2(pianning) VC1 VC1S(plannning)
Controlled axes 8-axis 3-axis 3-axis 2-axis
Max. output frequency 200 kHz 100 kHz 100 kHz 100 kHz
Pulse output mode Open collector Open collector Open collector Open collector
Pulse+direction,
Pulse+directio
Pulse output type positive and negative Pulse+direction Pulse+direction
n
pulses
Trapezoidal
Acceleration and acceleration/decelerati Trapezoidal Trapezoidal Trapezoidal
on, triangle acceleration/d acceleration/dec acceleration/dece
deceleration treatment
acceleration and eceleration eleration leration
deceleration disabling
319
VC Series Micro-PLC Programming Manual Positioning function guide
2-axis linear
Interpolation function interpolation and — — —
circular interpolation
Position
Synchronization
synchronization, — — —
function
electronic gear
Absolute position
ABS instruction read — —
detection
Positioning range -2,147,483,648–+2,147,483,647 (pulse)
*Note: Only interpolation instruction supports the positive and negative pulse output modes.
When connecting to the servo, you need to set the input signal of the servo amplifier to the negative logic mode. The pulse output
form is defined as follows:
Pulse + direction
Positive pulse + negative pulse
Pulse OFF
OFF
FWD
ON
ON
OFF
REV OFF
Direction
ON ON
Note: The high-speed I/O instruction can also be used as a pulse output, but only for the output control of the pulse signal, and
does not control the direction signal. When these high-speed I/O instructions are used, the corresponding position SD elements
are subjected to the accumulation processing in the forward direction. When you want to drive the servo in forward motion, you
needs to program and set the servo direction signal to ON, and set to OFF in reverse motion.
320
VC Series Micro-PLC Programming Manual Positioning function guide
Name Action Content VC3 VC2 VC1 VC1S
It acts according to the set
running speed, stops at the
DRVA target position, and uses ● ● ● ●
absolute coordinates for the
position.
It acts according to the set
running speed. If the running
speed changes, it runs at the
Running speed
new speed; if the energy flow
Speed becomes invalid, the pulse
PLSV output stops. When there is ● ● ● ●
acceleration/deceleration, the
Speed Speed Energy
Startup
change chaneg flow OFF acceleration/deceleration is
executed when the speed is
changed.
Y coordinate
Target position(x,y)
It moves to the target position
along a linear trajectory
LIN ●
according to the specified
X coordinate vector speed.
Start point
321
VC Series Micro-PLC Programming Manual Positioning function guide
Name Action Content VC3 VC2 VC1 VC1S
Total movement
Movement Movement
before after
synchronizati synchronizati
on on
The positioning instruction and high-speed instruction output a controllable pulse at the high-speed port according to the settings,
and the output of the pulse has nothing to do with the scan cycle of the user program. For details about the usages of these
instructions, refer tosection 6.10 "High-speed I/O instruction". In the program, using positioning instructions or high-speed
instructions for different output ports can obtain independent high-speed pulse output at the corresponding output port.
When there are multiple positioning instructions or high-speed instructions on the same port, the first valid instruction occupies
the output port, and the latter valid one does not occupy the output port.
⚫ Transistor output
An VC series PLC with transistor output is a must.
1. You cannot drive and use other positioning or high-speed pulse output instructions on the same high-speed pulse output
point at the same time. A high-speed pulse output point can only be driven by a positioning instruction (or high-speed
instruction) at any one time.
2. When the energy flow of a positioning instruction is disconnected, the instruction can be driven again only when the energy
flow is connected after one or more PLC scan cycles.
⚫ The main points for using the high-speedand positioning instructions at the same time
Considering from the function implementation, it is recommended to use the positioning instruction to replace these high-
speed pulse output instructions (PLSY, PLSR, and PLS), so as to complete the automatic update of the absolute position
SD elements.
The absolute position SD elements can be used to store and update the current absolute position after the positioning
instruction is used. The automatic increase and decrease of the absolute position SD element value is determined based on
the change value of the output pulse accumulation SD element and the running direction when the positioning instruction is
called, so they are linked. Do not perform the write operation on the the output pulse accumulation SD element when using
the positioning instruction. Otherwise, the data of the absolute position SD element may be disordered.
322
VC Series Micro-PLC Programming Manual Positioning function guide
If it is necessary to use both positioning instructions and other high-speed pulse output instructions (PLSY, PLSR, and PLS)
at the same time, you need to write the PLC program so that the data of absolute position SD elements in the absolute
position register can be correctly updated.
⚫ Restrictive conditions for the actual output frequency of the positioning instruction
When the positioning instruction is executed, the min. frequency of the actual output pulse is limited by the following formula:
Fmax 500
Fmin_ acc =
T
In the above formula, Fmax indicates the max.speed; T indicates the acceleration/deceleration time , and the unit is ms.
The calculation result Fmin_ acc is the min. output frequency limit value.
If the output frequency specified in the positioning instruction is F, there are three cases of the actual output frequency as
follows.
• When F is less than the base frequency or greater than the max. frequency Fmax , there is actually no output.
• When F is less than Fmin_ acc , and the actual output is Fmin_ acc .
• When F is greater than or equal to Fmin_ acc , and less than or equal to Fmax , the output is F.
The definition and assignment of the output axes of the VC1 series PLCs are shown in the table below.
OFF
Pulse + Pulse Y1 Direction
ON
direction
FWD REV
Note
When using any one of the output axes to connect the servo, you need to consider the pairing of the output points. All the output
single-axis positioning can only use the "pulse + direction" mode. Only the interpolation instruction can use the "FWD + REV"
mode. Only one group of interpolation instructions can be executed at one time. One group of interpolation instructions occupies
4 ports: Y0, Y1, Y2, Y3, among which Y0 and Y1 are X-axes, and Y 2 and Y3 are Y-axes.When there are double pulses, Y0 is a
positive pulse and Y1 is a negative pulse while Y2 is a positive pulse and Y3 is a negative pulse. In the "pulse + direction" mode,
you need to note that when the direction signal is selected, the output point cannot be used for other purposes at the same time.
For example, you cannot do not define the same output point as that of the pulse or direction signal of other output axes.
323
VC Series Micro-PLC Programming Manual Positioning function guide
Pulse Y0
Pulse + Pulse + direction
0
direction Directio OFF
Any output points except Y0 Pulse
n ON
Pulse +
Pulse Y1 OFF
direction Direction
1
Directio ON
Any output points except Y1
n
FWD REV
Pulse + Pulse Y2
2 direction Directio
Any output points except Y2
n
Clicking Next to enter the configuration interface where high-speed pulse output points, max. and min. frequency of the high-
speed pulse output, and ACC/DEC time can be set, shown in the following figure.
324
VC Series Micro-PLC Programming Manual Positioning function guide
During acceleration/deceleration time, the acceleration speed of all the segments of the envelope curve is constant. For
example, if the settings are as shown above, then the acceleration time taken to accelerate from 20000 Hz to 50000 Hz for
the motor is:
1000× (50000-20000)÷ (100000-5000)=316 (ms)=0.316 (s)
During the acceleration time, the total number of output pulses can be calculated through using the trapezoidal area
calculation formula:
(20000+50000)×0.316÷2=11060 (number of pulses)
Therefore, if you have a requirement for the time or number of pulses during acceleration/deceleration, you need to perform
the related calculations before setting the max. speed, min. speed and acceleration/deceleration time.
After clicking Next Step in the above figure, enter Motion Outline Define in the figure below. You can enter the target speed
and moving distance of the first step first, and click New Step. Then you can enter the target speed and moving distance of
the second step, and click New Step, and so on, and finally click OK.
The above configuration is saved in the D elements, and you can choose which D elements to store these settings, as shown
below.
325
VC Series Micro-PLC Programming Manual Positioning function guide
The wizard will create two subprograms, one is the parameter setting subprogram, and the otheris the PLS execution
subprogram, as shown below. You need to make sure that the parameter setting subprogram is correctly called and
executed (the relevant D elementsare assigned) when programming in the main program, and then call the execution
subprogram.
At this point, all configuration has been completed, as shown in the figure below. Clicking Finish to complete the PTO
configuration.
326
VC Series Micro-PLC Programming Manual Positioning function guide
327
VC Series Micro-PLC Programming Manual Special auxiliary relay
All special auxiliary relays are initialized when the PLCs change from STOP to RUN. The special auxiliary relays that have been
set in the system setting are set to the preset value in the system block after the initialization.
Note
The reserved SD and SM elements are not listed in the table. The reserved SM elements are by default read and write (R/W).
328
VC Series Micro-PLC Programming Manual Special auxiliary relay
4. Interrupt control
Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
X0 input rising edge interrupt
SM25 Enable when set as 1 R/W √ √ √ √ √
enable flag bit
X1 input rising edge interrupt Enable when set as 1
SM26 R/W √ √ √ √ √
flag bit
X2 input rising edge interrupt Enable when set as 1
SM27 R/W √ √ √ √ √
enable flag bit
X3 input rising edge interrupt Enable when set as 1
SM28 R/W √ √ √ √ √
enable flag bit
X4 input rising edge interrupt Enable when set as 1
SM29 R/W √ √ √ √ √
enable flag bit
X5 input rising edge interrupt Enable when set as 1
SM30 R/W √ √ √ √ √
enable flag bit
X6 input rising edge interrupt Enable when set as 1
SM31 R/W √ √ √ √ √
enable flag bit
X7 input rising edge interrupt Enable when set as 1
SM32 R/W √ √ √ √ √
enable flag bit
X0 input falling edge interrupt Enable when set as 1
SM33 R/W √ √ √ √ √
enable flag bit
X1 input falling edge interrupt Enable when set as 1
SM34 R/W √ √ √ √ √
enable flag bit
X2 input falling edge interrupt Enable when set as 1
SM35 R/W √ √ √ √ √
enable flag bit
X3 input falling edge interrupt Enable when set as 1
SM36 R/W √ √ √ √ √
enable flag bit
X4 input falling edge interrupt Enable when set as 1
SM37 R/W √ √ √ √ √
enable flag bit
X5 input falling edge interrupt Enable when set as 1
SM38 R/W √ √ √ √ √
enable flag bit
X6 input falling edge interrupt Enable when set as 1
SM39 R/W √ √ √ √ √
enable flag bit
X7 input falling edge interrupt Enable when set as 1
SM40 R/W √ √ √ √ √
enable flag bit
COM 0 frame transmission Enable when set as 1
SM41 R/W √ √ √ √ √
interrupt enable flag bit
COM 0 frame receiving interrupt Enable when set as 1
SM42 R/W √ √ √ √
enable flag bit
COM 1 frame transmission Enable when set as 1
SM43 R/W √ √ √ √
interrupt enable flag bit
329
VC Series Micro-PLC Programming Manual Special auxiliary relay
Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
COM 1 frame receiving interrupt Enable when set as 1
SM44 R/W √ √ √ √
enable flag bit
COM 2 frame transmission Enable when set as 1
SM45 R/W √ √ √ √
interrupt enable flag bit
COM 2 frame receiving interrupt Enable when set as 1
SM46 RW √ √
enable flag bit
SM47 Timed interrupt 0 enable flag bit Enable when set as 1 RW √ √ √
SM48 Timed interrupt 1 enable flag bit Enable when set as 1 R/W √ √ √ √
SM49 Timed interrupt 2 enable flag bit Enable when set as 1 R/W √ √ √ √
PTO (Y0) output completion Enable when set as 1
SM50 R/W √ √ √ √ √
interrupt enable flag bit
PTO (Y1) output completion Enable when set as 1
SM51 R/W √ √ √ √ √
interrupt enable flag bit
PTO (Y2) output completion Enable when set as 1
SM52 R/W √ √ √ √ √
interrupt enable flag bit
PTO (Y3) output completion Enable when set as 1
SM53 R/W √ √ √
interrupt enable flag bit
PTO (Y4) output completion Enable when set as 1
SM54 R/W √
interrupt enable flag bit
PTO (Y5) output completion Enable when set as 1
SM55 R/W √ √
interrupt enable flag bit
PTO (Y6) output completion Enable when set as 1
SM56 R/W √
interrupt enable flag bit
PTO (Y7) output completion Enable when set as 1
SM57 R/W √
interrupt enable flag bit
High-speed counter interrupt Enable when set as 1
SM58 R/W √
enable flag bit
Interpolation completion Enable when set as 1
SM59 R/W √
interrupt 1 enable flag bit
Interpolation completion Enable when set as 1
SM60 R/W √
interrupt 2 enable flag bit
Interpolation completion Enable when set as 1
SM61 R/W √
interrupt 3 enable flag bit
Interpolation completion Enable when set as 1
SM62 R/W √
interrupt 4 enable flag bit
Enable flag bit for position- Enable when set as 1
SM63 based interrupt 0 in the R/W √
positioning instruction
Enable flag bit for position- Enable when set as 1
SM64 based interrupt 1 in the R/W √
positioning instruction
Enable flag bit for position- Enable when set as 1
SM65 based interrupt 2 in the R/W √
positioning instruction
Enable flag bit for position- Enable when set as 1
SM66 based interrupt 3 in the R/W √
positioning instruction
Enable flag bit for position- Enable when set as 1
SM67 based interrupt 4 in the R/W √
positioning instruction
Enable flag bit for position- Enable when set as 1
SM68 based interrupt 5 in the R/W
positioning instruction
Enable flag bit for position- Enable when set as 1
SM69 based interrupt 6 in the R/W
positioning instruction
Enable flag bit for position- Enable when set as 1
SM70 based interrupt 7 in the R/W √
positioning instruction
330
VC Series Micro-PLC Programming Manual Special auxiliary relay
5. Peripheral instruction
Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
When this bit is set to 1, there
are 1-16 characters. When it is
SM78 Printing mode selection R/W √ √ √
set to 0, there areregularly 8
characters.
When this bit is set to 1, the
SM79 Printing Peripheral instruction R √ √ √
printing is in progress
331
VC Series Micro-PLC Programming Manual Special auxiliary relay
1. All the elements in the table are cleared when the PLC changes from STOP to RUN. The pulse capture is valid when the HCNT
and SPD instructions are being executed at the same input port. For details, refer to section 6.10.9"SPD: frequency measurement
instruction"and section 6.10.1 "HCNT: high-speed counter drive instruction".
10. Quad-frequency
Address Name function R/W VC1S VC1 VC2 VC3 VC5
Switching between one/four times Clearing when from
SM100 R/W √ √ √ √ √
of AB phase input of X0 and X1 STOP->RUN;
Switching between one/four times of
SM101 R/W √ √ √
AB phase input of X2 and X3
Switching between one/four times of
SM102 R/W √ √ √ √ √
AB phase input of X3 and X4
Switching between one/four times of
SM103 R/W √ √ √
AB phase input of X4 and X5
Note
SM110-SM114 are flagsfor receiving, completion and idle states in all communication protocols that are supported by PORT0.
For example, PORT0 of VC1 series PLCs supports Modbus protocol. No matter what protocol is used, the functions of M110-
SM114 remain the same.
332
VC Series Micro-PLC Programming Manual Special auxiliary relay
Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
This bit is set when the RCV instruction is
used, and cleared after the transmission is
PORT1
over. You can manually clear this bit to
SM121 receiving R/W √ √ √ √ √
suspend the current transmission at PORT1.
enable flag bit
The transmission can continue when the
energy flow is on again
PORT1
transmission
SM122 This bit is set after the transmission is over R/W √ √ √ √ √
completion flag
bit
PORT1
receiving
SM123 This bit is set after the receiving is over R/W √ √ √ √ √
completion flag
bit
PORT1 idle flag
SM124 This bit is set when the port is idle R √ √ √ √ √
bit
PORT1
MODBUS This bit is set when the communication is
SM125 R √ √ √ √
communication completed
completion
PORT1
MODBUS
SM126 This bit is set when communication error R √ √ √ √
communication
error
Note
SM120-SM124 are flags for receiving, completion and idle states in all communication protocols that are supported by PORT1.
For example, PORT1 of VC1 series PLCs supports N:N, Modbus and Free-port protocols. No matter what protocol is used, the
functions of M120-SM124 remain the same.
333
VC Series Micro-PLC Programming Manual Special auxiliary relay
Note
SM130-SM134 are flags for receiving, completion and idle states in all communication protocols that are supported by PORT2.
334
VC Series Micro-PLC Programming Manual Special auxiliary relay
335
VC Series Micro-PLC Programming Manual Special auxiliary relay
Differentia Address
Name Register content R/W VC1S VC1 VC2 VC3 VC5
tion no.
SM242 C242 down mode, its corresponding SM2 R/W √ √ √ √ √
SM243 C243 _ _ changes to ON. R/W √ √ √ √ √
SM244 C244 When it is in up mode, its R/W √ √ √ √ √
SM245 C245 corresponding SM2 _ _ changes to R/W √ √ √ √ √
SM246 C246 OFFl. R/W √ √ √ √ √
SM247 C247 R/W √ √ √ √ √
SM248 C248 R √ √ √ √ √
SM249 C249 R √ √ √ √ √
Single- SM250 C250 R √ √ √ √ √
phase SM251 C251 R √ √ √ √ √
bidirection SM252 C252 R √ √ √ √ √
al count SM253 C253 R √ √ √ √ √
input SM254 C254 Register content R √ √ √ √ √
SM255 C255 The ON and OFF of SM2 _ R √ √ √ √ √
SM256 C256 _correspond to counting up and R √ √ √ √ √
SM257 C257 down of the counter respectively R √ √ √ √ √
Two- SM258 C258 R √ √ √ √ √
phase SM259 C259 R √ √ √ √ √
count SM260 C260 R √ √ √ √ √
input SM261 C261 R √ √ √ √ √
SM262 C262 R √ √ √ √ √
SM263 C263 R √ √ √ √ √
336
VC Series Micro-PLC Programming Manual Special auxiliary relay
Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
SM280 REV limit Y0 is applicable to DSZR/DVIT R √ √ √
Logic reversal of the
SM281 Y0 is applicable to DSZR R √ √ √
DOG signal
Logic reversal of the
SM282 Y0 is applicable to DSZR R √ √ √
zero signal
Y0 is applicable to DVIT, but not
Logic reversal of the
SM283 applicable to the user interrupt input R/W √ √
interrupt signal
instruction
The positioning
SM284 Y0 is applicable to DSZR/DVIT R/W √ √ √
instruction is driving
User interrupt input
SM285 Y0 is applicable to DVIT R/W √
instruction
337
VC Series Micro-PLC Programming Manual Special auxiliary relay
338
VC Series Micro-PLC Programming Manual Special auxiliary relay
Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
and repeatedly driven with the energy
stream.
When this bit is ON , The PLS
The envelope
SM334 instruction loop of Y3 is executed R/W √ √ √
executes in a loop
repeatedly
When this bit is ON ,Y3 PSLV
PLSV progressive
instruction frequency changes
SM335 frequency R/W √ √
gradually, enabling acceleration and
conversion
deceleration function.
Enabling the clear The CLR signal output function Y3 of
SM336 R/W √ √ √ √
function the ZRN instruction is valid.
Y element Y (N) corresponding to the
The element value N in SD235 is used to indicate
SM337 specified by the the clear signal. If not specified, Y3 is R √ √ √ √
clear signal is valid Y13 by default, which is applicable to
DSZR and ZRN.
SM338 The ZRN direction Y3 is applicable to DSZR R √ √ √
SM339 FWD limit Y3 is applicable to DSZR/DVIT R √ √ √
SM340 REV limit Y3 is applicable to DSZR/DVIT R √ √ √
Logic reversal of the
SM341 Y3 is applicable to DSZR R √ √ √
DOG signal
Logic reversal of the
SM342 Y3 is applicable to DSZR R √ √ √
zero signal
Y3 is applicable to DVIT, but not
Logic reversal of the
SM343 applicable to the user interrupt input R/W √ √
interrupt signal
instruction
The positioning
SM344 Y3 is applicable to DSZR/DVIT R/W √ √ √
instruction is driving
User interrupt input
SM345 Y3 is applicable to DVIT R/W √
instruction
339
VC Series Micro-PLC Programming Manual Special auxiliary relay
Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
Y14 by default, which is applicable to
DSZR and ZRN.
SM358 The ZRN direction Y4 is applicable to DSZR R √ √ √
SM359 FWD limit Y4 is applicable to DSZR/DVIT R √ √ √
SM360 REV limit Y4 is applicable to DSZR/DVIT R √ √ √
Logic reversal of the
SM361 Y4 is applicable to DSZR R √ √ √
DOG signal
Logic reversal of the
SM362 Y4 is applicable to DSZR R √ √ √
zero signal
Y4 is applicable to DVIT, but not
Logic reversal of the
SM363 applicable to the user interrupt input R/W √ √
interrupt signal
instruction
The positioning
SM364 Y4 is applicable to DSZR/DVIT R/W √ √ √
instruction is driving
User interrupt input
SM365 Y4 is applicable to DVIT R/W √
instruction
340
VC Series Micro-PLC Programming Manual Special auxiliary relay
Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
User interrupt input
SM385 Y5 is applicable to DVIT R/W √
instruction
341
VC Series Micro-PLC Programming Manual Special auxiliary relay
Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
When this bit is ON, the interrupt
program and subroutine can call the
The interrupt drive PLSY instruction of Y7, and the call in
SM413 R/W √ √ √
pulse output valid the main program will be continuously
and repeatedly driven with the energy
stream.
When this bit is ON , The PLS
The envelope
SM414 instruction loop of Y7 is executed R/W √ √ √
executes in a loop
repeatedly
When this bit is ON ,Y7 PSLV
PLSV progressive
instruction frequency changes
SM415 frequency R/W √ √
gradually, enabling acceleration and
conversion
deceleration function.
Enabling the clear The CLR signal output function Y7 of
SM416 R/W √ √ √ √
function the ZRN instruction is valid.
Y element Y (N) corresponding to the
The element value N in SD315 is used to indicate
SM417 specified by the the clear signal. If not specified, Y7 is R √ √ √ √
clear signal is valid Y17 by default, which is applicable to
DSZR and ZRN.
SM418 The ZRN direction Y7 is applicable to DSZR R √ √ √
SM419 FWD limit Y7 is applicable to DSZR/DVIT R √ √ √
SM420 REV limit Y7 is applicable to DSZR/DVIT R √ √ √
Logic reversal of the
SM421 Y7 is applicable to DSZR R √ √ √
DOG signal
Logic reversal of the
SM422 Y7 is applicable to DSZR R √ √ √
zero signal
Y7 is applicable to DVIT, but not
Logic reversal of the
SM423 applicable to the user interrupt input R/W √ √
interrupt signal
instruction
The positioning
SM424 Y7 is applicable to DSZR/DVIT R/W √ √ √
instruction is driving
User interrupt input
SM425 Y7 is applicable to DVIT R/W √
instruction
342
VC Series Micro-PLC Programming Manual Special auxiliary relay
CANopen instruction
SM442 R √ √ √
is running
343
VC Series Micro-PLC Programming Manual Special data register
Note
1. The reserved SD and SM elements are not listed in the table. The reserved SD elements are by default read only.
344
VC Series Micro-PLC Programming Manual Special data register
Reserved
SD24 operation error R √ √ √ √ √
code 4
3. FROM/TO error
Address Name R/W VC1S VC1 VC2 VC3 VC5 Range
Initial
SD25 Special module's numbering is wrong . R √ √ √
value: 255
The I/O chip's numbering is wrong (starts from 0) Initial
SD26 R √ √ √
when I/O is refreshed value: 255
4. Scan time
Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5 Range
Current
SD30 Current scan time (unit: 0.1ms) R √ √ √ √ √
scan value
Min. scan
SD31 Min. scan time (unit: 0.1ms) R √ √ √ √ √
time
Max. scan
SD32 Max. scan time (unit: 0.1ms) R √ √ √ √ √
time
Initial value: 0ms (configurable only
through the system block), Unit: 1 ms.
When the constant scan time is longer
than the set value of user monitoring
Set value timeout, the user program timeout alarm
0–
of constant is raised. When a scan cycle of the user
SD33 R √ √ √ √ √ 1000m
scan time program is longer than the constant scan
s
time, the constant scan mode of this
cycle is invalid automatically and no
alarm is raised.
SD33 is regarded as 1000 ms when it is
set bigger than 1000 ms.
Initial value:200 ms (configurable only
Set value
through the system block).
of user 100–
SD34 is regarded as 100 when it is set
SD34 program R √ √ √ √ √ 1000m
smaller than 100.
timeout s
SD34 is regarded as 1000 when it is set
smaller than 1000.
Note
1. The error tolerance of SD30, SD31 and SD32 is 1ms.
2. It is recommended to set the user program overtime (SD34) at least 5ms bigger than the constant scan time (SD33).
Otherwise,when the value of SD33 closes to SD34, the system is apt to report user program overtime errordue to the influence of
the system operation and user program.
345
VC Series Micro-PLC Programming Manual Special data register
Input filtering (configurable only through the system
SD40 R/W √ √
constant block)
Input filtering (configurable only through the system
SD41 R/W √ √
constant block)
Input filtering (configurable only through the system
SD42 R/W √ √
constant block)
7. Real-time clock
Address Name Register content R/W VC1S VC1 VC2 VC3 VC5 Range
SD60 Year For real-time clock R √ √ √ √ √ 2000–2099
SD61 Month For real-time clock R √ √ √ √ √ 1–12 month
SD62 Day For real-time clock R √ √ √ √ √ 1–31 day
SD63 Hour For real-time clock R √ √ √ √ √ 0–23 hour
SD64 Minute For real-time clock R √ √ √ √ √ 0–59 minute
SD65 Second For real-time clock R √ √ √ √ √ 0–59 second
0 (Sunday)–6
SD66 Week For real-time clock R √ √ √ √ √
(Saturday)
You can set these elements only with the TWR instruction or through the host computer
346
VC Series Micro-PLC Programming Manual Special data register
b2, b1, b0
000: 38,400 baud rate
SD100.0– 001: 19,200 baud rate
SD100.2 010: 9,600 baud rate
Port baud 011: 4,800 baud rate
rate 100: 2,400 baud rate
101: 1,200 baud rate
110: 57,600 baud rate
111: 115,200 baud rate
347
VC Series Micro-PLC Programming Manual Special data register
Address Name Register content R/W VC1S VC1 VC2 VC3 VC5 Range
Default: 0 ms
Intercharacter
SD103 (intercharacter timeout R/W √ √ √ √ √ √
timeout
is omitted)
Default: 0 ms
SD104 Frame timeout (frame timeout is R/W √ √ √ √ √ √
omitted)
Bit 0: set when the
receiving ends
Bit 1: set when the
specified end word is
received
Bit 2: set when the
Receiving
max. character
completion
SD105 number is received R √ √ √ √ √ √
message code
Bit 3: set upon
intercharacter timeout
Bit 4: set upon frame
timout
Bit 5: set upon the
parity check error
Bits 6-15: reserved
Currently received
SD106 R √ √ √ √ √ √
characters
Total number of
SD107 currently received R √ √ √ √ √ √
characters
Currently
SD108 transmitted R √ √ √ √ √ √
characters
PORT 0 Station
SD109 R/W √ √ √ √ √ √
number setting
PORT0 maximum
timeout setting
(after sending and
SD110 R/W √ √ √ √ √ √
before receiving)
ECBUS additional
delay.
PORT 0 retry
SD111 R/W √ √ √ √ √ √
number
N:N network
refresh mode
SD112 R/W √ √ √ √ √ √
(reserved by
PORT 0)
Error code for
SD113 Modbus master R √ √ √ √ √ √
station (PORT 0)
348
VC Series Micro-PLC Programming Manual Special data register
Address Name Register content R/W VC1S VC1 VC2 VC3 VC5 Range
SD120.3 0: 1 stop bit
Stop bit 1: 2 stop bits
SD120.4
0: even parity
Parity
1: odd parity
check
SD120.5
Parity 0: no parity check
check 1: parity check
enabling
Data bit of each
SD120.6
character
Characte
0: 8-bit character
r data bit
1: 7-bit character
SD120.7
Free-port 1: has specific start
receiving character
start 0: no specific start
character character
mode
SD120.8
Free-port 1: has specific end
receiving character
end 0: no specific end
character character
mode
SD120.9
Free-port 1: has valid
interchar intercharacter timeout
acter 0: no valid
timout intercharacter timeout
enabling
SD120.
10 1: has interframe
Free-port timeout
interfram 0: no interframe
e timeout timeout
enabling
SD120.1
Reserved
1
SD120.1 0: LSB of the word
2 element is valid
MSB/LS 1: MSB/LSB of the
B valid word element is valid
SD120.1
3–
Reserved
SD120.1
5
SD121 Start character R/W √ √ √ √ √
SD122 End character R/W √ √ √ √ √
Default: 0 ms
Intercharacter
SD123 (intercharacter R/W √ √ √ √ √
timeout
timeout is omitted)
Default: 0 ms
SD124 Frame timeout (frame timeout is R/W √ √ √ √ √
omitted)
349
VC Series Micro-PLC Programming Manual Special data register
Address Name Register content R/W VC1S VC1 VC2 VC3 VC5 Range
Bit 0: set when the
receiving ends
Bit 1: set when the
specified end word is
received
Bit 2: set when the
Receiving max. character
SD125 completion number is received R √ √ √ √ √
message code Bit 3: set upon
intercharacter timeout
Bit 4: set upon frame
timout
Bit 5: set upon the
parity check error
Bits 6-15: reserved
Currently
SD126 received R √ √ √ √ √
characters
Total number of
SD127 currently received R √ √ √ √ √
characters
Currently
SD128 transmitted R √ √ √ √ √
characters
PORT 1 Station
SD129 R/W √ √ √ √ √ √
number setting
PORT1
maximum timeout
setting (after
SD130 sending and R/W √ √ √ √ √ √
before receiving)
ECBUS additional
delay.
PORT 1 retry
SD131 R/W √ √ √ √ √ √
number
N:N network
refresh mode
SD132 R/W √ √ √ √ √ √
(reserved by
PORT 1)
Error code for
SD133 Modbus master R √ √ √ √ √ √
station (PORT 1)
Error code for The value is 0 if there
SD134 Modbus master is no error in R √ √ √ √ √ √
station (PORT 1) communication
350
VC Series Micro-PLC Programming Manual Special data register
Address Name Register content R/W VC1S VC1 VC2 VC3 VC5 Range
SD140.3 0: 1 stop bit
Stop bit 1: 2 stop bits
SD140.4
0: even parity
Parity
1: odd parity
check
SD140.5
Parity 0: no parity check
check 1: parity check
enabling
Data bit of each
SD140.6
character
Characte
0: 8-bit character
r data bit
1: 7-bit character
SD140.7
Free-port 1: has specific start
receiving character
start 0: no specific start
character character
mode
SD140.8
Free-port 1: has specific end
receiving character
end 0: no specific end
character character
mode
SD140.9
Free-port 1: has valid
interchar intercharacter timeout
acter 0: no valid
timout intercharacter timeout
enabling
SD140.
10 1: has interframe
Free-port timeout
interfram 0: no interframe
e timeout timeout
enabling
SD140.1
Reserved
1
SD140.1 0: LSB of the word
2 element is valid
MSB/LS 1: MSB/LSB of the
B valid word element is valid
SD140.1
3–
Reserved
SD140.1
5
SD141 Start character R/W √ √ √ √ √
SD142 End character R/W √ √ √ √ √
Default: 0 ms
Intercharacter
SD143 (intercharacter R/W √ √ √ √ √
timeout
timeout is omitted)
Default: 0 ms
SD144 Frame timeout (frame timeout is R/W √ √ √ √ √
omitted)
351
VC Series Micro-PLC Programming Manual Special data register
Address Name Register content R/W VC1S VC1 VC2 VC3 VC5 Range
Bit 0: set when the
receiving ends
Bit 1: set when the
specified end word is
received
Bit 2: set when the
Receiving max. character
SD145 completion number is received R √ √ √ √ √
message code Bit 3: set upon
intercharacter timeout
Bit 4: set upon frame
timout
Bit 5: set upon the
parity check error
Bits 6-15: reserved
Currently
SD146 received R √ √ √ √ √
characters
Total number of
SD147 currently received R √ √ √ √ √
characters
Currently
SD148 transmitted R √ √ √ √ √
characters
PORT 2 Station
SD149 R/W √ √ √ √ √ √
number setting
PORT 2
maximum timeout
setting (after
SD150 sending and R/W √ √ √ √ √ √
before receiving)
ECBUS additional
delay.
PORT 2 retry
SD151 R/W √ √ √ √ √ √
number
N:N network
refresh mode
SD152 R/W √ √ √ √ √ √
(reserved by
PORT 2)
Error code for
SD153 Modbus master R √ √ √ √ √ √
station (PORT 2)
Error code for The value is 0 if there
SD154 Modbus master is no error in R √ √ √ √ √ √
station (PORT 2) communication
1) Y0 Correlation register
Address Action and function Initial value R/W VC1S VC1 VC2 VC3 VC5
SD160 The cumulative number of Y0 pulse
0 R/W √ √ √ √
SD161 output.
SD164 0 R √ √ √ √ √
352
VC Series Micro-PLC Programming Manual Special data register
Address Action and function Initial value R/W VC1S VC1 VC2 VC3 VC5
Current frequency of Y0 output
SD165
positioning instruction.
SD166 Max. speed at which the ZRN, PLSV,
DRVI, DRVA, DSZR and DVIT
100000 R/W √ √ √ √
SD167 instructions are executed (10- 100000)
(Y0)
Base speed when ZRN, PLSV, DRVI,
SD168 DRVA, DSZR and DVIT instructions are 5000 R/W √ √ √ √
executed (1/10 of max. speed) (Y0)
Acceleration/deceleration time for
accelerating from base speed (SD204)
to max. speed (SD202, SD203) when
SD169 the ZRN, DRVI, DRVA, DSZR and 1000 R/W √ √ √ √
DVIT instructions are executed (Y0)
(50ms-5000ms)
2) Y1 Correlation register
Address Action and function Initial value R/W VC1S VC1 VC2 VC3 VC5
SD180 The cumulative number of Y1 pulse
0 R/W √ √ √ √
SD181 output.
353
VC Series Micro-PLC Programming Manual Special data register
Address Action and function Initial value R/W VC1S VC1 VC2 VC3 VC5
Deceleration time for decelerating from
max. speed to base speed when the
SD190 ZRN, DRVI, DRVA, DSZR and DVIT 1000 R/W √
instructions are executed Y1 (50 ms-
5000 ms)
Crawling speed Y1 is applicable to
SD191 1000 R/W √ √ √ √
DSZR
SD192 The zero return speed Y1 is applicable
50000 R/W √ √ √ √
SD193 to DSZR
Number of segments to which the PLS
SD194 output instruction is currently executed 0 R/W √ √ √ √
(Y1 applicable)
Y1 is specified as the soft element of
SD195 0 R/W √ √ √ √
the clear signal
DVIT interrupt signal soft element
SD196 0 R/W √ √ √ √
specification (applicable Y1)
3) Y2 Correlation register
Address Action and function Initial value R/W VC1S VC1 VC2 VC3 VC5
SD200 The cumulative number of Y2 pulse
0 R/W √ √ √ √
SD201 output.
354
VC Series Micro-PLC Programming Manual Special data register
Address Action and function Initial value R/W VC1S VC1 VC2 VC3 VC5
DVIT interrupt signal soft element
SD216 0 R/W √ √ √ √
specification (applicable Y2)
4) Y3 Correlation register
Address Action and function Initial value R/W VC1S VC1 VC2 VC3 VC5
SD220 The cumulative number of Y3 pulse
0 R/W √ √ √ √
SD221 output.
5) Y4 Correlation register
Address Action and function Initial value R/W VC1S VC1 VC2 VC3 VC5
SD240 The cumulative number of Y4 pulse
0 R/W √ √ √ √
SD241 output.
355
VC Series Micro-PLC Programming Manual Special data register
Address Action and function Initial value R/W VC1S VC1 VC2 VC3 VC5
SD246 Max. speed at which the ZRN, PLSV,
DRVI, DRVA, DSZR and DVIT
100000 R/W √ √ √ √
SD247 instructions are executed (10- 100000)
(Y4)
Base speed when ZRN, PLSV, DRVI,
SD248 DRVA, DSZR and DVIT instructions are 5000 R/W √ √ √ √
executed (1/10 of max. speed) (Y4)
Acceleration/deceleration time for
accelerating from base speed (SD204)
to max. speed (SD202, SD203) when
SD249 the ZRN, DRVI, DRVA, DSZR and 1000 R/W √ √ √ √
DVIT instructions are executed (Y4)
(50ms-5000ms)
6) Y5 Correlation register
Address Action and function Initial value R/W VC1S VC1 VC2 VC3 VC5
SD260 The cumulative number of Y5 pulse
0 R/W √ √ √ √
SD261 output.
356
VC Series Micro-PLC Programming Manual Special data register
Address Action and function Initial value R/W VC1S VC1 VC2 VC3 VC5
Deceleration time for decelerating from
max. speed to base speed when the
SD270 ZRN, DRVI, DRVA, DSZR and DVIT 1000 R/W √
instructions are executed Y5 (50 ms-
5000 ms)
Crawling speed Y5 is applicable to
SD271 1000 R/W √ √ √ √
DSZR
SD272 The zero return speed Y5 is applicable
50000 R/W √ √ √ √
SD273 to DSZR
Number of segments to which the PLS
SD274 output instruction is currently executed 0 R/W √ √ √ √
(Y5 applicable)
Y5 is specified as the soft element of
SD275 0 R/W √ √ √ √
the clear signal
DVIT interrupt signal soft element
SD276 0 R/W √ √ √ √
specification (applicable Y5)
7) Y6 Correlation register
Address Action and function Initial value R/W VC1S VC1 VC2 VC3 VC5
SD280 The cumulative number of Y6 pulse
0 R/W √ √ √ √
SD281 output.
357
VC Series Micro-PLC Programming Manual Special data register
Address Action and function Initial value R/W VC1S VC1 VC2 VC3 VC5
DVIT interrupt signal soft element
SD296 0 R/W √ √ √ √
specification (applicable Y6)
8) Y7 Correlation register
Address Action and function Initial value R/W VC1S VC1 VC2 VC3 VC5
SD300 The cumulative number of Y7 pulse
0 R/W √ √ √ √
SD301 output.
358
VC Series Micro-PLC Programming Manual Special data register
359
VC Series Micro-PLC Programming Manual Reserved elements
Description VC1S/VC1/VC2/VC3/VC5
N:N network sharing area D7700 D7763
N:N enhanced mode (mode 14-18)
D7500 D7755
network sharing area
N:N network sharing area M1400 M1911
360
VC Series Micro-PLC Programming Manual Modbus communication error codes
Abnormal
Meaning of abnormal code
code
0x01 Illegal function code
0x02 Illegal register address
0x03 Data number error
0x10 Communication timeout, namely communication time exceeds the max communication time set by the user
0x11 Receiving data frame error
0x12 Parameter error, setting parameter (mode or master/slave) error
0x13 The station no. is the same as that set by the instruction, and an error occurred
0x14 Element address overflows (the data quantity received or sent is beyond the element storage space)
0x15 Instruction execution failed
The received slave address does not match the requested one, and detailed error code element stores the
0x16
received slave address
The received function code does not match the requested one, and detailed error code element stores the
0x17
received function code
Information frame error: the start address of element does not match, and detailed error code element stores the
0x18
received element start address
The received data length does not match the one specified by the protocol or the element number exceeds the
0x19
max. number specified by this function code.
0x20 CRC/LRC parity error
0x21 Reserved
0x22 Start address of instruction parameter element is set wrong
0x23 Instruction parameter sets unsupported function code or illegal function code
0x24 The number of instruction parameter elements are set wrong
0x25 Reserved
0x26 Parameter is non-modifiable during running.
0x27 Parameter is protected by a password
361
VC Series Micro-PLC Programming Manual System error codes
362
VC Series Micro-PLC Programming Manual System error codes
Error code Meaning Error type Description
User program stops, and ERR indicator turns
on
42 Data block file error System error
To remove this error, it is required to download
new data block file or format the disk
User program keeps running, and ERR
Battery-backed data loss indicator blinks
43 System error
error To remove this error, it is required to clear the
elements, format the disk, or reset.
User program keeps running, and ERR
indicator blinks
44 Forcing table loss error System error
To remove this error, it is required to clear the
elements, force, format the disk, or reset.
User program stops, and ERR indicator turns
on
45 User information file error System error To remove this error, it is required to download
new program and data block files or format the
disk
46–59 Reserved
User program compilation User program stops, and ERR indicator turns
60 Execution error
error on.
User program operation Execution error User program stops, and ERR indicator turns
61
timeout on.
Illegal user program Execution error User program stops, and ERR indicator turns
62
instruction execution error on.
Illegal element type of Execution error User program stops, and ERR indicator turns
63
instruction operand on.
Execution error User program keeps running, and ERR
Illegal instruction operand
64 indicator keeps off. The corresponding error
value
code is prompted in SD20
Outside the instruction Execution error
65
operand element range
Subprogram stack Execution error
66
overflow
User interrupt request Execution error
67
queue overflow
Illegal label jump or Execution error
68
subprogram call
69 Divide by 0 error Execution error
Execution error When the stack size, or number of stack
Definition error of the elements are smaller than zero, or number of
70
stack operated the stack elements exceed the limit of the stack
size
71 Reserved Execution error
Undefined user Execution error
72 subprogram or interrupt
subprogram
Invalid special module Execution error
73
address
Error occurred when Execution error
74
assess the special module
I/O immediate refreshing Execution error
75
error
76 Clock setup error Execution error
PLSR instruction Execution error
77
parameter error
BFM buffer of assessed Execution error
78 special module exceeds
the range
363
VC Series Micro-PLC Programming Manual Modbus communication protocols
1. Using RS485 or RS232 interface, with RS232 3-line system as the physical interface.
3. Being as an Modbus slave station with the address ranging from 1 to 31.
4. Supportingthe broadcast mode. The broadcast is effective for write and sub-function codes of diagnosis.
5. Supporting baud rates including 38,400 bps, 19,200 bps, 9,600 bps, 4,800 bps, 2,400 bps and 1,200 bps.(Default: 19200,
8 bits, 1 stop bit, and even check)
6.Supporting data field 2 × 252 bytes (ASII mode) or 252 bytes (RTU mode).
Name of function
Function code Modicon data addresss Type of operable element Note
code
01 Read coil 0Note 1:xxxx Y, X, M, SM, S, T, and C Bit read
02 Read discrete input 1Note 2:xxxx X Bit read
Note 3
03 Read register 4 :xxxxNote 4 D, SD, Z, T, and C Word read
05 Write single coil 0:xxxx Y, M, SM, S, T, and C Bit write
Write single
06 4:xxxx D, SD, Z, T, and C Word write
register
15 Write multiple coils 0:xxxx Y, M, SM, S, T, and C Bit write
Write multiple
16 4:xxxx D, SD, Z, T, and C Word write
registers
Notes:
1. 0 indicates "coil".
2. 1 indicates "discrete input".
3. 4 indicates "register".
4. xxxx indicates range "1–9999". Each type has an independent logic address range of 1 to 9999 (protocol address starts from
0).
5. 0, 1 and 4 do not have the physical meaning and are not involved in actual addressing.
6. You shall not write data in X element with function codes 05 and 15; otherwise, the system does not feed back the error
information if the
written operand and data are correct, but the system does not perform any operation on the write instruction.
364
VC Series Micro-PLC Programming Manual Modbus communication protocols
Eleme Protocol Supported
Type Physical element Note
nt address function code
M2048–M10240 12000-20191
SM0–SM255 4400–4655
SM Bit 01, 05, and 15
SM256–SM1023 30000-30767
S0–S1023 6000-7023
S Bit 01, 05, and 15
S1024–S4095 31000-34071
T0–T255 8000–8255
T Bit 01, 05, and 15 State of T element
T256–T511 11000-11255
C0–C255 9200–9455
C Bit 01, 05, and 15 State of C element
C256–C511 10000-10511
D Word D0–D7999 0000–7999 03, 06, and 16
SD0–SD255 8000–8255
SD Word 03, 06, and 16
SD256–SD1023 12000-12767
Z Word Z0–Z15 8500–8515 03, 06, and 16
T0–T255 9000–9255
T Word 03, 06, and 16 Current value of T element
T256–T511 11000-11255
C Word C0–C199 9500–9699 03, 06, and 16 Current value of C element (INT)
Double
C C200–C255 9700–9811 03 and 16 Current value of C element (DINT)
word
Double
C C256–C306 10000-10101 03 and 16 Current value of C element (DINT)
word
R Word R0–R32767 13000-45767 03, 06, and 16
Note:
The protocol address is the address used on data transmission and corresponds with the logic address of Modicon data. The
protocol address starts from 0 while the logic address of Modicon data starts from 1, that is, protocol address + 1 = logic address
of Modicon data. For example, if M0 protocol address is 2000, and its corresponding logic address of Modicon data is 0:2001. In
fact, the read and write of M0 is completed through the protocol address, for example: read M0 element frame (sent from the
master station).
01 01 07 D0 00 01 FD 47
CRC check code
CRC check code
Start address. The decimal value of D7D0 is 2000.
Function code
Station No.
⚫ Notes
1. X and Y elements use the octal system. There are 256 points in total from X0 to X377, 256 points from Y0 to Y377, with
2. Two addressing methods are available for X element. One is the protocol address of 1200-1455 with corresponding
function codes of 01, 05 and 15; the other is the protocol address of 0-255 with function code 02.
3. Processing of double-word elements: C element is a counter. It has its state and current value. C200–C255 are 32-bit
elements, but each C element in the range occupies two protocol addresses during the protocol addressing. For
example: The protocol address of C200 is 9700–9701. When reading the elements though Modbus, both the startprotocol
address and the number of the read elements are even number.
4. For most SM and SD elements, the real value cannot be written through Modbus, but PLC salve station still returns "OK"
to indicate the completion of write operation, which is allowable.
365
VC Series Micro-PLC Programming Manual Modbus communication protocols
5. In addition, the Modbus communication protocol of the VC series supports the read and write of double word element,
LONGINT variable and floating-point number. In VC series PLCs, 32-bit data are stored with high bits at high address. For
example, a 32-bit data is stored in two D elements (D3 and D4), with MSB in D3 and LSB in D4, as shownin the following
figure: (Refer to the description for the specific example)
D3 MSB
MSB LSB
D4 LSB
32-bit data
1. Request frame
Start address Number of elements
Address Function code (01H)
H L H L
2. Response frame
If the read address is not a multiple of 8, the remaining bits are filled with 0 (starting from the high bits).
Check
Addres Function code Number of read elements (n) code
Read data No.1 …… Read data No.n
s (01H) (Number of bytes) (CRC or
LRC)
B7 B6 B5 B4 B3 B2 B1 B0
In the VC series PLC, it specially refers to X element. The function code only supports the read function of X element with the
max. read number of 256.
1. Request frame
Function code Start address Number of elements Check code
Address
(02H) H L H L (CRC or LRC)
2. Response frame
If the read address is not a multiple of 8, the remaining bits are filled with 0 (starting from the high bits).
Function Number of read elements (n) Check code
Address Read dataNo.1 …… Read data No.n
code (02H) (Number of bytes) (CRC or LRC)
B7 B6 B5 B4 B3 B2 B1 B0
Reading holding registers refers to reading the value of data (word) register at the slave station, with a maximum of 125 registers
to be read. It does not support the broadcast.
1. Request frame
Address Function code Start address Number of elements Check code
366
VC Series Micro-PLC Programming Manual Modbus communication protocols
(03H) H L H L (CRC or LRC)
2. Response frame
Function Number of read Read dataNo.1 Read data No.n
code elements (n) Check code
Address ……
(03H) (Number of H L H L (CRC or LRC)
bytes)
Forcing (writing) single coil writes the bit element value to the slave station and supports broadcast, that is, writing the same
element to all slave stations. It supports a maximum of 1 bit element.
1. Request frame
Function code Start address Written element value Check code
Address
(05H) H L H L (CRC or LRC)
2. Response frame
Presetting (writing) single register (0x06) writes the word element value to the slave station andsupports broadcast, that is, writing
the same element to all slave stations. It supports a maximum of 1 word element.
1. Request frame
Function code Start address Written element value Check code
Address
(06H) H L H L (CRC or LRC)
2. Response frame
Diagnostic registers and communication error information can be obtained through the returning diagnostic check.
Diagnostic code Meaning
0x00 Returning the request frame
0x 01 Restarting the communication option
0x 04 Listen only mode of the slave station
0x0a Clearing counters and diagnostic registers
0x0b Returning the bus message count
0x0c Returning the bus CRC error count
0x0d Returning the slave error count
0x0e Returning the slave message count
0x0f Returning the slave no response count
0x12 Returning the bus character overrun count
The frame description of sub-function code is as follows.
⚫ Returning the request frame(0x00):
1. Request frame
Function code Function word code Any character Check code
Address
(0x08H) (0x00H) (0x00H) H L (CRC or LRC)
367
VC Series Micro-PLC Programming Manual Modbus communication protocols
2. Response frame
After receiving the frame, the PLC exit from the listen only mode (Broadcast frame is supported).
1. Request frame
The slave station enters the listen only mode. None of the instruction is executed or responded. The slave station can only
recognize the restarting communication option instruction and enters the online mode after receiving the
instruction(Broadcast frame is supported).
1. Request frame
2. Response frame
No return.
⚫ Clearing counters and diagnostic registers(0x0A):
1. Request frame
Function word code Data field
Function code Check code
Address 0x00 0x00
(0x08H) (0x00H) (0x0AH) (CRC or LRC)
H H
2. Response frame
Function word code Data field
Function code Check code
Address 0x00 0x00
(0x08H) (0x00H) (0x0AH) (CRC or LRC)
H H
Recording the total number of the messages to all master stations from the slave stations since the last starting, clearing
1. Request frame
Function word code Data field
Function code Check code
Address 0x00 0x00
(0x08H) (0x00H) (0x0BH) (CRC or LRC)
H H
2. Response frame
Function code Function word code Data field Check code
Address
(0x08H) (0x00H) (0x0BH) H L (CRC or LRC)
Recording the number of CRC errors received by the slave station since the last starting, clearing and power-on of counters.
368
VC Series Micro-PLC Programming Manual Modbus communication protocols
1. Request frame
Function word code Data field
Function code Check code
Address 0x00 0x00
(0x08H) (0x00H) (0x0CH) (CRC or LRC)
H H
2. Response frame
Function code Function word code Data field Check code
Address
(0x08H) (0x00H) (0x0CH) H L (CRC or LRC)
Recording the number of errors that are detected by the slave station since the last starting, clearing and power-onof counters,
which includes the error detected in the broadcast message.
1. Request frame
Function word code Data field
Function code Check code
Address 0x00 0x00
(0x08H) (0x00H) (0x0DH) (CRC or LRC)
H H
2. Response frame
Function code Function word code Data field Check code
Address
(0x08H) (0x00H) (0x0DH) H L (CRC or LRC)
Recording the number of the addressing messages received by the slave station since the last starting, clearing andpower-
on of counters.
1. Request frame
Function word code Data field
Function code Check code
Address 0x00 0x00
(0x08H) (0x00H) (0x0EH) (CRC or LRC)
H H
2. Response frame
Function code Function word code Data field Check code
Address
(0x08H) (0x00H) (0x0EH) H L (CRC or LRC)
Recording the number of messages that have not returned to the slave station since the last starting, clearing andpower-on
of counters.
1. Request frame
Function word code Data field
Function code Check code
Address 0x00 0x00
(0x08H) (0x00H) (0x0FH) (CRC or LRC)
H H
2. Response frame
Function code Function word code Data field Check code
Address
(0x08H) (0x00H) (0x0FH) H L (CRC or LRC)
Recording the number of the messages that cannot be addressed due to the character overrun since the last starting,clearing
and power-on of counters.
1. Request frame
Function word code Data field
Function code Check code
Address 0x00 0x00
(0x08H) (0x00H) (0x12H) (CRC or LRC)
H H
2. Response frame
369
VC Series Micro-PLC Programming Manual Modbus communication protocols
Function code Function word code Data field Check code
Address
(0x08H) (0x00H) (0x12H) H L (CRC or LRC)
A maximum of 1968 bit elements (0x07b0) can be written and the number is changeable according to the defined range.
1. Request frame
Functi Start Number of
Written
on address elements Number
Add element Written element Check code
code of bytes ……
ress value value No.N (CRC or LRC)
H L H L (n)
No.1
(0FH)
B7 B6 B5 B4 B3 B2 B1 B0
2. Response frame
Add Function code Start address Number of elements Check code
ress (0FH) H L H L (CRC or LRC)
1. Request frame
Number
Function Numb
Start of Written element Written element
Add code er of Check code
address element value No.1 …… value No.N
ress bytes (CRC or LRC)
s
(0x10H) (n)
H L H L H L H L
2. Response frame
Add Function code Start address Number of elements Check code
ress (0x10H) H L H L (CRC or LRC)
Response frame:
Error code (Refer to 2. "Supported Modbus function code Check code
Address Function code
and element addressing mode"of appendix G (CRC or LRC)
Function code refers to the function code of the captured request frame +0x80.
3.10 Note
1. Refer to the address classification of elements, the read soft elements each time shall be of the same type. For example, X and
Y elements cannot be read in one frame.
2. The address and data range of the element shall be within the range specified by the protocol. For example:
• If the read start address is 1 and 256 elements are read, address error is returned (error code 02),because there are only
255 Y elements that start from 1.
• If the read start address is 0 and 257 elements are read, data error is returned (error code 03), becausethe actual defined
number of Y elements is only 256.
• If the read start address is 0 and 256 elements are read, the states of 256 elements are returned.
370
VC Series Micro-PLC Programming Manual Modbus communication protocols
In other words, the number of the read elements must be within the actually defined range. It is true for read/write ofbit/word
elements.
All supported function codes, except 08, are used for reading and writing elements. In principle, in oneframe, there are 2000
bit elements and 125 word elements for reading, 1968 bit elements and 120 word elements for writing at most. However,
theactual protocol addresses for different types of elements are different and discontinuous (for example, Y377's protocol
addressis 255 while X0's protocol address is 1200). Therefore, when reading or writing an element, the element read at one
timecan only be the same type, and the max. number of the read/written elements depends on the number of the elements
thatare actually defined. For example, when reading Y elements(Y0 – Y377), the protocol addressranges from 0 to 255, the
corresponding logic address of Modicon data is from 1 to 256, and the max. number of the Y elements that can be readis
256.The examples are as follows:
01 – address; 01- function code; 00 00 – start address; 01 00 – number of the read elements; 3D 9A – check
The master station reads 01 01 (257) elements, which is beyond thedefined number of Y elements.
The response of the slave station is illegal address, because 257>256, and 256 is the allowed max. number of Y
elements.
00 64 (decimal: 100) is the start address for the master station to read, and 00 A0 (decimal: 160) is the number of the
elements.
The response of the slave station is illegal address, because the protocol address 300 has no definition of bit elements.
The response of the slave station is illegal address, because there are only 156 Y elements which are defined to start
from 100, and 160 Y elements have exceeded the specified number.
The response of the slave station is illegal address, because the protocol address 300 has no definition of bit elements.
The master station reads 10 (X0–X9) input elements (X elements) from the start address.
371
VC Series Micro-PLC Programming Manual Modbus communication protocols
The slave station responds with correct information, which has 02 bytes, and the content is 00 00.
The master station reads 10 bit elements (X0–X9) starting from 04 B0 (demical:1200).
The slave station responds with 02 bytes, and the content is 00 00.
Note
1. The address of the slave station is 01, the last two bytes are CRC check codes and the second byte is function code.
2. X element does not support the write operation.
⚫ Processing of double word elements
1. The current count value of C element is word or double word element. The values from C200 to C263 are double word
elements, which are read and written through the function codes (03 and 16) of read/write registers. The address of every
two registers corresponds to one C double word element, and the registers can only be read or written in pair.
For example, reading the RTU frame of three C double word elements from C200 to C202.
01 03 25 E4 00 06 8E F3
Check code
Number of read element: 6
Start address: 9700
Function code
Station No.
In the returned data, two addresses 9700 and 9701 indicate the contents of C200. 9700 is MSB, and 9701 is LSB.
2. When reading a double word element, if the start address for reading is not an even number, then the system responds
with error code of illegal address. For example:
The start address for the reading sent by the master station is 25 E5 (four word elements, decimal:9701).
3. If the number of the read registers is not an even number, the system responds with error code of illegal data. For example:
The start address for the master station reading is 25 E4 (5 word elements).
Based on the storage method of VC series PLCs, one LONG INT data can be saved in two D elements. For example, if a
LONG INT data is saved in D3 and D4, VEICHI PLC think that MSB are stored in D3 and LSB are stored in D4. When the
master station reads the LONG INT data through Modbus, the 32-bit data shall be regrouped based on the LONG INTstorage
principle of VEICHI PLC after reading the data.
The storage principle of FLOAT is the same as the storage principle of LONG INT.
5. Description of broadcast
The slave station supports broadcast but not all the function codes. The slave station supports function codes 01, 02,03, 05, 06,
08, 15 and 16 (decimal), among which, 01, 02 and 03 can read element but do not support broadcast, noresponse is gotten after
372
VC Series Micro-PLC Programming Manual Modbus communication protocols
sending out the broadcast; 05, 06, 15 and 16 are can write element and support broadcast,no response is gotten after sending
out the broadcast, but the slave station processes the received data; 08 is thediagnostic function code, it does not support the
broadcast except its sub-function codes 0x01, 0x04 and 0x0A(hex).
373
VC Series Micro-PLC Programming Manual ASCII code character encoding table
374
VC Series Micro-PLC Programming Manual Instruction order index table
Step
Instruction Instructionfunction Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Instruction for obtaining ACOS
ACOS 7 Zero, carry, and borrow √ √ √ √ √ 115
of a floating-point number
ADD Integer addition instruction 7 Zero, carry, and borrow √ √ √ √ √ 98
Energy flow block and
ANB 1 √ √ √ √ √ 61
instruction
AND NO contact and instruction 1 √ √ √ √ √ 59
Integer comparison AND<
AND< 5 √ √ √ √ √ 200
instruction
Integer comparison AND<=
AND<= 5 √ √ √ √ √ 200
instruction
Integer comparison AND<>
AND<> 5 √ √ √ √ √ 200
instruction
Integer comparison AND=
AND= 5 √ √ √ √ √ 200
instruction
Integer comparison AND>
AND> 5 √ √ √ √ √ 200
instruction
Integer comparison AND>=
AND>= 5 √ √ √ √ √ 200
instruction
Long integer comparison AND<
ANDD< 7 √ √ √ √ √ 203
instruction
Long integer comparison
ANDD<= 7 √ √ √ √ √ 203
AND<= instruction
Long integer comparison
ANDD<> 7 √ √ √ √ √ 203
AND<> instruction
Long integer comparison AND=
ANDD= 7 √ √ √ √ √ 203
instruction
Long integer comparison AND>
A ANDD> 7 √ √ √ √ √ 203
instruction
Long integer comparison
ANDD>= 7 √ √ √ √ √ 203
AND>= instruction
Floating-point number
ANDR< 7 √ √ √ √ √ 206
comparison AND> instruction
Floating-point number
ANDR<= 7 √ √ √ √ √ 206
comparison AND<= instruction
Floating-point number
ANDR<> 7 √ √ √ √ √ 206
comparison AND<> instruction
Floating-point number
ANDR= 7 √ √ √ √ √ 206
comparison AND= instruction
Floating-point number
ANDR> 7 √ √ √ √ √ 206
comparison AND> instruction
Floating-point number
ANDR>= 7 √ √ √ √ √ 206
comparison AND>= instruction
ANI NC contact and instruction 1 √ √ √ √ √ 60
ANR Signal alarm reset instruction 1 Zero, carry, and borrow √ √ 249
ANS Signal alarm set instruction 7 Zero, carry, and borrow √ √ 248
ASCII code conversion
ASC 19 Zero, carry, and borrow √ √ √ √ √ 123
instruction
Instruction for obtaining ASIN
ASIN 7 Zero, carry, and borrow √ √ 115
of a floating-point number
Instruction for converting an
ATI 7 Zero, carry, and borrow √ √ √ √ √ 124
ASCII code to a 16-bit hex data
Instruction for obtaining ATAN
ATAN 7 Zero, carry, and borrow √ √ 115
of a floating-point number
ALT Alternate output instruction 11 Zero, carry, and borrow √ √ √ √ √ 184
375
VC Series Micro-PLC Programming Manual Instruction order index table
Step
Instruction Instructionfunction Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Cam absolute control √ √
ABSD 9 Zero, carry, and borrow √ 181
instruction
Word bit contact AND
BAND 5 √ √ √ √ √ 196
instruction
BANI Word bit contact ANI instruction 5 √ √ √ √ √ 197
Instruction for converting a
BCD 5 Zero, carry, and borrow √ √ √ √ √ 119
word to a 16-bit BCD code
BIN: Instruction for converting a
BIN 5 Zero, carry, and borrow √ √ √ √ √ 120
16-bit BCD code to a word
Instruction for counting on bit in
BITS 5 √ √ √ √ √ 194
word
Bulk data addition operation
BKADD 9 Zero, carry, and borrow √ √ 210
instruction
BKCMP=,
Bulk data comparison
>,<,<>,<=, 9 √ √ 211
B instruction
>=
Bulk data subtraction operation
BKSUB 9 Zero, carry, and borrow √ √ 211
instruction
BLD Word bit contact LD instruction 5 √ √ √ √ √ 195
BLDI Word bit contact LDI instruction 5 √ √ √ √ √ 196
Block data transmission
BMOV 7 √ √ √ √ √ 92
instruction
Instruction for judging on bit in
BON 7 √ √ 195
word
BOR Word bit contact OR instruction 5 √ √ √ √ √ 197
Word bit contact ORI
BORI 5 √ √ √ √ √ 198
instruction
BOUT Word bit coil output instruction 5 √ √ √ √ √ 198
BRST Word bit coil reset instruction 5 √ √ √ √ √ 199
BSET Word bit coil set instruction 5 √ √ √ √ √ 198
B
Byte-unit data combination
BTOW 7 Zero, carry, and borrow √ √ 245
instruction
Instruction for calling the user
CALL √ √ √ √ √ 90
subprogram
CCITT CCITT check instruction 7 √ √ √ √ √ 191
Counterclockwise arc trajectory
CCW 12 Zero, carry, and borrow √ √ 238
interpolation
Instruction for conditional return
CFEND 1 √ √ √ √ √ 88
of user main program
Instruction for conditional return
CIRET 1 √ √ √ √ √ 89
of user interrupt program
CJ Conditional jump instruction 3 √ √ √ √ √ 88
Instruction for obtaining COS of
COS 7 Zero, carry, and borrow √ √ √ √ √ 112
C a floating-point number
CRC16 CRC16 check instruction 7 √ √ √ √ √ 191
Instruction for conditional return
CSRET 1 √ √ √ √ √ 90
of user subprogram
16-bit cyclic counting
CTR 5 √ √ √ √ √ 76
instruction
16-bit increment counter
CTU 5 √ √ √ √ √ 76
instruction
Instruction for setting integer √ √
CMP 7 √ 209
comparison to ON
Clockwise arc trajectory √ √
CW 12 Zero, carry, and borrow 237
interpolation
Long integer addition
DADD 10 Zero, carry, and borrow √ √ √ √ √ 102
D instruction
DBAND Deadband control instruction 9 Zero, carry, and borrow √ √ 213
376
VC Series Micro-PLC Programming Manual Instruction order index table
Step
Instruction Instructionfunction Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Instruction for converting a
DBCD double word to a 32-bit BCD 7 Zero, carry, and borrow √ √ √ √ √ 120
code
Instruction for converting a 32-
DBIN 7 √ √ √ √ √ 121
bit BCD code to a double word
Instruction for counting on bit in
DBITS 6 √ √ √ √ √ 195
double word
DCMP< Date < comparison instruction 7 √ √ √ √ 153
DCMP<= Date <= comparison instruction 7 √ √ √ √ 153
DCMP<> Date <> comparison instruction 7 √ √ √ √ 153
DCMP= Date = comparison instruction 7 √ √ √ √ 153
DCMP> Date > comparison instruction 7 √ √ √ √ 153
DCMP>= Date >= comparison instruction 7 √ √ √ √ 153
32-bit increment and
DCNT 7 √ √ √ √ √ 77
decrement counting instruction
Long integer minus one
DDEC 4 Zero, carry, and borrow √ √ √ √ √ 105
instruction
DDIV Long integer division instruction 10 Zero, carry, and borrow √ √ √ √ √ 103
DEC Integer minus one instruction 3 Zero, carry, and borrow √ √ √ √ √ 101
Instruction for floating-point
DEG number radian-angle 7 Zero, carry, and borrow √ √ 116
conversion
DECO Decoding instruction 5 √ √ √ √ √ 193
Instruction for converting a long
DFLT integer to a floating-point 7 Zero, carry, and borrow √ √ √ 118
number
Data block double word fill
DFMOV 9 √ √ √ √ √ 93
instruction
Instruction for reading double
DFROM words from a special module 10 √ √ √ 141
buffer register
Instruction for converting a 32-
DGBIN 7 Zero, carry, and borrow √ √ √ √ √ 122
bit gray code to a double word
Instruction for converting a
DGRY double word to a 32-bit gray 7 Zero, carry, and borrow √ √ √ √ √ 121
code
Instruction for triggering
DHSCI interrupt based on comparison 10 √ √ √ √ √ 157
of high-speed count
Instruction for resetting the
DHSCR 10 √ √ √ √ √ 159
high-speed count comparison
Instruction of setting the high-
DHSCS 10 √ √ √ √ √ 156
speed count comparison
Instruction for pulse output
DHSP based on high-speed count 10 √ √ √ √ √ 164
table comparison
Instruction for triggering
interrupt based on comparison
DHSPI 10 √ √ √ 159
of absolute high-speed output
positions
High-speed count table
DHST 10 √ √ √ √ √ 162
comparison instruction
High-speed count range
DHSZ 13 √ √ √ √ √ 161
comparison instruction
DI Disable interrupt instruction 1 √ √ √ √ √ 89
Long integer plus one
DINC 4 Zero, carry, and borrow √ √ √ √ √ 104
instruction
377
VC Series Micro-PLC Programming Manual Instruction order index table
Step
Instruction Instructionfunction Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Instruction for convert a
DINT floating-point number to a long 7 Zero, carry, and borrow √ √ √ √ √ 119
integer
Instruction for separating 4
DIS 7 Zero, carry, and borrow √ √ 247
bitsof 16-bit data
DIV Integer division instruction 7 √ √ √ √ √ 99
Double word data transmission
DMOV 7 √ √ √ √ √ 91
instruction
Long integer multiplication
DMUL 10 Zero, carry, and borrow √ √ √ √ √ 103
instruction
Long integer negation
DNEG 7 Zero, carry, and borrow √ √ √ √ √ 106
instruction
Instruction for 32-bit rotate left
DRCL 9 Carry √ √ √ √ √ 136
with carry flag bit
Instruction for 32-bit rotate right
DRCR 9 Carry √ √ √ √ √ 135
with carry flag bit
DROL 32-bit rotate left instruction 9 Carry √ √ √ √ √ 135
DROR 32-bit rotate right instruction 9 Carry √ √ √ √ √ 134
Absolute position control
DRVA 11 Zero, carry, and borrow √ √ √ √ √ 230
instruction
Relative position control
DRVI 11 Zero, carry, and borrow √ √ √ √ √ 229
instruction
DSHL 32-bit shift left instruction 9 √ √ √ √ √ 138
DSHR 32-bit shift right instruction 9 √ √ √ √ √ 138
Instruction for extracting the
DSQT 7 Zero, carry, and borrow √ √ √ √ √ 104
square root of a long integer
D Long integer subtraction
DSUB 10 Zero, carry, and borrow √ √ √ √ √ 102
instruction
Long integer accumulation
DSUM 9 Zero, carry, and borrow √ √ √ √ √ 108
instruction
Instruction for converting a long
DTI 6 Zero, carry, and borrow √ √ √ √ √ 117
integer to an integer
Instruction for writing double
DTO words from a special module 10 √ √ √ 143
buffer register
Instruction for generating timed
DUTY 7 √ √ 250
pulses
Instruction for obtaining the
DVABS 7 Zero, carry, and borrow √ √ √ √ √ 105
absolute value of a long integer
DWAND Double word AND instruction 10 √ √ √ √ √ 130
Double word negation
DWINV 10 √ √ √ √ √ 131
instruction
DWOR Double word OR instruction 10 √ √ √ √ √ 130
DWXOR Double word XOR instruction 10 √ √ √ √ √ 131
DXCH Double word swop instruction 7 √ √ √ √ √ 94
Cam absolute control √ √
DABSD 11 Zero, carry, and borrow √ 183
instruction
Instruction for zero return with √ √
DSZR 9 Zero, carry, and borrow √ √ 231
DOG
DVIT Interrupt positioning instruction 11 Zero, carry, and borrow √ 232
Falling edge detection
ED 1 √ √ √ √ √ 64
instruction
EI Enable interrupt instruction 1 √ √ √ √ √ 89
E ENCO Encoding instruction 5 √ √ √ √ √ 194
EROMWR EEPROM write instruction 7 145
Rising edge detection
EU 2 √ √ √ √ √ 64
instruction
378
VC Series Micro-PLC Programming Manual Instruction order index table
Step
Instruction Instructionfunction Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Instruction for obtaining the
EXP natural number power of a 7 Zero, carry, and borrow √ √ √ √ √ 114
floating-point number
FIFO First-in-first-out instruction 7 √ √ √ √ √ 95
Instruction for converting an
FLT integer to a floating-point 6 Zero, carry, and borrow √ √ √ √ √ 118
number
F FMOV Data block fill instruction 7 √ √ √ √ √ 92
FOR Cycle instruction 3 √ √ √ √ √ 85
Instruction for reading words
FROM from a special module buffer 9 √ √ √ 141
register
Instruction for converting a 16-
GBIN 5 Zero, carry, and borrow √ √ √ √ √ 122
bit gray code to a word
G
Instruction for converting a
GRY 5 Zero, carry, and borrow √ √ √ √ √ 121
word to a 16-bit gray code
Sawtooth wave signal output
HACKLE 12 √ √ √ √ √ 179
instruction
Instruction for driving the high-
HCNT 7 √ √ √ √ √ 156
speed counter
H HOUR Chronograph instruction 8 √ √ √ √ √ 152
Instruction for
HTOS converting hour-minute- 5 √ √ 155
second data to seconds
INC Integer plus one instruction 3 Zero, carry, and borrow √ √ √ √ √ 100
Instruction for initializing an
INITR 5 Zero, carry, and borrow 223
extension register
Instruction for converting a
INT floating-point number to an 6 Zero, carry, and borrow √ √ √ √ √ 118
I integer
Energy flow negation
INV 1 √ √ √ √ √ 157
instruction
Instruction for converting a 16-
ITA 7 Zero, carry, and borrow √ √ √ √ √ 124
bit hex data to an ASCII code
Instruction for converting an
ITD 6 Zero, carry, and borrow √ √ √ √ √ 117
integer to a long integer
LBL Jump label definition instruction 3 √ √ √ √ √ 86
LCNV Project conversion instruction 9 Zero, carry, and borrow √ √ √ 125
LD NO contact instruction 1 √ √ √ √ √ 199
Integer comparison
LD< 5 √ √ √ √ √ 199
LD<instruction
Integer comparison
LD<= 5 √ √ √ √ √ 199
LD<=instruction
Integer comparison
LD<> 5 √ √ √ √ √ 199
LD<>instruction
Integer comparison
L LD= 5 √ √ √ √ √ 199
LD=instruction
Integer comparison
LD> 5 √ √ √ √ √ 199
LD=instruction
Integer comparison
LD>= 5 √ √ √ √ √ 199
LD>=instruction
Long integer comparison
LDD< 7 √ √ √ √ √ 202
LD<instruction
Long integer comparison
LDD<= 7 √ √ √ √ √ 202
LD<=instruction
Long integer comparison
LDD<> 7 √ √ √ √ √ 202
LD<>instruction
379
VC Series Micro-PLC Programming Manual Instruction order index table
Step
Instruction Instructionfunction Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Long integer comparison
LDD= 7 √ √ √ √ √ 202
LD=instruction
Long integer comparison
LDD> 7 √ √ √ √ √ 202
LD>instruction
Long integer comparison
LDD>= 7 √ √ √ √ √ 202
LD>=instruction
LDI NC contact instruction 1 √ √ √ √ √ 59
Floating-point number
LDR< 7 √ √ √ √ √ 205
comparison LD<instruction
Floating-point number
LDR<= 7 √ √ √ √ √ 205
comparison LD<=instruction
Floating-point number
LDR<> 7 √ √ √ √ √ 205
comparison LD<>instruction
Floating-point number
LDR= 7 √ √ √ √ √ 205
comparison LD=instruction
Floating-point number
LDR> 7 √ √ √ √ √ 205
comparison LD>instruction
Floating-point number
LDR>= 7 √ √ √ √ √ 205
comparison LD>=instruction
LIFO Last-in-first-out instruction 7 √ √ √ √ √ 96
Upper/lower limit control
LIMIT 9 Zero, carry, and borrow √ √ 212
instruction
Linear trajectory interpolation
LIN 12 Zero, carry, and borrow √ √ 234
instruction
Instruction for obtaining the
LN natural logarithm of a floating- 7 Zero, carry, and borrow √ √ √ √ √ 113
point number
Instruction for reading data from
LOADR 5 Zero, carry, and borrow 221
an extension file register
Instruction for obtaining the
LOG common logarithm of a 7 Zero, carry, and borrow √ √ 116
floating-point number
Instruction for logging on an
LOGR 11 Zero, carry, and borrow 224
extension register
LRC LRC check instruction 7 √ √ √ √ √ 192
MC Main control instruction 3 √ √ √ √ √ 70
MCR Main control reset instruction 1 √ √ √ √ √ 70
MEAN Mean instruction 7 Zero, carry, and borrow √ √ 244
Modbus master station
Modbus 8 √ √ √ √ √ 184
communication instruction
Word data transmission
MOV 5 √ √ √ √ √ 91
instruction
MOVLINK Synchronous control instruction 17 Zero, carry, and borrow 238
M
Output energy flow stack pop
MPP 1 √ √ √ √ √ 63
instruction
Output energy flow push
MPS 1 √ √ √ √ √ 62
instruction
Instruction for reading output
MRD 1 √ √ √ √ √ 63
energy flow stack top value
MUL Integer negation instruction 8 Zero, carry, and borrow √ √ √ √ √ 99
MODRW Modbus read/write instruction 14 √ √ √ √ √ 187
NEG Integer negation instruction 5 Zero, carry, and borrow √ √ √ √ √ 102
N NEXT Cycle return instruction 1 √ √ √ √ √ 85
NOP No operation instruction 1 √ √ √ √ √ 70
O OR NO contact or instruction 1 √ √ √ √ √ 60
380
VC Series Micro-PLC Programming Manual Instruction order index table
Step
Instruction Instructionfunction Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Integer comparison
OR< 5 √ √ √ √ √ 201
OR<instruction
Integer comparison
OR<= 5 √ √ √ √ √ 201
OR<=instruction
Integer comparison
OR<> 5 √ √ √ √ √ 201
OR<>instruction
Integer comparison
OR= 5 √ √ √ √ √ 201
OR=instruction
Integer comparison
OR> 5 √ √ √ √ √ 201
OR>instruction
Integer comparison
OR>= 5 √ √ √ √ √ 201
OR>=instruction
ORB Energy flow block or instruction 1 √ √ √ √ √ 62
Long integer comparison
ORD< 7 √ √ √ √ √ 204
OR<instruction
Long integer comparison
ORD<= 7 √ √ √ √ √ 204
OR<=instruction
Long integer comparison
ORD<> 7 √ √ √ √ √ 204
OR<>instruction
Long integer comparison
ORD= 7 √ √ √ √ √ 204
OR=instruction
Long integer comparison
ORD> 7 √ √ √ √ √ 204
OR>instruction
Long integer comparison
ORD>= 7 √ √ √ √ √ 204
OR>=instruction
ORI NO contact or instruction 1 √ √ √ √ √ 61
Floating-point number
ORR< 7 √ √ √ √ √ 207
comparison OR>instruction
Floating-point number
ORR<= 7 √ √ √ √ √ 207
comparison OR<=instruction
Floating-point number
ORR<> 7 √ √ √ √ √ 207
comparison OR<>instruction
Floating-point number
ORR= 7 √ √ √ √ √ 207
comparison OR=instruction
Floating-point number
ORR> 7 √ √ √ √ √ 207
comparison OR>instruction
Floating-point number
ORR>= 7 √ √ √ √ √ 207
comparison OR>=instruction
OUT Coil output instruction 1 √ √ √ √ √ 61
OUT Sxx SFC state jump instruction 3 √ √ √ √ √ 72
PID PID function instruction 9 √ √ √ √ √ 174
Envelop line pulse output
PLS 7 √ √ √ √ 171
instruction
Instruction for count pulse
PLSR output with 10 √ √ √ √ √ 168
acceleration/deceleration
Variable speed pulse output
P PLSV 8 Zero, carry, and borrow √ √ √ √ √ 228
instruction
High-speed pulse output
PLSY 9 √ √ √ √ √ 167
instruction
Instruction for exponentiation of
POWER 10 Zero, carry, and borrow √ √ √ √ √ 113
a floating-point number
PUSH Data push instruction 7 √ √ √ √ √ 94
PWM Pulse output instruction 7 √ √ √ √ √ 172
R Instruction for floating-point √ √
RAD number angle-radian 7 Zero, carry, and borrow √ 116
conversion
381
VC Series Micro-PLC Programming Manual Instruction order index table
Step
Instruction Instructionfunction Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Floating-point number addition
RADD 10 Zero, carry, and borrow √ √ √ √ √ 108
instruction
RAMP Ramp signal output instruction 12 √ √ √ √ √ 178
Instruction for 16-bit rotate left
RCL 7 Carry √ √ √ √ √ 134
with carry flag bit
Instruction for 16-bit rotate right
RCR 7 Carry √ √ √ √ √ 133
with carry flag bit
RCV Free-port receiving instruction 7 √ √ √ √ √ 186
Floating-point number division
RDIV 10 Zero, carry, and borrow √ √ √ √ √ 110
instruction
Instruction for immediately
REF 5 √ √ √ √ √ 144
refreshing I/O
Instruction for setting input
REFF 3 √ √ √ √ √ 144
filtering constant
SFC program segment end
RET 1 √ √ √ √ √ 73
instruction
Floating-point project
RLCNV 12 Zero, carry, and borrow √ √ √ 126
conversion instruction
Floating-point data
RMOV 7 √ √ √ √ √ 92
transmission instruction
Floating-point number
RMUL 10 Zero, carry, and borrow √ √ √ √ √ 109
multiplication instruction
Instruction for generating
RND 3 Zero √ √ 249
random numbers
Floating-point number negation
RNEG 7 Zero, carry, and borrow √ √ √ √ √ 111
instruction
ROL 16-bit rotate left instruction 7 Carry √ √ √ √ √ 132
ROR 16-bit rotate right instruction 7 Carry √ √ √ √ √ 132
Instruction for extracting the
RSQT square root of a floating-point 7 Zero, carry, and borrow √ √ √ √ √ 110
number
RST Coil reset instruction 1 √ √ √ √ √ 69
RST Sxx SFC state reset instruction 3 √ √ √ √ √ 72
Floating-point number
RSUB 10 Zero, carry, and borrow √ √ √ √ √ 109
subtraction instruction
Floating-point number
RSUM 9 Zero, carry, and borrow √ √ √ √ √ 114
accumulation instruction
Instruction for obtaining the
RVABS absolute value of a floating- 7 Zero, carry, and borrow √ √ √ √ √ 111
point number
Instruction for setting floating-
RCMP point number comparison to 9 √ √ √ 210
ON
Instruction for writing data to an
SAVER 7 Zero, carry, and borrow 222
extension file register
SCL Coordinate setting instruction 7 Zero, carry, and borrow √ √ 214
Instruction for converting a
SEG 5 Zero, carry, and borrow √ √ √ √ √ 123
word to a 7-segment code
SER Data search instruction 9 Zero, carry, and borrow √ √ 215
SET Coil set instruction 1 √ √ √ √ √ 69
S
SET Sxx SFC state transition instruction 3 √ √ √ √ √ 72
SFTL Bit string shift left instruction 9 √ √ √ √ √ 139
SFTR Bit string shift right instruction 9 √ √ √ √ √ 139
SHL 16-bit shift left instruction 7 √ √ √ √ √ 137
SHR 16-bit shift right instruction 7 √ √ √ √ √ 136
Instruction for obtaining SIN of
SIN 7 Zero, carry, and borrow √ √ √ √ √ 111
a floating-point number
382
VC Series Micro-PLC Programming Manual Instruction order index table
Step
Instruction Instructionfunction Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Frequency measuring
SPD 7 √ √ √ √ √ 166
instruction
Instruction for extracting the
SQT 5 Zero, carry, and borrow √ √ √ √ √ 100
square root of an integer
STL SFC state loading instruction 3 √ √ √ √ √ 71
Instruction for converting
STOH seconds to hour-minute-second 5 √ √ 155
data
Instruction for stopping the user
STOP 1 √ √ √ √ √ 89
program
STRADD String combination instruction 7 Zero, carry, and borrow √ √ 216
STRINST
String search instruction 9 Zero, carry, and borrow √ √ 220
R
Instruction for reading a string
STRLEFT 7 Zero, carry, and borrow √ √ 218
from left
Instruction for detecting the
STRLEN 5 Zero, carry, and borrow √ √ 217
string length
Instruction for reading any
STRMIDR 7 Zero, carry, and borrow √ √ 219
characters of a string
Instruction for replacing any
STRMIDW 7 Zero, carry, and borrow √ √ 219
characters of a string
STRMOV String transmission instruction 5 Zero, carry, and borrow √ √ 221
STRRIGH Instruction for reading a string
7 Zero, carry, and borrow √ √ 217
T from right
SUB Integer subtraction instruction 7 Zero, carry, and borrow √ √ √ √ √ 99
Integer accumulation
SUM 8 Zero, carry, and borrow √ √ √ √ √ 106
instruction
SWAP MSB/LSB swop instruction 3 √ √ √ √ √ 93
TADD Clock addition instruction 7 Zero and carry √ √ √ √ 150
Instruction for obtaining TAN of
TAN 7 Zero, carry, and borrow √ √ √ √ √ 112
a floating-point number
TCMP< Time < comparison instruction 7 √ √ √ √ 154
TCMP<= Time >= comparison instruction 7 √ √ √ √ 154
TCMP<> Time <> comparison instruction 7 √ √ √ √ 154
TCMP= Time = comparison instruction 7 √ √ √ √ 154
TCMP> Time > comparison instruction 7 √ √ √ √ 154
TCMP>= Time >= comparison instruction 7 √ √ √ √ 154
TKY Numeric key input instruction 7 √ √ 146
Non-retriggerable monostable
TMON 5 √ √ √ √ √ 75
T timing instruction
Instruction for writing words
TO from a special module buffer 9 √ √ √ 142
register
TOF Turn-off delay timing instruction 5 √ √ √ √ √ 74
TON Turn-on delay timing instruction 5 √ √ √ √ √ 73
Memory-type turn-on delay
TONR 5 √ √ √ √ √ 73
timing instruction
TRD Real-time clock read instruction 3 √ √ √ √ 148
TRIANGL Triangle wave signal output
12 √ √ √ √ √ 180
E instruction
TSUB Clock subtraction instruction 7 Zero and borrow √ √ √ √ 151
TWR Real-time clock write instruction 3 √ √ √ √ 149
Instruction for combining 4 bits
U UNI 7 Zero, carry, and borrow √ √ 246
of 16-bit data
383
VC Series Micro-PLC Programming Manual Instruction order index table
Step
Instruction Instructionfunction Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Instruction for obtaining the
VABS 5 Zero, carry, and borrow √ √ √ √ √ 101
absolute value of an integer
V
Instruction for reading the value
VRRD 5 143
of an analog potentiometer
WAND Word AND instruction 7 √ √ √ √ √ 127
Instruction for watchdog reset
WDT 1 √ √ √ √ √ 88
of user program
WINV Word INV instruction 5 √ √ √ √ √ 130
WOR Word OR instruction 7 √ √ √ √ √ 129
W WSFL Word string shift left instruction 9 Zero, carry, and borrow √ √ √ √ √ 97
Word string shift right
WSFR 9 Zero, carry, and borrow √ √ √ √ √ 96
instruction
Byte-unit data separation
WTOB 7 Zero, carry, and borrow √ √ 244
instruction
WXOR Word XOR instruction 7 √ √ √ √ √ 129
XCH Word swop instruction 5 √ √ √ √ √ 94
X
XMT Free-port sending instruction 7 √ √ √ √ √ 185
ZONE Zone control instruction 9 Zero, carry, and borrow √ √ 213
ZRN Zero return instruction 11 Zero, carry, and borrow √ √ √ √ √ 227
Instruction for resetting bits to 0
Z ZRST 5 √ √ √ √ √ 193
in batch
Instruction for resetting bits in
ZSET 5 √ √ √ √ √ 193
batch
Note:
384
VC Series Micro-PLC Programming Manual Instruction classification index table
Step
Instruction Instruction function Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
NO contact
LD 1 √ √ √ √ √ 59
instruction
NC contact
LDI 1 √ √ √ √ √ 59
instruction
NO contact and
AND 1 √ √ √ √ √ 59
instruction
NC contact and
ANI 1 √ √ √ √ √ 60
instruction
NO contact or
OR 1 √ √ √ √ √ 60
instruction
NC contact or
ORI 1 √ √ √ √ √ 61
instruction
OUT Coil output instruction 1 √ √ √ √ √ 61
SET Coil set instruction 1 √ √ √ √ √ 69
RST Coil reset instruction 1 √ √ √ √ √ 69
Energy flow block
ANB 1 √ √ √ √ √ 61
and instruction
Energy flow block or
ORB 1 √ √ √ √ √ 62
instruction
Energy flow negation
INV 1 √ √ √ √ √ 69
instruction
No operation
NOP 1 √ √ √ √ √ 70
instruction
Output energy flow
MPS 1 √ √ √ √ √ 62
push instruction
Basic Instruction for
instructio reading output
ns MRD 1 √ √ √ √ √ 63
energy flow stack top
value
Output energy flow
MPP 1 √ √ √ √ √ 63
stack pop instruction
Main control
MC 3 √ √ √ √ √ 70
instruction
Main control reset
MCR 1 √ √ √ √ √ 70
instruction
Rising edge detection
EU 2 √ √ √ √ √ 64
instruction
Falling edge
ED 2 √ √ √ √ √ 64
detection instruction
Turn-on delay timing
TON 5 √ √ √ √ √ 73
instruction
Turn-off delay timing
TOF 5 √ √ √ √ √ 74
instruction
Non-retriggerable
TMON monostable timing 5 √ √ √ √ √ 75
instruction
Memory-type turn-on
TONR delay timing 5 √ √ √ √ √ 73
instruction
16-bit increment
CTU 5 √ √ √ √ √ 76
counter instruction
16-bit cyclic counting
CTR 5 √ √ √ √ √ 76
instruction
385
VC Series Micro-PLC Programming Manual Instruction classification index table
Step
Instruction Instruction function Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
32-bit increment and
DCNT decrement counting 7 √ √ √ √ √ 77
instruction
Jump label definition
LBL 3 √ √ √ √ √ 86
instruction
Conditional jump
CJ 3 √ √ √ √ √ 88
instruction
Instruction for calling
CALL √ √ √ √ √ 90
the user subprogram
Instruction for
CSRET conditional return of 1 √ √ √ √ √ 90
user subprogram
Instruction for
CFEND conditional return of 1 √ √ √ √ √ 88
user main program
Program Instruction for
flow conditional return of
CIRET 1 √ √ √ √ √ 89
control user interrupt
instructio program
ns FOR Cycle instruction 3 √ √ √ √ √ 85
Cycle return
NEXT 1 √ √ √ √ √ 85
instruction
Instruction for
WDT watchdog reset of 1 √ √ √ √ √ 88
user program
Instruction for
STOP stopping the user 1 √ √ √ √ √ 89
program
Enable interrupt
EI 1 √ √ √ √ √ 89
instruction
Disable interrupt
DI 1 √ √ √ √ √ 89
instruction
SFC state loading
STL 3 √ √ √ √ √ 71
instruction
SFC state transition
SET Sxx 3 √ √ √ √ √ 72
instruction
SFC SFC state jump
OUT Sxx 3 √ √ √ √ √ 72
instructio instruction
ns SFC state reset
RST Sxx 3 √ √ √ √ √ 72
instruction
SFC program
RET segment end 1 √ √ √ √ √ 73
instruction
Word data
MOV transmission 5 √ √ √ √ √ 91
instruction
Double word data
DMOV transmission 7 √ √ √ √ √ 91
Data
instruction
transmissi
Floating-point data
on
RMOV transmission 7 √ √ √ 92
instructio
instruction
ns
Block data
BMOV transmission 7 √ √ √ √ √ 92
instruction
MSB/LSB swop
SWAP 3 √ √ √ √ √ 93
instruction
Word swop
Data flow XCH 5 √ √ √ √ √ 94
instruction
386
VC Series Micro-PLC Programming Manual Instruction classification index table
Step
Instruction Instruction function Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Double word swop
DXCH 7 √ √ √ √ √ 94
instruction
Data block fill
FMOV 7 √ √ √ √ √ 92
instruction
Data block double
DFMOV 9 √ √ √ √ √ 93
word fill instruction
Word string shift right
WSFR 9 Zero, carry, and borrow √ √ √ √ √ 96
instruction
Word string shift left
WSFL 9 Zero, carry, and borrow √ √ √ √ √ 97
instruction
PUSH Data push instruction 7 √ √ √ √ √ 94
First-in-first-out
FIFO 7 √ √ √ √ √ 95
instruction
Last-in-first-out
LIFO 7 √ √ √ √ √ 96
instruction
Integer addition
ADD 7 Zero, carry, and borrow √ √ √ √ √ 98
instruction
Long integer addition
DADD 10 Zero, carry, and borrow √ √ √ √ √ 102
instruction
Integer subtraction
SUB 7 Zero, carry, and borrow √ √ √ √ √ 99
instruction
Long integer
DSUB subtraction 10 Zero, carry, and borrow √ √ √ √ √ 102
instruction
Integer plus one
INC 3 Zero, carry, and borrow √ √ √ √ √ 100
instruction
Long integer plus one
DINC 4 Zero, carry, and borrow √ √ √ √ √ 104
instruction
Integer minus one
DEC 3 Zero, carry, and borrow √ √ √ √ √ 101
instruction
Long integer minus
DDEC 4 Zero, carry, and borrow √ √ √ √ √ 105
one instruction
Integer multiplication
MUL 8 Zero, carry, and borrow √ √ √ √ √ 99
instruction
Integer/lo Long integer
ng integer DMUL multiplication 10 Zero, carry, and borrow √ √ √ √ √ 103
arithmetic instruction
operation Integer division
DIV 7 √ √ √ √ √ 99
instructio instruction
ns Long integer division Zero, carry, and borrow
DDIV 10 √ √ √ √ √ 103
instruction
Instruction for Zero, carry, and borrow
obtaining the
VABS 5 √ √ √ √ √ 101
absolute value of an
integer
Instruction for Zero, carry, and borrow
obtaining the
DVABS 7 √ √ √ √ √ 105
absolute value of a
long integer
Integer negation Zero, carry, and borrow
NEG 5 √ √ √ √ √ 102
instruction
Long integer Zero, carry, and borrow
DNEG 7 √ √ √ √ √ 106
negation instruction
Instruction for Zero, carry, and borrow
SQT extracting the square 5 √ √ √ √ √ 100
root of an integer
Instruction for Zero, carry, and borrow
DSQT extracting the square 7 √ √ √ √ √ 104
root of a long integer
387
VC Series Micro-PLC Programming Manual Instruction classification index table
Step
Instruction Instruction function Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Integer accumulation Zero, carry, and borrow
SUM 8 √ √ √ √ √ 106
instruction
Long integer Zero, carry, and borrow
DSUM accumulation 9 √ √ √ √ √ 108
instruction
Floating-point Zero, carry, and borrow
RADD number addition 10 √ √ √ √ √ 108
instruction
Floating-point Zero, carry, and borrow
RSUB number subtraction 10 √ √ √ √ √ 109
instruction
Floating-point Zero, carry, and borrow
RMUL number multiplication 10 √ √ √ √ √ 109
instruction
Floating-point Zero, carry, and borrow
RDIV number division 10 √ √ √ √ √ 110
instruction
Instruction for Zero, carry, and borrow
obtaining the
RVABS 7 √ √ √ √ √ 111
absolute value of a
floating-point number
Floating-point Zero, carry, and borrow
RNEG number negation 7 √ √ √ √ √ 111
instruction
Floating-
Instruction for Zero, carry, and borrow
point
extracting the square
arithmetic RSQT 7 √ √ √ √ √ 110
root of a floating-
operation
point number
instructio
Instruction for Zero, carry, and borrow
ns
SIN obtaining SIN of a 7 √ √ √ √ √ 111
floating-point number
Instruction for Zero, carry, and borrow
COS obtaining COS of a 7 √ √ √ √ √ 112
floating-point number
Instruction for Zero, carry, and borrow
TAN obtaining TAN of a 7 √ √ √ √ √ 112
floating-point number
Instruction for Zero, carry, and borrow
obtaining the natural
LN 7 √ √ √ √ √ 113
logarithm of a
floating-point number
Instruction for Zero, carry, and borrow
obtaining the natural
EXP 7 √ √ √ √ √ 114
number power of a
floating-point number
Instruction for Zero, carry, and borrow
POWER exponentiation of a 10 √ √ √ √ √ 113
floating-point number
Floating-point Zero, carry, and borrow
RSUM number accumulation 9 √ √ √ √ √ 114
instruction
Floating- Instruction for Zero, carry, and borrow
point ASIN obtaining ASIN of a 7 √ √ √ √ √ 115
arithmetic floating-point number
operation Instruction for Zero, carry, and borrow
instructio ACOS obtaining ACOS of a 7 √ √ √ √ √ 115
ns floating-point number
Instruction for Zero, carry, and borrow
ATAN obtaining ATAN of a 7 √ √ √ √ √ 115
floating-point number
388
VC Series Micro-PLC Programming Manual Instruction classification index table
Step
Instruction Instruction function Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Instruction for Zero, carry, and borrow
floating-point number
RAD 7 √ √ √ 116
angle-radian
conversion
Instruction for Zero, carry, and borrow
floating-point number
DEG 7 √ √ √ 116
radian-angle
conversion
Instruction for Zero, carry, and borrow
obtaining the
LOG common logarithm of 7 √ √ √ 116
a floating-point
number
WAND Word AND instruction 7 √ √ √ √ √ 127
Double word AND
DWAND 10 √ √ √ √ √ 130
instruction
WOR Word OR instruction 7 √ √ √ √ √ 129
Word/dou
Double word OR
ble word DWOR 10 √ √ √ √ √ 130
instruction
logic
Word XOR
operation WXOR 7 √ √ √ √ √ 130
instruction
instructio
Double word XOR
ns DWXOR 10 √ √ √ √ √ 131
instruction
WINV Word INV instruction 5 √ √ √ √ √ 130
Double word
DWINV 7 √ √ √ √ √ 131
negation instruction
16-bit rotate right
ROR 7 Carry √ √ √ √ √ 132
instruction
32-bit rotate right
DROR 9 Carry √ √ √ √ √ 134
instruction
16-bit rotate left
ROL 7 Carry √ √ √ √ √ 132
instruction
32-bit rotate left
DROL 9 Carry √ √ √ √ √ 135
instruction
Instruction for 16-bit
RCR rotate right with carry 7 Carry √ √ √ √ √ 133
flag bit
Instruction for 32-bit
DRCR rotate right with carry 9 Carry √ √ √ √ √ 135
flag bit
Bit shift Instruction for 16-bit
and rotate RCL rotate left with carry 7 Carry √ √ √ √ √ 134
instructio flag bit
ns Instruction for 32-bit
DRCL rotate left with carry 9 Carry √ √ √ √ √ 136
flag bit
16-bit shift right
SHR 7 √ √ √ √ √ 136
instruction
32-bit shift right
DSHR 9 √ √ √ √ √ 138
instruction
16-bit shift left
SHL 7 √ √ √ √ √ 137
instruction
32-bit shift left
DSHL 9 √ √ √ √ √ 138
instruction
Bit string shift left
SFTL 9 √ √ √ √ √ 139
instruction
Bit string shift right
SFTR 9 √ √ √ √ √ 139
instruction
DECO Decoding instruction 5 √ √ √ √ √ 193
389
VC Series Micro-PLC Programming Manual Instruction classification index table
Step
Instruction Instruction function Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
ENCO Encoding instruction 5 √ √ √ √ √ 194
Instruction for
BITS counting on bit in 5 √ √ √ √ √ 194
word
Enhanced Instruction for
bit DBITS counting on bit in 6 √ √ √ √ √ 195
processin double word
g Instruction for
instructio ZRST resetting bits to 0 in 5 √ √ √ √ √ 193
ns batch
Instruction for
ZSET 5 √ √ √ √ √ 193
resetting bits in batch
Instruction for judging
BON 7 √ √ 195
on bit in word
High-speed counter
HCNT 7 √ √ √ √ √ 156
drive instruction
High-speed counting
DHSCS comparison set 10 √ √ √ √ √ 156
instruction
High-speed counting
DHSCR comparison reset 10 √ √ √ √ √ 159
instruction
High-speed counting
DHSCI comparison interrupt 10 √ √ √ √ √ 157
trigger instruction
High-speed count
DHSZ range comparison 13 √ √ √ √ √ 161
instruction
High-speed count
High-
DHST table comparison 10 √ √ √ √ √ 162
speed I/O
instruction
instructio
Instruction for pulse
ns
output based on
DHSP 10 √ √ √ √ √ 164
high-speed count
table comparison
Frequency
SPD 7 √ √ √ √ √ 166
measuring instruction
High-speed pulse
PLSY 9 √ √ √ √ √ 167
output instruction
Instruction for count
pulse output with
PLSR 10 √ √ √ √ √ 168
acceleration/decelera
tion
PWM pulse output
PWM 7 √ √ √ √ √ 172
instruction
Envelop line pulse
PLS 7 √ √ √ √ 172
output instruction
PID Function instruction 9 √ √ √ √ √ 174
Ramp signal output
RAMP 12 √ √ √ √ √ 178
instruction
Control
Triangle wave signal
calculatio TRIANGLE 12 √ √ √ √ √ 180
output instruction
n
Sawtooth wave
instructio
HACKLE signal output 12 √ √ √ √ √ 179
ns
instruction
Cam absolute control
ABSD 9 Zero, carry, and borrow √ √ √ 181
instruction
390
VC Series Micro-PLC Programming Manual Instruction classification index table
Step
Instruction Instruction function Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Double word cam
DABSD absolute control 11 Zero, carry, and borrow √ √ √ 183
instruction
Alternate output
ALT 3 Zero, carry, and borrow √ √ √ √ √ 184
instruction
Instruction for
reading words from a
FROM 9 √ √ √ 141
special module buffer
register
Instruction for
reading double words
DFROM from a special 10 √ √ √ 141
module buffer
register
Instruction for writing
words from a special
TO 9 √ √ √ 142
module buffer
register
Instruction for writing
Periphera double words from a
DTO 10 √ √ √ 143
l special module buffer
instructio register
ns Instruction for
reading the value of
VRRD 5 143
an analog
potentiometer
Instruction for setting
REFF input filtering 3 √ √ √ √ √ 144
constant
Instruction for
REF immediately 5 √ √ √ √ √ 144
refreshing I/O
EEPROM write
EROMWR 7 145
instruction
PR Printing instruction 5 √ √ √ 145
Numeric key input
TKY 7 √ √ √ 146
instruction
Zero return
ZRN 11 Zero, carry, and borrow √ √ √ √ √ 227
instruction
Variable speed pulse
PLSV 8 Zero, carry, and borrow √ √ √ √ √ 228
output instruction
Relative position
DRVI 11 Zero, carry, and borrow √ √ √ √ √ 229
control instruction
Absolute position
DRVA 11 Zero, carry, and borrow √ √ √ √ √ 230
control instruction
Instruction for zero
DSZR 9 Zero, carry, and borrow √ √ √ √ 231
Positionin return with DOG
g Interrupt positioning
DVIT 11 Zero, carry, and borrow √ 232
instructio instruction
ns Linear trajectory
LIN interpolation 12 Zero, carry, and borrow √ √ 234
instruction
Clockwise arc
CW trajectory 12 Zero, carry, and borrow √ √ 237
interpolation
Counterclockwise arc
trajectory
CCW 12 Zero, carry, and borrow √ √ 238
interpolation
instruction
391
VC Series Micro-PLC Programming Manual Instruction classification index table
Step
Instruction Instruction function Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Synchronous control
MOVLINK 17 Zero, carry, and borrow 238
instruction
Real-time clock read
TRD 3 √ √ √ √ 148
instruction
Real-time clock write
TWR 3 √ √ √ √ 149
instruction
Clock addition
TADD 7 Zero and carry √ √ √ √ 150
instruction
Clock subtraction
TSUB 7 Zero and borrow √ √ √ √ 151
Real-time instruction
clock Chronograph
HOUR 8 √ √ √ √ 152
instructio instruction
ns Instruction for
converting hour-
HTOS 5 √ √ √ 155
minute-second data
to seconds
Instruction for
converting seconds
STOH 5 √ √ √ 155
to hour-minute-
second data
Integer comparison
LD= 5 √ √ √ √ √ 199
LD= instruction
Long integer
LDD= comparison LD= 7 √ √ √ √ √ 202
instruction
Floating-point
LDR= number comparison 7 √ √ √ √ √ 205
LD= instruction
Comparis Integer comparison
LD> 5 √ √ √ √ √ 199
on LD= instruction
contact Long integer
instructio LDD> comparison LD> 7 √ √ √ √ √ 202
ns instruction
Floating-point
LDR> number comparison 7 √ √ √ √ √ 205
LD> instruction
Integer comparison
LD>= 5 √ √ √ √ √ 199
LD>= instruction
Long integer
LDD>= comparison LD>= 7 √ √ √ √ √ 202
instruction
Integer comparison
LD< 5 √ √ √ √ √ 199
LD<instruction
Long integer
LDD< comparison LD< 7 √ √ √ √ √ 202
instruction
Floating-point
LDR< number comparison 7 √ √ √ √ √ 205
Comparis
LD< instruction
on
Integer comparison
contact LD<= 5 √ √ √ √ √ 199
LD<= instruction
instructio
Long integer
ns
LDD<= comparison LD<= 7 √ √ √ √ √ 202
instruction
Floating-point
LDR<= number comparison 7 √ √ √ √ √ 205
LD<= instruction
Integer comparison
LD<> 5 √ √ √ √ √ 199
LD<> instruction
392
VC Series Micro-PLC Programming Manual Instruction classification index table
Step
Instruction Instruction function Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Long integer
LDD<> comparison LD<> 7 √ √ √ √ √ 202
instruction
Floating-point
LDR<> number comparison 7 √ √ √ √ √ 205
LD<> instruction
Integer comparison
AND= 5 √ √ √ √ √ 200
AND= instruction
Long integer
ANDD= comparison AND= 7 √ √ √ √ √ 203
instruction
Floating-point
ANDR= number comparison 7 √ √ √ √ √ 206
AND= instruction
Integer comparison
AND> 5 √ √ √ √ √ 200
AND> instruction
Long integer
ANDD> comparison AND> 7 √ √ √ √ √ 203
instruction
Floating-point
ANDR> number comparison 7 √ √ √ √ √ 206
AND> instruction
Integer comparison
AND>= 5 √ √ √ √ √ 200
AND>= instruction
Long integer
ANDD>= comparison AND>= 7 √ √ √ √ √ 203
instruction
Floating-point
ANDR>= number comparison 7 √ √ √ √ √ 206
AND>= instruction
Integer comparison
AND< 5 √ √ √ √ √ 200
AND< instruction
Long integer
ANDD< comparison AND< 7 √ √ √ √ √ 203
instruction
Floating-point
ANDR< number comparison 7 √ √ √ √ √ 206
AND> instruction
Integer comparison
AND<= 5 √ √ √ √ √ 200
AND<= instruction
Long integer
ANDD<= comparison AND<= 7 √ √ √ √ √ 203
instruction
Floating-point
ANDR<= number comparison 7 √ √ √ √ √ 206
AND<= instruction
393
VC Series Micro-PLC Programming Manual Instruction classification index table
Step
Instruction Instruction function Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Integer comparison
AND<> 5 √ √ √ √ √ 200
AND<> instruction
Long integer
ANDD<> comparison AND<> 7 √ √ √ √ √ 203
instruction
Floating-point
ANDR<> number comparison 7 √ √ √ √ √ 206
AND<> instruction
Integer comparison
OR= 5 √ √ √ √ √ 201
OR= instruction
Long integer
ORD= comparison OR= 7 √ √ √ √ √ 204
instruction
Floating-point
ORR= number comparison 7 √ √ √ √ √ 207
OR= instruction
Integer comparison
OR> 5 √ √ √ √ √ 201
OR> instruction
Long integer
ORD> comparison OR> 7 √ √ √ √ √ 204
instruction
Floating-point
ORR> number comparison 7 √ √ √ √ √ 207
OR> instruction
Integer comparison
OR>= 5 √ √ √ √ √ 201
OR>= instruction
Long integer
Comparis ORD>= comparison OR>= 7 √ √ √ √ √ 204
on instruction
contact Floating-point
instructio ORR>= number comparison 7 √ √ √ √ √ 207
ns OR>= instruction
Integer comparison
OR< 5 √ √ √ √ √ 201
OR< instruction
Long integer
ORD< comparison OR< 7 √ √ √ √ √ 204
instruction
Floating-point
ORR< number comparison 7 √ √ √ √ √ 207
OR> instruction
Integer comparison
OR<= 5 √ √ √ √ √ 201
OR<= instruction
Long integer
ORD<= comparison OR<= 7 √ √ √ √ √ 204
instruction
Floating-point
ORR<= number comparison 7 √ √ √ 207
OR<= instruction
Integer comparison
OR<> 5 √ √ √ √ √ 201
OR<> instruction
Long integer
ORD<> comparison OR<> 7 √ √ √ √ √ 204
instruction
Floating-point
ORR<> number comparison 7 √ √ √ √ √ 207
OR<> instruction
Instruction for setting
CMP integer comparison to 7 √ √ √ 209
ON
394
VC Series Micro-PLC Programming Manual Instruction classification index table
Step
Instruction Instruction function Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Instruction for setting
LCMP long integer 9 √ √ √ 209
comparison to ON
Instruction for setting
RCMP floating-point number 9 √ √ √ 210
comparison to ON
Instruction for Zero, carry, and borrow
ITD converting an integer 6 √ √ √ √ √ 117
to a long integer
Instruction for Zero, carry, and borrow
DTI converting a long 6 √ √ √ √ √ 117
integer to an integer
Instruction for Zero, carry, and borrow
converting an integer
FLT 6 √ √ √ √ √ 118
to a floating-point
number
Instruction for Zero, carry, and borrow
converting a long
DFLT 7 √ √ √ √ √ 118
integer to a floating-
point number
Instruction for Zero, carry, and borrow
converting a floating-
INT 6 √ √ √ √ √ 118
point number to an
integer
Instruction for convert Zero, carry, and borrow
a floating-point
DINT 7 √ √ √ √ √ 119
number to a long
integer
Instruction for Zero, carry, and borrow
BCD converting a word to 5 √ √ √ √ √ 119
Value a 16-bit BCD code
conversio Instruction for Zero, carry, and borrow
n converting a double
DBCD 7 √ √ √ √ √ 120
instructio word to a 32-bit BCD
ns code
Instruction for Zero, carry, and borrow
BIN converting a 16-bit 5 √ √ √ √ √ 120
BCD code to a word
Instruction for Zero, carry, and borrow
converting a 32-bit
DBIN 7 √ √ √ √ √ 121
BCD code to a
double word
Instruction for Zero, carry, and borrow
GRY converting a word to 5 √ √ √ √ √ 121
a 16-bit gray code
Instruction for Zero, carry, and borrow
converting a double
DGRY 7 √ √ √ √ √ 121
word to a 32-bit gray
code
Instruction for Zero, carry, and borrow
GBIN converting a 16-bit 5 √ √ √ √ √ 122
gray code to a word
Instruction for Zero, carry, and borrow
converting a 32-bit
DGBIN 7 √ √ √ √ √ 122
gray code to a double
word
Instruction for Zero, carry, and borrow
SEG converting a word to 5 √ √ √ √ √ 123
a 7-segment code
395
VC Series Micro-PLC Programming Manual Instruction classification index table
Step
Instruction Instruction function Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
ASCII code Zero, carry, and borrow
ASC conversion 19 √ √ √ √ √ 123
instruction
Instruction for Zero, carry, and borrow
converting a 16-bit
ITA 7 √ √ √ √ √ 124
hex data to an ASCII
code
Instruction for Zero, carry, and borrow
converting an ASCII
ATI 7 √ √ √ √ √ 124
code to a 16-bit hex
data
Project conversion Zero, carry, and borrow
LCNV 9 √ √ √ 125
instruction
Floating-point project Zero, carry, and borrow
RLCNV conversion 12 √ √ √ 126
instruction
Word bit contact LD
BLD 5 √ √ √ √ √ 195
instruction
Word bit contact LDI
BLDI 5 √ √ √ √ √ 196
instruction
Word bit contact AND
BAND 5 √ √ √ √ √ 196
instruction
Word bit contact ANI
BANI 5 √ √ √ √ √ 197
Word instruction
contact Word bit contact OR
BOR 5 √ √ √ √ √ 197
instructio instruction
ns Word bit contact ORI
BORI 5 √ √ √ √ √ 198
instruction
Word bit coil set
BSET 5 √ √ √ √ √ 198
instruction
Word bit coil reset
BRST 5 √ √ √ √ √ 199
instruction
Word bit coil output
BOUT 5 √ √ √ √ √ 198
instruction
Master station
Modbus communication 8 √ √ √ √ √ 184
instruction
Communi
Free-port sending
cation XMT 7 √ √ √ √ √ 185
instruction
instructio
Free-port receiving
ns RCV 7 √ √ √ √ √ 186
instruction
Modbus read/write
MODRW 14 √ √ √ √ √ 187
instruction
CCITT check
CCITT 7 √ √ √ √ √ 191
instruction
Check
CRC16 check
instructio CRC16 7 √ √ √ √ √ 191
instruction
ns
LRC check
LRC 7 √ √ √ √ √ 192
instruction
Date = comparison
DCMP= 7 √ √ √ √ 153
instruction
Date > comparison
Data DCMP> 7 √ √ √ √ 153
instruction
comparis
Date < comparison
on DCMP< 7 √ √ √ √ 153
instruction
instructio
Date >= comparison
ns DCMP>= 7 √ √ √ √ 153
instruction
Date <= comparison
DCMP<= 7 √ √ √ √ 153
instruction
396
VC Series Micro-PLC Programming Manual Instruction classification index table
Step
Instruction Instruction function Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Date <> comparison
DCMP<> 7 √ √ √ √ 153
instruction
Time = comparison
TCMP= 7 √ √ √ √ 154
instruction
Time > comparison
TCMP> 7 √ √ √ √ 154
instruction
Time
Time < comparison
comparis TCMP< 7 √ √ √ √ 154
instruction
on
Time >= comparison
instructio TCMP>= 7 √ √ √ √ 154
instruction
ns
Time <= comparison
TCMP<= 7 √ √ √ √ 154
instruction
Time <> comparison
TCMP<> 7 √ √ √ √ 154
instruction
MEAN Mean instruction 7 Zero, carry, and borrow √ √ 244
Byte-unit data Zero, carry, and borrow
WTOB 7 √ √ 244
separation instruction
Byte-unit data Zero, carry, and borrow
BTOW combination 7 √ √ 245
instruction
Data
Instruction for Zero, carry, and borrow
processin
UNI combining 4 bits of 7 √ √ 246
g
16-bit data
instructio
Instruction for Zero, carry, and borrow
ns
DIS separating 4 bitsof 7 √ √ 247
16-bit data
Signal alarm set Zero, carry, and borrow
ANS 7 √ √ 248
instruction
Signal alarm reset Zero, carry, and borrow
ANR 1 √ √ 249
instruction
Bulk data addition Zero, carry, and borrow
BKADD 9 √ √ 210
Bulk data operation instruction
processin Bulk data subtraction Zero, carry, and borrow
BKSUB 9 √ √ 211
g operation instruction
instructio BKCMP=,> Zero, carry, and borrow
Bulk data comparison
ns ,<,<>,<=,> 9 √ √ 211
instruction
=
Upper/lower limit Zero, carry, and borrow
LIMIT 9 √ √ 212
control instruction
Deadband control Zero, carry, and borrow
DBAND 9 √ √ 213
Datashee instruction
t Zone control Zero, carry, and borrow
ZONE 9 √ √ 213
instructio instruction
ns Coordinate setting Zero, carry, and borrow
SCL 7 √ √ 214
instruction
Data search Zero, carry, and borrow
SER 9 √ √ 215
instruction
String combination Zero, carry, and borrow
STRADD 7 √ √ 216
instruction
Instruction for Zero, carry, and borrow
Character
STRLEN detecting the string 5 √ √ 217
string
length
processin
Instruction for Zero, carry, and borrow
g STRRIGH
reading a string from 7 √ √ 217
instructio T
right
ns
Instruction for Zero, carry, and borrow
STRLEFT reading a string from 7 √ √ 218
left
397
VC Series Micro-PLC Programming Manual Instruction classification index table
Step
Instruction Instruction function Influenced flag bit VC1S VC1 VC2 VC3 VC5 Page
length
Instruction for Zero, carry, and borrow
STRMIDR reading any 7 √ √ 219
characters of a string
Instruction for Zero, carry, and borrow
STRMIDW replacing any 7 √ √ 219
characters of a string
String search Zero, carry, and borrow
STRINSTR 9 √ √ 220
instruction
String transmission Zero, carry, and borrow
STRMOV 5 √ √ 221
instruction
Instruction for Zero, carry, and borrow
LOADR reading data from an 5 √ √ 221
extension file register
Instruction for writing Zero, carry, and borrow
SAVER data to an extension 7 √ √ 222
Extension file register
file Instruction for Zero, carry, and borrow
register INITR initializing an 5 √ √ 223
instructio extension register
n Instruction for logging Zero, carry, and borrow
LOGR on an extension 11 √ √ 224
register
Instruction for Zero, carry, and borrow
INITER initializing an 5 √ √ 225
extension file register
Instruction for
RND generating random 3 Zero √ √ 249
Other
numbers
instructio
Instruction for
n
DUTY generating timed 7 √ √ 250
pulses
398