0% found this document useful (0 votes)
20 views411 pages

VC PLC Programming Manual v1.1

The VC Series Micro-PLC Programming Manual provides comprehensive guidance for automation technicians on programming, system design, and commissioning of VEICHI PLCs. It includes detailed instructions on programming principles, software and hardware resources, and application methods, organized for both novice and experienced users. The manual also offers technical references and related documents to enhance understanding of PLC functionalities.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views411 pages

VC PLC Programming Manual v1.1

The VC Series Micro-PLC Programming Manual provides comprehensive guidance for automation technicians on programming, system design, and commissioning of VEICHI PLCs. It includes detailed instructions on programming principles, software and hardware resources, and application methods, organized for both novice and experienced users. The manual also offers technical references and related documents to enhance understanding of PLC functionalities.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 411

VC Series Micro-PLC Programming Manual

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.

Suzhou Veichi Electric Co., Ltd.

All rights reserved.The content of the manualis subject to change without prior notice.

Suzhou Veichi Electric Co., Ltd.

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

Chapter 1 Product overview................................................................................................................................................ 1

1.1 Product introduction...............................................................................................................................................1


1.1.1 Product performance and specifications .................................................................................................... 1
1.1.2 Appearance of VC1, and VC1 series main modules .................................................................................. 5
1.2 Auto Studio programming software .......................................................................................................................5
1.2.1 Basic configuration ..................................................................................................................................... 6
1.2.2 Installation process of the Auto Studio programming software................................................................... 6
1.2.3 Running interface of Auto Studio ................................................................................................................ 6
1.2.4 Programming cable .................................................................................................................................... 7
1.3 Communication function ........................................................................................................................................7
1.3.1 Modbus communication network ................................................................................................................ 7
1.3.2 N:N communication network ...................................................................................................................... 7
1.3.3 Free-port network ....................................................................................................................................... 8
Chapter 2 Function Description .........................................................................................................................................11

2.1 Programming resources and principles ...............................................................................................................12


2.1.1 Programming resources ........................................................................................................................... 12
2.1.2 PLC operating mechanism (Scan cycle model)........................................................................................ 14
2.1.3 User program running watchdog .............................................................................................................. 15
2.1.4 Constant scan operation mode ................................................................................................................ 15
2.1.5 User file download and storage ................................................................................................................ 15
2.1.6 Element initialization ................................................................................................................................ 15
2.1.7 Saving data at power outage.................................................................................................................... 15
2.1.8 Digital filtering for input points .................................................................................................................. 16
2.1.9 No battery mode....................................................................................................................................... 16
2.1.10 User program protection......................................................................................................................... 16
2.2 System configuration ...........................................................................................................................................17
2.2.1 System block ............................................................................................................................................ 17
2.2.2 Data blocks .............................................................................................................................................. 23
2.2.3 Global variable table ................................................................................................................................ 24
2.3 Running mode and state control ..........................................................................................................................24
2.3.1 Concepts of system run and stop states .................................................................................................. 24
2.3.2 Run and stop state ................................................................................................................................... 24
2.3.3 Setting the state of output pointsin the stop state ..................................................................................... 25
2.4 System commissioning ........................................................................................................................................25
2.4.1 Program download and upload ................................................................................................................ 25
2.4.2 Error reporting mechanism ....................................................................................................................... 26
2.4.3 Modifying the user program online ........................................................................................................... 28
2.4.4 Clearing and formatting ............................................................................................................................ 28
2.4.5 Checking PLC information online ............................................................................................................. 29
2.4.6 Element value writing and forcing, and element monitoring table ............................................................ 29
2.4.7 Generating data blocks from RAM ........................................................................................................... 32
Chapter 3 Soft element and data .......................................................................................................................................34

3.1 Type and function of soft elements ......................................................................................................................35


3.1.1 Summary of soft elements........................................................................................................................ 35
3.1.2 Soft elementlist......................................................................................................................................... 35
VC Series Micro-PLC Programming Manual Preface
3.1.3 Input and output points ............................................................................................................................. 37
3.1.4 Auxiliary Relays........................................................................................................................................ 37
3.1.5 State relay ................................................................................................................................................ 38
3.1.6 Timer ........................................................................................................................................................ 38
3.1.7 Counter .................................................................................................................................................... 39
3.1.8 Data register............................................................................................................................................. 39
3.1.9 Special auxiliary relay .............................................................................................................................. 40
3.1.10 Special data register .............................................................................................................................. 40
3.1.11 Indexing register..................................................................................................................................... 41
3.1.12 Local auxiliary relay ................................................................................................................................ 41
3.1.13 Local data register .................................................................................................................................. 41
3.1.14 Bit-string combined addressing mode (Kn addressing mode) ................................................................ 41
3.1.15 Indexing mode (Z addressing mode) ...................................................................................................... 42
3.1.16 Bit-string combined indexing mode ........................................................................................................ 43
3.1.17 Storing and addressing 32-bit data in D, R, and V elements .................................................................. 44
3.2 Data .....................................................................................................................................................................44
3.2.1 Data type .................................................................................................................................................. 44
3.2.2 Correlation between elements and data types ......................................................................................... 44
3.2.3 Constant ................................................................................................................................................... 45
Chapter 4 Programming concept .......................................................................................................................................46

4.1 Introduction to programming languages ..............................................................................................................47


4.1.1 LAD .......................................................................................................................................................... 47
4.1.2 IL .............................................................................................................................................................. 48
4.1.3 SFC .......................................................................................................................................................... 48
4.2 Program Elements ...............................................................................................................................................49
4.2.1 User Program ........................................................................................................................................... 49
4.2.2 System block ............................................................................................................................................ 50
4.2.3 Data block ................................................................................................................................................ 50
4.3 Block comment and variable comment of the program........................................................................................50
4.3.1 Block comment......................................................................................................................................... 50
4.3.2 Variable Comment ................................................................................................................................... 51
4.4 Subprogram .........................................................................................................................................................52
4.4.1 Concept .................................................................................................................................................... 52
4.4.2 Notestouse SBRs ..................................................................................................................................... 52
4.4.3 Definition of the SBR variable table .......................................................................................................... 53
4.4.4 SBR parameter transfer ........................................................................................................................... 54
4.4.5 SBR application instance ......................................................................................................................... 54
4.5 General information of the instructions ................................................................................................................56
4.5.1 Instruction operands ................................................................................................................................. 56
4.5.2 Flag bit ..................................................................................................................................................... 56
4.5.3 Restrictions on the use of instructions ...................................................................................................... 56
Chapter 5 Basic instructions ..............................................................................................................................................57

5.1 Contact logic instructions.....................................................................................................................................59


5.1.1 LD: NO contact instruction ....................................................................................................................... 59
5.1.2 LDI: NC contact instruction....................................................................................................................... 59
5.1.3 AND: NO contact and instruction ............................................................................................................. 59
5.1.4 ANI: NC contact and instruction ............................................................................................................... 60
5.1.5 OR: NO contact or instruction .................................................................................................................. 60
5.1.6 ORI: NO contact or instruction ................................................................................................................. 61
VC Series Micro-PLC Programming Manual Preface
5.1.7 OUT: Coil output instruction ..................................................................................................................... 61
5.1.8 ANB: Energy flow block and instruction ................................................................................................... 61
5.1.9 ORB: Energy flow block or instruction ...................................................................................................... 62
5.1.10 MPS: Output energy flow push instruction ............................................................................................. 62
5.1.11 MRD: Instruction for reading output energy flow stack top value ........................................................... 63
5.1.12 MPP: Output energy flow stack pop instruction ...................................................................................... 63
5.1.13 EU: Rising edge detection instruction .................................................................................................... 64
5.1.14 ED: Falling edge detection instruction .................................................................................................... 64
5.1.15 LDP: Rising edge of contact ................................................................................................................... 65
5.1.16 LDF: Falling edge of contact .................................................................................................................. 65
5.1.17 ANDP: Rising edge of contact ................................................................................................................ 66
5.1.18 ANDF: Falling edge of contact ............................................................................................................... 66
5.1.19 ORP: Rising edge of contact .................................................................................................................. 67
5.1.20 ORF: Falling edge of contact.................................................................................................................. 67
5.1.21 PLP: Rising edge output instruction ....................................................................................................... 68
5.1.22 PLF: Falling edge output instruction ....................................................................................................... 68
5.1.23 INV: Energy flow negation instruction .................................................................................................... 69
5.1.24 SET: Coil set instruction ......................................................................................................................... 69
5.1.25 RST: Coil reset instruction...................................................................................................................... 69
5.1.26 NOP:No operation instruction................................................................................................................. 70
5.2 Main control instructions ......................................................................................................................................70
5.2.1 MC: Main control instruction ..................................................................................................................... 70
5.2.2 MCR: Main control reset instruction ......................................................................................................... 70
5.3 SFC instructions ..................................................................................................................................................71
5.3.1 STL: SFC state loadinginstruction ............................................................................................................ 71
5.3.2 SET Sxx: SFC state transition instruction ................................................................................................ 72
5.3.3 OUT Sxx: SFC state jumpinstruction ........................................................................................................ 72
5.3.4 RST Sxx: SFC state reset instruction ....................................................................................................... 72
5.3.5 RET: SFC program segment end instruction............................................................................................ 73
5.4 Timer instructions ................................................................................................................................................73
5.4.1 TON: Turn-on delay timing instruction ...................................................................................................... 73
5.4.2 TONR: Memory-type turn-on delay timing instruction .............................................................................. 73
5.4.3 TOF: Turn-off delay timing instruction ...................................................................................................... 74
5.4.4 TMON: Non-retriggerable monostable timing instruction ......................................................................... 75
5.5 Counter instructions.............................................................................................................................................76
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
Chapter 6 Application instructions .....................................................................................................................................79

6.1 Program flow control instructions.........................................................................................................................85


6.1.1 FOR: Cycle instruction ............................................................................................................................. 85
6.1.2 NEXT: Cycle return instruction ................................................................................................................. 85
6.1.3 LBL: Jump label definition instruction ....................................................................................................... 86
6.1.4 CJ: Conditional jump instruction ............................................................................................................... 88
6.1.5 CFEND: Instruction for conditional return of user main program .............................................................. 88
6.1.6 WDT: Instruction for watchdog reset of user program .............................................................................. 89
6.1.7 EI: Enable interrupt instruction ................................................................................................................. 89
6.1.8 DI: Disable interrupt instruction ................................................................................................................ 89
6.1.9 CIRET: Instruction for conditional return of user interrupt program .......................................................... 89
6.1.10 STOP: Instruction for stopping the user program ................................................................................... 89
VC Series Micro-PLC Programming Manual Preface
6.1.11 CALL: Instruction for calling the user subprogram ................................................................................. 90
6.1.12 CSRET: Instruction for conditional return of user subprogram ............................................................... 90
6.2 Data transmission instructions .............................................................................................................................91
6.2.1 MOV: Word data transmissioninstruction ................................................................................................. 91
6.2.2 DMOV: Double word data transmission instruction .................................................................................. 91
6.2.3 RMOV: Floating-point data transmission instruction ................................................................................ 92
6.2.4 BMOV: Block data transmission instruction.............................................................................................. 92
6.2.5 FMOV: Data block fill instruction .............................................................................................................. 92
6.2.6 DFMOV: Data block double word fill instruction ....................................................................................... 93
6.2.7 SWAP: MSB/LSB swop instruction .......................................................................................................... 93
6.2.8 XCH: Word swop instruction .................................................................................................................... 94
6.2.9 DXCH: Double word swop instruction ...................................................................................................... 94
6.2.10 PUSH: Data push instruction.................................................................................................................. 94
6.2.11 FIFO: First-in-first-out instruction............................................................................................................ 95
6.2.12 LIFO: Last-in-first-out instruction ............................................................................................................ 96
6.2.13 WSFR: Word string shift right instruction................................................................................................ 96
6.2.14 WSFL: Word string shift left instruction .................................................................................................. 97
6.3 Integer arithmetic operation instructions ..............................................................................................................98
6.3.1 ADD: Integer addition instruction.............................................................................................................. 98
6.3.2 SUB: Integer subtraction instruction ......................................................................................................... 99
6.3.3 MUL: Integer multiplication instruction ..................................................................................................... 99
6.3.4 DIV: Integer division instruction ................................................................................................................ 99
6.3.5 SQT: Instruction for extracting the square root of an integer .................................................................. 100
6.3.6 INC: Integer plus one instruction ............................................................................................................ 100
6.3.7 DEC: Integer minus one instruction ........................................................................................................ 101
6.3.8 VABS: Instruction for obtaining the absolute value of an integer............................................................ 101
6.3.9 NEG: Integer negation instruction .......................................................................................................... 102
6.3.10 DADD: Long integer addition instruction .............................................................................................. 102
6.3.11 DSUB: Long integer subtraction instruction.......................................................................................... 102
6.3.12 DMUL: Long integer multiplication instruction ...................................................................................... 103
6.3.13 DDIV: Long integer division instruction ................................................................................................ 103
6.3.14 DSQT: Instruction for extracting the square root of a long integer ....................................................... 104
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
VC Series Micro-PLC Programming Manual Preface
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
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
VC Series Micro-PLC Programming Manual Preface
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
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
VC Series Micro-PLC Programming Manual Preface
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

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

7.1 Introduction to SFC............................................................................................................................................252


7.1.1 What is SFC ........................................................................................................................................... 252
7.1.2 What is SFC of VC series PLCs ............................................................................................................. 252
7.1.3 Basic concept of SFC ............................................................................................................................. 252
7.1.4 Programming symbols and their usage .................................................................................................. 252
7.1.5 SFC program structure ........................................................................................................................... 253
7.1.6 Execution of SFC program ..................................................................................................................... 257
7.2 Relationship between SFC and LAD .................................................................................................................258
7.2.1 STL instruction and step states .............................................................................................................. 258
7.2.2 SET instruction ....................................................................................................................................... 259
VC Series Micro-PLC Programming Manual Preface
7.2.3 RET instruction and SFC program segment........................................................................................... 259
7.2.4 OUT instruction and RST instruction ...................................................................................................... 259
7.2.5 SFC selection branch, parallel branch and merge ................................................................................. 259
7.3 How to program With SFC .................................................................................................................................259
7.4 Notesin SFC programming ................................................................................................................................260
7.4.1 Common programming errors ................................................................................................................ 260
7.4.2 Programming tricks ................................................................................................................................ 263
7.5 Examples of SFC programming ........................................................................................................................264
7.5.1 Simple sequential structure .................................................................................................................... 265
7.5.2 Selection branch structure...................................................................................................................... 266
7.5.3 Parallel branch structure ........................................................................................................................ 269
Chapter 8 Operating guide for high-speed input function ................................................................................................274

8.1 High-speed counter ...........................................................................................................................................275


8.1.1 Configuration .......................................................................................................................................... 275
8.1.2 Relationship between high-speed counter and SM auxiliary relay ......................................................... 276
8.1.3 How to use the high-speed counters ...................................................................................................... 278
8.1.4 Notes about the VC1 series high-speed counters .................................................................................. 281
8.2 External pulse capture function .........................................................................................................................282
8.3 Notes on High-speed input application ..............................................................................................................282
Chapter 9 Using Interrupts ...............................................................................................................................................283

9.1 Interrupt program ...............................................................................................................................................284


9.2 Processing interrupt event .................................................................................................................................286
9.3 Using timed interrupt .........................................................................................................................................286
9.4 Using external interrupts ....................................................................................................................................289
9.5 Using high-speed counter interrupt....................................................................................................................290
9.6 Using PTO output completion interrupt ..............................................................................................................291
9.7 Using serial port-based interrupt........................................................................................................................292
Chapter 10 Communication function guide ......................................................................................................................295

10.1 Communication resources ...............................................................................................................................296


10.2 Programming port communication protocol .....................................................................................................296
10.3 Free-port communication protocol ...................................................................................................................296
10.3.1 Introduction .......................................................................................................................................... 296
10.3.2 Parameters setting of free-port............................................................................................................. 296
10.3.3 Free-port instruction ............................................................................................................................. 298
10.4 Modbus communication protocol .....................................................................................................................299
10.4.1 Introduction .......................................................................................................................................... 299
10.4.2 Characteristics of links ......................................................................................................................... 299
10.4.3 RTU transmission mode ....................................................................................................................... 299
10.4.4 Supported Modbus function codes ....................................................................................................... 300
10.4.5 Addressing mode of the PLC elements ................................................................................................ 300
10.4.6 Modbus slave station ........................................................................................................................... 301
10.4.7 Reading and writing elements .............................................................................................................. 301
10.4.8 Processing of double word element ..................................................................................................... 302
10.4.9 Processing of LONG INT data .............................................................................................................. 302
10.4.10 Diagnostic function code .................................................................................................................... 302
10.4.11 Error code .......................................................................................................................................... 303
10.4.12 Modbus parameter setting.................................................................................................................. 303
10.4.13 Modbus instruction ............................................................................................................................. 304
10.5 N:N communication protocol ...........................................................................................................................306
VC Series Micro-PLC Programming Manual Preface
10.5.1 N:N introduction ................................................................................................................................... 306
10.5.2 N:N network data transmission form .................................................................................................... 306
10.5.3 N:N network structure .......................................................................................................................... 307
10.5.4 N:N refresh mode ................................................................................................................................. 308
10.5.5 Enhanced refresh mode ....................................................................................................................... 312
10.5.6 N:N parameter setting .......................................................................................................................... 313
10.6 Several control strategies ................................................................................................................................315
10.6.1 Determination of the master station ..................................................................................................... 315
10.6.2 Maximum number of inspection stations .............................................................................................. 315
10.6.3 Multi-master and slave (M: N) .............................................................................................................. 315
10.6.4 Examples of using N:N ......................................................................................................................... 315
Chapter 11 Positioning function guide .............................................................................................................................316

11.1 Positioning control system ...............................................................................................................................317


11.1.1 Absolute position system...................................................................................................................... 317
11.1.2 Positioning control system.................................................................................................................... 318
11.1.3 Process of positioning control .............................................................................................................. 319
11.2 Overview of the VC series PLC positioning functions ......................................................................................319
11.3 Note of using the positioning instructions ........................................................................................................322
11.4 Special elements related to the positioning instructions ..................................................................................323
11.4.1 Outputaxes of the VC series PLC ........................................................................................................ 323
11.4.2 Outputaxes of the VC1 series PLC ...................................................................................................... 324
11.5 Application instance.........................................................................................................................................324
11.5.1 Configuration method of the PLS envelope instruction ........................................................................ 324
Appendix A Special auxiliary relay ...................................................................................................................................328

1. PLC working state flag.........................................................................................................................................328


2. Clock running bit ..................................................................................................................................................328
3. User program execution error ..............................................................................................................................329
4. Interrupt control ...................................................................................................................................................329
5. Peripheral instruction ...........................................................................................................................................331
6. 0peration flag bit ..................................................................................................................................................331
7. DHST/DHSP Table comparison completion flag .................................................................................................331
8. ASCII code conversion instruction flag ................................................................................................................331
9. Pulse capture monitoring bit ................................................................................................................................331
10. Quad-frequency .................................................................................................................................................332
11. Free port (PORT0).............................................................................................................................................332
12. Free port (PORT1).............................................................................................................................................332
13. Extended free port (PORT2) ..............................................................................................................................333
14. N:N communication ...........................................................................................................................................334
15. System bus error flag ........................................................................................................................................334
16. Real-time clock error flag...................................................................................................................................335
17. Enable flag of integrated analog channel ..........................................................................................................335
18. Count direction and monitoring of high-speed counters ....................................................................................335
19. High speed output and positioning instruction ...................................................................................................336
1) Y0 Correlation flag bit......................................................................................................................................336
2) Y1 Correlation flag bit......................................................................................................................................337
3) Y2 Correlation flag bit......................................................................................................................................338
4) Y3 Correlation flag bit......................................................................................................................................338
5) Y4 Correlation flag bit......................................................................................................................................339
6) Y5 Correlation flag bit......................................................................................................................................340
VC Series Micro-PLC Programming Manual Preface
7) Y6 Correlation flag bit......................................................................................................................................341
8) Y7 Correlation flag bit......................................................................................................................................341
20. Timed output instruction ....................................................................................................................................342
21. Signal alarm ......................................................................................................................................................342
22. CANopen instruction..........................................................................................................................................342
Appendix B Special data register .....................................................................................................................................344

1. PLC working state data .......................................................................................................................................344


2. Operation error code FIFO area ..........................................................................................................................344
3. FROM/TO error ...................................................................................................................................................345
4. Scan time ............................................................................................................................................................345
5. Input filtering constant setup ................................................................................................................................345
6. Timed interrupt cycle ...........................................................................................................................................346
7. Real-time clock ....................................................................................................................................................346
8. Usage of DHSP and DHST instructions ..............................................................................................................346
9. Free-port receiving control and state (PORT0) ....................................................................................................347
10. Free-port receiving control and state (PORT1) ..................................................................................................348
11. Free-port receiving control and state (PORT2) ..................................................................................................350
12. High-speed pulse output and positioning...........................................................................................................352
1) Y0 Correlation register ....................................................................................................................................352
2) Y1 Correlation register ....................................................................................................................................353
3) Y2 Correlation register ....................................................................................................................................354
4) Y3 Correlation register ....................................................................................................................................355
5) Y4 Correlation register ....................................................................................................................................355
6) Y5 Correlation register ....................................................................................................................................356
7) Y6 Correlation register ....................................................................................................................................357
8) Y7 Correlation register ....................................................................................................................................358
13. Timed output instruction ....................................................................................................................................358
14. Signal alarm instruction .....................................................................................................................................359
Appendix C Reserved elements ......................................................................................................................................360

Appendix D Modbus communication error codes ............................................................................................................361

Appendix E System error codes ......................................................................................................................................362

Appendix F Modbus communication protocols ................................................................................................................364

1. Overview of Modbus communication protocol .....................................................................................................364


2. Supported Modbus function code and element addressing mode .......................................................................364
3. Modbus function code description .......................................................................................................................366
3.1 Reading the coil state (0x01)..................................................................................................................... 366
3.2 (0x02)Reading the discrete input state (0x02)........................................................................................... 366
3.3 Reading holding registers (0x03) .............................................................................................................. 366
3.4 Forcing (writing) single coil (0x05) ............................................................................................................. 367
3.5 Presetting (writing) single register (0x06) .................................................................................................. 367
3.6 Returning diagnostic check (0x08) ............................................................................................................ 367
3.7 Forcing (Writing) multiple coils(0x0F) ........................................................................................................ 370
3.8 Presetting (writing) multiple registers (0x10 Hex) ...................................................................................... 370
3.9 Fault response frame (0x80+function code) .............................................................................................. 370
3.10 Note ........................................................................................................................................................ 370
4. Example of Modbus communication control ........................................................................................................371
5. Description of broadcast ......................................................................................................................................372
VC Series Micro-PLC Programming Manual Preface
Appendix G ASCII code character encoding table ...........................................................................................................374

Appendix H Instruction order index table .........................................................................................................................375

Appendix I Instruction classification index table ...............................................................................................................385


VC Series Micro-PLC Programming Manual Product overview

Chapter 1 Product overview

This chapter briefly describes the product elements, programming software platform, and network configuration and application
of VC1 series PLCs.
Preface ............................................................................................................................................................................... 1

Chapter 1 Product overview................................................................................................................................................ 1

1.1 Product introduction...............................................................................................................................................1


1.1.1 Product performance and specifications .................................................................................................... 1
1.1.2 Appearance of VC1, and VC1 series main modules .................................................................................. 5
1.2 Auto Studio programming software .......................................................................................................................5
1.2.1 Basic configuration ..................................................................................................................................... 6
1.2.2 Installation process of the Auto Studio programming software................................................................... 6
1.2.3 Running interface of Auto Studio ................................................................................................................ 6
1.2.4 Programming cable .................................................................................................................................... 7
1.3 Communication function ........................................................................................................................................7
1.3.1 Modbus communication network ................................................................................................................ 7
1.3.2 N:N communication network ...................................................................................................................... 7
1.3.3 Free-port network ....................................................................................................................................... 8

1
VC Series Micro-PLC Programming Manual Product overview

1.1 Product introduction


VC series are integrated PLCs with built-in high-performance microprocessors and core computing control systems, integrating
input and output points, expansion module bus, etc. I/O extension modules and special modules are also included in these series.
The main module integrates 2 to 3 communication ports. VC2/3/5 series PLCs can be directly connected to the network while
other series PLC main modules can be connected to the field bus network through the fieldbus expansion modules. The I/O
configured on the main modules also includes high-speed counting and high-speed pulse output channels, which can be used for
precise positioning. They are equipped with abundant built-in programming resources, adopt three standardized programming
languages, and can implement commissioning and monitoring through the powerful Auto Studio programming
software.Furthermore, optimal security protection mechanisms are provided for user programs.

1.1.1 Product performance and specifications


Table 1-1 Performance and specifications of PLC main modules
VC3 VC2
Name VC5(Planning) VC1 VC1S
(Planning) (Planning)
8 in/6 out 8 in/6 out
12 in/8 out 12 in/8 out
14 in/10 out 14 in/10 out
16 in/16 out 16 in/16 out 16 in/14 out 16 in/14 out
Digital I/O point 16 in/16 out
32 in/32 out 32 in/32 out 24 in/16 out 24 in/16 out
36 in/24 out 36 in/24 out
16 in/14 out/ 16 in/14 out/
2 AI/1 AO 2 AI/1 AO
Max. number of
512 512 128 128 60
logical I/O points
Max. number of
8 8 8 8 None
special modules
2×100 kHz
8×200 kHz (for 3×100 kHz (for 3×100 kHz (for
High-speed (for
None transistor output transistor transistor
pulse output transistor
only) output only) output only)
output only)
Single-phase
8×200 kHz 2×50 kHz + 6×10 kHz 6×10 kHz
counting channel
Two-phase
4×200 kHz 1×30 kHz + 3×5 kHz 1×5 kHz
counting channel
Max.frequency
I/O sum of the high- 1600 kHz 1600 kHz 80 kHz 60 kHz 60 kHz
speed counters
Applying
Applying
Applying digital Applying digital Applying digital digital
digital filtering
filtering for X0 to filtering for X0 to filtering for X0 filtering for
for X0 to X7.
X7. X7. to X5. X0 to X7.
Digital filtering Input filtering
Input filtering Input filtering Input filtering Input filtering
constant
constant range: constant range: constant range: constant
range: 0–60
0–60 ms 0–60 ms 0–60000 us range: 0–60
ms
ms
Max. 2 A/ 1 point
Resistive
curre 8 A/ 4 point group common terminal
load
nt of 8 A/ 8 point group common terminal
the Inductive
220 V AC, 80 VA
relay load
outpu
Lamp
t 220 V AC, 100 W
load
point
Max.
curre Resistive Output point: 0.5 A/1 point
nt of load Others: 0.5 A/1 point; 0.8 A/4 point; 1.6 A/8 point
the Above 8 points, the total current increases by 0.1 A for each addition point

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

Timer 10 ms precision: T210–T479 10 ms precision: T210–T251

1 ms precision: T480–T511 1 ms precision: T252–T255

16-bit increment counter: C0–C199 16-bit increment counter: C0–C199


32-bit increment and decrement
Counter counter: C200–C235
32-bit increment and decrement counter: C200–
32-bit high-speed counter: C236–
C235
Soft C263
element 32-bit high-speed counter: C236–C263
resourc
es
Data register D0–D7999, 0–R32767 D0–D7999
Local data
V0–V63
register
Indexing register Z0–Z15
Special data
SD0–SD1023 SD0–SD1023 SD0–SD1023 SD0–SD511 SD0–SD511
register
Auxiliary relay M0–M10239 M0–M10239 M0–M2047 M0–M2047
Local auxiliary
LM0–LM63
relay
Special auxiliary SM0–
SM0–SM1023 SM0–SM1023 SM0–SM1023 SM0–SM511
relay SM511
State relay S0– S4095 S0– S4095 S0– S1023 S0– S1023
Internal timed
3 3 3 3
interruption
Interrup
External
tion 16 16 16 16
interruption
resourc
High-speed
e
counter-based 8 8 8 8
interruption

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

220 V AC/15 1s ON/1s OFF, 3,200,000 times


Service VA/sensitive
life of
the
output 220 V AC /30 1s ON/1s OFF, 1,200,000 times
relay VA/sensitive
contact
s
220 V AC/72 1s ON/1s OFF, 300,000 times
VA/sensitive

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.

1.1.2 Appearance of VC1, and VC1 series main modules


Figure 1-1 shows the appearance and structure of VC1 series main modules (using VC1-1614MAT as an Application instance).

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.

1.2 Auto Studio programming software


Auto Studio is programming software designed for VC1S, VC1, VC2, VC3 and VC5 series PLC products. This software can be
downloaded at the company website.

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

1.2.2 Installation process of the Auto Studio programming software

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.

1.2.3 Running interface of Auto Studio

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.

Figure 1-4 Main interface of Auto Studio

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.

Figure 1-5 shows the connection of a programming cable.

Figure 1-5 Programming cable connection

1.3 Communication function


The main module of VC1/VC1S series micro-PLC integrates two serial ports: PORT0 ,PORT1 and one USB port. PORT0 and
PORT1 suppor firmware upgrade and programming.These serial ports adopt the Modbus and N: N communication protocols, and
the user-defined free-port protocol is also applicable. The PORT0 port cannot be used for N:N network connection.

1.3.1 Modbus communication network

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".

1.3.2 N:N communication network

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

Chapter 2 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

2.1 Programming resources and principles ...............................................................................................................12


2.1.1 Programming resources ........................................................................................................................... 12
2.1.2 PLC operating mechanism (Scan cycle model)........................................................................................ 14
2.1.3 User program running watchdog .............................................................................................................. 15
2.1.4 Constant scan operation mode ................................................................................................................ 15
2.1.5 User file download and storage ................................................................................................................ 15
2.1.6 Element initialization ................................................................................................................................ 15
2.1.7 Saving data at power outage.................................................................................................................... 15
2.1.8 Digital filtering for input points .................................................................................................................. 16
2.1.9 No battery mode....................................................................................................................................... 16
2.1.10 User program protection......................................................................................................................... 16
2.2 System configuration ...........................................................................................................................................17
2.2.1 System block ............................................................................................................................................ 17
2.2.2 Data blocks .............................................................................................................................................. 23
2.2.3 Global variable table ................................................................................................................................ 24
2.3 Running mode and state control ..........................................................................................................................24
2.3.1 Concepts of system run and stop states .................................................................................................. 24
2.3.2 Run and stop state ................................................................................................................................... 24
2.3.3 Setting the state of output pointsin the stop state ..................................................................................... 25
2.4 System commissioning ........................................................................................................................................25
2.4.1 Program download and upload ................................................................................................................ 25
2.4.2 Error reporting mechanism ....................................................................................................................... 26
2.4.3 Modifying the user program online ........................................................................................................... 28
2.4.4 Clearing and formatting ............................................................................................................................ 28
2.4.5 Checking PLC information online ............................................................................................................. 29
2.4.6 Element value writing and forcing, and element monitoring table ............................................................ 29
2.4.7 Generating data blocks from RAM ........................................................................................................... 32

11
VC Series Micro-PLC Programming Manual Function Description

2.1 Programming resources and principles

2.1.1 Programming resources

Table 2-2 VC1 programming resources


Name Specification and description
Max. number of
128 (theoretical value)
I/O points
I/O
Number of
Configuration
extension 15
modules
User program
User file 16 ksteps
capacity
capacity
Block size 8000 D elements
Basic instruction 0.2 us/instruction
Instruction
Application
speed A few us – hundreds us /instruction
instruction
Basic instruction 32
Number of
Application
instructions 234
instruction
I/O points 128 inputs/128 outputs (inputs: X0–X177; outputs: Y0–Y177)note 1
Auxiliary relay 2048 (M0–M2047)
Local auxiliary
64 (LM0–LM63)
relay
Special auxiliary
512 (SM0–SM511)
relay
State relay 1024 (S0–S1023)
Soft element
Timer 256 (T0–T255)note 2
resourcesnote 7
Counter 256 (C0–C255)note 3
Data register 8000 (D0–D7999)
Local data
64 (V0–V63)
register
Indexing register 16 (Z0–Z15)
Special data
512 (SD0–SD511)
register

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

Name Specification and description


Single input: 50 kHz
High-speed X0, X1 Simultaneous inputs of X0 to X7: The total frequency is no more than 80
counter kHz.
X2–X5 Single input: 10 kHz
High-speed
Y0, Y1, Y2 Three independent outputs: 100 kHz (for transistor output type only)
pulse output
Special
Digital filtering Applying digital filtering for X0–X7 and hardware filtering for other ports
function
Analog
potentiometernote None
4

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

(1) 100 ms precision: T0–T209

(2) 10 ms precision: T210–T251

(3) 1 ms precision: T252–T255

Note 3: Addresses of the C elements are classified into three categories according to the width and function of count values:

VC1

(1) 16-bit increment counter: C0–C199

(2) 32-bit increment and decrement counter: C200–C235

(3) 32-bit high-speed counter: C236–C263

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".

2.1.2 PLC operating mechanism (Scan cycle model)

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.

Executing the user


program

Refreshing I/O Communication

Housekeeping

Figure 2-1PLC operating mechanism


⚫ Executing the user program
The system sequentially executes the instructions of the user program, starting from the first instruction to the end instruction
of the main program.
⚫ Communication
The system communicates with the programming software and responds to the programming communication instructions,
such as the download, run, and stop instructions sent by the programming software.
⚫ Housekeeping
The system handles various system housekeeping tasks such as refreshing panel indicators, updating timing value of the
software timer, refreshing special auxiliary relaysand special data registers.
⚫ Refreshing I/O
I/O refresh includes an output refresh phase and an input refresh phase.

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).

2.1.3 User program running watchdog

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.

2.1.4 Constant scan operation mode

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.

2.1.5 User file download and storage

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.

2.1.6 Element initialization

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.

Table 2-6 PLC data initialization priorities


Storage device type Power OFF→ON STOP→RUN
Data saved at power outage Highest Highest
Data storage on EEPROM High High
Data blocks (when "Datablock enabled" is selected in the advanced
Medium Medium
settings of the system block)
Element values (when "Element value retained" is selected in the
— Low
advanced settings of the system block)

2.1.7 Saving data at power outage

⚫ Conditions for saving data at power outage


When detecting that a power outage occurs, the system stops the user program and saves the data values of the elements
set within the storage range in the system block to the power outage backup file.
⚫ Element recovery at power-on

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.

Figure 2-2 Setting the saving range

 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.

2.1.8 Digital filtering for input points

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.

2.1.9 No battery mode

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.

2.1.10 User program protection

VC Series PLCs are designed with multi-level password protection and other security strategies.

Table 2-7 User program protection


User program
Description
protection
After disabling formatting in the system block configuration and downloading the system block to a PLC,
Disable formatting you cannot delete the user program, system block, and data block on the PLC by formatting. To enable
formatting, you need to download a new system block in which formatting is not disabled.

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.

2.2 System configuration

2.2.1 System block

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.

The system block configuration includes the following items:

⚫ 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

Figure 2-4 Setting the output table

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

Figure 2-5 shows the set time tab.

Figure 2-5 Set time

1. Watchdog time setting

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.

2. Constant scan time setting

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.

Figure 2-6 Setting the input filter


⚫ Input point

Figure 2-7 shows the input point setting tab.

1. Set the input point for starting the PLC

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.

Figure 2-7 Input point setting

2. Disable input point

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.

Figure 2-8 Advanced settings

4. Datablock enabled

Select Datablock enabledand the PLC uses data blocks to initialize D elements when switching from STOP to RUN.

5. Element value retained

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

Figure 2-9 Communication port setting

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.

1. Programming port protocol

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.

3. Modbus communication protocol

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.

4. N:N communication protocol

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".

⚫ Expansion module configuration

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

Figure 2-10 Expansion module configuration

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.

Figure 2-11 Module property setting

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.

2.2.2 Data blocks

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.

2.2.3 Global variable table

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.

Figure 2-16 Global variable table

2.3 Running mode and state control


You can start or stop PLCs in any of the following three ways.

1. Using the mode selection switch.

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.

2.3.1 Concepts of system run and stop states

The working states of main modulesinclude run and stop states.

⚫ 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.

2.3.2 Run and stop state

⚫ How to change from STOP to RUN


1. Resetting the PLC

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.

2. Setting the mode selection switch manually

The system is changed from STOP to RUN state when you set the mode selection switch from OFF to ON.

3. Startup mode of input points

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.

⚫ How to change from RUN to STOP


1. Resetting the PLC

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.

3. Using the instruction control mode

The system changes from RUN to STOP after executing the STOP instruction in the user program.

4. Auto-stop upon faults

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).

2.3.3 Setting the state of output pointsin the stop state

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".

2.4 System commissioning

2.4.1 Program download and upload

⚫ 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.

Figure 2-17 Tips for recompiling the program

 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.

Figure 2-18 Upload the 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.

2.4.2 Error reporting mechanism


A system can detect and report two types of errors: system error and user program execution error.
A system error is caused by abnormal system operation.
A user program execution error is caused by the abnormal execution of the user program.
All errors are numbered uniformly, and each error code represents an error. For details, refer to Appendix F"System error codes".
⚫ The reporting mechanism for system error
When the system detects that a system error occurs, the system error code is written to a special data register SD3, and the
special relay SM3 is set at the same time. You can obtain the system error information by assessing the error code stored in
SD3.

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.

⚫ The reporting mechanism for user program execution error


When a user program execution error occurs, the system sets a special relay SM20 and writes the current error code into a
special data register SD20.

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.

New user program error

SD20 Error record 0

SD21 Error record 1

SD22 Error record 2

SD23 Error record 3

SD24 Error record 4

Discard

Figure 2-19 Push stack process of error codes


When a serious user program execution error occur, a user program stops and a ERR indicator on the main module turns on
for a long time. In less serious cases, a ERR indicator on the main module does not turn on.
⚫ Checking the error information online
Connecting the PLC with your PC through a serial port, and you can read various PLC state information through Auto Studio,
including codes and descriptions of the above-mentioned system errors and user program execution errors.
In the main interface of Auto Studio, you can click PLC->PLC Info item to check the PLC information, as shown in Figure 2-
20.

Figure 2-20 PLC information

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.

2.4.3 Modifying the user program online


You can use the online modification function when you need to modify the user program without stopping the PLC.

 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.

2.4.4 Clearing and formatting

The clearing operations include PLC element value clear, PLC program clear, and PLC data block clear.

Formatting is to clear all data and programs in PLCs.

⚫ PLC element value clear


The PLC element value clear function can clear all element values in the PLC. Element values should be cleared when the
PLC is in the stop state.

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.

⚫ PLC program clear


The PLC program clear function can clear the user programs in the PLC. User programs should be cleared when the PLC
is in the stop state.

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.

⚫ PLC data block clear


The PLC data block clear function can clear all the data block setups in the PLC. Data blocks should be cleared when the
PLC is in the stop state.
Clearing the data blocks in the PLC causes the PLC to stop using the preset value of the data block for initializing D elements,
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.
⚫ PLC formatting
The PLC formatting function can format all the PLC data, including clearing the user program, restoring the default
configuration, and clearing data blocks. Data blocks should be cleared when the PLC is in the stop state.
This operation clears all the downloaded and setup 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.

28
VC Series Micro-PLC Programming Manual Function Description

2.4.5 Checking PLC information online

⚫ 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.

Figure 2-21 Current operation information of the PLC

⚫ PLC time
The PLC time function can be used to display and set the current time of PLCs, as shown in Figure 2-22.

Figure 2-22 Setting the PLC time


The window displays the current date and time from the PLC. You can adjust the time setting and click the Set Time button
to set a new time to the PLC.

2.4.6 Element value writing and forcing, and element monitoring table

⚫ Write and forced values of the elements


During the commissioning process, you can manually modify the value of certain soft elements to achieve some conditions,
the element value write and force offer you this function. Difference between the write and force is that: the write element
value is valid for once, and the value being written may change with the running of the program, but the forced element value
is recorded in the PLC hardware until being cancelled by you.

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-23 Dialog box for writing an element value

Figure 2-24 shows the dialog box for forcing an element value.

Figure 2-24 Dialog box for forcing an element value

The forced soft element carries a lock mark in LAD, as shown in Figure 2-25:

Figure 2-25 Locks mark of the forced soft element

⚫ Element value unforcing


For element values that no long need to be forced, you can unforcing them. When you remove the force function, you need
to first select target elements, right click and select Unforce, and then a dialog box pops up and displays all forced soft
elements. You can selectively unforce certain forced soft elements, click OK button to confirm, and then these forced values
are deleted from the PLC, so are the corresponding lock marks. Figure 2-26 shows the dialog box of unforce.

31
VC Series Micro-PLC Programming Manual Function Description

Figure 2-26 Unforce

⚫ Element monitoring table


The element monitoring table provides element value monitoring function during commissioning. Program input and output
elements, registers, and word elements can be added to the element monitoring table so that they can be tracked after the
program is downloaded to PLCs.

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.

Figure 2-27 shows the element monitoring table.

Figure 2-27 Element state monitoring table

2.4.7 Generating data blocks from RAM

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

Figure 2-27Window for generating data blocks from RAM

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

Chapter 3 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

3.1 Type and function of soft elements ......................................................................................................................35


3.1.1 Summary of soft elements........................................................................................................................ 35
3.1.2 Soft elementlist......................................................................................................................................... 35
3.1.3 Input and output points ............................................................................................................................. 37
3.1.4 Auxiliary Relays........................................................................................................................................ 37
3.1.5 State relay ................................................................................................................................................ 38
3.1.6 Timer ........................................................................................................................................................ 38
3.1.7 Counter .................................................................................................................................................... 39
3.1.8 Data register............................................................................................................................................. 39
3.1.9 Special auxiliary relay .............................................................................................................................. 40
3.1.10 Special data register .............................................................................................................................. 40
3.1.11 Indexing register..................................................................................................................................... 41
3.1.12 Local auxiliary relay ................................................................................................................................ 41
3.1.13 Local data register .................................................................................................................................. 41
3.1.14 Bit-string combined addressing mode (Kn addressing mode) ................................................................ 41
3.1.15 Indexing mode (Z addressing mode) ...................................................................................................... 42
3.1.16 Bit-string combined indexing mode ........................................................................................................ 43
3.1.17 Storing and addressing 32-bit data in D, R, and V elements .................................................................. 44
3.2 Data .....................................................................................................................................................................44
3.2.1 Data type .................................................................................................................................................. 44
3.2.2 Correlation between elements and data types ......................................................................................... 44
3.2.3 Constant ................................................................................................................................................... 45

34
VC Series Micro-PLC Programming Manual Soft element and data

3.1 Type and function of soft elements

3.1.1 Summary of soft elements

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

Special auxiliary relay SM


Special data register SD

Output image registers


Input image registers

Auxiliary relay M
State relay S
Data register D
Timer T
Counter C
Local auxiliary relay LM
Indexing register Z
Local data register V

Y discrete output point


Buttons, contacts, etc.

X discrete input point

displaying devices
hardware circuit

hardware circuit
Output point Y
Input point X

Executing and
Soft elements

PLC system functions, system states, clock


square wave, interrupts, communication, etc.

Figure 3-1 Types and functions of soft elements

In this manual, soft elements are named according to their types. For example:

⚫ Input point X, or "X element" for short

⚫ Output point Y, or "Y element" for short

⚫ Auxiliary relay M, or "M element" for short

⚫ Data register D, or "D element" for short

⚫ State relay S, or "S element" for short

3.1.2 Soft elementlist

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.

Figure 3-1 shows the list of VC series micro-PLC soft elements.


Figure 3-1 VC series PLC soft element list
Numbered
VC1S VC1 VC2(Pianning) VC3(Pianning) VC5(Pianning)
in
36 inputs 128 inputs 256 inputs 512 inputs 512 inputs
Soft
24 outputs 128 outputs 256 outputs 512 outputs 512 outputs
element
I/O points (inputs:X0–X47 (inputs:X0–X177; (inputs:X0–X377; (inputs:X0–X777; (inputs:X0–X777; Octal
resources
note 4
outputs:Y0–Y27) outputs:Y0–Y177) outputs:Y0–Y377) outputs:Y0– outputs:Y0–
note 1 note 1 note 1 Y777)note 1 Y777)note 1

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

3.1.3 Input and output points

⚫ Element mnemonics ⚫ Classification


• X elements (discrete input points) Output channel corresponding to X elements: X0 to X17
• Y elements(discrete output points) are configured withthe digital filtering function. You can
set the filtering time through the system block. Other X
⚫ Function
input points use the hardware filtering. X0 to X7 can be
The X and Y elements represent respectively the input
used as counting input points for soft elements of high-
state of the hardware X terminal and output state of
speed counters. Besides, X0 to X7 can also be used as
hardware Y terminal.
input terminals for external interrupt, pulse capture, and
The state of X elements is obtained through the
the SPD instruction.
inputimage register, while the state of Y elements is
Y elements are used as high-speed output terminals or
output through the output circuit driven by the output
general output terminals.
image register. The two operations are carried out in the
I/O refresh phase of PLC scan cycle mode, as shown in ⚫ Elements addressing mode
Figure3-2. For details, refer tosection 2.1.2 "PLC Octal,started with 0. X and Y elements of the main
operating mechanism (Scan cycle model)". It is obvious module and I/O extension modules are addressed
that thereis a brief delay in PLC's response to the I/O. contiguously. X elements are addressed contiguously in
The delayis related to the input filter, communication, X0–X7, X10–X17, X20–X27, and so on. Y elements
housekeeping, and scan cycle. are addressed contiguously in Y0–Y7, Y10–Y17, Y20–
Y27, and so on.
⚫ Data type
Executing the user
program Both the X and Y elements are Boolean (element values
are ON or OFF).
Input filtering
Communication ⚫ Available forms
You can adopt NO and NC contacts of X elements during
Button Executin
g and
programming (depending on two instructions). NO and
s,
Housekeeping contact displayi NC contacts have opposite state values.They are
s, etc. ng the
devices sometimes referred to as "a contact" and "bcontact".
You can also adopt NO and NC contacts of Y elements
Refreshing I/O
Output relay delay during programming.
⚫ Value assignment
1. X elements accept only hardware input state and
forced operation state values which cannot be changed
Figure 3-2 Schematic diagram of I/O refresh
through output or setting instructions, nor be set during
the system commissioning.
2. You can assign state values to Y elements with the
OUTinstruction, set the state values of Y elements,
oreven force or write state values of Y elements during
the system commissioning.
3. Through the system block, you can set the output
states of Y elements in STOP state.

3.1.4 Auxiliary Relays

⚫ Element mnemonic electrical control circuit. You can use them to store
M elements various intermediate states in the user program.

⚫ Function ⚫ Elements addressing mode


The system provides a type of discrete state elements to Octal, started with 0.
you, which is similar to an intermediate relay in a real ⚫ Data type

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.5 State relay

⚫ Element mnemonic 2. NO and NC contacts (when the STL instruction is not


S elements programmed for SFC). Similar to characteristics of M
elements, NO and NC contacts of S elements can be
⚫ Alias
used for programming.
Step flag
⚫ Value assignment
⚫ Function
1. Through the instruction operations. 2. Force or write
As the step flag, S elements are used in the SFC. For
the state values during the system commissioning.
details, refer to Chapter 7 "SFC user guide".
⚫ Uninterrupted output after power outage
⚫ Classification
S elements for
S0–S19: initial step flag S elements for which
which data is
State data is saved at
Others: general step flag not saved at
power outage
power outage
⚫ Elements addressing mode
Power outage Unchanged Cleared
Decimal, starting with 0
RUN → STOP Unchanged Unchanged
⚫ Data type STOP → RUN Unchanged Cleared
Boolean elements (element values are ON or OFF). Note: The storage range at power outage is set through
the system block. For details, refer to 2.2.1 "System
⚫ Available forms
block".
1. Representing the step state (when the STL instruction
is programmed through SFC)

3.1.6 Timer

⚫ Element mnemonic classified into three types.The following table describes


T elements the T elements and corresponding timing precisions in
different address segments.You need to pay attention to
⚫ Function
it when using.
T element is a composite soft element that contains a
T element Timing precision
word element (2 bytes) and a bit element. The T word
T0–T209 100 ms precision
element records a 16-bit timing value that can be used
T210–T251 10 ms precision
as a value in the program. The T bit element reflects the
T252–T255 1 ms precision
state of the timer coil, which can be used for logic control.
For T elements with timing precision of 1 ms, they
1 state bit areactivated by interrupt trigger and unrelated to the PLC
T bit element scancycle. Therefore, their action time is the most
accurate. For T elements with timing precision of 10 ms
Sign bit
MSB and 100 ms, refresh and action time of their timing values
T word element LSB are related to the PLC scan cycle.
16 bits
⚫ Elements addressing mode
Figure 3-3 T elements Decimal, starting with 0

⚫ Classification ⚫ Data type


According to the timing precision, T elements are Boolean (element values are ON or OFF), and word.

38
VC Series Micro-PLC Programming Manual Soft element and data

⚫ Available forms power outage (for saved at power


VC2/3/5series only) outage
The timing and action modes of T elements are
Power outage Unchanged Cleared
determined by timing instructions. There are four types
RUN → STOP Unchanged Unchanged
of timing instructions, including TON, TOF, TONR, and
STOP → RUN Unchanged Cleared
TMON instructions. For details, refer to Chapter 5 "Basic
Note: The storage range at power outage is set through the
instructions". 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. The maximum timing value of T element is 32767. The
preset value is -32768 to -32767. Because T element
⚫ Uninterrupted output after power outage acts only when the count value reaches or exceeds the
State
T elements for which T elements for preset value. Therefore, it is actually meaning less to set
data is saved at which data is not the preset value as a negative number.

3.1.7 Counter

⚫ Element mnemonic instruction, 16-bit cycle counting instruction, 32-bit


C elements increment and decrement counting instruction, and high-
speed I/O instruction. For details, refer to Chapter 5
⚫ Function
"Basic instructions" and Chapter 6 "Application
A C element is a composite soft element that contains a
instructions".
bit element, and a word or adouble word element (2 or 4
The classification of C elements is shown in the table
bytes). The C word element records a 16-bit or 32-bit
below:
timing value that can be used as a value in the program
while C bit element reflects the timer coil state for logic Applicable instruction
C elements Counting function
type
control.
16-bit increment
1 state bit
16-bit increment counting instruction
C bit element C0–C199
counter 16-bit cyclic counting
MSB
instruction
Sign bit
16-bit counter LSB 32-bit increment and
32-bit increment and
16 bits
C200–C235 decrement counting
decrement counter
Sign bit
MSB LSB instruction
32-bit counter 32-bit high-speed High-speed I/O
16 bits 16 bits C236–C263
counter instruction
Figure 3-4 C elements
⚫ Value assignment
⚫ Classification 1. Through the instruction operations. 2. Force or write
Two types: 16-bit counter and 32-bit counter the state values during the system commissioning.

⚫ Elements addressing mode ⚫ Uninterrupted output after power outage


Decimal, starting with 0 C elements for which C elements for which
State data is saved at data is not saved at
⚫ Data type power outage power outage
Boolean(element values are ON or OFF), single word or Power outage Unchanged Cleared
double word. RUN → STOP Unchanged Unchanged
⚫ Available forms STOP → RUN Unchanged Cleared
The counting instructions that call C elements are Note: The storage range at power outage is set through the
system block. For details, refer to section 2.2.1 "System
classified into 4 types, namely 16-bit increment counting
block".

3.1.8 Data register

⚫ Element mnemonic ⚫ Elements addressing mode


D and R elements Decimal, starting with 0
⚫ Function ⚫ Data type
As data elements, D or R elements are used as Each D or R element is a 16-bit register that can store
operandsin manycalculation and control instructions. 16-bit data, such as 16-bit integer.

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.

3.1.9 Special auxiliary relay

⚫ Element mnemonic • SM25 – SM71: Interrupt control flag bit. Setting


SMelements these SM elements enables the corresponding
⚫ Function interrupt functions.
SM elements are closely related to the PLCsystem
function, reflectingthe system function and state of the
PLCs. For details, refer to Appendix A "Specialauxiliary ⚫ Elements addressing mode
Decimal, started with 0.
relay" in this manual.
⚫ Data type
⚫ Classification
Boolean elements (element values are ON or OFF).
The frequently used SM elements include:
• SM0: PLC operation monitor bit. It is ON whenthe ⚫ Available forms
NO and NC contacts
PLC is in RUN state.
• SM1: initial operation pulse bit. It is ON in the ⚫ Value assignment
1. Through the instruction operations. 2. Force or write
firstscan cycle of PLC operation.
the state values during the system commissioning.
• SM3: system error. It is ON if any system error is
 Note
detected after the PLC is powered on or when the
You cannot assign values to read-only SD elements.
PLC changes from STOP to RUN.
• SM10–SM12: respectively the clock square-wave
cycled at 10 ms, 100 ms, and 1 s (flipping-overtwice
in a cycle).

3.1.10 Special data register

⚫ Element mnemonic ⚫ Elements addressing mode


SD elements Decimal, started with 0.
⚫ Function ⚫ Data type
SD elements are closely related to the PLC system Word, and doubleword (integer)elements.
function, reflecting the system function parameters, state ⚫ Available forms
code values, and instruction operation data of PLCs. For Storage and calculation of integers
details, refer to Appendix B "Special data register" in this
⚫ Value assignment
manual.

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.

3.1.11 Indexing register

⚫ Element mnemonic ⚫ Data type


Z elements Word elements
⚫ Function ⚫ Available forms
16-bit register elements can be used to store symbolic Z elements are used for indexing. You need to write the
integer data.For details about indexing, refer to section address offset in Z elements before using them.
3.1.15 "Indexing mode (Z addressing Mode)". ⚫ Value assignment
⚫ Elements addressing mode 1. Through the instruction operations. 2. Force or write
Decimal, started with 0. state values during system commissioning.

3.1.12 Local auxiliary relay

⚫ Element mnemonic LM elements can be used to define the interface


LM elements parameters of subprograms to realize the interface
parameter transfer function. For details, refer to section
⚫ Function
4.4 "Subprogram".
LM elements are local variants that can be applied in the
main program and subprograms. They are variable ⚫ Elements addressing mode
elements that are locally valid in each individual program Decimal, started with 0.
body (main program, subprogram, and interrupt ⚫ Data type
program). Therefore, it is not possible to directly share Boolean(element values are ON or OFF).
the state of any LM element between different program
⚫ Available forms
bodies. When the system leaves a program body in the
NO and NC contacts
execution of the user program, the LM element is
redefined. When returning to the main program or calling ⚫ Value assignment
a subroutine, the value of the redefined LM element is 1. Through the instruction operations.
deleted or the corresponding state needs to be obtained
according to the interface parameter transfer function.

3.1.13 Local data register

⚫ Element mnemonic V elements can be used to define the interface


V elements parameters of subprograms to realize interface
parameter transfer function. For details, refer to section
⚫ Function
4.4 "Subprogram".
V elements are local variants that can be applied in the
main program and subprograms. They are variable ⚫ Elements addressing mode
elements that are locally valid in each individual program Decimal, started with 0.
body (main program and subprogram). Therefore, it is ⚫ Data type
not possible to directly share the data of any V element Boolean elements (element values are ON or OFF).
between different program bodies. When the system
⚫ Available forms
leaves a program body in the execution of the user
Word element, which can be used to store numeric
program, the V element is redefined. When returning to
information
the main program or calling a subroutine, the value of the
redefined V element is deleted or the corresponding data ⚫ Value assignment
needs to be obtained according to the interface 1. Through the instruction operations.
parameter transfer function.

3.1.14 Bit-string combined addressing mode (Kn addressing mode)

⚫ 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.

⚫ Data storage format in the Kn addressing mode


The following example describes how data is stored in the Kn addressing mode:

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:

Executing the instruction "DBITS 16# FFFFFFF0 K1M0".

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).

3.1.15 Indexing mode (Z addressing mode)

⚫ 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

SFTR X0Z1 M0 8 2 The addressing process is as follows:

42
VC Series Micro-PLC Programming Manual Soft element and data

Z1=6 The preceding instructions are in effect equal to:

X0Z1 = X (0+Z1) = X6 LD M01

2. Word element indexing example MOV D130 D0

LD M01 The addressing process is as follows:

MOV 30 Z20 Z20=30

MOV D100Z20 D0 D100 Z20 = D (100+Z20)= D130

⚫ Notes of the indexing mode


1. In the indexing mode (Z addressing mode), Z elements store the address offset. They support signed integers, which
means negative offset is supported.

For example:

MOV -30 Z20

MOV D100Z20 D0

The preceding instructions are in effect equal to:

MOV D70 D0

2. The SM and SD elements do not support the indexing mode.

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.).

3.1.16 Bit-string combined indexing mode

The bit-string combined addressing mode can be used in MOV K1X0Z10 D0


conjunction with the indexing mode. For example: K1X0Z10.
The preceding instructions are in effect equal to:
In this mode, you need to determine the start bit element
LD M1
address through the Z addressing, and determine the length
of the bit string through the Kn addressing. MOV K1X3 D0

For example: The addressing process is as follows:

LD M1 Z10 = 3

MOV 3 Z10 K1X0Z10=K1X (0+Z10) = K1X3

43
VC Series Micro-PLC Programming Manual Soft element and data

3.1.17 Storing and addressing 32-bit data in D, R, and V elements

⚫ Storing 32-bit data in D, R, and V elements


The DINT, DINT, and REAL type data are 32-bit, anda D, R, or V element is only 16-bit. Two consecutive D, R, or V elements
are needed to store the 32-bit 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

3.2.1 Data type

All instruction operands are of a certain data type. There are altogether six data types, as listed in the following table.
Table 3-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

3.2.2 Correlation between elements and data types

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

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


DINT

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

Chapter 4 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

4.1 Introduction to programming languages ..............................................................................................................47


4.1.1 LAD .......................................................................................................................................................... 47
4.1.2 IL .............................................................................................................................................................. 48
4.1.3 SFC .......................................................................................................................................................... 48
4.2 Program Elements ...............................................................................................................................................49
4.2.1 User Program ........................................................................................................................................... 49
4.2.2 System block ............................................................................................................................................ 50
4.2.3 Data block ................................................................................................................................................ 50
4.3 Block comment and variable comment of the program ........................................................................................50
4.3.1 Block comment......................................................................................................................................... 50
4.3.2 Variable Comment ................................................................................................................................... 51
4.4 Subprogram .........................................................................................................................................................52
4.4.1 Concept .................................................................................................................................................... 52
4.4.2 Notestouse SBRs ..................................................................................................................................... 52
4.4.3 Definition of the SBR variable table .......................................................................................................... 53
4.4.4 SBR parameter transfer ........................................................................................................................... 54
4.4.5 SBR application instance ......................................................................................................................... 54
4.5 General information of the instructions ................................................................................................................56
4.5.1 Instruction operands ................................................................................................................................. 56
4.5.2 Flag bit ..................................................................................................................................................... 56
4.5.3 Restrictions on the use of instructions ...................................................................................................... 56

46
VC Series Micro-PLC Programming Manual Programming concept

4.1 Introduction to programming languages


There are three programming languages: LAD, IL, and SFC.

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.

4. Coil ( ): It represents the relay output in the electrical control diagram.

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

Energy flow No.1

Energy flow No.1

Energy flow No.2

Energy flow No.3


Three energy flows

Figure 4-2 Energy flow and its driving function

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.

The following figure is an application instance of converting a LAD into an IL.


LAD 1L
LD X0
OR X1
AND X14
MPS
OUT Y0
AND X1
OUT Y1
MPP
AND X2
MPS
OUT Y2
AND X3
AND X4
OUT Y3
MRD
LD X5
AND X6
LD X7
AND X10
ORB
ANB
OUT Y4
MPP
OUT Y5

4.1.3 SFC

The SFC is a 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.

The following figure is an application instance of a simple SFC.

/*Validating step state S0 in the first scan cycle of the user


program*/

/*Processing step state S0*/

/*Processing step state S20*/

Figure 4-3 Application instance of SFC

4.2 Program Elements


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

programming.

4.2.1 User Program

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.

One user program has only one main program.

⚫ 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.

A user program can have random number of subprograms, or no subprogram at all.

⚫ 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

4.2.2 System block

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.

4.2.3 Data block

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.

4.3 Block comment and variable comment of the program

4.3.1 Block comment

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.

Figure 4-4 Adding block comment

Entering your comment into the block comment dialogue box that pops out and clicking the OK button.

Figure 4-5 Block comment dialogue box

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

Figure 4-6 The clock comment in the program

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.

4.3.2 Variable Comment

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.

Figure 4-7 Variables defined in the 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.

Figure 4-8 The state of 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

Figure 4-9 The state of symbol addressing is selected

⚫ Elementcomment
You can control whether the element comments are displayed in the LAD by selecting the Element comment menu, as shown in
Figure4-10.

Figure 4-10 The LAD program displaying the element comments

4.4 Subprogram

4.4.1 Concept

Being an optional part of the user program, a subprogram (SBR) is an independent program organization unit (POU) that can be
called by the main program or other SBRs.

You can use SBRs in your user program to:

1. Reduce the size of the user program. You can write a repeated program section as a SBR and call it whenever necessary.

2. Clarify the program structure, particularly the structure of the main program.

3. Make the user program more transplantable.

4.4.2 Notestouse SBRs

When writing or calling a SBR, You need to note the following:

1. The PLCs support a maximum of 6 levels of SBR nesting calling.

The following is an fine application instance of 6-level of SBR nesting calling:

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

⚫ MAIN→SBR0→SBR0 (recursive call, illegal)

⚫ MAIN→SBR0→SBR1→SBR0 (cyclic call, illegal)

3. A maximum of 64 SBRs can be defined in a user program.

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.

6. The interrupt programs are not allowed to call SBRs

4.4.3 Definition of the SBR variable table

⚫ 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.

⚫ SBR variable properties


The SBR variables (including interface parameters and local variables) have the following properties:

1. Variable address

Based on the variable data type, the software 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

4.4.4 SBR parameter transfer

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.

4.4.5 SBR application instance

Here is an application instance of how to write and call a SBR.

⚫ Introduction to the function of the application instance


Calling SBR_1 in the main program to perform the addition calculation (3+2) of two integer constants, and assigning the
operation result 5 to D0.

⚫ Operation procedures of the application instance


Step 1: Creating a SBR in the project and naming it as SBR_1.

Step 2: Writing the SBR_1.

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.

2. Writing the SBR_1 as:

LD SM0

ADD #IN1 #IN2 #OUT1

The writing process of the SBR_1 is shown in the following figure.

54
VC Series Micro-PLC Programming Manual Programming concept

Figure 4-11 Writing process of the SBR_1

Step 3: Writing the main program and calling the SBR

Using the CALL instruction in the main program to call the SBR_1.

The corresponding main program is as follows:

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.

• Parameter IN1 is brought in to transfer the constant integer 3

• Parameter IN2 is brought in to transfer the constant integer 2

• The return value OUT1 is stored in D0

The above program is shown in the following figure.

Figure 4-12 Calling the SBR

Step 4: Compiling, downloading and running the user program to verify the logic of the subprogram.

• Execution result of the application instance

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.

4.5 General information of the instructions

4.5.1 Instruction operands


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

4.5.2 Flag bit


The instruction operations may affect the following three kinds of flags bits.
⚫ Zero flag SM80
Setting the zero flag when the instruction operation result is zero.
⚫ Carry flag SM81
Setting the carry flagwhen the instruction operation result is a carry.
⚫ Borrow flag SM82
Setting the borrow flag when the instruction operation result is a borrow.

4.5.3 Restrictions on the use of instructions

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.

⚫ Exclusive hardware resources


Some instructions requires hardware resources. When a specific hardware is being used by a certain instruction, the access
to the hardware is denied to other instructions, because the occupation of the resource is exclusive.

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.

⚫ Application limit of the instructions


Some instructions cannot be used in certain situations due to their limited application scope.

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

Chapter 5 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

5.1 Contact logic instructions.....................................................................................................................................59


5.1.1 LD: NO contact instruction ....................................................................................................................... 59
5.1.2 LDI: NC contact instruction....................................................................................................................... 59
5.1.3 AND: NO contact and instruction ............................................................................................................. 59
5.1.4 ANI: NC contact and instruction ............................................................................................................... 60
5.1.5 OR: NO contact or instruction .................................................................................................................. 60
5.1.6 ORI: NO contact or instruction ................................................................................................................. 61
5.1.7 OUT: Coil output instruction ..................................................................................................................... 61
5.1.8 ANB: Energy flow block and instruction ................................................................................................... 61
5.1.9 ORB: Energy flow block or instruction ...................................................................................................... 62
5.1.10 MPS: Output energy flow push instruction ............................................................................................. 62
5.1.11 MRD: Instruction for reading output energy flow stack top value ........................................................... 63
5.1.12 MPP: Output energy flow stack pop instruction ...................................................................................... 63
5.1.13 EU: Rising edge detection instruction .................................................................................................... 64
5.1.14 ED: Falling edge detection instruction .................................................................................................... 64
5.1.15 LDP: Rising edge of contact ................................................................................................................... 65
5.1.16 LDF: Falling edge of contact .................................................................................................................. 65
5.1.17 ANDP: Rising edge of contact ................................................................................................................ 66
5.1.18 ANDF: Falling edge of contact ............................................................................................................... 66
5.1.19 ORP: Rising edge of contact .................................................................................................................. 67
5.1.20 ORF: Falling edge of contact.................................................................................................................. 67
5.1.21 PLP: Rising edge output instruction ....................................................................................................... 68
5.1.22 PLF: Falling edge output instruction ....................................................................................................... 68
5.1.23 INV: Energy flow negation instruction .................................................................................................... 69
5.1.24 SET: Coil set instruction ......................................................................................................................... 69
5.1.25 RST: Coil reset instruction...................................................................................................................... 69
5.1.26 NOP:No operation instruction................................................................................................................. 70
5.2 Main control instructions ......................................................................................................................................70
5.2.1 MC: Main control instruction ..................................................................................................................... 70
5.2.2 MCR: Main control reset instruction ......................................................................................................... 70
5.3 SFC instructions ..................................................................................................................................................71
5.3.1 STL: SFC state loadinginstruction ............................................................................................................ 71
5.3.2 SET Sxx: SFC state transition instruction ................................................................................................ 72
5.3.3 OUT Sxx: SFC state jumpinstruction ........................................................................................................ 72
5.3.4 RST Sxx: SFC state reset instruction ....................................................................................................... 72
5.3.5 RET: SFC program segment end instruction............................................................................................ 73
5.4 Timer instructions ................................................................................................................................................73
5.4.1 TON: Turn-on delay timing instruction ...................................................................................................... 73
5.4.2 TONR: Memory-type turn-on delay timing instruction .............................................................................. 73
5.4.3 TOF: Turn-off delay timing instruction ...................................................................................................... 74
5.4.4 TMON: Non-retriggerable monostable timing instruction ......................................................................... 75
5.5 Counter instructions.............................................................................................................................................76

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

5.1 Contact logic instructions

5.1.1 LD: NO contact instruction

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

Operand description Application instance


LD M0
S: Source operand OUT Y0
Function description When M0 is ON, the Y0 output is ON.

Connecting to the left bus to connect Application instance


(state: ON) or disconnect (state: OFF)
the energy flow.
LD D1.2

OUT Y0

When the second bit of D1 is 1, the Y0 output is ON.

5.1.2 LDI: NC contact instruction


LAD:
Applicable model VC1S VC1 VC2 VC3 VC5
LDI

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

Operand description Application instance

S: Source operand LDI M0

Function description OUT Y0


When M0 is OFF, the Y0 output is ON.
Connecting to the left bus to connect
(state: ON) or disconnect (state: OFF)
the energy flow.

5.1.3 AND: NO contact and instruction


LAD: Applicable model VC1S VC1 VC2 VC3 VC5
AND
Influenced flag
bit

IL: AND (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

Operand description Application instance


S: Source operand LD M0
AND M1
Function description
OUT Y0
Performing the "AND" operation on the ON/OFF
state of the designated contact (S) and the current
energy flow, and assigning the obtained result to When M0 is ON and M1 is ON, the Y0 output is ON.
the current energy flow.

5.1.4 ANI: NC contact and instruction


LAD: Applicable model VC1S VC1 VC2 VC3 VC5
ANI
Influenced flag
bit

IL: ANI (S) Step length 1


Operand Type Applicable soft element Indexing
S BOOL X Y M S LM SM Dx.y C T

Operand description Application instance

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.

5.1.5 OR: NO contact or instruction

Applicable model VC1S VC1 VC2 VC3 VC5

LAD: Influenced flag


bit

OR

IL: OR (S) Step length 1


Operand Type Applicable soft element Indexing
S BOOL X Y M S LM SM Dx.y C T

Operand description Application instance

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.

5.1.6 ORI: NO contact or instruction


LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag
bit

ORI

IL: ORI (S) Step length 1


Operand Type Applicable soft element Indexing
S BOOL X Y M S LM SM Dx.y C T

Operand description Application instance

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.

5.1.7 OUT: Coil output instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


OUT
Influenced flag
bit

IL: OUT (S) Step length 1


Operand Type Applicable soft element Indexing
S BOOL X Y M S LM SM Dx.y C T

Operand description Application instance

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).

5.1.8 ANB: Energy flow block and instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

61
VC Series Micro-PLC Programming Manual Basic instructions

ANB

Influenced flag
bit

Energy flow Energy flow


block 1 block 2

IL: ANB Step length 1

Operand description Application instance

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.

5.1.9 ORB: Energy flow block or instruction


LAD:
Applicable model VC1S VC1 VC2 VC3 VC5
Energy flow
block 1

Influenced flag

ORB bit

Energy flow
block 2

IL: ORB Step length 1

Operand description Application instance

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.

5.1.10 MPS: Output energy flow push instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

62
VC Series Micro-PLC Programming Manual Basic instructions

MPS

Influenced flag
bit

IL: MPS Step length 1

Function description Note:

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

IL: MRD Step length 1

Function description

Assigning the top value of the energy flow output stack to the current energy flow.

5.1.12 MPP: Output energy flow stack pop instruction


LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag
bit

MPP
IL: MPP Step length 1

63
VC Series Micro-PLC Programming Manual Basic instructions

Function description Application instance

Performing the Pop operation on the LDM0


energy flow output stack, andassigning the MPS
popped value to the current energy flow. AND M1
OUT Y0
MRD
AND M2
OUT Y1
MPP
AND M3
OUT Y2

5.1.13 EU: Rising edge detection instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


EU Influenced flag
bit
IL: EU Step length 2

Function description Application instance

Comparing the state of the input energy


LD M0
flow in the current scan with that in the last
EU
scan. If the energy flow rises (OFF→ON),
SET Y0
the output in the current scan cycle is valid.

5.1.14 ED: Falling edge detection instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


ED Influenced flag
bit
IL: ED Step length 2

Function description Sequence chart of the application instance

Comparing the state of the input energy flow


ON
in the current scan with that in the last scan. If
OFF
the energy flow falls (OFF→ON), the output in M2

the current scan cycleis valid. ON


OFF
Y2
Application instance
ON
LD M2
Y3 OFF
MPS
EU
OUT Y2
Note
MPP
ED
OUT Y3

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

5.1.15 LDP: Rising edge of contact

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

Operand description Application instance LD M0


OUT Y0
S: Source operand
LDP M1
Function description
INC D0
The LDP command is used to fetch the
rising edge of the contact signal When M0 is ON, the M1 output is ON. At this time, M1 changes
The rising edge jump of the from OFF to ON and remains valid for 1 scanning cycle, and D0
corresponding signal is detected in, performs increase 1. In the next scanning cycle, M1 will be
then the contact is effective, invalid and D0 remains 1.

On the next scan, the contact becomes


invalid

5.1.16 LDF: Falling edge of contact

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

Operand description Application instance LD M0


OUT Y0
S: Source operand
LDF M1
Function description
INC D0
The LDF command is used to fetch the
falling edge of the contact signal When M0 is ON, the M1 output is ON. At this time,If M1 changes
The falling edge jump of the from ON to OFF and remains valid for 1 scanning cycle, D0
corresponding signal is detected in, performs increase 1. In the next scanning cycle, M1 will be
then the contact is effective, invalid and D0 remains 1.

On the next scan, the contact becomes


invalid

5.1.17 ANDP: Rising edge of contact

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

Operand description Application instance LD M0


OUT Y0
S: Source operand
LD SM0
Function description
ANDP M1
The ANDP instruction is to participate in INC D0
the AND operation of the rising edge of
the contact.
When M0 is ON, the M1 output is ON. At this time,If M1 changes
from OFF to ON and remains valid for 1 scanning cycle, D0
performs increase 1. In the next scanning cycle, M1 will be
invalid and D0 remains 1.

5.1.18 ANDF: Falling edge of contact

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

Operand description Application instance LD M0


OUT Y0
S: Source operand
LD SM0
Function description
ANDF M1
INC D0

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.

5.1.19 ORP: Rising edge of contact


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

Operand description Application instance LD M0


OUT Y0
S: Source operand
LD M2
Function description
ORP M1
The ORP instruction is to participate in INC D0
the OR operation of the rising edge of
the contact.
When M0 is ON, the M1 output is ON. At this time,If M1 changes
from OFF to ON and remains valid for 1 scanning cycle, D0
performs increase 1. In the next scanning cycle, M1 will be
invalid and D0 remains 1.

5.1.20 ORF: Falling edge of contact

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

Operand description Application instance LD M0


OUT Y0
S: Source operand
LD M2
Function description
ORF M1
The ORF instruction is to participate in INC D0
the OR operation of the falling edge of
the contact.
When M0 is ON, the M1 output is ON. At this time,If M1 changes
from ON to OFF and remains valid for 1 scanning cycle, D0
performs increase 1. In the next scanning cycle, M1 will be
invalid and D0 remains 1.

67
VC Series Micro-PLC Programming Manual Basic instructions

5.1.21 PLP: Rising edge output instruction

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

Operand description Application instance LD M2


PLP Y0
S: Source operand
LD Y0
Function description
INC D0
The PLP instruction is to take the rising
edge of the output signal. If the rising
edge of the output signal is detected in
When M2 is ON, the Y0 output is ON and remains valid for 1
this scanning, the output contact will be
scanning cycle, D0 performs increase 1. In the next scanning
ON. In the next scanning cycle, the
cycle, M1 will be invalid and D0 remains 1.
contact of the output will become
invalid. .

5.1.22 PLF: Falling edge output instruction

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

Operand description Application instance LD M2


PLF Y0
S: Source operand
LD Y0
Function description
INC D0
The PLP instruction is to take the
Falling edge of the output signal. If the
falling edge of the output signal is
When M2 changes from ON to OFF, the Y0 output is ON and
detected in this scanning, the output
remains valid for 1 scanning cycle, D0 performs increase 1. In
contact will be ON. In the next
the next scanning cycle, M1 will be invalid and D0 remains 1.
scanning cycle, the contact of the
output will become invalid. .

68
VC Series Micro-PLC Programming Manual Basic instructions

5.1.23 INV: Energy flow negation instruction


LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag
INV bit

IL: INV Step length 1


Function description

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

5.1.24 SET: Coil set instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: SET (S) Step length 1
Operand Type Applicable soft element Indexing
S BOOL Y M S LM SM Dx.y C T

Operand description Application instance

S: Source operand LD M0
SET M1
Function description

Setting the bit element assigned by D when


the energy flow is valid.

5.1.25 RST: Coil reset instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: RST (S) Step length 1
Operand Type Applicable soft element Indexing
S BOOL Y M S LM SM Dx.y C T

69
VC Series Micro-PLC Programming Manual Basic instructions

Operand description Application instance

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.

5.1.26 NOP:No operation instruction


Applicable model VC1S VC1 VC2 VC3 VC5
LAD:
Influenced flag
bit
IL: NOP Step length 1

Function description Note

Performing no operation. In LAD, this instruction cannot be directly


connected to the left energy flow bus.

5.2 Main control instructions

5.2.1 MC: Main control instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag
bit
IL: MC (S) Step length 3
Operand Type Applicable soft element Indexing
Consta
S INT
nt
Operand description

S: Source operand

5.2.2 MCR: Main control reset instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: MCR (S) Step length 1
Operand Type Applicable soft element Indexing
Consta
S INT
nt

70
VC Series Micro-PLC Programming Manual Basic instructions

Operand description Note

S: Source operand 1. In LAD, the MCR instruction must be


directly connected to the left energy flow
Function description
bus.
1. Matching the MC and MCR instructions to form an MC-MCR structure.
2. In LAD, the MCR instruction cannot
The MC instruction represents the beginning of an MC-MCR structure,
connect in parallel or in series with other
and its operand Sis the label of the MC-MCR structure. The value of
instructions.
operand S is a constantranging from 0 to 7. MCR represents the end of
an MC-MCR structure. 3. Multiple different numbered MC-MCR
structures can be used in the nested
2. Executing the instruction in the middle of the MC-MCR structure when
mode, but thenumber of nest levels
the energy flow before the MC instruction is valid,
cannot exceed 8. MC-MCR structures
3. Skipping over the instruction in middle of the MC-MCR structure when with the same number cannotbe used in
the energy flow before the MC instruction is invalid, and executing it and the nested mode.
deleting the destination operands corresponding to OUT, TON, TOF,
4. Two MC-MCR structures cannot be
PWM,HCNT, PLSY,PLSR, DHSCS, SPD, DHSCI, DHSCR, DHSZ,DHST,
used in the cross manner. The use
DHSP and BOUT in the structure after the program directly jumps to the
method shown in the following figure is
structure
illegal.
Application instance

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.

5.3 SFC instructions

5.3.1 STL: SFC state loadinginstruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag
bit
IL: STL (S) Step length 3
Operand Type Applicable soft element Indexing
S BOOL S

71
VC Series Micro-PLC Programming Manual Basic instructions

Operand description corresponding to OUT, TON, TOF, PWM, HCNT,PLSY,


PLSR, DHSCS, SPD, DHSCI, DHSCR,DHSZ, DHST,
S: Source operand
DHSP and BOUT.
Function description 4. Not executing the built-in instructions of a step when
1. Indicating the beginning of the process of a step state the state of the step is invalid (OFF).
(S). 5. Defining a parallel merging structure by consecutive
2. Executing thebuilt-in instructions of a step when the STL instructions (serial connectionof STL elements),
state of the step is valid (ON). where the STL instructions can be used in a maximum of
3. If the state of a step changes from ON to OFF (falling 16 consecutive times, that is, the maximum number of
edge change), not executing the built-in instructions of branches in the parallel merging structure is 16.
the step, and deleting the destination operands

5.3.2 SET Sxx: SFC state transition instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: SET (D) Step length 3
Operand Type Applicable soft element Indexing
D BOOL S

Operand description Function description

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.

5.3.3 OUT Sxx: SFC state jumpinstruction


Applicable model VC1S VC1 VC2 VC3 VC5
LAD:
Influenced flag
bit
IL: OUT (D) Step length 3
Operand Type Applicable soft element Indexing
D BOOL S

Operand description Function description

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.

5.3.4 RST Sxx: SFC state reset instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag
bit
IL: RST (D) Step length 3
Operand Type Applicable soft element Indexing
D BOOL S

Operand description Function description

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

5.3.5 RET: SFC program segment end instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag
bit
IL: RET Step length 1

Function description Note

Indicating the end of a segment of the SFC program. It can be used only in the main program.

5.4 Timer instructions

5.4.1 TON: Turn-on delay timing instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: TON (D) (S) Step length 5
Operand Type Applicable soft element Indexing
D INT T
Consta
S INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt

Operand description Application instance

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.

2. Setting the timing coil output of the designated ON ON


Telement to ON when the timing value is more than OFF
M0
or equal to the preset value (S). 0.3 s 0.4 s ON

3. Stopping timing, resetting the timing value to T1 timing coil


OFF T1=32767 (max.)

zero, and setting the timing coil output to OFF when


T1=3 T1 =4
the energy flow is OFF.
T1 timing value
T1 =0
4. Setting the timing coil value of the designated T
element to OFF and resetting the timing value to
zero when the system executes the instruction for
the first time.

5.4.2 TONR: Memory-type turn-on delay timing instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: TONR (D) (S) Step length 5
Operand Type Applicable soft element Indexing
D INT T

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

Operand description Application instance

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

element to ON when the timing value is more than T1 timing coil


OFF T1=32767 (max.)

or equal to the preset value (S). T1 =3 T1 =5

3. Stopping timing, and remaining the current timing T1 timing value


T1= 0

coil and timing value when the energy flow is OFF.

5.4.3 TOF: Turn-off delay timing instruction


LAD: Applicable model VC1S VC1 VC2 VC3 VC5
Influenced flag bit
IL: TOF (D) (S) Step length 5
Indexi
Operand Type Applicable soft element
ng
D INT T
Consta
S INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt

74
VC Series Micro-PLC Programming Manual Basic instructions

Operand description Application instance

D: Destination operand LD M0
TOF T1
S: Source operand
5
Function description LD T1

1. Starting the timing of the specified timer T (D) OUT Y0

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.

4. Stopping timing, resetting the timing value to


zero, and setting the timing coil output to ON when
the energy flow is ON.

5.4.4 TMON: Non-retriggerable monostable timing instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag bit

IL: TMON (D) (S) Step length 5


Indexi
Operand Type Applicable soft element
ng
D INT T
Consta
S INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt

Operand description Application instance

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

Sequence chart of the application instance

75
VC Series Micro-PLC Programming Manual Basic instructions

1. Starting the timing of the designated timer T (D)


(based on the current value) when the input energy
flow changes from OFF to ON (rising edge
ON ON
change), and the timing has not started, and
keeping the timing coil output ON when in the OFF
M0
timing state (the timing length is determined by S). ON

2. Keeping timing and keeping the timing coil OFF OFF


T1 timing coil
output ON no matter how the energy flow changes 0.5 s T1=5 0.5 s
T1=5
when it is in the timing state (the timing length is
T1 timing value
determined by S). T 1= 0 T 1= 0

3. Stopping timing, resetting the timing value to


zero, and setting the timing coil output to OFF when
the timing value is reaches the preset point.

5.5 Counter instructions

5.5.1 CTU: 16-bit increment counterinstruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: CTU (D) (S) Step length 5
Operand Type Applicable soft element Indexing
D INT C
Consta
S INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt

Operand description Application instance

D: Destination operand LD M0
CTU C0
S: Source operand
3
Function description LD C0

1. Increasing the count value of the specified16-bit counter OUT Y0

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

ranging from C0 to C199.

5.5.2 CTR: 16-bit cycliccountinginstruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: CTR (D) (S) Step length 5
Operand Type Applicable soft element Indexing
D INT C

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

Operand description Application instance

D: Destination operand LD M0
CTR C0 3
S: Source operand
Sequence diagram of the Application instance
Function description

1. Increasing the count value of the specified 16-bit


counter C (D) by 1 when the input energy flow changes
from OFF to ON (rising edge change).

2. Setting the counting coil to ON, when the count value is


equal to the preset point (S). ON ON ON ON ON ON

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

again (rising edge change). C0=1 C0=2


C0=3
C0=2
C0=3
C0=0 C0=1
C0 count value
Note

1. Performing no counting action when the preset count


value (S) is less than or equal to 0.

2. Setting the address of the 16-bit counter C (D) to a value


ranging from C0 to C199.

5.5.3 DCNT:32-bit increment and decrement counting instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: DCNT (D) (S) Step length 7
Operand Type Applicable soft element Indexing
D DINT C
Consta
S DINT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt

77
VC Series Micro-PLC Programming Manual Basic instructions

Operand description Application instance

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).

2. For increment counters, setting the counting


D0=3
coil to ON when the count value is larger than or D0
ON
equal to the preset point (S).
OFF Switch to decrement counting
SM235
3. For decrement counters, setting the counting ON ON ON ON ON ON ON

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

when the count value is 2147483647 and is C235=2 C235=3


C235=1
C235=0
increased by 1. C235 count value C235=2
C235=1
C235=0 C235=-1

5. Changing the count value to 2147483647


when the count value is –2147483648 and is
decreased by 1.

Note

The address of C element (D) must be within the


range of C200 to C235.

78
VC Series Micro-PLC Programming Manual Application instructions

Chapter 6 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

6.1 Program flow control instructions.........................................................................................................................85


6.1.1 FOR: Cycle instruction ............................................................................................................................. 85
6.1.2 NEXT: Cycle return instruction ................................................................................................................. 85
6.1.3 LBL: Jump label definition instruction ....................................................................................................... 86
6.1.4 CJ: Conditional jump instruction ............................................................................................................... 88
6.1.5 CFEND: Instruction for conditional return of user main program .............................................................. 88
6.1.6 WDT: Instruction for watchdog reset of user program .............................................................................. 89
6.1.7 EI: Enable interrupt instruction ................................................................................................................. 89
6.1.8 DI: Disable interrupt instruction ................................................................................................................ 89
6.1.9 CIRET: Instruction for conditional return of user interrupt program .......................................................... 89
6.1.10 STOP: Instruction for stopping the user program ................................................................................... 89
6.1.11 CALL: Instruction for calling the user subprogram ................................................................................. 90
6.1.12 CSRET: Instruction for conditional return of user subprogram ............................................................... 90
6.2 Data transmission instructions .............................................................................................................................91
6.2.1 MOV: Word data transmissioninstruction ................................................................................................. 91
6.2.2 DMOV: Double word data transmission instruction .................................................................................. 91
6.2.3 RMOV: Floating-point data transmission instruction ................................................................................ 92
6.2.4 BMOV: Block data transmission instruction.............................................................................................. 92
6.2.5 FMOV: Data block fill instruction .............................................................................................................. 92
6.2.6 DFMOV: Data block double word fill instruction ....................................................................................... 93
6.2.7 SWAP: MSB/LSB swop instruction .......................................................................................................... 93
6.2.8 XCH: Word swop instruction .................................................................................................................... 94
6.2.9 DXCH: Double word swop instruction ...................................................................................................... 94
6.2.10 PUSH: Data push instruction.................................................................................................................. 94
6.2.11 FIFO: First-in-first-out instruction............................................................................................................ 95
6.2.12 LIFO: Last-in-first-out instruction ............................................................................................................ 96
6.2.13 WSFR: Word string shift right instruction................................................................................................ 96
6.2.14 WSFL: Word string shift left instruction .................................................................................................. 97
6.3 Integer arithmetic operation instructions ..............................................................................................................98
6.3.1 ADD: Integer addition instruction.............................................................................................................. 98
6.3.2 SUB: Integer subtraction instruction ......................................................................................................... 99
6.3.3 MUL: Integer multiplication instruction ..................................................................................................... 99
6.3.4 DIV: Integer division instruction ................................................................................................................ 99
6.3.5 SQT: Instruction for extracting the square root of an integer .................................................................. 100
6.3.6 INC: Integer plus one instruction ............................................................................................................ 100
6.3.7 DEC: Integer minus one instruction ........................................................................................................ 101
6.3.8 VABS: Instruction for obtaining the absolute value of an integer............................................................ 101
6.3.9 NEG: Integer negation instruction .......................................................................................................... 102
6.3.10 DADD: Long integer addition instruction .............................................................................................. 102
6.3.11 DSUB: Long integer subtraction instruction.......................................................................................... 102
6.3.12 DMUL: Long integer multiplication instruction ...................................................................................... 103
6.3.13 DDIV: Long integer division instruction ................................................................................................ 103
6.3.14 DSQT: Instruction for extracting the square root of a long integer ....................................................... 104

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

6.1 Program flow control instructions

6.1.1 FOR: Cycle instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: FOR (S) Step length 3

Operand Type Applicable soft element Indexing


Consta
S INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
⚫ Operand description
S: Source operand

6.1.2 NEXT: Cycle return instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: NEXT Step length 1

⚫ Function description consecutively executed for 100 times. D0 is increased by


1. FOR and NEXT instructionsform a FOR-NEXT one for 100 times. When the cycle is over, D0=100.
structure.

2. Cyclically executing the instructions in the middle of


the FOR-NEXT structure by S times continuously when
the energy flow before FOR is valid and the cycle times
(S) is larger than 0. Continuing to execute the instructions
after the FOR-NEXT structure when the cyclic execution
is done by S times.

3. Not executing the instructions in the middle of the


FOR-NEXT structure, directly jumping to the FOR-NEXT
structure to continue the execution when the energy flow
before FOR is invalid, or the cycle times (S) is less than
or equal to zero.

⚫ 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:

5. The intersection of the MC-MCR structure body and


3. You can use the conditional jump (CJ) instruction to the FOR-NEXT structure body is prohibited, and the LAD
jump out of the cycle body, so as to terminate the cycle below cannot be compiled correctly:
body execution in advance, as shown in the LAD below:

 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.

6.1.3 LBL: Jump label definition instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: LBL (S) Step length 3

Operand Type Applicable soft element Indexing


Consta
S INT
nt

⚫ 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

Repeated label No.

87
VC Series Micro-PLC Programming Manual Application instructions

6.1.4 CJ: Conditional jump instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: CJ (S) Step length 3

Operand Type Applicable soft element Indexing


Consta
S INT
nt

⚫ 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.

6.1.5 CFEND: Instruction for conditional return of user main program

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: CFEND Step length 1

⚫ Function description ⚫ Application instance


1. When the energy flow of the instruction is valid, the LD M0
The program flow
main program returns to the system from the current returns from the main
CFEND
program to the system
scan cycle (the user main program is executed by the LD
system repeatedly according to the scan cycle), and the SM12
instructionsin the subsequent main program are not
OUT Y0
executed.
When the program is running, if M0=OFF, the CFEND
2. When the energy flow of the instruction is invalid, this
instruction does not generate any action, the subsequent
instruction does not generate any action, and the
LD SM12 and OUT Y0 instructions are executed, and
subsequent instructions are executed in order.
you can see the Y0 blinks periodically.If M0=ON, CFEND
⚫ Note instruction generates an action, the program flow returns
The CFEND instruction must be used in the user main to the system from the main program in advance, the
program, otherwise the program cannot be compiled. subsequent LD SM12 and OUT Y0 instructions are not
be executed, and the Y0 no longer blinks periodically.
88
VC Series Micro-PLC Programming Manual Application instructions

6.1.6 WDT: Instruction for watchdog reset of user program


Applicable model VC1S VC1 VC2 VC3 VC5
LAD:
Influenced flag
bit
IL: WDT Step length 1
⚫ Function description
When the energy flow is valid, this instruction clears the timing value of the watchdog in the user program, and the watchdog
of the system user program restarts the timing.

6.1.7 EI: Enable interrupt instruction


Applicable model VC1S VC1 VC2 VC3 VC5
LAD:
Influenced flag
bit
IL: EI Step length 1
⚫ Function description
1. When the energy flow is valid, the interrupts in the current scan cycle are enabled.
2. When the EI instruction is valid, the interrupt request is allowed to be added into the interrupt request queue, waiting for
the system response.

6.1.8 DI: Disable interrupt instruction


Applicable
VC1S VC1 VC2 VC3 VC5
LAD: model
Influenced
flag bit
Step
IL: DI 1
length
⚫ Function description
1. When the energy flow is valid, the global interrupt enable flag is invalid,that is, the global interrupt is disabled.
2. When the global interrupt enable flag is invalid, the interrupt events cannot generate any interrupt request.
⚫ Note
When the interrupt disabling request instruction is valid, the system still responds to the unprocessed interrupt requests in
the interrupt request queue, but the new interrupt events cannot generate the interrupt requests.

6.1.9 CIRET: Instruction for conditional return of user interrupt program


Applicable
LAD: VC1S VC1 VC2 VC3 VC5
model
Influenced
flag bit
Step
IL: CIRET 1
length
⚫ Function description
When the energy flow is valid, the system exits the current interrupt program in advance.

6.1.10 STOP: Instruction for stopping the user program


Applicable
VC1S VC1 VC2 VC3 VC5
LAD: model
Influenced
flag bit
Step
IL: STOP 1
length
⚫ Function description
When the energy flow is valid, the system stops the execution of the user program immediately.

89
VC Series Micro-PLC Programming Manual Application instructions

6.1.11 CALL: Instruction for calling the user subprogram

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.

6.1.12 CSRET: Instruction for conditional return of user subprogram

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag
bit
IL: CSRET Step length 1

⚫ 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

6.2 Data transmission instructions

6.2.1 MOV: Word data transmissioninstruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: MOV (S) (D) Step length 5

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 √

⚫ Operand description ⚫ Note


S: Source operand 1. MOV instruction supports two kinds of integers: one with symbol
D: Destination operand and the other without symbol. If the two operands of the instruction are
both soft elements, then the data type is integer with symbol. If the
⚫ Function description
source operand of the instruction is long integer with symbol, such as
Assigning the content of S to D and keeping
(-10, +100), then the destination operand is integer with symbol. If
the value of S when the energy flow is valid.
the source operand is long integer without symbol, such as (100,
45535), then the destination operand is also integer without symbol.
2. The corresponding soft element C supports C0 to C199 only.
⚫ Application instance
LD X0
MOV D0
D10
Assigning the content of D0 to D10 when X0=ON.In this case,
D10=500.

6.2.2 DMOV: Double word data transmission instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: DMOV (S) (D) Step length 7

Operand Type Applicable soft element Indexing


Consta
S DINT KnX KnY KnM KnS KnLM KnSM D SD C V Z R √
nt
D DINT KnY KnM KnS KnLM D SD C V R √

⚫ Operand description ⚫ Note


S: Source operand 1. DMOV instruction supports two kinds of long integers: one with symbol
D: Destination operand and the other without symbol. If the two operands of the instruction are both
soft elements, then the data type is integer with symbol. If the source
⚫ Function description
operand of the instruction is long integer with symbol, such as (-10, +100),
Assigning the content of S to D and
keeping the value of S when the then the destination operand is also integer with symbol. If the source
energy flow is valid. operand is long integer without symbol, such as (100, 45535), then the
destination operand is also integer without symbol.
2. The corresponding soft element C supports 32-bit C element only.
⚫ Application instance

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

6.2.3 RMOV: Floating-point data transmission instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: RMOV (S) (D) Step length 7

Operand Type Applicable soft element Indexing


Consta
S REAL D V R √
nt
D REAL D V R √

⚫ Operand description ⚫ Application instance


S: Source operand LD X0
D: Destination operand RMOV D0 D10
⚫ Function description Assigning the content of (D0, D1) to (D10, D11) when X0=ON.In this case,
Assigning the content of S to D and (D10, D11)=50000.5.
keeping the value of S when the
energy flow is valid.

6.2.4 BMOV: Block data transmission instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag
bit
IL: BMOV (S1) (D) (S2) Step length 7

Operand Type Applicable soft element Indexing


S1 INT KnX KnY KnM KnS KnLM D SD C T V R √
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 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

6.2.5 FMOV: Data block fill instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: FMOV (S1) (D) (S2) Step length 7

Operand Type Applicable soft element Indexing

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 ⚫ Note


S: Source operand, start unit of data 1. When S1, D, and S2 use C elements, the legal range is C0 to C199.
block 2. S2 is greater than 0.
D: Destination operand, start unit of 3. When S1 and D are both Kn addressing, Kn needs to be equal.
data block
⚫ Application instance
S2: Size of the data block
LD X0
⚫ Function description FMOV D0 D100 10
Fillingthe content of S1 in S2 units
Filling the content of D0 in 10 units starting from D100 when X0=ON. In this
starting from D and keeping the
case, D100=D101=……=D109=D0=500.
content of S1 when the energy flow
is valid.

6.2.6 DFMOV: Data block double word fill instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag
bit
IL: DFMOV (S1) (D) (S2) Step length 9

Operand Type Applicable soft element Indexing


Consta
S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
D DINT KnY KnM KnS KnLM D C V R √
Consta
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt

⚫ Operand description ⚫ Note


S1: Start of source operand 1. When S1, D, and S2 use C elements, only 32-bit C elements are supported.
D: Destination operand, start unit of 2. S2 is greater than 0.
data block 3. When S1 and D are both Kn addressing, Kn needs to be equal.
S2: Size of the data block ⚫ Application instance
⚫ Function description LD X0
Fillingthe content of S1 in S2 units DFMOV D0 D10 10
starting from D and keeping the
Filling the content of (D0,D1) in10×2 units starting from D10 when X0=ON.
content of S1 when the energy flow
In this case, (D10,D11)= (D12,D13)=……= (D28,D29)= (D0,D1)=100000.
is valid.

6.2.7 SWAP: MSB/LSB swop instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag
bit
IL: SWAP (D) Step length 3

Operand Type Applicable soft element Indexing


D INT KnY KnM KnS KnLM D C T V Z R √

⚫ 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).

6.2.8 XCH: Word swop instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag
bit
IL: XCH (D1) (D2) Step length 5

Operand Type Applicable soft element Indexing


D1 INT KnY KnM KnS KnLM D C T V Z R √
D2 INT KnY KnM KnS KnLM D C T V Z R √

⚫ Operand description 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

6.2.9 DXCH: Double word swop instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag
bit
IL: DXCH (D1) (D2) Step length 7

Operand Type Applicable soft element Indexing


D1 DINT KnY KnM KnS KnLM D C T V R √
D2 DINT KnY KnM KnS KnLM D C T V R √

⚫ 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

6.2.10 PUSH: Data push instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag
bit

94
VC Series Micro-PLC Programming Manual Application instructions

IL: PUSH (S1) (D) (S2) Step length 7

Operand Type Applicable soft element Indexing


Consta
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
D INT D V R √
Consta
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt

⚫ 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

2. Setting the operation carry flag bit


(SM81) to 1, and not executing the 1. Pushing the content of D0 into the stack whose stack bottom is D100 when
push operation when the value of D M0=ON.
is equal to the value of S2 and there
2. Before execution: D0=1000, D100=8, D109=0.
are still push instructions being
3. After execution: D0=1000, D100=9, D109=1000.
executed.
⚫ Note

6.2.11 FIFO: First-in-first-out instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

FIFO (D1) (D2) (S) Influenced flag


FIFO (D1) (D2) (S) bit
IL: FIFO (D1) (D2) (S) Step length 7

Operand Type Applicable soft element Indexing


D1 INT D V R √
D2 INT KnY KnM KnS KnLM D C T V Z R √
Consta
S INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt

⚫ 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

LD M0 2. Before execution: D0=0, D100=10, D101=1000,


FIFO D100 D0 10D102=2000, ……, D109=9000, D110=10000.
3. After execution: D0=1000, D100=9, D101=2000,
Stack pointer
D102=3000, ……, D109=10000, D110=0.
0 D 110 D109 D 108 D 107 D 106 D 105 D 104 D 103 D 102 D 101 D 100 D0

1. Filling the content of D101in D0,movingthe


content of D101 to D110forward, and filling 0 in
D110 when M0=ON.

6.2.12 LIFO: Last-in-first-out instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: LIFO (D1) (D2) (S) Step length 7

Operand Type Applicable soft element Indexing


D1 INT D V R √
D2 INT KnY KnM KnS KnLM D C T V Z R √
Consta
S INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt

⚫ 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.

6.2.13 WSFR: Word string shift right instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
Carry flag, borrow flag
bit
IL: WSFR (S1) (D) (S2) (S3) Step length 9

Operand Type Applicable soft element Indexing


S1 INT KnX KnY KnM KnS KnLM D SD C T V R √
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

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.

6.2.14 WSFL: Word string shift left instruction


Applicable model VC1S VC1 VC2 VC3 VC5
LAD:
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: WSFL (S1) (D) (S2) (S3) Step length 9
Operand Type Applicable soft element Indexing
S1 INT KnX KnY KnM KnS KnLM D SD C T V R √
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
Consta
S3 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt

97
VC Series Micro-PLC Programming Manual Application instructions

⚫ Operand description 3. S2 is no less than S3.


S1: Source operand 4. When S1 and D both use the Kn addressing, Kn needs to be the same.
D: Destination operand, start ⚫ Application instance
element of a word string
S2: Size of destination word queue
S3: Number of words filled when LD X0
shifting a word string rightward WSFL D0 D100 10 3

⚫ 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.

6.3 Integer arithmetic operation instructions

6.3.1 ADD: Integer addition instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: ADD (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 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

6.3.2 SUB: Integer subtraction instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: SUB (S1) (S2) (D) Step length 7

Operand Type Applicable soft element Indexing


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. 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.

6.3.3 MUL: Integer multiplication instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: MUL (S1) (S2) (D) Step length 8

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 √

⚫ Operand description ⚫ Note


S1: Source operand 1 The operation result of MUL instruction is a 32-bit data.
S2: Source operand 2 ⚫ Application instance
D: Destination operand
⚫ Function description
LD X0
Multiplying S1 by S2 and assigning the operation result
to D when the energy flow is valid. MUL D0 D1 D10
Multiplying D0 (1000) by D1 (2000), and assigning the
operation result to (D10,D11) when X0=ON. In this case,
(D10,D11)=2000000.

6.3.4 DIV: Integer division instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

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 description ⚫ Note


S1: Source operand 1 If S2≠0, the system reportsan error, indicating that 0
S2: Source operand 2 cannot be used as a divisor and does not execute the
D: Destination operand division operation.

⚫ Function description ⚫ Application instance


Dividing S1 by S2 and assigning the operation result to
D (D includes two units, one stores the quotient value
and the other stores the residue value) when the energy LD X0
flow is valid. DIV D0 D1 D10
Dividing D0 (2500) by D1 (1000), and assigning the
operation result to (D10,D11) when X0=ON. In this case,
D10=2, D11=500.

6.3.5 SQT: Instruction for extracting the square root of an integer

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: SQT (S) (D) Step length 5

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.

6.3.6 INC: Integer plus one instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: INC (D) Step length 3
Operand Indexin
Type Applicable soft element
g

100
VC Series Micro-PLC Programming Manual Application instructions

D INT KnY KnM KnS KnLM D C T V Z R √

⚫ Operand description ⚫ Note


D: Destination operand This instruction is a cyclic addition instruction, and the range is from -32768
⚫ Function description to 32767. The supported range of C element is from C0 to C199.
Increasing D by 1 automatically when ⚫ Application instance
the energy flow is valid. LD X0
INC D0
Increasing D0 (1000) by 1 automatically when X0=ON. After execution,
D0=1001.

6.3.7 DEC: Integer minus one instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag
bit
IL: DEC (D) Step length 3
Operand Indexin
Type Applicable soft element
g
D INT KnY KnM KnS KnLM D C T V Z R √

⚫ Operand description This instruction is cyclic minus instruction, and the range is from -32768 to
D: Destination operand 32767.

⚫ Function description ⚫ Application instance


Decreasing D by 1 LD X0
automaticallyWhen the energy flow is DEC D0
valid. DecreasingD0 (1000) by 1 automatically when X0=ON. After execution,
⚫ Note D0=999.

6.3.8 VABS: Instruction for obtaining the absolute value of an integer


Applicable model VC1S VC1 VC2 VC3 VC5
LAD:
Influenced flag
bit
IL: VABS (S) (D) Step length 5
Operand
Type Applicable soft element Indexing
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 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.

⚫ Function description ⚫ Application instance


Taking an absolute value of S and LD X0
assigning the obtained result to D VABS D0 D10
when the energy flow is valid. Taking an absolute value of D0 (-1000), assigning the obtained result to D10
⚫ Note when X0=ON. In this case, D10=1000.

101
VC Series Micro-PLC Programming Manual Application instructions

6.3.9 NEG: Integer negation instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag
bit
IL: NEG (S) (D) Step length 5
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 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.

⚫ Function description ⚫ Application instance


Taking the negative of S and LD X0
assigning the obtained result to D NEG D0 D10
when the energy flow is valid. Taking the negative of D0 (1000), and assigning the obtained result to D10
⚫ Note when X0=ON. In this case, D10=-1000.

6.3.10 DADD: Long integer addition instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: DADD (S1) (S2) (D) Step length 10

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 description ⚫ Application instance


S1: Source operand 1
S2: Source operand 2
D: Destination operand LD X0
⚫ Function description DADD D0 D2 D10
1. Increasing S1 by S2 and assigning the operation result Increasingthe value (100000) of (D0,D1) bythe value
to D when the energy flow is valid. (200000) of (D2,D3),and assigning the operation result
2. Setting the carry flag bit (SM81) when the operation to (D10,D11)when X0=ON. In this case,
result (D) is larger than 2147483647. Setting the zero (D10,D11)=300000.
flag bit (SM80) when the operation result is 0. Setting the
borrow flag bit (SM82) when the operation result is less
than -2147483648.

6.3.11 DSUB: Long integer subtraction instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: DSUB (S1) (S2) (D) Step length 10

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 description ⚫ Application instance


S1: Source operand 1
S2: Source operand 2
D: Destination operand LD X0

⚫ Function description DSUB D0 D2 D10


1. Subtracting S1 by S2 and assigning the operation Subtractingthe value (100000) of (D0,D1) bythe value
result to D when the energy flow is valid. (200000) of (D2,D3), and assigning the operation result
2. Setting the carry flag bit (SM81) when the operation to (D10,D11)when X0=ON. In this case, (D10,D11)=-
result (D) is larger than 2147483647. Setting the zero 100000.
flag bit (SM80) when the operation result is 0. Setting the
borrow flag bit (SM82) when the operation result is less
than -2147483648.

6.3.12 DMUL: Long integer multiplication instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: DMUL (S1) (S2) (D) Step length 10

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

6.3.13 DDIV: Long integer division instruction


Applicable model VC1S VC1 VC2 VC3 VC5
LAD:
Influenced flag
bit
IL: DDIV (S1) (S2) (D) Step length 10
Operand
Type Applicable soft element Indexing

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 √

⚫ Operand description ⚫ Note


S1: Source operand 1 If S2≠0, the system reports an error, indicating that 0 cannot be used as a
S2: Source operand 2 divisor and does not execute the division operation.
D: Destination operand ⚫ Application instance
⚫ Function description LD X0
DividingS1 by S2 and assigning the DDIV D0 D2 D10
operation result to D (D includes four Dividing the value (83000) of (D0,D1) by the value (2000) of (D2,D3), and
units, the first two store the quotient assigning the operation result to (D10,D11) and (D12,D13)when X0=ON. In
value and the last two store the this case, (D10,D11)=41 and (D12,D13)=1000.
residue value) when the energy flow
is valid.

6.3.14 DSQT: Instruction for extracting the square root of a long integer

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: DSQT (S) (D) Step length 7

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 description ⚫ Note


S: Source operand If S ≥ 0, the system reports an operand error and does not execute the
D: Destination operand square root extraction.

⚫ Function description ⚫ Application instance


1. Extracting the square root of S and LD X0
assigning the operation result to D DSQT D0
when the energy flow is valid. D10
2. Setting the zero flag bit (SM80) Extracting the square root of the value (83000) of (D0,D1), and assigning the
When (D) is 0. Setting the carry flag square root result to (D10,D11) when X0=ON. In this case, (D10,D11)=288.
bit (SM82) when the operation result
is rounded off.

6.3.15 DINC: Long integer plus one instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag
bit
IL: DINC (D) Step length 4

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 description ⚫ Note


D: Destination operand 1. This instruction is a cyclic addition instruction, and the range is from -
⚫ Function description 2147483648 to 2147483647.
Increasing D by 1 automatically when 2. Supporting 32-bit C element only among C elements.
the energy flow is valid. ⚫ Application instance
LD X0
DINC D0
Increasing the value (100000) of (D0,D1)automatically when X0=ON. After
execution,(D0,D1)=100001.

6.3.16 DDEC: Long integer minus one instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag
bit
IL: DDEC (D) Step length 4

Operand Indexin
Type Applicable soft element
g
D DINT KnY KnM KnS KnLM D C V R √

⚫ Operand description ⚫ Note


D: Destination operand This instruction is cyclic minus instruction, and the range is from -
⚫ Function description 2147483648 to 2147483647.
Decreasing D by 1 automatically ⚫ Application instance
When the energy flow is valid. LD X0
DDEC D0
Decreasing the value (100000) of (D0,D1) automatically when X0=ON. After
execution, (D0,D1)=99999.

6.3.17 DVABS: Instruction for obtaining the absolute value of a long integer

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: DVABS (S) (D) Step length 7

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 description ⚫ Note


S: Source operand The range of S needs to be from -2147483647 to 2147483647. When the
D: Destination operand value of S is -2147483648, the system an error, indicating the value of the
instruction operand is invalid, andthe instruction does not generate any
⚫ Function description
action.
Taking an absolute value of S and
assigning the obtained result to D ⚫ Application instance
when the energy flow is valid. LD X0
DVABS D0 D10
Taking an absolute value (-100000) of (D0,D1), and assigning the obtained
result to (D10,D11) when X0=ON. In this case, (D10,D11)=100000.

105
VC Series Micro-PLC Programming Manual Application instructions

6.3.18 DNEG: Long integer negation instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: DNEG (S) (D) Step length 7

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 description ⚫ Note


S: Source operand The range of S needs to be from -2147483647 to 2147483647. When the
D: Destination operand value of S is -2147483648, the system an error, indicating the value of the
⚫ Function description instruction operand is invalid, and the instruction does not generate any
Taking the negative of S and action.
assigning the obtained result to D ⚫ Application instance
when the energy flow is valid. LD X0
DNEG D0 D10
Taking the negative of the value (100000) of (D0,D1), and assigning the
obtained result to (D10,D11) when X0=ON. In this case, (D10,D11)=-
100000.

6.3.19 SUM: Integeraccumulation instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: SUM (S1) (S2) (D) Step length 8

Operand
Type Applicable soft element Indexing

S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √


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 √

⚫ Operand description ⚫ Note


S1: Source operand, start unit for 1. The operation result of the SUM instructionis 32-bit data.
accumulation 2. If 0≤S2≤255, the system reports an operand error.
S2: Source operand, number of 3. Since D is a 32-bit data, the carry and borrow flags are always 0, while the
pieces of data to be accumulated zero flag bit is determined by the final accumulation result.
D: Destination operand, ⚫ Application instance
accumulation result
LD SM0
⚫ Function description MOV 1000 D0
Accumulating the content of S2 units MOV 2000 D1
starting from the start unit (S1), and
MOV 3000 D2
assigning the obtained result to D
MOV 4000 D3
when the energy flow is valid.
MOV 5000 D4
LD X0
SUM D0 5
D100

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

6.3.20 DSUM: Long integer accumulation instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: DSUM (S1) (S2) (D) Step length 9

Operand
Type Applicable soft element Indexing

S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √


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 √

⚫ Operand description If 0≤S2≤255, the system reports an operand error.


S1: Source operand, start unit for ⚫ Application instance
accumulation LD SM0
S2: Source operand, number of DMOV 100000 D0
pieces of data to be accumulated DMOV 200000 D2
D:Destination operand,
DMOV 300000 D4
accumulation result
DMOV 400000 D6
⚫ Function description DMOV 500000 D8
Accumulating the content of S2×2 LD X0
units starting from the start unit (S1),
DSUM D0 5 D100
performing the DSUM instruction,
Accumulating the data of 5×2 units starting from D0, and assigning the
and assigning the obtained result to
obtained result to (D100,D101) when X0=ON.
D when the energy flow is valid.
In this case, (D100,D101)= (D0,D1)+……+ (D8,D9)=1500000.
⚫ Note

6.4 Floating-point arithmetic operation instructions

6.4.1 RADD: Floating-point numberaddition instruction


Applicable
LAD: VC1S VC1 VC2 VC3 VC5
model
Influenced Zero flag, carry flag, and
flag bit borrow flag
Step
IL: RADD (S1) (S2) (D) 10
length

Operand Type Applicable soft element Indexing


Consta
S1 REAL D V R √
nt
Consta
S2 REAL D V R √
nt
D REAL D V R √

⚫ 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.

6.4.2 RSUB: Floating-point numbersubtraction instruction


Applicable
LAD: VC1S VC1 VC2 VC3 VC5
model
Influenced Zero flag, carry flag, and
flag bit borrow flag
IL: RSUB (S1) (S2) (D) Step length 10

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 √

⚫ Operand description ⚫ Application instance


S1: Source operand 1
S2: Source operand 2
D: Destination operand LD X0
RSUB D0 D2 D10
⚫ Function description
1. Subtracting S1 by S2 and assigning the operation Subtractingthe value (-10000.2) of (D0,D1) bythe value
result to D when the energy flow is valid. (2000.5) of (D2,D3), and assigning the operation result
2. Setting the carry flag bit (SM81) when the operation to (D10,D11)when X0=ON. In this case, (D10,D11)=-
result (D) is larger than 1.701412e+038 or less than - 12000.7.
1.701412e+038. Setting the zero flag bit (SM80) when
the operation result is 0.

6.4.3 RMUL: Floating-point numbermultiplication instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: RMUL (S1) (S2) (D) Step length 10

Operand Type Applicable soft element Indexing


Consta
S1 REAL D V R √
nt
Consta
S2 REAL D V R √
nt
D REAL D V R √

⚫ Operand description ⚫ Application instance


S1: Source operand 1
S2: Source operand 2
LD X0
D: Destination operand
RMUL D0 D2 D10
⚫ Function description
Multiplying the value (-10000.2) of (D0,D1) by the value
1. Multiplying S1 by S2 and assigning the operation
(2000.5)of (D2,D3), and assigning the operation result to
result to D when the energy flow is valid.
(D10,D11)when X0=ON. In this case, (D10,D11)=-
2. Setting the carry flag bit (SM81) when the operation
20005400.0 (actually the result is -20005400.1, but is
result (D) is larger than 1.701412e+038 or less than - rounded off according to the calculation precision).
1.701412e+038. Setting the zero flag bit (SM80) when
the operation result is 0.

109
VC Series Micro-PLC Programming Manual Application instructions

6.4.4 RDIV: Floating-point numberdivision instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: RDIV (S1) (S2) (D) Step length 10
Operand Indexin
Type Applicable soft element
g
Consta
S1 REAL D V R √
nt
Consta
S2 REAL D V R √
nt
D REAL D V R √

⚫ Operand description ⚫ Note


S1: Source operand 1 If S2≠0, the system reportsan error, indicating that 0 cannot be used as a
S2: Source operand 2 divisor and does not execute the division operation.
D: Destination operand ⚫ Application instance
⚫ Function description LD X0
1. Dividing S1 by S2 and assigning RDIV D0 D2 D10
the operation result to D. Dividing the value (-10000.2) of (D0,D1) by the value (2000.5) of (D2,D3),
2. Setting the carry flag bit (SM81) and assigning the operation result to (D10,D11)when X0=ON.In this case,
when the operation result (D) is (D10,D11)=-4.998850.
larger than 1.701412e+038 or less
than -1.701412e+038. Setting the
zero flag bit (SM80) when the
operation result is 0.

6.4.5 RSQT: Instruction for extracting the square root of a floating-point number

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: RSQT (S) (D) Step length 7
Operand
Type Applicable soft element Indexing
Consta
S REAL D V R √
nt
D REAL D V R √

⚫ 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

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag
bit
IL: RVABS (S) (D) Step length 7
Operand
Type Applicable soft element Indexing
Consta
S REAL D V R √
nt
D REAL D V R √

⚫ 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

6.4.7 RNEG: Floating-point number negation instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag
bit
IL: RNEG (S) (D) Step length 7
Operand
Type Applicable soft element Indexing
Consta
S REAL D V R √
nt
D REAL D V R √

⚫ 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

6.4.8 SIN: Instruction for obtaining SIN of a floating-point number


Applicable model VC1S VC1 VC2 VC3 VC5
LAD:
Zero flag, carry flag, and borrow
Influenced flag
flag
bit

IL: SIN (S) (D) Step length 7


Operand
Type Applicable soft element Indexing
Consta
S REAL D V R √
nt
D REAL D V R √

⚫ Operand description ⚫ Function description


S: Source operand
D: Destination operand

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.

6.4.9 COS: Instruction for obtaining COS of a floating-point number

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Zero flag, carry flag, and borrow
Influenced flag
flag
bit

IL: COS (S) (D) Step length 7


Operand
Type Applicable soft element Indexing
Consta
S REAL D V R √
nt
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 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.

6.4.10 TAN: Instruction for obtaining TAN of a floating-point number

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Zero flag, carry flag, and borrow
Influenced flag
flag
bit

IL: TAN (S) (D) Step length 7


Operand
Type Applicable soft element Indexing
Consta
S REAL D V R √
nt
D REAL D V R √

⚫ 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.

⚫ Function description ⚫ Application instance


1. Obtaining the TAN value of S (unit: LD X0
radian), and assigning the obtained TAN D0 D10
result to D when the energy flow is Taking the TAN value (1.57) of (D0,D1), and assigning the obtained result to
valid. (D10,D11) when X0=ON. In this case, (D10,D11) =1255.848398.

112
VC Series Micro-PLC Programming Manual Application instructions

6.4.11 POWER: Instruction for exponentiation of a floating-point number


Applicable
LAD: VC1S VC1 VC2 VC3 VC5
model
Influenced flag Zero flag, carry flag, and
bit borrow flag
IL: POWER (S1) (S2) (D) Step length 10
Operand
Type Applicable soft element Indexing
Consta
S1 REAL D V R √
nt
Consta
S2 REAL D V R √
nt
D REAL D V R √

⚫ Operand description ⚫ Note


S1: Source operand 1 1. If S1=0 and S2≤0, the system reportsan operand value error and does not
S2: Source operand 2 execute the operation.
D: Destination operand 2. If S1<0 and the mantissa of S2 is not 0, the system reports an operand

⚫ 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

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Zero flag, carry flag, and borrow
Influenced flag
flag
bit

IL: LN (S) (D) Step length 7


Operand
Type Applicable soft element Indexing
Consta
S REAL D V R √
nt
D REAL D V R √

⚫ 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

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: EXP (S) (D) Step length 7
Operand
Type Applicable soft element Indexing
Consta
S REAL D V R √
nt
D REAL D V R √

⚫ 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

6.4.14 RSUM: Floating-point number accumulation instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: RSUM (S1) (S2) (D) Step length 9
Operand
Type Applicable soft element Indexing

S1 REAL D V R √
Consta
S2 INT KnX KnY KnM KnS KnLM KnSM D V R √
nt
D REAL D V R √

⚫ Operand description ⚫ Application instance


S1: Source operand, start unit for LD SM0
accumulation RMOV 10000.1
S2:Source operand, number of D0
pieces of data to be accumulated RMOV 20000.2
D:Destination operand,accumulation D2
result RMOV 30000.3
⚫ Function description D4
Accumulating the content of S2×2 RMOV 40000.4
units starting from the start unit (S1), D6
performing the RSUM instruction, RMOV 50000.5
and assigning the obtained result to D8
D when the energy flow is valid. LD X0
⚫ Note RSUM D0 5
1. If 0≤S2≤255, the system reports an D100
operand error. Accumulating the data of 5×2 units starting from D0, and assigning the
2. The system does not perform the obtained result to (D100,D101) when X0=ON.
accumulation operation once an In this case, (D100,D101)= (D0,D1)+……+ (D8,D9)=150001.5.
overflow occurs.

114
VC Series Micro-PLC Programming Manual Application instructions

6.4.15 ASIN: Instruction for obtaining ASIN of a floating-point number

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: ASIN (S) (D) Step length 7
Operand
Type Applicable soft element Indexing
Consta
S REAL D V R √
nt
D REAL D V R √

⚫ Operand description ⚫ Note


S: Source operand If S>1 or S<-1, the system reports an operand error, does not perform the
D: Destination operand conversion operation and keeps the content of D.
⚫ Function description ⚫ Application instance
1. Obtaining the SIN-1 value of S, and LD SM0
assigning the operation result to D ASIN D0 D10
when the energy flow is valid.
Taking the SIN-1 value (0.500000) of (D0,D1),and assigning the obtained
2. Setting the zero flag bit (SM80) result to (D10,D11) when SM0=ON. In this case, (D10,D11) =0.523599.
when the operation result (D) is 0.

6.4.16 ACOS: Instruction for obtaining ACOS of a floating-point number

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: ACOS (S) (D) Step length 7
Operand
Type Applicable soft element Indexing
Consta
S REAL D V R √
nt
D REAL D V R √

⚫ 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

6.4.17 ATAN: Instruction for obtaining ATAN of a floating-point number


LAD: Applicable model VC1S VC1 VC2 VC3 VC5
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: ATAN (S) (D) Step length 7
Operand
Type Applicable soft element Indexing
Consta
S REAL D V R √
nt

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

LAD: Applicable model VC2 VC3 VC5


Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: LOG (S) (D) Step length 7
Operand
Type Applicable soft element Indexing
Consta
S REAL D V R √
nt
D REAL D V R √

⚫ 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.

6.4.19 RAD: Instruction for floating-point number angle-radian conversion

LAD: Applicable model VC2 VC3 VC5


Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: RAD (S) (D) Step length 7
Operand
Type Applicable soft element Indexing
Consta
S REAL D V R √
nt
D REAL D V R √

⚫ Operand description operation result to D when the energy flow is valid.


S: Source operand 2. Setting the zero flag bit (SM80) when the operation result is 0.
D: Destination operand ⚫ Application instance
⚫ Function description LD SM0
1. Converting the angle value of S RAD D0 D10
unit floating-point number into a Taking the value (180.0)of D0(D1), and assigning the obtained result to
radian value, and assigning the D10(D11)when SM0=ON. In this case, D10(D11) =3.141593.

6.4.20 DEG: Instruction for floating-point number radian-angle conversion

LAD: Applicable model VC2 VC3 VC5


Influenced flag Zero flag, carry flag, and borrow
bit flag

116
VC Series Micro-PLC Programming Manual Application instructions

IL: DEG (S) (D) Step length 7


Operand
Type Applicable soft element Indexing
Consta
S REAL D V R √
nt
D REAL D V R √

⚫ Operand description operation result to D when the energy flow is valid.


S: Source operand 2. Setting the zero flag bit (SM80) when the operation result is 0.Setting the
D: Destination operand carry (overflow) flag bit (SM81) when the operation result (D) overflows.

⚫ Function description ⚫ Application instance


1. Converting the radian value of S LD SM0
unit floating-point number into a DEG D0 D10
angle value, and assigning the Taking the value (3.0)of D0(D1), and assigning the obtained result to
D10(D11)when SM0=ON. In this case, D10(D11) =171.8873.

6.5 Value conversion instructions

6.5.1 DTI: Instruction for converting a long integer to an integer

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Zero flag, carry flag, and borrow
Influenced flag
flag
bit

IL: DTI (S) (D) Step length 6

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

6.5.2 ITD: Instruction for converting an integer to a long integer

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: ITD (S) (D) Step length 6

Operand Type Applicable soft element Indexing


Consta
S 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 √

⚫ Operand description ⚫ Function description


S: Source operand Converting S from an integer to a long integer, and assigning the operation
D: Destination operand result to D when the energy flow is valid.

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

6.5.3 FLT: Instruction for converting an integer to a floating-point number

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: FLT (S) (D) Step length 6

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 description ⚫ Application instance


S: Source operand LD X0
D: Destination operand FLT D0 D10
⚫ Function description Converting D0=10005 from an integer to a floating-point number, and
Converting S from an integer to a assigning the operation result to (D10,D11) when X0=ON. In this case,
floating-point number, and assigning (D10,D11)=10005.0.
the operation result to D when the
energy flow is valid.

6.5.4 DFLT: Instruction for converting a long integer to a floating-point number

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: DFLT (S) (D) Step length 7

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 description ⚫ Application instance


S: Source operand LD X0
D: Destination operand DFLT D0 D10
⚫ Function description Converting (D0,D1)=100000 from a long integer to a floating-point number,
Converting S from a long integer to a and assigning the operation result to (D10,D11) when X0=ON. In this case,
floating-point number, and assigning (D10,D11)=100000.0.
the operation result to D when the
energy flow is valid.

6.5.5 INT: Instruction for converting a floating-point number to an integer

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Zero flag, carry flag, and borrow
Influenced flag
flag
bit

IL: INT (S) (D) Step length 6

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

6.5.6 DINT: Instruction for convert a floating-point number to a long integer

Applicable model VC1S VC1 VC2 VC3 VC5


LAD: Zero flag, carry flag, and borrow
Influenced flag
flag
bit

IL: DINT (S) (D) Step length 7

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.

6.5.7 BCD: Instruction for converting a word to a 16-bit BCD code

Applicable model VC1S VC1 VC2 VC3 VC5


LAD: Zero flag, carry flag, and borrow
Influenced flag
flag
bit

IL: BCD (S) (D) Step length 5


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 √

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

Applicable model VC1S VC1 VC2 VC3 VC5


LAD: Zero flag, carry flag, and borrow
Influenced flag
flag
bit

IL: DBCD (S) (D) Step length 7


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 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

6.5.9 BIN: Instruction for converting a 16-bit BCD code to a word

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Zero flag, carry flag, and borrow
Influenced flag
flag
bit

IL: BIN (S) (D) Step length 5


Operand
Type Applicable soft element Indexing
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 obtained result to D when the energy flow is valid.


S: Source operand, its data format ⚫ Note
must comply with BCD code format If the data format of S does not comply with BCD code format, the system
D: Destination operand. reports an operand error, does not execute the conversion operation, and
⚫ Function description keeps the content of D.
Converting S from a 16-bit BCD ⚫ Application instance
codeto an integer, and assigning the LD X0

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

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: DBIN (S) (D) Step length 7
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 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.

⚫ Function description ⚫ Application instance


1. Converting S from a 32-bit BCD LD X0
codeto a long integer, and assigning DBIN D0 D10
the obtained result to D when the Converting (D0,D1)=0x99999999 (2576980377) from a 32-bit BCD code to
energy flow is valid. a long integer, and assigning the operation resultto (D10,D11) when X0=ON.
2. The data format of S must comply In this case, (D10,D11)=0x5F5E0FF (99999999).
with BCD code format.
⚫ Note

6.5.11 GRY: Instruction for converting a word to a 16-bit gray code

Applicable model VC1S VC1 VC2 VC3 VC5


LAD: Zero flag, carry flag, and borrow
Influenced flag
flag
bit

IL: GRY (S) (D) Step length 5


Operand
Type Applicable soft element Indexing
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 ⚫ Application instance


S: Source operand LD X0
D: Destination operand GRY D0 D10
⚫ Function description Converting D0=0xAAAA (43690) from an integer to a 16-bit gray code, and
Converting S from an integer to a 16- assigning the operation resultto D10 when X0=ON. In this case,
bit gray code, and assigning the D10=0xFFFF (65535).
obtained result to D when the energy
flow is valid.

6.5.12 DGRY: Instruction for converting a double word to a 32-bit gray code

Applicable model VC1S VC1 VC2 VC3 VC5


LAD: Zero flag, carry flag, and borrow
Influenced flag
flag
bit

121
VC Series Micro-PLC Programming Manual Application instructions

IL: DGRY (S) (D) Step length 7


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 description ⚫ Application instance


S: Source operand LD X0
D: Destination operand DGRY D0 D10
⚫ Function description Converting (D0,D1)=0x88888888 (2290649224) from a long integer to a 32-
Converting S from a long integer to a bit gray code, and assigning the operation resultto (D10,D11) when X0=ON.
32-bit gray code, and assigning the In this case, (D10,D11)=0xCCCCCCCC (3435973836).
obtained result to D when the energy
flow is valid.

6.5.13 GBIN: Instruction for converting a 16-bit gray code to a word

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: GBIN (S) (D) Step length 5
Operand
Type Applicable soft element Indexing
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 ⚫ Application instance


S: Source operand LD X0
D: Destination operand GBIN D0 D10
⚫ Function description Converting D0=0xFFFF (65535)from a 16-bit gray code to an integer, and
Converting S from a 16-bit gray code assigning the operation resultto D10 when X0=ON. In this case,
to an integer, and assigning the D10=0xAAAA (43690).
obtained result to D when the energy
flow is valid.

6.5.14 DGBIN: Instruction for converting a 32-bit gray code to a double word

Applicable model VC1S VC1 VC2 VC3 VC5


LAD: Zero flag, carry flag, and borrow
Influenced flag
flag
bit

IL: DGBIN (S) (D) Step length 7


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 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

6.5.15 SEG: Instruction for converting a word to a 7-segment code

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: SEG (S) (D) Step length 5
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 ⚫ Note


S: Source operand, S≤15 IfS > 15, the system reports an operand error, does not execute the
D: Destination operand conversion operation, and keeps the content of D.
⚫ Function description ⚫ Application instance
Converting S from aninteger to a7- LD X0
segment code, and assigning the SEG D0 D10
obtained result to D when the energy
Converting D0=0x0F (15)from an integer to a 7-segment code, and assigning
flow is valid.
the operation result to D10 when X0=ON. In this case, D10=0x71 (113).

6.5.16 ASC: ASCII code conversion instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Zero flag, carry flag, and borrow
Influenced flag
flag
bit

IL: ASC (S1–S8) (D) Step length 19


Operand
Type Applicable soft element Indexing
Consta
S1 INT
nt
Consta
S2 INT
nt
Consta
S3 INT
nt
Consta
S4 INT
nt
Consta
S5 INT
nt
Consta
S6 INT
nt
Consta
S7 INT
nt
Consta
S8 INT
nt
D INT D C T V Z R √

⚫ Operand description characters is less than 8, the remaining characters are


S1–S8: Source operand (If the number of characters is filled with 0)
less than 8, the remaining characters are filled with 0) D: Destination operand
Only supporting the characters whose ASCII code is ⚫ Function description
0x21 to 0x7E (input through keyboard, if the number of

123
VC Series Micro-PLC Programming Manual Application instructions

Converting the character string S1–S8 to ASCII code, LD M0


and assigning the obtained result to the elements starting ASC 12345678 D0
from D when the energy flow is valid. Storing two ASCII Executing the ASCII conversion when M0=ON and data
code data in the high/low byte of each D element when is stored in two modes:
SM85=OFF. Storing one ASCII code data in low byte of • If SM85=OFF, the execution result is: D0=0x3231,
each D element when SM85=ON.
D1=0x3433, D2=0x3635, D3=0x3837.
⚫ Application instance • If SM85=ON, the execution result is: D0=0x31,
D1=0x32, D2=0x33, D3=0x34, D4=0x35, D5=0x36,
D6=0x37, D7=0x38.

6.5.17 ITA: Instruction for convertinga 16-bit hex data to an ASCII code

Applicable model VC1S VC1 VC2 VC3 VC5


LAD: Zero flag, carry flag, and borrow
Influenced flag
flag
bit

IL: ITA (S1) (D) (S2) Step length 7


Operand
Type Applicable soft element Indexing
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

⚫ 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.

⚫ Function description ⚫ Application instance


Converting the hex data starting from S1 element to S2
ASCII codes, and assigning the obtained result to the
Source data: 0x9876.
elements starting from D when the energy flow is valid.
LD M0
Storing two ASCII code data in the high/low byte of each
D element when SM85=OFF. Storing one ASCII code ITA 16#9876 D20 8
data in low byte of each D element when SM85=ON. Executing ITA conversion operation when M0=ONand
data is stored in two modes:
⚫ Note
• If SM85=OFF, the execution result is: D20=0x3839,
1. If S1 and D use Kn addressing, Kn=4.
2. If S2 is not within the range of 1 to 256, the system D21=0x3637.
reports an operand error, does not execute the • If SM85=ON, the execution result is: D20=0x39,
conversion operation, and keeps the content of D. D21=0x38, D22=0x37, D23=0x36.

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

IL: ATI (S1) (D) (S2) Step length 7


Operand
Type Applicable soft element Indexing

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

⚫ Operand description 2. If S1 is not within the range of 0x30 to 0x39 or 0x41 to


S1: Source ASCII code data to be converted 0x46, or S2 is not within the range of 1 to 256, the system
0x30≤S1≤0x39 or 0x41≤S1≤0x46 (when SM85=OFF, it is reports an operand error, does not execute the
required thathigh/low bytes of S1 be within this range) conversion operation, and keeps the content of D.

D: Destination operand 3. If S1 is a constant, when SM85=OFF and S2≥2, the


S2: Number of ASCII codes (1≤S2≤256) system default is S2=2. When SM85=ON and S2≥1, the
system default is S2=1. The system does not report an
⚫ Function description
operand error once the default is adopted.
When energy flow is valid, convert the ASCII code data
of the first S2 of S1 element to hex data, and store the ⚫ Application instance
result per 4 bits into the starting element of D. When
SM85=OFF, high/low byte of each D element stores two
ASCII code data, when SM85=ON, low byte of each D LD M0
element stores one ASCII code data. ATI D10 D30 4
Converting S2 ASCII codes starting from S1 element Source data: D10=0x3938, D11=0x3736, D12=0x3534,
tothe hex data, and storing the obtained result every 4 D13=0x3332.
bits in the elements starting from D when the energy flow Executing ITA conversion operation when M0=ONand
is valid. Storing two ASCII code data in the high/low byte the results generated according to the data storage
of each D element when SM85=OFF. Storing one ASCII mode are listed below:
code data in low byte of each D element when SM85=ON. • If SM85=OFF, execution result is: D30=0x8967.
⚫ Note • If SM85=ON, execution result is: D30=0x8642.
1. If S1 and D use Kn addressing, Kn=4.

6.5.19 LCNV: Project conversion instruction


Applicable model VC2 VC3 VC5
LAD: Zero flag, carry flag, and borrow
Influenced flag
flag
bit

IL: LCNV (S1) (S2) (D) (S3) Step length 9


Operand
Type Applicable soft element Indexing
S1 INT D V R
S2 INT D V R
D INT D V R
Consta
S3 INT D V R
nt

⚫ Operand description When temperature or analog modulesare used for


S1: The start address of the source operand to be temperature or analog measurement applications, if the
converted temperature or project read value measured by the PLC
S2:The start address of conversion table deviates from the result measured by the standard
thermometer or relevant standard instruments, this
D: The start address that stores the conversion result
instruction can be used to make linear modification to
S3: Number of data to be converted (1≤S3≤64)
calibrate the actual measurement.
⚫ Function description Filling the conversion table with four parameters, namely
When adopting the analog input module to read the
low point measurement value VML , high point
external analog signal, you can use this instruction to
convert the original analog read value into the measurement value VMH and corresponding low point
corresponding project read value. standard value VSL and high point standard value VSH .
When the linear conversion is executed, the target

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

Dn is conversion result data. MOV 3530 D1001


MOV 260 D1002
A = (VSL − VSH ) /(VML − VMH ) *10000
MOV 3650 D1003
B = VSL − (VML * A / 10000 ) LDI M4
MOV 282 D100
Dn = ( S n * A / 10000 ) + B
MOV 3530 D101
⚫ Note MOV 1906 D102
These four data in the conversion table has their actual MOV 0 D103
meanings,for instance, the low point measurement value MOV 5000 D104
should be less than the high point measurement value.
MOV -115 D105
The result is inaccurate if the conversion result exceeds
LD M2
the integer range. If Dn is larger than 32767, it is 32767;
LCNV D100 D100 D1000 D200 6
if it is smaller than -32768, it is -32768. Executing the LGNV instruction when M2=ON. The
⚫ Application instance results generated according to data storage mode are
listed below:
D200 = 260
D201 = 3650
D202 = 1955
D203 = -34
D204 = 5184
D205 = -154

6.5.20 RLCNV: Floating-point project conversion instruction


Applicable model VC2 VC3 VC5
LAD: Zero flag, carry flag, and borrow
Influenced flag
flag
bit

IL: RLCNV (S1) (S2) (D) (S3) Step length 12


Operand
Type Applicable soft element Indexing
S1 REAL D V R
S2 REAL D V R
D REAL D V R
Consta
S3 INT D V R
nt

⚫ 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

if it is smaller than -32768, it is -32768. D210(D211) = -154.357

⚫ Application instance

6.6 Word logic operation instructions

6.6.1 WAND: Word AND instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag bit

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

⚫ Operand description obtained result to D when the energy flow is valid.


S1: Source operand 1 ⚫ Application instance
S2: Source operand 2 LD X0
WAND
D: Destination operand
D0 D1 D10
⚫ Function description Performing the AND operationon D0=2#1011011010010011 (46739) and
Performingthe AND operationby D1=2#1001001100101110 (37678) by bit, and assigning the obtained result to
bit on S1 and S2, and assigningthe D10 when X0=ON. In this case, D10=2#1001001000000010 (37378).

6.6.2 WOR: INT OR instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag bit
Step length 7
IL: WOR (S1) (S2) (D)
Operan
d Type Applicable soft element Indexing

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 √

⚫ Operand description obtained result to D when the energy flow is valid.


S1: Source operand 1 ⚫ Application instance
S2: Source operand 2 LD X0
WOR D0 D1 D10
D: Destination operand
Performing the OR operation by bit on D0=2#1011011010010011 (46739)
⚫ Function description
and D1=2#1001001100101110 (37678), and assigning the obtained result to
Performingthe OR operationby bit
D10 when X0=ON. In this case, D10=2#1011011110111111 (47039).
on S1 and S2, and assigning the

6.6.3 WXOR: Word XOR instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag bit
Step length 7
IL: WXOR (S1) (S2) (D)
Operan
Indexi
d Type Applicable soft element
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 √

⚫ Operand description obtained result to D when the energy flow is valid.


S1: Source operand 1 ⚫ Application instance
S2: Source operand 2 LD X0
WXOR D0 D1 D10
D: Destination operand
Performing the XOR operation by bit on D0=2#1011011010010011 (46739)
⚫ Function description
and D1=2#1001001100101110 (37678), and assigning the obtained result to
Performingthe XOR operationby bit
D10 when X0=ON. In this case, D10=2#0010010110111101 (9661).
on S1 and S2, and assigning the

129
VC Series Micro-PLC Programming Manual Application instructions

6.6.4 WINV: Word INV instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag bit

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 √

⚫ Operand description result to D when the energy flow is valid.


S: Source operand ⚫ Application instance
D: Destination operand LD X0
WINV D0 D10
⚫ Function description
Performing the INV operation by bit on D0= (46739), and assigning the obtained
Performingthe INV operationby bit
result to D10 when X0=ON. In this case, D10= (18796).
on S, and assigning the obtained

6.6.5 DWAND: Double word AND instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag bit
Step length 7
IL: DWAND (S1) (S1) (D)
Operan
Type Applicable soft element Indexing
d
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 √

⚫ Operand description ⚫ Application instance


S1: Source operand 1 LD X0
DWAND D0 D2
S2: Source operand 2
D10
D: Destination operand
Performing the AND operationon
⚫ Function description (D0,D1)=2#10110010101001101110011001010010 (2997282386) and (D2,
Performingthe AND operationby bit D3)=2#00111010001110110011000100110011 (976957747) by bit, and assigning
on S1 and S2, and assigning the the obtained result to (D10, D11) when X0=ON. In this case, (D10,
obtained result to D when the D11)=2#00110010001000100010000000010010 (841097234).
energy flow is valid.

6.6.6 DWOR: Double word OR instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag bit
Step length 10
IL: DWOR (S1) (S2) (D)
Operan Indexi
Type Applicable soft element
d ng

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 √

⚫ Operand description ⚫ Function description


S1: Source operand 1 Performingthe OR operationby bit on S1 and S2, and
S2: Source operand 2 assigning the obtained result to D when the energy flow is
D: Destination operand valid.

⚫ Application instance D3)=2#00111010001110110011000100110011


LD X0 (976957747), and assigning the obtained result
DWOR D0 D2 D10 to (D10, D11) when X0=ON. In this case, (D10,
Performing the OR operation by bit on (D0, D11)=2#10111010101111111111011101110011
D1)=2#10110010101001101110011001010010 (2997282386) and (D2, (3133142899).

6.6.7 DWXOR: Double word XOR instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Influenced flag bit
Step length 10
IL: DWXOR (S1) (S2) (D)
Operan Indexi
Type Applicable soft element
d ng
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 √

⚫ Operand description ⚫ Application instance


S1: Source operand 1 LD X0
DWXOR D0 D2
S2: Source operand 2
D10
D: Destination operand
Performing the XOR operation by bit on
⚫ Function description (D0,D1)=2#10110010101001101110011001010010(2997282386) and
Performingthe XOR operationby bit (D2,D3)=2#00111010001110110011000100110011 (976957747), and assigning
on S1 and S2, and assigning the the obtained result to (D10, D11) when X0=ON. In this case, (D10,
obtained result to D when the energy D11)=2#10001000100111011101011101100001 (2292045665).
flow is valid.

6.6.8 DWINV: Double word negation instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag bit

IL: DWINV (S) (D) Step length 7


Operan
Type Applicable soft element Indexing
d

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 √

⚫ Operand description ⚫ Application instance


S: Source operand LD X0
DWINV D0 D10
D: Destination operand
Performing the INV operation by bit on
⚫ Function description
(D0,D1)=2#10110010101001101110011001010010 (2997282386), and assigning
Performingthe INV operationby bit on
the obtained result to (D10,D11) when X0=ON. In this case,
S, and assigning the obtained result
(D10,D11)=2#01001101010110010001100110101101 (1297684909).
to D when the energy flow is valid.

6.7 Bit shift and rotate instructions

6.7.1 ROR: 16-bit rotate right instruction

Applicable
LAD: VC1S VC1 VC2 VC3 VC5
model

Influenced flag bit Carry flag SM81

IL: ROR (S1) (D) (S2) Step length 7


Operan Indexin
Type Applicable soft element
d g
Const
S1 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
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
ant

⚫ 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

(SM81)when the energy flow is


valid. SM181 1

⚫ 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

6.7.2 ROL: 16-bit rotate left instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Carry flag SM81
Influenced flag bit

132
VC Series Micro-PLC Programming Manual Application instructions

IL: ROL (S1) (D) (S2) Step length 7


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
D INT KnY KnM KnS KnLM D C T V Z R √
Const
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
ant

⚫ 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

After the execution


MSB LSB
1 1 1 0 0 1 1 0 1 1 0 0 1 0 1 0

0 SM181

6.7.3 RCR: Instruction for 16-bit rotate right with carry flag bit

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag bit Carry flag SM81

IL: RCR (S1) (D) (S2) Step length 7


Operan Indexin
Type Applicable soft element
d g
Const
S1 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
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
ant

⚫ Operand description S2 is greater than or equal to 0. When S1 uses Kn addressing, Kn needs to be


S1: Source operand 1 equal to 4.
D: Destination operand
S2: Source operand 2
⚫ Function description
Cyclically shifting the data of S1 with
the carry flag bit (SM81) rightward by
S2 bits, and assigning the obtained
result to D when the energy flow is
valid.
⚫ Note

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

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag bit Carry flag SM81

IL: RCL (S1) (D) (S2) Step length 7


Operan Indexin
Type Applicable soft element
d g
Const
S1 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
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
ant

⚫ 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

6.7.5 DROR: 32-bit rotate right instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Carry flag SM81
Influenced flag bit

IL: DROR (S1) (D) (S2) Step length 9


Operan Indexi
Type Applicable soft element
d ng
Con
S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
stant
D DINT KnY KnM KnS KnLM D C V R √

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

⚫ Operand description S2 is greater than or equal to 0. When S1 uses Kn addressing, Kn needs to


S1: Source operand 1 be equal to 8.
D: Destination operand ⚫ Application instance
S2: Source operand 2 LD M0
DROR D0 D10 7
⚫ Function description
Cyclically shifting the data of S1 Cyclically shifting D0 (D1)=2#10110011100110001001110010101100
(3013123244) rightward by 7 bits, assigning the obtained result to (D10, D11),
rightward by S2 bits, assigning the
and storing the destination bit in the carry flag bit when M0=ON. In this case,
obtained result to D, and storingthe
(D10,D11)=2#01011001011001110011000100111001 (1499935033) and
destination bit in the carry flag bit
(SM81)when the energy flow is valid. SM81=OFF.
For details, refer to the diagram of ROR instruction.
⚫ Note

6.7.6 DROL: 32-bit rotate left instruction

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Carry flag SM81
Influenced flag bit

IL: DROL (S1) (D) (S2) Step length 9


Operan Indexi
Type Applicable soft element
d ng
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

⚫ Operand description S2 is greater than or equal to 0. When S1 uses Kn addressing, Kn needs to be


S1: Source operand 1 equal to 8.
D: Destination operand ⚫ Application instance
S2: Source operand 2 LD M0
DROL D0 D10 30
⚫ Function description
Cyclically shifting the data of S1 Cyclically shifting (D0,D1)=2#10110011100110001001110010101100
leftward by S2 bits, assigning the (3013123244) rightward by 30 bits, assigning the obtained result to (D10, D11),
obtained result to D, and storingthe and storing the destination bit in the carry flag bit when M0=ON. In this case,
destination bit in the carry flag bit (D10,D11)=2#00101100111001100010011100101011 (753280811) and
(SM81)when the energy flow is valid. SM81=ON.
For detals, refer to the diagram of ROL instruction.
⚫ Note

6.7.7 DRCR: Instruction for 32-bit rotate right with carry flag bit

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Carry flag SM81
Influenced flag bit

IL: DRCR (S1) (D) (S2) Step length 9


Operan Indexi
Type Applicable soft element
d ng

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

⚫ Operand description ⚫ Application instance


S1: Source operand 1 LD M0
DRCR D0
D: Destination operand
D10 11
S2: Source operand 2
1. Cyclically shifting
⚫ Function description (D0,D1)=2#10110011100110001001110010101100 (3013123244)with
Cyclically shifting the data of S1 with the carry the carry flag bit (SM81=OFF) rightward by 11 bits, and assigning the
flag bit (SM81) rightward by S2 bits, and obtained result to (D10,D11) when M0=ON.In this case,
assigning the obtained result to D when the (D10,D11)=2#00101011000101100111001100010011 (722891539)
energy flow is valid. and SM81=ON.
⚫ Note 2. For details, refer to the diagram of RCR instruction.
S2 is greater than or equal to 0. When S1 uses
Kn addressing, Kn needs to be equal to 8.

6.7.8 DRCL: Instruction for 32-bit rotate left with carry flag bit

Applicable model VC1S VC1 VC2 VC3 VC5


LAD:
Carry flag SM81
Influenced flag bit

IL: DRCL (S1) (D) (S2) Step length 9


Operan Indexi
Type Applicable soft element
d ng
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

⚫ Operand description S2 is greater than or equal to 0. When S1 uses Kn addressing, Kn needs to be


S1: Source operand 1 equal to 8.
D: Destination operand ⚫ Application instance
S2: Source operand 2 LD M0
DRCL D0 D10 25
⚫ Function description
1. Cyclically shifting (D0,D1)=2#10110011100110001001110010101100
Cyclically shifting the data of S1 with
(3013123244)with the carry flag bit (SM81=ON) rightward by25 bits, and
the carry flag bit (SM81) leftward by
assigning the obtained result to (D10,D11) when M0=ON. In this case,
S2 bits, and assigning the obtained
(D10,D11)=2#001011000101100111001100010011100 (1488165020) and
result to D when the energy flow is
SM81=ON.
valid.
2. For details, refer to the diagram of RCL instruction.
⚫ Note

6.7.9 SHR: 16-bit shift right instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag bit

136
VC Series Micro-PLC Programming Manual Application instructions

IL: SHR (S1) (D) (S2) Step length 7


Operan Indexi
Type Applicable soft element
d ng
Con
S1 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t
D INT KnY KnM KnS KnLM D C T V Z R √
Con
S2 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t

⚫ 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).

6.7.10 SHL:16-bit shift left instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag bit

IL: SHL (S1) (D) (S2) Step length 7


Operan Indexi
Type Applicable soft element
d ng
Con
S1 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t
D INT KnY KnM KnS KnLM D C T V Z R √
Con
S2 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t

⚫ Operand description ⚫ Application instance


S1: Source operand 1
D: Destination operand LD M0
SHL D0 D10 7
S2: Source operand 2
⚫ Function description Before the execution Rotate leftward by 7 bits
MSB LSB
Shifting the data of S1 leftward by S2
0 1 1 1 1 0 1 0 1 1 0 1 1 1 0 0
bits, and assigning the obtained
result to D when the energy flow is After the execution
valid. MSB LSB
0 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0
⚫ Note
S2 is greater than or equal to 0.
When S1 uses Kn addressing, Kn Shifting D0=2#0111101011011100 (31452) leftward by 7 bits, and assigning
needs to be equal to 4. the obtained result to D10 when M0=ON. In this case,
D10=2#0110111000000000 (28160).

137
VC Series Micro-PLC Programming Manual Application instructions

6.7.11 DSHR: 32-bit shift right instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag bit

IL: DSHR (S1) (D) (S2) Step length 9


Operan Indexi
Type Applicable soft element
d ng
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

⚫ Operand description S2 is greater than or equal to 0. When S1 uses Kn addressing, Kn needs to


S1: Source operand 1 be equal to 8.
D: Destination operand ⚫ Application instance
S2: Source operand 2 LD M0
DSHR D0 D10 10
⚫ Function description
Shifting the data of S1 rightward by 1. Shifting (D0,D1)=2#01110011100110001001110010101100 (1939381420)
S2 bits, and assigning the obtained rightward by 10 bits, and assigning the obtained result to (D10,D11) when
result to D when the energy flow is M0=ON. In this case, (D10,D11)=2#00000000000111001110011000100111
valid. (1893927).
2. For details, refer to the diagram of SHR instruction.
⚫ Note

6.7.12 DSHL: 32-bit shift left instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag bit

IL: DSHL (S1) (D) (S2) Step length 9


Operan Indexi
Type Applicable soft element
d ng
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

⚫ Operand description S2 is greater than or equal to 0. When S1 uses Kn addressing, Kn needs to be


S1: Source operand 1 equal to 8.
D: Destination operand ⚫ Application instance
S2: Source operand 2 LD M0
DSHL D0 D10 15
⚫ Function description
1. Shifting (D0,D1)=2#01110011100110001001110010101100 (1939381420)
Shifting the data of S1 leftward by S2
leftward by 15 bits, and assigning the obtained result to (D10,D11) when M0=ON.
bits, and assigning the obtained
In this case, (D10,D11)=2#01001110010101100000000000000000
result to D when the energy flow is
(1314258944).
valid.
2. For details, refer to the diagram of SHR instruction.
⚫ Note

138
VC Series Micro-PLC Programming Manual Application instructions

6.7.13 SFTR: Bit string shift right instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5


Influenced flag bit

IL: SFTR (S1) (D) (S2) (S3) Step length 9


Operan Indexi
Type Applicable soft element
d ng
S1 BOOL X Y M S LM SM C T √
D BOOL Y M S LM C T √
Con
S2 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t
Con
S3 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t

⚫ Operand description Both S2 and S3 aregreater than or equal to zero.


S1: Source operand 1 ⚫ Application instance
D: Destination operand LD M0
SFTR X0 M10 10
S2: Source operand 2
3
S3: Source operand 3
⚫ Function description X2 X1 X0

Shifting the content of the S2 units


starting from D rightward by S3 units, M19 M18 M17 M16 M15 M14 M13 M12 M11 M10

discarding the S3 data on the


rightmost end, and shifting the
1. Shifting the content of 10 units starting from M10 rightward by 3 units, discarding
content of S3 units starting from S1
M10 to M12 on the rightmost end, and shifting the content of 3 units starting from
to the left end of the word string
X0 to the left end of the bit string when M0=ON.
when the energy flow is valid.
2. Before execution: X0=1, X1=0, X2=1. M10=0, M11=1, M12=1, M13=0, M14=0,
⚫ Note M15=1, M16=0, M17=0, M18=0, and M19=1.
Left right order, elements with large
3. After execution: The contents of X0 to X2 are kept. M10=0, M11=0, M12=1,
element No. areon the left, and
M13=0, M14=0, M15=0, M16=1, M17=1, M18=0, and M19=1.
elements with small element No.
areon the right.

6.7.14 SFTL: Bit string shift left instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit

IL: SFTL (S1) (D) (S2) (S3) Step length 9


Operan Indexi
Type Applicable soft element
d ng
S1 BOOL X Y M S LM SM C T √
D BOOL Y M S LM C T √
Const
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
ant
Const
S3 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
ant

⚫ 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 Peripheral instructions

6.8.1 FROM: Instruction for reading words from a special module buffer register

LAD: Applicable model VC2 VC3 VC5

Influenced flag bit

IL: FROM (S1) (S2) (D) (S3) Step length 9


Operan Indexi
Type Applicable soft element
d ng
Const
S1 INT
ant
Const
S2 INT
ant
D INT D V R √
Const
S3 INT
ant

⚫ 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

LAD: Applicable model VC2 VC3 VC5

Influenced flag bit

IL: DFROM (S1) (S2) (D) (S3) Step length 10


Operan Indexi
Type Applicable soft element
d ng
Const
S1 INT
ant
Const
S2 INT
ant
D DINT D V R √
Const
S3 INT
ant

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

LAD: Applicable model VC2 VC3 VC5

Influenced flag bit

IL: TO (S1) (S2) (S3) (S4) Step length 9


Operan Indexi
Type Applicable soft element
d ng
Const
S1 INT
ant
Const
S2 INT
ant
Const
S3 INT D V R √
ant
Const
S4 INT
ant

⚫ Operand description S3: Data to be written into the special modules


S1: SN of the special modules S4: Number of the consecutive BFM buffers (single word) to be written.
visited Data range: 1 to 32767. When accessing an invalid address of the BFM buffer,
Settable range: 0 to 7. When the system reports that the BFM buffer of the assessed special module
accessing a special module that exceeds the range.
does not exist in the system, the ⚫ Function description
system reports that the special Writing the data from consecutive S4 word units starting from S3 into S4 word
module address is invalid. elements starting fromthe designated BFM buffer (address is S2)of the
S2: The start address of the BFM designated special module (SN: S1).
buffer of the special module to be ⚫ Note
written The execution time of the TO instruction is relatively long, and related to the
Settable range: 0 to 32767. When value of S4.
accessing an invalid BFM address, ⚫ Application instance
the system reports that BFM unit of LD SM0
the assessed special module TO 0 8 1000 2
exceeds the range. Writing 1000 respectively into BFM #8 and BFM #9 buffers of No. 0 special
module when the PLC is running.

142
VC Series Micro-PLC Programming Manual Application instructions

6.8.4 DTO: Instruction for writing double words from a special module buffer register

LAD: Applicable model VC2 VC3 VC5

Influenced flag bit

IL: DTO (S1) (S2) (S3) (S4) Step length 10


Operan Indexi
Type Applicable soft element
d ng
Const
S1 INT
ant
Const
S2 INT
ant
Const
S3 DINT D V R √
ant
Const
S4 INT
ant

⚫ 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.

6.8.5 VRRD: Instruction for readingthe value of an analog potentiometer

LAD: Applicable model Reserve

Influenced flag bit

IL: VRRD (S) (D) Step length 5


Operan Indexi
Type Applicable soft element
d ng
Con
S WORD stan
t
D WORD D V √

⚫ 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

6.8.6 REFF: Instruction for setting input filtering constant

LAD: Applicable model VC1S VC1

Influenced flag bit

IL: REFF (S) Step length 3


Operan Indexi
Type Applicable soft element
d ng
Con
S INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t

⚫ Operand description Setting the input filtering constant of X0–X7.


S: Input filtering constant ⚫ Note
• VC1: The actual valid data is 0, 8, 16, 32 and 64. The input filtering constant is valid only for the port used
Any parameter less than 8 is processed as 0 and as normal input, and it is invalid for the port used as high-
speed input.
less than 16 is processed as 8. The parameter less
⚫ Application instance
than 32 is processed as 16 and less than 64 is
LD M0
processed as 32, and other data are processed as
REFF 30
64. Setting the input filtering constant time to 30ms when
⚫ Function description X10 is ON.

6.8.7 REF: Instruction for immediately refreshing I/O

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit

IL: REF (D) (S) Step length 5


Operan Indexi
Type Applicable soft element
d ng
D BOOL X Y
Con
S INT stan
t

⚫ 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.

6.8.8 EROMWR: EEPROM write instruction

LAD: Applicable model VC1

Influenced flag bit

IL: EROMWR (S1) (S2) Step length 6


Operan Indexi
Type Applicable soft element
d ng
S1 INT D R
Con
S2 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t

⚫ 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.

6.8.9 PR: Printing 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

⚫ Operand description D: The start number of Y elements that output data.


S: The start number of the soft elements that save data. ⚫ Function description
145
VC Series Micro-PLC Programming Manual Application instructions
1. Outputting the data saved in LSB of S–S+7 (1 byte) to
Energy flow input
D–D+7 in mode of hours and minutes, and fixing the
˜˜
enabling signal to Y0. Data output Start End
character ˜˜ character
2. SM79 is a flag that indicates the printing instruction is
Operation cycle
being executed. SM79 is switched on during the printing T T T T:
or interrupt time
process, and reset after the printing is completed.
Printer gating ˜˜
The sequence diagram is shown below.
Flag bit for executing
Instruction input
S S+1 S+2 S+3 S+7
D–D+7 A B C D H
Data Resetting SM79 when the energy flow is invalid.
T0 T0 T0: Scan time(ms)
T0  Note
D+8 Gating
1. Printing only once when the energy flow is valid.
2. SM79 (which indicates that the printing instruction is
3. When the special register SM78 is OFF, the serial being executed) can be used to control the ON/OFF of
output is fixed at 8 bytes; when it is on, the serial output the printing instruction.
may be 1 to 16 characters; the code H00 (NUL code)
indicates that the previous character is the last character ⚫ Application instance
of a string.
When SM78 is ON, the sequence diagram is as follows.

⚫ 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.

6.8.10 TKY: Numeric key input instruction

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

D1 INT KnY KnM KnLM D SD C T V Z R √

D2 BOOL Y M S SM LM

⚫ Operand description entered through keypad; D2+10 detects keypad input,


S: Start bit of the data entered through numeric that is, when any one input is ON, this bit is set.
key(occupying 10 bits). 1) Inputting the value of D1
D1: Data storage unit. In the figure below, the value 2130 is stored in D1 after
D2: Number of the soft element corresponding to the you press the numeric keys in the order of 1, 2, 3, and 4.
ON/OFF state of the input key (occupying 11 points). 2) Key information of D2-D2+10
⚫ Function description Whether the key information of D2-D2+9 is ON or OFF
1. S to S+9 are used for keypad input, and the input data depends on the key you press.
is stored in D1; D2 to D2+9 output the information When any one of the keys 0-9 is pressed, the keypad
detection output of D2+10 is ON.

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

6.9 Real-time clock instructions

6.9.1 TRD: Real-time clock read instruction

LAD: Applicable model VC1 VC2 VC3 VC5

Influenced flag bit

IL: TRD (D) Step length 3


Operan Indexin
Type Applicable soft element
d g
D INT D V R √

⚫ Operand description ⚫ Note


D: Reading the start unit that storesthe system time, and The TRD instruction fails if there are something wrong in
storing the read time in 7 consecutive units starting from the system clock setting.
the unit assigned by D. ⚫ Application instance
⚫ Function description LD M0
Reading the system time and storing it in the storage unit TRD D10
assigned by D. Sending the system time to 7 units starting from D10
respectively when M0 is ON.

The execution results of the instruction are listed below:


Element Project Clock data Element Project
SD60 Year 2000–2099 ――――――→ D10 Year
SD61 Month 1–12 ――――――→ D11 Month
Special data register
SD62 Day 1–31 ――――――→ D12 Day
for the real-time clock
SD63 Hour 0–23 ――――――→ D13 Hour
SD64 Minute 0–59 ――――――→ D14 Minute
SD65 Second 0–59 ――――――→ D15 Second
SD66 Week 0–6 ――――――→ D16 Week

148
VC Series Micro-PLC Programming Manual Application instructions

6.9.2 TWR: Real-time clock write instruction

LAD: Applicable model VC1 VC2 VC3 VC5

Influenced flag bit

IL: TWR (S) Step length 3


Operan
Type Applicable soft element Indexing
d
S INT D V R √

⚫ 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

⚫ Function description ⚫ Application instance


You can use the TWR instruction to Changing the system time with the TWR instruction, as shown in the
correct the system time when the following figure.
system time is different from the
actual time. LD X10
EU
⚫ Note
MOV 2004 D10
1. The written time data needs touse MOV 12 D11
the solar calendar, otherwise the MOV 7 D12
instruction cannot be executed MOV 9 D13
successfully. MOV 53 D14
MOV 30 D15
2. It is suggested touse the edge
MOV 2 D16
trigger as the execution condition of LD X11
this instruction. EU
TWR D10
LD M0
TRD D20

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

6.9.3 TADD: Clock addition instruction

Applicable model VC1 VC2 VC3 VC5


LAD:
Zero flag SM80, carry flag SM81
Influenced flag bit

IL: TADD (S1) (S2) (D) Step length 7


Operan
Type Applicable soft element Indexing
d
S1 INT D SD V R √
S2 INT D SD V R √
D INT D V R √

⚫ Operand description Setting range of”Minute”: 0–59


S1: Clock data 1 Setting range of”Second”: 0–59
Storing the time data in the three ⚫ Application instance
storage units assigned by S1. If the S1 S2 D
data is not compliant with the time D10 23 hours D20 23 hours D30 23 hours
format, the system reports an error, 59 58
D11 + D21 = D31 58 minutes
indicating that the value of the minutes minutes
instruction operand is invalid. D12
59
D22
58
D32
57
seconds seconds seconds
S2: Clock data 2
Storing another time data in the three
storage units assigned by S2. If the
data is not compliant with the time
LD X10
format, the system reports an error, MOV 23 D10
indicating that the value of the MOV 59 D11
instruction operand is invalid. MOV 59 D12
D: Storage unit of time result MOV 23 D20
MOV 58 D21
Data obtained after the time addition
MOV 58 D22
operation is stored in the three
LD M0
storage units assigned by D. The TADD D0 D20 D30
result affects the carry flag SM81 and LD SM81
the zero flag SM80. OUT Y10
⚫ Function description LD SM80
OUT Y11
Performing the addition operation on
the data with the time format, and
executing the operation rule in the
time format. 1. Sending the time data to three storage units starting from D10 and three
⚫ Note storage units starting from D20 when X10 is ON.

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

6.9.4 TSUB: Clock subtraction instruction

Applicable model VC1 VC2 VC3 VC5


LAD:
Zero flag SM80, carry flag SM82
Influenced flag bit

IL: TADD (S1) (S2) (D) Step length 7


Operan
Type Applicable soft element Indexing
d
S1 INT D SD V R √
S2 INT D SD V R √
D INT D V R √

⚫ Operand description ⚫ Application instance


S1: Clock data 1 S1 S2 D
D10 23 hour D20 23 hour D30 23 hour
Storing the time data in the three
59
storage units assigned by S1. If the D11 59 minute - D21 = D31 59 minute
minute
data is not compliant with the time
59
format, the system reports an error, D12 58 second D22
second
D32 59 second
indicating that the value of the
instruction operand is invalid. ⚫ Application instance
S2: Clock data 2
LD X10
Storing another time data in the three MOV 23 D10
storage units assigned by S2. If the MOV 59 D11
data is not compliant with the time MOV 58 D12
format, the system reports an error, MOV 23 D20
indicating that the value of the MOV 59 D21
instruction operand is invalid. MOV 59 D22
LD M0
D: Storage unit of time result
TSUB D10 D20
Data obtained after the time addition D30
operation is stored in the three LD SM82
storage units assigned by D. The OUT Y10
result affects the carry flag SM81 and LD SM80
the zero flag SM80. OUT Y11

⚫ 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

6.9.5 HOUR: Chronograph instruction

LAD: Applicable model VC1 VC2 VC3 VC5

Influenced flag bit

IL: HOUR (S) (D1) (D2) Step length 8


Operan
Type Applicable soft element Indexing
d
Con
S INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t
D1 INT D V R √
D2 BOOL Y M S LM

⚫ 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

6.9.6 DCMP: (=、<、>、<>、>=、<=)Date comparison instruction

LAD: Applicable model VC1 VC2 VC3 VC5

Influenced flag bit

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

6.9.7 TCMP: (=、<、>、<>、>=、<=)Time comparison instruction

LAD: Applicable model VC1 VC2 VC3 VC5

Influenced flag bit

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

6.9.8 HTOS: Instruction for converting hour-minute-second data to seconds

LAD: Applicable model VC2 VC3 VC5

Influenced flag bit

IL: HTOS (S) (D) Step length 5


Operan
Type Applicable soft element Indexing
d
S INT KnX KnY KnM KnS T C D SD R √
D INT KnY KnM KnS T C D SD R √

⚫ Operand description ⚫ Application instance


S: Number of the start soft element
that stores the time data to be LD M1
converted. HTOS D0 D10
D: Number of the soft element that
stores the converted time data.
1. Converting the time data (hours, minutes, and seconds) starting from D0
⚫ Function description
into seconds, and storing the obtained resultin D10 when
Converting the time data (hours,
M1=ON.D10=11415 when D0=3, D1=10 and D2=15.
minutes, and seconds) of S-S+2 into
seconds, and storing the obtained
result in D.

6.9.9 STOH: Instruction for converting seconds to hour-minute-second data

LAD: Applicable model VC2 VC3 VC5

Influenced flag bit

IL: STOH (S) (D) Step length 5


Operan
Type Applicable soft element Indexing
d
S INT KnX KnY KnM KnS T C D SD R √
D INT KnY KnM KnS T C D SD R √

⚫ 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

6.10 High-speed I/O instructions

6.10.1 HCNT: Instruction for driving the high-speed counter

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: HCNT (D) (S) Step length 7
Operan
Type Applicable soft element Indexing
d
D DINT C
Const
S DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
ant

⚫ Operand description ⚫ Application instance


D: Assigning the counter number. LD X10
Settable range: C236-C263 OUT SM236
LD X11
S: Assigning the comparison
RST C236
constant, a 32-bit data with symbol. LD X12
The data range: -2147483648 - HCNT C236 -5
+2147483647. The time sequence operation of the program operation is shown below:
⚫ Function description
X10 Rising Rising
Driving the designated hardware Falling

high-speed counter. Performing the X11 Reset input

hardware high-speed counting on all X12 Startup input

high-speed counters only when it is X0


continuously driven, and judging the Counting input 5
4 4
action of NO contacts of the high- 2
3 3
2
1 1
speed counter according to S. Current value 0 0 1
-1
⚫ Note Output situation -2
-3 -3
-4 -4
There are hardware conflicts -5
-6 -6
-5
-7 -7
between the HCNT instruction, SPD C236 output contact
-8

instruction, external input interrupt,


and pulse capture. You need to note
that the use conditions of all high- 1. Initializing the hardware counter corresponding to C236 when X12
speed I/O. Refer to Chapter changes from OFF to ON. X0 is the pulse input end of C236 while C236
8"Operating guide for high-speed counts the external pulse of X0. X0 is a general input point when X12 is OFF,
input function" for use. and C236 cannot count the external pulse of X0.
2. Action on the contacts: Setting the contact of C236 when the current value
of the counter C236 is increased from -6 to -5. Resetting the contact of C236
when the current value of counter C236 is decreased from -5 to -6.
3. Executing the RST instruction when X11 is ON, clearing the C236 data,
and disconnecting the C236 contact.
4. When a power failure occurs, you can set the data and contact state of the
high-speed counter in the system block of the upper software.

6.10.2 DHSCS: Instruction of setting the high-speed count comparison

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: DHSCS (S1) (S2 ) (D) Step length 10
Operan
Type Applicable soft element Indexing
d

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

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: DHSCI (S1) (S2) (S3) Step length 10
Operan
Type Applicable soft element Indexing
d
Consta
S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
S2 DINT C
Consta
S3 INT
nt

⚫ 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

LAD: Applicable model VC2 VC3

Influenced flag bit


IL: DHSPI (S1) (S2) (S3) Step length 10
Operan
Type Applicable soft element Indexing
d
Con
S1 DINT stan KnX KnY KnM KnS KnLM KnSM D SD C V R √
t
S2 DINT SD
Con
S3 INT stan
t

⚫ Operand description ⚫ Application instance


S1: Data to be compared by the high-speed output The User main program is shown as below:
position element, 32-bit DINT data, ranging from -
2147483648 to +2147483647.
S2: High-speed output position element. The applicable
range:
S3: Interrupt number. Range of the interrupt number:
53,54,55,56,57,58,59, and 60.
⚫ Function description
When the value of the high-speed output position
element is equal to S1 in the DHSPI instruction, it enters
into the interrupt subprogram designated by S3. You can
The interrupt number of the interrupt subprogram can be
write a program to be executed immediately in the
set to 54 or other position-based interrupt source of high-
interrupt subprogram.
speed output, and then the program to be executed when
⚫ Note passing the position can be written in the interrupt
1. When data is written in an SD element, no position- subprogram.
based interrupt is triggered. After the data is written,
position-based interrupt is triggered by a specified
position.

159
VC Series Micro-PLC Programming Manual Application instructions

6.10.5 DHSCR: Instruction for resetting the high-speed count comparison

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: DHSCR (S1) (S2) (D) Step length 10
Operan
Type Applicable soft element Indexing
d
Con
S1 DINT stan KnX KnY KnM KnS KnLM KnSM D SD C V R √
t
S2 DINT C
D BOOL Y M S C

⚫ 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

6.10.6 DHSZ: High-speed count range comparison instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: DHSZ (S1) (S2) (S3) (D) Step length 13
Operan
Type Applicable soft element Indexing
d
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
S3 DINT C
D BOOL Y M S

⚫ Operand description high-speed counter is larger than S2 in the DHSZ instruction.


S1: Data 1 to be compared by the 5. If it is Y element, Y element outputs the corresponding state immediately,
high-speed counter, 32-bit DINT data, and the output action is irrelevant to the scan cycle of the program.
ranging from -2147483648 to ⚫ Note
+2147483647. 1. The DHSZ instruction needs to worktogether with the HCNT instruction.
S2: Data 2 to be compared by the DHSZ can be executed correctly only when the high-speed counter is driven
high-speed counter,32-bit DINT data, by HCNT.
ranging from 2147483648 to 2. The result compared by the DHSZ instruction takes effect when external
+2147483647. pulses of the high-speed counter are inputted. Therefore, the DHSZ
S3: High-speed counter. The instruction does not generate any action even if the high-speed counter value
applicable range: C236–C263 is changed through the DMOV or MOV instruction.
D: Bit element output object, 3. Like general instructions, multiple DHSCZ (DHSCI, DHSCS, DHSCR,
immediately setting the output of Y, M, DHSP, and DHST) instructions can be used simultaneously, but the total
and S regardless of the scan period. number of these instructions cannot exceed 8.The first 8 instructions are
⚫ Function description executed in order, and the 9th or later instructions are not effective and
therefore not executed.
1. A high-speed counter can count in
interrupt mode only when it is driven 4. The max. frequency supported by the high-speed counter of the PLCs. If
by the HCNT instruction and the you use the DHSCS, DHSCI, DHSCR, DHSZ, DHSP, or DHST instruction, it
counting input changes from OFF to is limited by the max. response frequency and comprehensive frequency. For
ON. details, refer toChapter 8"Operating guide for high-speed input function".
2. Setting the bit element designated ⚫ Application instance
by D, and resetting the two bit LD M0
HCNT C249 1000
elements following the one
LD M1
designated by D when the value of
DHSZ 1500 2000 C249 Y10
the high-speed counter is less than
LD SM249
S1 in the instruction. OUT Y12
3. Resetting the bit element LD C249
designated by D, and setting the two OUT Y6
bit elements following the one 1. When M0 is ON, C249 counts up when X2 changes from OFF to ON, or
designated by D when the value of counts down when X3 changes from OFF to ON (for the input frequency of
the high-speed counter is greater X0, refer to the instruction for high-speed I/O). When C249 changes from
than or equal to S1 and less than or 999 to 1000, the C249 contact is set and when C249 changes from 1001 to
equal to S2. 1000, the C249 contact is reset. When Y6 is driven by C249, the execution
4. Resetting the bit element of Y6 is determined by the scan cycle of the user program.
designated by D, and resetting the 2. When M1 is ON and the DHSZ high-speed instruction meets the
two bit elements following the one requirements stated in the preceding "Note", the state of Y10, Y11, and Y12
designated by D when the value of are as below:

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。

6.10.7 DHST: High-speed count table comparison instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: DHST (S1) (S2) (S3) Step length 10
Operan
Type Applicable soft element Indexing
d
S1 DINT D R
Const
S2 INT
ant
S3 DINT C

⚫ Operand description data designated by a certain table and Y elements, you


S1: Start unit of the data forthe table comparison (Start can use the DHST instruction.
number of D element). The subsequent three D elements ⚫ Note
with consecutive serial numbers are used to specify the 1. The DHST instruction needs to work together with the
data to be compared by the high-speed counter, the HCNT instruction. DHST can be executed correctly only
serial number and corresponding output state of the Y when the high-speed counter is driven by HCNT.
element. The D elements connected to these four 2. The result compared by the DHST instruction takes
consecutive serial numbers are collectively referred to effect when external pulses of the high-speed counter
beone record. are inputted. Therefore, the DHST instruction does not
S2: Number of records to be compared. The data range: generate any action even if the high-speed counter value
1–128 is changed through the DMOV or MOV instruction.
S3: High-speed counter. The applicable range: C236– 3. Like general instructions, multiple DHST (DHSCI,
C263. DHSCS, DHSCR, DHSP, and DHSZ) instructions can be
used simultaneously, but the total number of these
⚫ Function description
instructions cannot exceed 8.The first 8 instructions are
1. A high-speed counter can count in interrupt mode only
executed in order, and the 9th or later instructions are not
when it is driven by the HCNT instruction and the
effective and therefore not executed. If DHSP is a valid
counting input changes from OFF to ON.
instruction in the user's instruction, DHST is not executed.
2. When the value of the high-speed counter is equal to
On the contrary, if DHST is a valid instruction,DHSP is
the data to be compared currently, the corresponding Y
not executed. Only one instruction (DHST or DHSP) can
element state is output according to the recorded data,
be valid at the same time in the user program.
and the output object can be the Y element only.
4. The max. frequency supported by the high-speed
3. The output action is irrelevant to the scan cycle, and
counter of the PLCs. If you use the DHSCS, DHSCI,
the Y element designated by the current record outputs
DHSCR, DHSZ, DHSP, or DHST instruction, it is limited
the designated state immediately.
by the max. response frequency and comprehensive
4. If it is desired that the the user program executesthe frequency. For details, refer to Chapter 8"Operating
immediate output operation according to the comparison guide for high-speed input function".

⚫ 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

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: DHSP (S1) (S2) (S3) Step length 10
Operan
Type Applicable soft element Indexing
d
S1 DINT D R
Con
S2 INT stan
t
S3 DINT C

⚫ Operand description ⚫ Note


S1: Start unit of the data forthe table comparison (Start 1. The DHSP instruction needs to work together with the
number of D element). The subsequent three D elements HCNT instruction. DHSP can be executed correctly only
with consecutive serial numbers are used to specify the when the high-speed counter is driven by HCNT.
data to be compared by the high-speed counter, and the 2. When DHSP is used in conjunction with PLSY, the
data outputted to SD86 and SD87. The D data transmitted to SD86 and SD 181 need to meet the
elementsconnected to these four consecutive serial frequency output requirement of PLSY. For details, refer
numbers are collectively referred to beone record. to the PLSY instruction.
S2: Number of records to be compared. The data range: 3. If you want to stop the comparison at the last row, you
1–128. need to set the data sent to SD86 and SD87 by the last
S3: High-speed counter. The applicable range: C236– cell of the comparison table to 0. In this case, the other
DHST and DHSP instructions are invalid, but the DHSP
C263.
instruction is not counted in the total instruction number
⚫ Function description
of other high speed instructions.
1. A high-speed counter can count in interrupt mode only
4. The result compared by the DHSP instruction takes
when it is driven by the HCNT instruction and the
effect when external pulses of the high-speed counter
counting input changes from OFF to ON.
are inputted. Therefore, the DHSP instruction does not
2. When the value of the high-speed counter is equal to
generate any action even if the high-speed counter value
the comparison data of the current record, SD86 and
is changed through the DMOV or MOV instruction.
SD87 are modified according to output data of current
5. Like general instructions, multiple DHSP (DHSCI,
data.
DHSCS, DHSCR, DHST, and DHSZ) instructions can be
3. If it is needed to make user program determine high
used simultaneously, but the total number of these
speed output or other data assignment value according
instructions cannot exceed 8.The first 8 instructions are
to a certain table, use DHSP table comparison instruction.
executed in order, and the 9th or later instructions are not
For instance, user can assign SD86 and SD87 (double
effective and therefore not executed.
word) as the output frequency operand of PLSY
6. If DHSP is a valid instruction in the user instruction,
instruction to make PLSY output frequency adjust
DHST is not executed, on the contrary, if DHST is a valid
according to table comparison result.
instruction, DHSP is not executed. Only one instruction
3. You can use the DHSP instruction when you hope the
(DHST or DHSP) can be valid at the same time in the
user program to determine the assignment of high-speed
user program, and the others are invalid.
output or other data based on a certain table. For
7. The max. frequency supported by the high-speed
example, SD86 and SD87 (double word) can be
counter of the PLCs. If you use the DHSCS, DHSCI,
specified as the output frequency operands of the PLSY
DHSCR, DHSZ, DHSP, or DHST instruction, it is limited
instruction, so as to adjust the PLSY output frequency
by the max. response frequency and comprehensive
according to the table comparison result.
frequency. For details, refer to Chapter 8"Operating
guide for high-speed input function".

⚫ 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

The LAD is shown as below:

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

6.10.9 SPD: Frequency measuring instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: SPD (S1) (S2) (D) Step length 7
Operan
Type Applicable soft element Indexing
d
S1 BOOL X
Con
S2 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t
D INT D V R √

⚫ 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

Detecting the number of input pulses of X0–X7 within the


specified time (ms), and storing the obtained result in the
designated soft element unit.
⚫ Note 1000
1. There is a hardware conflict between SPD and HCNT,
external input interrupt, and pulse capture. For details, D12: Elapsed time (ms)
refer to Chapter 8"Operating guide for high-speed input
function" for use.
2. For VC1, the input points of SPD are within the range
of X0 to X7. Input X0
3. The max. pulse input frequency of SPD is 10kHz, and
an detection error may occur if the input frequency
exceeds 10kHz.
⚫ Application instance

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

6.10.10 PLSY: High-speed pulse output instruction

LAD: Applicable model VC1S VC1 VC2 VC3

Influenced flag bit


IL: PLSY (S1) (S2) (D) Step length 9
Operan
Type Applicable soft element Indexing
d
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 BOOL Y

⚫ Operand description instructions, it is required the output port of the


S1: Specified frequency (Hz) transist or be connected to the corresponding load.
When the output waveform does not conform to
When S1 is not within the setting range, the system reports that
the instruction operand is illegal and no system hardware the instruction operand, it is viable to increase the
resource is occupied. When the content of S1 is changed while load current of the transistor (the transistor
load≤100mA).
the instruction is running, the output frequency changes
accordingly. 5. When the high-speed instruction is executed
S2: Number of generated pulses (PLS). effectively (including output completion), other
operations on the same portare invalid. Only when
If the set operand is not within the setting range, the system
the high-speed pulse output instruction is invalid
reports that the instruction operand is illegal, the pulse does not
can other instructions operate this port.
output, and no system hardware resource is occupied. When
6. Using multiple PLSR instructions can obtain
S2 is 0, the pulse always outputs when the instruction is valid.
separate high-speed pulse output at high-speed
If the content of S2 is changed while the instruction is running,
output points, or using the PWM (or PLSR)
the change takes effect in the next round of the drive.
instruction to obtain separate high-speed pulse
D: High-speed pulse output point.
output at different output points.
⚫ Function description
7. When multiple PWM, PLSY or PLSR
Generating a specified amount of the high-speed pulse instructions operate on the same port, the first
outputaccording to the frequency specified by the instruction. To valid instruction controls the output state of the
output the high-speed pulses, the load current on the output port and the later valid instructions do not affect
transistor of the PLCs needs to be large enough, but it cannot the state of the output points.
exceed the rated load current.
8. Similar to other high-speed instructions
⚫ Note (DHSCS, DHSCR,DHSZ, DHSP, DHST, and
1. The PLCs need to adopt the transistor output mode.2. When HCNT), the PLSY instruction needs to meet the
the PLCsare executing the high-speed pulse output, it is requirements for high-speed input and high-speed
required to use the load current specified by the PLC output pulse output in the system.
transistor described below. ⚫ Application instance
3. The output circuit (transistor) for PLSY, PWM and PLSR is
shown as follows.

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

6.10.11 PLSR: Instruction for count pulse output with acceleration/deceleration

LAD: Applicable model VC1S VC1 VC2 VC3

Influenced flag bit


IL: PLSR (S1) (S2) (S3) (D) Step length 10
Operan
Type Applicable soft element Indexing
d
Consta Kn
S1 INT KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt X
Consta Kn
S2 DINT KnY KnM KnS KnLM KnSM D SD C V R √
nt X
Consta Kn
S3 INT KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt X
D1 BOOL Y

⚫ Operand description If S1×S3<100000, S3 is regarded as 100000/S1, the


S1: Max frequency (Hz). Settable range: 10–20000 (Hz). system reports a parameter error of the PLSR instruction,
and the acceleration/deceleration time is uncertain.
If the operand specified indirectly is larger than 20000, it
is treated as 20000, if it is less than 10, it is treated as 10. If S1×S3>S2×909, S3 is regarded as S2×909/S1, the
In that case, the system an error, indicating that the value system reports a parameter error of the PLSR instruction,
of the instruction operand is invalid, and high-speed and the acceleration/deceleration time is uncertain.
pulse is outputted by default.
S2: Total number of output pulses (PLS). Settable range: The speed change is evenly divided into 10 steps during
110–2147483647. If the set operand is not withinthe the acceleration/deceleration is treated, and each step is
range, the system reports an error, indicating that the S1/10.
value of the instruction operand is invalid, outputs no D: High-speed pulse output point.
pulse, and no hardware resources corresponding to this ⚫ Function description
instruction is occupied. The PLSR instruction is a high-speed pulse output
S3: Acceleration/deceleration time (ms) instruction with acceleration/deceleration function for fix-
dimension transmission. Targeting the specified max.
frequency, the pulse output is accelerated evenly and
168
VC Series Micro-PLC Programming Manual Application instructions
after the number of output pulses reaches the preset
value, the pulse output is decelerated evenly.

169
VC Series Micro-PLC Programming Manual Application instructions
The operation process is shown in the following figure:

S1 max. frequency: 10-20000 Hz


10 1
9 2
Output: Y0 or Y1 8 3
Speed change in
7 4 one step is at most
6 5 1/10 of S1
Speed S2 total number of Speed
5 change: change: 10 6
output pulses: 110-
4 10 steps 2,147,483,647 PLS steps 7
3 8
2 9
1 10

S3 acceleration time S3 deceleration time Time (sec)

⚫ 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

6.10.12 PLS: Envelopepulse output instruction

LAD: Applicable model VC1 VC2 VC3

Influenced flag bit


IL: PLS (S1) (S2) (D1) Step length 7
Operan
Type Applicable soft element Indexing
d
Const
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
ant
Const
S2 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
ant
D1 BOOL Y

⚫ 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

6.10.13 PWM: Pulse output instruction

LAD: Applicable model VC1S VC1 VC2 VC3

Influenced flag bit

IL: PWM (S1) (S2) (D) Step length 7


Opera Type Applicable soft element Indexing
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 BOOL Y

⚫ Operand description 2. The waveforms obtained from the output


S1: Assigned pulse width (ms/us) terminals are related to the user’s output load.
When the max. output current is fulfilled, the
Settable range: 0–32767 (ms), when S1 is larger than 32767, the
smaller the load, the closer the output
system reports that the instruction operand is illegal and no system
waveform is to the set operand. In order to
hardware resource is occupied.
output the high-speed pulses, the load current
If the content of S1 is changed while the instruction is running, the
on the output transistors of the PLCs needs to
output pulse is also changed. When SM272 is 0, S1 is in the unit
be large enough within the range of the rated
of ms; when SM272 is 1, S1 is in the unit of us.
load current.
S2: Assigned pulse cycle (ms)
3. When the high-speed instruction is executed
Settable range: 1–32767, when the set operand is not within the effectively (including output completion), other
setting range, the system reports that the instruction operand is operations on the same portare invalid. Only
illegal, the pulse does not output, and no system hardware when the high-speed pulse output instruction is
resource is occupied. invalid can other instructions operate this port.
If the content of S2 is changed while the instruction is running, the 4. Using two PWM instructions can obtain
output pulse is also changed. When SM84 is 0, S1 is in the unit of separate pulse output atoutput ports, or using
ms; when SM84 is 1, S1 is in the unit of us. the PLSY (or PLSR) instruction to obtain
S2 needs to be larger than or equal to S1, otherwise the system separate high-speed pulse output at different
reports an operand error, and no system resource is occupied. output ports.
D: High-speed pulse output point. 5. When multiple PWM, PLSY or PLSR
⚫ Function description instructions operate on the same port, the first
The PWM pulse whose output width is S1 and the pulse cycle is valid instruction controls the output state of the
S2 is outputted at the port designated by D. port and the later valid instructions do not affect
Note the state of the output points.

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

6.11 Control calculation instructions

6.11.1 PID: Function instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: PID (S1) (S2) (S3) (D) Step length 9
Operan
Type Applicable soft element Indexing
d
S1 INT D R √
S2 INT D R √
S3 INT D R √
D INT D R √

⚫ Operand description S3+18: Alarm set value of the PID output


D: Operation result output (MV) when executing the program variation (negative change). Range: 0 –
S1: Set target value (SV) 32767 (when bit 2 and bit 5 of S3+1 are 1
S2: Current measurement value (PV) and 0 respectively).
S3: Sampling time (Ts). Range: 1–32767 (ms). It need to be set longer Set value of the output lower limit. Range: -
than the calculation time. 32768–+32767 (when bit2 and bit5 of S3
S3+1: Word for setting the action, alarm and upper/lower limit function. +1 are 0 and 1 respectively).
Set value and definition S3+19: PID alarm output.
Bit
0 1 • Bit 0: Input variation (positive change)
0 Positive feedback Adverse feedback overflows.
Input variation alarm
1 Input variation alarm valid • Bit 1: Input variation (negative change)
invalid
overflows.
Output variation alarm
2 Output variation alarm valid • Bit 2: Output variation (positive
invalid
3~4 Reserved change) overflows.
Output value • Bit 3: Output variation (negative
Output value upper/lower
5 upper/lower limit value change) overflows.
limit value setup is valid
setup is invalid
In which, S3–S3+6are mandatory user
6 ~ 15 Reserved
set operands while S3 + 15 – S3 + 19
S3+2: Input filtering constant (α). Range:0–99[﹪]. When it is 0,there
areoptional user set operands. You can set
is no input filtering.
the operand s through the PID instruction
S3+3: Proportional gain (Kp). Range:1–32767[﹪]. wizard of Auto Studio.
S3+4: Integral time (TI). Range:0–32767 (×100ms). When it is 0, it ⚫ Function description
is processed as ∞ (no integral). 1. Performing the PID operation when the
S3+5: Differential gain (KD). Range:0–100[﹪]. When it is 0, there is energy flow is valid and the sampling time
no differential gain. is reached.
S3+6: Differential time (TD).Range:0–32767 (×10ms). When it is 0, 2. Multiple PID instruction can be executed
it is processed as no differential. simultaneously by multiple times (on limit
S3+7–S3+14: Internal data register for PID operation. on the loop number). But you need to note
that the S1, S2, S3 or D soft element
S3+15: Alarm set value of the PID input variation (positive change).
number used by the operation cannot be
Range:0–32767 (when bit 1 of S3+1 is 1). overlayed.
S3+16: Alarm set value of the PID input variation (negative change). 3. The PID instruction is applicable to the
Range:0–32767 (when bit 1 of S3+1 is 1). timed interrupt subprograms, general
S3+17: Alarm set value of the PID output variation (positive change). subprograms, and main programs. Under
Range:0 – 32767 (when bit 2 and bit 5 of S3 + 1 are 1 and 0 this condition, you need to confirm operand
set unit and clear the internal processing
respectively).
data of S3 + 7 before executing the PID
Set value of the output upper limit. Range:-32768–+32767 (when bit
instruction.。
2 and bit 5 of S3+1 are 0 and 1 respectively).
174
VC Series Micro-PLC Programming Manual Application instructions
4. The input filtering constant can smooth the changes of measured Output value
value. Without output limits
S3+17 No output
5. The differential gain can ease the dramatic change of output value. Upper limit

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

7. Output upper/lower limit setting: When you set the output


upper/lower limit to be valid (bit 5 and bit 2 of S3+1are ON and OFF
respectively) , the integral item of PID can be prevented from
becoming too large. The output value is shown as below:
8. Alarm setting: When you set the output upper/lower limit to be valid (in S3+1, bit 1 is ON, bit 2 is ON, and bit 5 is OFF) ,
the PID instruction compares the I/O variation with the preset value in S3+15–S3+18. If the current value is larger than
the preset value, PID reports an alarm, and the corresponding function bits in S3+19 are set immediately after executing
the PID instruction. In this way, you can monitor the IO variation. The current output values are shown as below:
Input variation
Input variation
Positive
Positive
change
0
change Samping
Samping 0
times
Negative times Negative
change
Alarm flag change
S3+19 Alarm flag
bit 0 ON OFF S3+19
bit 2 ON OFF
S3+19
bit 1 OFF S3+19
ON bit 3 OFF ON

9. Basic expression of the PID instruction:


Action
PID expression
direction

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

Symbol description is shown below:


Symbol Description Symbol Description
EV n Current sampling deviation Dn Current differential item
EV n − 1 Deviation before one cycle Dn − 1 Differential item before one cycle
SV Target value KP Proportional gain
PVnf Current sampling value (after filtering) TS Sampling cycle
Sampling value before one cycle (after
PVnf − 1 TI Integral time
filtering)
Sampling value before two cycles (after
PVnf − 2 TD Differential time
filtering)
ΔMV Output variation αD Differential gain
MV Current operation quantity

⚫ 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

6.11.2 RAMP: Ramp signal output instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: RAMP (S1) (S2) (D1) (S3) (D2) Step length 12
Operan
Type Applicable soft element Indexing
d
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
D1 INT D V R √
Const
S3 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
ant
D2 BOOL Y M S LM C T

⚫ 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

keeps ON, each scan cycle, based on the height and


mobile scan times of the ramps, determines the ⚫ Note
incremental quantity and current output value. After 1. If the result is not divisible when calculating the step
reaching S2, the output value (D1) stays in current state, length,you can adopt the "rounded off" method.
and the state output position is ON. If a falling edge 2. The instruction generates the ramp data only once
occurred to the energy flow, the output state (D2) is OFF, upon every rising edge.
theoutput value (D1) stays in current state until the rising 3. When S1=S2, D1=S2, and D2=ON.
edge occurs to the energy flow again, the output value 4. The total number of RAMP, HACKLE, and TRIANGLE
(D1) is initialized to be the value of S1, and continues to instructions cannot exceed 100 in the program.
generate next ramp operation, as shown below: ⚫ Application instance
//Initializing the register upon the first scan cycle after the
pf power-on
S2 LD SM1
S1 MOV 0 D0
D1 MOV 2000 D1
//Executing the ramp function instruction when X0=ON
D2
LD X0
pf: state of the energy flow
RAMP D0 D1 D10 1000 M0
The execution process of the ramp instructionis shown
//Sending the output value of ramp function to the
below (S3=5):
external DA module when X1=ON, so as to generate
ramp waveforms
LD X1
TO 0 6 D10 1
The LAD of the above instructions is shown below:

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.

6.11.3 HACKLE: Sawtooth wave signal output instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: HACKLE (S1) (S2) (D1) (S3) (D2) Step length 12
Operan Indexi
Type Applicable soft element
d ng
Con
S1 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t
Con
S2 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t
D1 INT D V R √
Con
S3 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t
D2 BOOL Y M S LM C T

⚫ Operand description
S1: Startvalue pf

S2: End value S2


D1: Output value S1
S3: Number of steps (S3>0, otherwise the system reports an D1

operand error, and does not execute the operation)


D2
D2: Output state
pf: state of the energy flow
⚫ Function description
The execution process of a sawtooth wave instruction is
When theenergy flow is valid, the increment and current output
shown as follows (S3=5).
value (D1) are determined for each scan cycle according to
the height and steps of the sawtooth wave (D1).When the
output value reaches S2, it is initialized to S1, and the state
D1
output bit (D2) is set to ON. In the next scan cycle, if the energy
flow keeps ON, the state output bit (D2) is set to OFF, and the
next sawtooth wave is generated. During the generation
process of sawtooth wave function, if afalling edge occurs to D2
the energy flow, the output state (D2) is OFF and the output
value (D1) remains in the current state. When a rising edge
occurs to the energy flow again, the output value (D1) is SM15
initialized to S1 and a new sawtooth wave generation process
S3
starts, as shown below.

⚫ 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.

6.11.4 TRIANGLE: Triangle wave signal output instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: TRIANGLE (S1) (S2) (D1) (S3) (D2) Step length 12
Operan
Type Applicable soft element Indexing
d
Con
S1 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t
Con
S2 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t
D1 INT D V R √
Con
S3 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t
D2 BOOL Y M S LM C T

⚫ 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.

LD SM1 2. You can use an external special module to convert the


data into the analog waveform.
MOV 0 D0

6.11.5 ABSD: Cam absolute control instruction

Applicable
VC2 VC3 VC5
LAD: model
ABSD (S1) (S2) (D) (S3) Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: ABSD (S1) (S2) (D) (S3) Step length 9


Operan Indexi
Type Applicable soft element
d ng
S1 INT KnX KnY KnM KnS D C T R √
S2 INT C √
D BOOL Y M S
Consta
S3 INT
nt

⚫ Operand description ⚫ Function description


S1: Start element number of storing the table data (rising 1. Comparing n rows of table data starting from
edge, and falling edge). n=4. S1(occupying n rows×2 points) with current value S2 of
the counter, and performing ON/OFF control on the
S2: Number of the counterused for monitoring the current
consecutive n-point D output.
value compared with the table data.
2. Each rising/falling point can be changed by rewriting
D: Outputting the number of the start bit element.
the data of S1–S1+n×2.
S3: Number ofrows in the table and number ofpoints of
the outputted bit elements. Range: 1≤S3≤64.
181
VC Series Micro-PLC Programming Manual Application instructions

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

6.11.6 DABSD: Double word cam absolute control instruction

Applicable
VC2 VC3 VC5
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: DABSD (S1) (S2) (D) (S3) Step length 11


Operan Indexi
Type Applicable soft element
d ng
S1 DINT KnX KnY KnM KnS D C T R √
S2 DINT C √
D BOOL Y M S
Consta
S3 INT
nt

⚫ 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

⚫ Function description 0 180 360


1. Comparing n rows of table data starting from
⚫ Application instance
S1(occupying n rows×4 points) with current value S2 of
Outputting ON/OFF by rotating the platform once (0–
the counter, and performing ON/OFF control on the
consecutive n-point D output. 360 degrees, rotation angle signal that indicates 1
degree per pulse).
2. Each rising/falling point can be changed by rewriting
the data of [S1+1, S1]–[S1+(n×2)+3, S1+(n×2)+2].
3. Firstlyusing the transmission instruction, and writing
the data shown below into [S1, S1+1]–[S1, S1+1]+4n+3.
Value
Value
Rising point exampl Falling point Output
example Among them, M0 is the energy flow input, and X1 is a
e
[S1+1, S1] 40 [S1+3, S1+2] 140 D rotation angle signal indicating 1 degree per pulse.
[S1+5, S1+4] 100 [S1+7, S1+6] 200 D+1 Among them, M0 is the instruction input, and X1 is a
[S1+9, S1+8] 160 [S1+11, S1+10] 60 D+2 rotation angle signal indicating 1 degree per pulse. At this
[S1+13, S1+12] 240 [S1+15, S1+14] 280 D+3 time, the default value of SM200 is OFF, the DCNT
…… …… …… …… …… instruction is incremented.
[S1+4n+1, [S1+4n+3, ⚫ Note
D+n-1
S1+4n] S1+4n+2]
1. When the bit number of the bit soft elements is
designated in S1, n=8.
2. When the counter number is designated in S2,C200–
C255 need to be designated for S2.
3. This instruction is affected by the scan cycle.

183
VC Series Micro-PLC Programming Manual Application instructions

6.11.7 ALT: Alternate output instruction

Applicable
VC2 VC3 VC5
LAD: model
ALT (D) Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: ALT (D) Step length 11


Operan Indexin
Type Applicable soft element
d g
D BOOL Y M S

⚫ 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.

6.12 Communication instructions

6.12.1 MODBUS: Master station communication instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: Modbus (S1) (S2) (S3) Step length 8
Operan Indexi
Type Applicable soft element
d ng
Con
S1 INT stan
t
S2 INT D V R
S3 INT D R √

⚫ 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

RTU or ASCII mode, only RTU-format data is stored in units


3. Data is received through Modbus. Whether you set the
starting from S2. The start character, end character, and
mode to RTU or ASCII, the received data is stored in

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

6.12.2 XMT: Free-port sending instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: XMT (S1) (S2) (S3) Step length 7
Operan Indexin
Type Applicable soft element
d g
S1 INT Constant
S2 INT D V R
S3 INT Constant KnX KnY KnM KnS KnLM D SD C T V Z R

⚫ Operand description 1. SM110/SM120: Transmission enable flag. This bit is


S1: Designated communication channel. For VC1, the set when the XMT instruction is used, cleared after the
value range is 1 and 2. transmission is over, and reset when the current
S2: Start address of the data to be sent transmission is terminated.

S3: Number of bytes to be sent 2. SM112/SM122: Transmission completion flag. When it


is judged that the transmission is completed, the
⚫ Function description
transmission completion flag is set.
When the energy flow is turned on and the
3. SM114/SM124: Idle flag. When the serial port has no
communication conditions are met, the data are sent
communication task, it is set. It can be used as the check
through the designated channel and address.
bit for the communication.
⚫ Note
4. For details about the application instance, refer to
1. Size of the communication frame: Size of the
Chapter 10"Communication function guide".
communication frame: The end character of the frame
⚫ Application instance
transmitted cannot exceed D7999 or V63, depending on
the selected element type (D or V).
2. In the case of a shutdown, the transmission is stopped.
⚫ Special register

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

6.12.3 RCV: Free-port receiving instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: RCV (S1) (D) (S2) Step length 7
Operan Indexi
Type Applicable soft element
d ng
Consta
S1 INT
nt
D INT D V R
Consta
S2 INT KnX KnY KnM KnS KnLM D SD C T V Z R
nt

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

6.12.4 MODRW: Modbus read/write instruction

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)

The processing time of the slave station can be calculated


by the following formula:
One complete Modbus communication time ( Tm ) is T10 = T5 + T11 + T12 + T7
comprised of T1 and T2 , namely In which, the max. scan time of T11

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

The master station


master station is calculated as follows:
waits
Receiv
10  10
T5 =  1000+1 = 6.2ms
e data
House
keepin
g
Execu
te the
instruc
19200
Other

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

6.13 Check instructions

6.13.1 CCITT: Check instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: CCITT (S1) (S2) (D) Step length 7
Operan Indexi
Type Applicable soft element
d ng
S1 INT D V R √
Cons
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
tant
D INT D V R √

⚫ 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,

6.13.2 CRC16: Check instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: CRC16 (S1) (S2) (D) Step length 7
Operan Indexin
Type Applicable soft element
d g
S1 INT D V R √
Con
S2 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t
D INT D V R √

⚫ 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

Performing theCRC16 check operation on 8 data starting from D0,


and assigning the obtained result to D100 when X0=ON.

6.13.3 LRC: Check instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: LRC (S1) (S2) (D) Step length 7
Operan Indexi
Type Applicable soft element
d ng
S1 INT D V R √
Const
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
ant
D INT D V R √

⚫ Operand description ⚫ Application instance


S1: Start unit of data to be checked
LD SM1
S2: Number of data to be checked (S2≥0,
MOV 16#00 D0
otherwise the system report an operand error)
MOV 16#11 D1
D: Check result MOV 16#22 D2
⚫ Function description MOV 16#33 D3
Performing theLRC check operation on S2 data MOV 16#44 D4
MOV 16#55 D5
starting from (S1) , and assigning the operation
MOV 16#66 D6
result to D.
MOV 16#77 D7
⚫ Note LD M0
1. The system usually brings the content of D MOV 0 D100
before the instruction execution into the LRC D0 8 D100
operation when executing the instruction each
time, so D needs to be initialized before
executing the instruction. Performing the LRC check operation on 8 data starting from D0, and
assigning the obtained result to D100 when X0=ON.
2. Data in the data check area starting from S2
unit are stored in byte mode by default, that is,
the high byte is taken as 0, and the check result
is 8 bits stored in the low bytes of D.

192
VC Series Micro-PLC Programming Manual Application instructions

6.14 Enhanced bit processing instructions

6.14.1 ZRST: Instruction for resetting bits to 0 in batch

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: ZRST (D) (S) Step length 5
Operan Indexi
Type Applicable soft element
d ng
D BOOL Y M S LM C T √
Const
S INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
ant

⚫ 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.

6.14.2 ZSET: Instruction for resetting bits in batch

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: ZSET (D) (S) Step length 5
Operan Indexin
Type Applicable soft element
d g
D BOOL Y M S LM C T √
Cons
S INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
tant

⚫ Operand description ⚫ Application instance


D: Destination operand LD SM0
ZSET M10 10
S: Source operand
Setting the data of 10 units starting from M10 (namely M10, M11,
⚫ Function description
M12…M19) to 1 when SM0=ON.
Setting S consecutive bit elements starting
from D to 1when the energy flow is valid.

6.14.3 DECO: Decoding instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: DECO (S) (D) Step length 5
Operan
Type Applicable soft element Indexing
d
Con
S INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t
D INT KnY KnM KnS KnLM KnSM D SD C T V Z R √

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.

6.14.4 ENCO: Encoding instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: ENCO (S) (D) Step length 5
Operan
Type Applicable soft element Indexing
d
Con
S INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t
D INT KnY KnM KnS KnLM D SD C T V Z R √

⚫ 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.

6.14.5 BITS: Instruction for counting on bit in word

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: BITS (S) (D) Step length 5
Operan Indexin
Type Applicable soft element
d g
Con
S INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t
D INT KnY KnM KnS KnLM KnSM D SD C T V Z R √

⚫ Operand description in the operand D when the energy flow is valid.


S: Source operand; D: Destination operand ⚫ Application instance
⚫ Function description LD SM0
BITS 16#F0F0 D1
Counting the number of "1" bitin the
operand S, and storing the statistical result When the energy flow is valid, S in the BITS instruction is constant
16#F0F0 which includes 8 bits whose value is "1" (ON state). The
calculation result is 8 and stored in D (D1).

194
VC Series Micro-PLC Programming Manual Application instructions

6.14.6 DBITS: Instruction for counting on bit in double word

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: DBITS (S) (D) Step length 6
Operan
Type Applicable soft element Indexing
d
Const
S DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
ant
D INT KnY KnM KnS KnLM KnSM D SD C T V Z R √

⚫ Operand description ⚫ Application instance


S: Source operand; D: Destination operand LD SM0
DBITS 16#FF0FF D10
⚫ Function description
When the energy flow is valid, S in the BITS instruction is constant
Counting the number of "1" bit in the double
16#FF0FF which includes 16 bits whose value is "1" (ON state). The
word S, and storing the statistical result in D
calculation result is 16 and stored in D (D10).
when the energy flow is valid.

6.14.7 BON: Instruction for judging on bit in word

LAD: Applicable model VC2 VC3 VC5

Influenced flag bit

IL: BON (S1) (D) (S2) Step length 7


Operan
Type Applicable soft element Indexing
d
Con
S1 INT stan KnX KnY KnM KnS KnLM KnSM D SD C V √
t
D BOOL Y M S
S2 INT D V R

⚫ Operand description ⚫ Application instance


S: Source operand; D: Destination operand LD M1
⚫ Function description BON D0 Y0 5

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.

6.15 Word contact instructions

6.15.1 BLD: Word bit contact LD instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit

IL: BLD (S1) (S2) Step length 5


Operan
Type Applicable soft element Indexing
d
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
Cons
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
tant

⚫ Operand description S1: Source operand

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

⚫ Function description Taking the state of the bit 5 (ON) in D0 (1000:


Taking the state of the bit S2 in S1, and using the obtained 2#0000001111101000), and using the obtained value to
valueto drive the subsequent operation. determine the state of Y0 in the subsequent operation.

⚫ Application instance

6.15.2 BLDI: Word bit contact LDI instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit

IL: BLDI (S1) (S2) Step length 5


Operan
Type Applicable soft element Indexing
d
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
Con
S2 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t

⚫ Operand description ⚫ Application instance


S1: Source operand BLDI D0 5
OUT Y0
S2: Designated bit,0≤S2≤15, otherwise the system
reports an operand error. Performing the NOT operation (OFF) on the state of the
bit 5 (ON) in D0 (1000: 2#0000001111101000), and using
⚫ Function description
the obtained value to determine the output state of Y0 in
Performing the NOT operation on the state of the bit S2
the subsequent operation.
in S1, and using the obtained value to drive the
subsequent operation.

6.15.3 BAND: Word bit contact AND instruction

LADnote:
Applicable model VC1S VC1 VC2 VC3 VC5

Note: The logical relationship has been manifested in the diagram, so


Influenced flag bit
the BAND instruction is displayed as BLD in LAD

IL: BAND (S1) (S2) Step length 5


Operan
Type Applicable soft element Indexing
d
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
Con
S2 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t

⚫ 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

6.15.4 BANI: Word bit contact ANI instruction

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

IL: BANI (S1) (S2) Step length 5


Operan
Type Applicable soft element Indexing
d
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
Con
S2 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t

⚫ 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

6.15.5 BOR: Word bit contact OR instruction

LADnote: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


Note: The logical relationship has been manifested in the diagram, so
the BOR instruction is displayed as BLD in LAD

IL: BOR (S1) (S2) Step length 5


Operan
Type Applicable soft element Indexing
d
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
Con
S2 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t

⚫ Operand description ⚫ Application instance


S1: Source operand LD X0
S2: Assignment bit (0≤S2≤15, otherwise BOR D0 5
OUT Y0
operand error will be reported)
⚫ Function description Taking the state of the bit 5 (ON) inD0 (1000:
2#0000001111101000), and using the obtained value in parallel
Taking the state of the bit S2 in S1, and using
connection with other nodes (X0=ON) to determine the output
the obtained value in parallel connection with
state ofY0 in the subsequent operation.
other nodes to drive the subsequent operation.

197
VC Series Micro-PLC Programming Manual Application instructions

6.15.6 BORI: Word bit contact ORI instruction

LADnote:
Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


Note: The logical relationship has been manifested in the diagram, so
the BORI instruction is displayed as BLDI in LAD

IL: BORI (S1) (S2) Step length 5


Operan
Type Applicable soft element Indexing
d
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
Con
S2 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t

⚫ Operand description ⚫ Application instance


S1: Source operand LD X0
S2: Designated bit (0≤S2≤15, otherwise the BORI D0 5
OUT Y0
system reports an operand error)
⚫ Function description Performing the NOT operation (OFF) on the state of the bit 5 (ON)
in D0 (1000: 2#0000001111101000), and using the obtained value
Performing the NOT operation on the state of
in parallel connection with other nodes (X0=ON) to determine the
the bit S2 in S1, and using the obtained value in
output state of Y0 in the subsequent operation.
parallel connection with other nodes to drive the
subsequent operation.

6.15.7 BOUT: Word bit coil output instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: BOUT (D) (S) Step length 5
Operan
Type Applicable soft element Indexing
d
D INT KnY KnM KnS KnLM D C T V Z R √
Con
S INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t

⚫ 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).

6.15.8 BSET: Word bit coil setinstruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: BSET (D) (S) Step length 5
Operan
Type Applicable soft element Indexing
d

198
VC Series Micro-PLC Programming Manual Application instructions

D INT KnY KnM KnS KnLM D C T V Z R √


Con
S INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t

⚫ Operand description ⚫ Application instance


D: Destination operand LD X0
S2: Designated bit (0≤S2≤15, otherwise BSET D0 15

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.

6.15.9 BRST: Word bit coil reset instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit


IL: BRST (D) (S) Step length 5
Operan
Type Applicable soft element Indexing
d
D INT KnY KnM KnS KnLM D C T V Z R √
Con
S INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t

⚫ Operand description ⚫ Application instance


D: Destination operand LD X0
S2: Designated bit (0≤S2≤15, otherwise the BRST D0 8

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 Comparison contact instructions

6.16.1 LD (=, <, >, <>, >=, <=): Integer comparison LD※instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit

IL: LD= (S1) (S2)

LD< (S1) (S2)


LD> (S1) (S2)
Step length 5
LD<> (S1) (S2)

LD>= (S1) (S2)


LD<= (S1) (S2)
Operan
Type Applicable soft element Indexing
d

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

⚫ Operand description LD= D0 D1


OUT Y0
S1: Comparison parameter 1
LD< D0 D1
S2: Comparison parameter 2 OUT Y1
⚫ Function description LD> D0 D1
Conducting the BIN comparison on OUT 2
LD<> D0 D1
the content of S1 and S2, and using
OUT Y3
the comparison result to drive the
LD>= D0 D1
subsequent operation.
OUT Y4
⚫ Application instance LD<= D0 D1
OUT Y5
Conducting the BIN comparison on the data of D0 and D1, and using the
comparisonresult to determine the output state of the subsequent elements.

6.16.2 AND (=, <, >, <>, >=, <=): Integer comparison AND ※instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit

IL: AND= (S1) (S2)


AND< (S1) (S2)
AND> (S1) (S2)
Step length 5
AND<> (S1) (S2)
AND>= (S1) (S2)
AND<= (S1) (S2)
Operan
Type Applicable soft element Indexing
d
Con
S1 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t
Con
S1 INT stan KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
t

⚫ Operand description ⚫ Application instance


S1: Comparison parameter 1 LD X0
AND= D0 D1
S2: Comparison parameter 2
OUT Y0
⚫ Function description LD X1
Conducting the BIN comparison on AND< D0 D1
the content of S1 and S2, and using OUT Y1
the comparison result in serial LD X2
connection with other nodes to drive AND> D0 D1
OUT Y2
the subsequent operation.
LD X3
AND<> D0 D1

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

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit

IL: OR= (S1) (S2)


OR< (S1) (S2)
OR> (S1) (S2)
Step length 5
OR<> (S1) (S2)
OR>= (S1) (S2)
OR<= (S1) (S2)
Operan
Type Applicable soft element Indexing
d
Consta
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt
Consta
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V Z R √
nt

⚫ 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

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit

IL: LDD= (S1) (S2)

LDD< (S1) (S2)


LDD> (S1) (S2)
Step length 7
LDD<> (S1) (S2)

LDD>= (S1) (S2)


LDD<= (S1) (S2)
Operan
Type Applicable soft element Indexing
d
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

⚫ Operand description LD=D0 D2


OUTY0
S1: Comparison parameter 1
LD<D0 D2
S2: Comparison parameter 2 OUT Y1
⚫ Function description LD<> D0 D2
Conducting the comparison on the OUT Y2
LD>= D0 D2
content of S1 and S2, and using the
OUT Y3
comparison result to drive the
LD>= D0 D2
subsequent operation.
OUT Y4
⚫ Application instance LD<=D0 D2
OUT Y5
Conducting the comparison on (D0,D1) and (D2,D3), and using the
comparisonresult to determine the output state of the subsequent elements.

202
VC Series Micro-PLC Programming Manual Application instructions

6.16.5 ANDD (=, <, >, <>, >=, <=): Long integer comparison ANDD※instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit

IL: ANDD= (S1) (S2)


ANDD< (S1) (S2)

ANDD> (S1) (S2)


Step length 7
ANDD<> (S1) (S2)
ANDD>= (S1) (S2)

ANDD<= (S1) (S2)


Operan
Type Applicable soft element Indexing
d
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

⚫ 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

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit

IL: ORD= (S1) (S2)

ORD< (S1) (S2)


ORD> (S1) (S2)
Step length 7
ORD<> (S1) (S2)

ORD>= (S1) (S2)


ORD<= (S1) (S2)
Operan
Type Applicable soft element Indexing
d
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

⚫ 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

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.

204
VC Series Micro-PLC Programming Manual Application instructions

6.16.7 LDR: Floating-point number comparison instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit

IL: LDR= (S1) (S2)

LDR< (S1) (S2)


LDR> (S1) (S2)
Step length 7
LDR<> (S1) (S2)

LDR>= (S1) (S2)


LDR<= (S1) (S2)
Operan
Type Applicable soft element Indexing
d
Cons
S1 REAL D V R √
tant
Cons
S2 RAEL D V R √
tant

⚫ Operand description LDR= D0 D2


OUT Y0
S1: Comparison parameter 1
LDR< D0 D2
S2: Comparison parameter 2 OUT Y1
⚫ Function description LDR> D0 D2
Conducting the comparison on the OUT Y2
content of S1 and S2, and using the LDR<> D0 D2
OUT Y3
comparison result to drive the
LDR>= D0 D2
subsequent operation.
OUT Y4
⚫ Application instance LDR<= D0 D2
OUT Y5
Conducting the comparison on (D0,D1) and (D2,D3), and using the
comparison result to determine the output state of the subsequent elements.

205
VC Series Micro-PLC Programming Manual Application instructions

6.16.8 ANDR: Floating-point number comparison instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit

IL: ANDR= (S1) (S2)

ANDR< (S1) (S2)


ANDR> (S1) (S2)
Step length 7
ANDR<> (S1) (S2)
ANDR>= (S1) (S2)
ANDR<= (S1) (S2)
Operan
Type Applicable soft element Indexing
d
Con
S1 REAL stan D V R √
t
Con
S2 REAL stan D V R √
t

⚫ 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

6.16.9 ORR: Floating-point number comparison instruction

LAD: Applicable model VC1S VC1 VC2 VC3 VC5

Influenced flag bit

IL: ORR= (S1) (S2)


ORR< (S1) (S2)
ORR> (S1) (S2)
Step length 7
ORR<> (S1) (S2)

ORR>= (S1) (S2)


ORR<= (S1) (S2)
Operan
Type Applicable soft element Indexing
d
Con
S1 REAL stan D V R √
t
Con
S2 REAL stan D V R √
t

⚫ 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

6.16.10 CMP: Instruction for setting integer comparison to ON

Applicable
LAD:
VC2 VC3 VC5
model
CMP (S1) (S2) (D) Influenced flag
bit

IL: CMP (S1) (S2) (D) Step length 7


Indexi
Operand Type Applicable soft element
ng
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 BOOL Y M S

⚫ Operand description ⚫ Function description


S1: Number of data or soft element to be Executing the instruction, and comparing S1 and S2 when the
compared. energy flow is valid. Making one of (D) (D+1) (D+2) ON
S2: Number of data or soft element that is the according to its result (less, equal, or larger).
source for comparison. ⚫ Application instance
D: Number of the start element that is used to LD m0
output the result CMP 1000 2000
M3

6.16.11 LCMP: Instruction for setting long integer comparison to ON

Applicable
LAD:
VC2 VC3 VC5
model
LCMP (S1) (S2) (D) Influenced flag
bit

IL: LCMP (S1) (S2) (D) Step length 9


Operan Indexi
Type Applicable soft element
d ng
Consta
S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V Z R √
nt
Consta
S2 DINT KnX KnY KnM KnS KnLM KnSM D SD C V Z R √
nt
D BOOL Y M S

⚫ 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).

D: Number of the start element that is ⚫ Application instance


used to output the result. LD m1
LCMP 200000 300000 M6
⚫ Function description

209
VC Series Micro-PLC Programming Manual Application instructions

6.16.12 RCMP: Instruction for setting floating-point number comparison to ON

Applicable
LAD:
VC2 VC3 VC5
model
RCMP (S1)(S2)(D) Influenced flag
bit

IL: RCMP (S1) (S2) (D) Step length 9


Operan Indexi
Type Applicable soft element
d ng
Consta
S1 REAL D R √
nt
Consta
S2 REAL D R √
nt
D BOOL Y M S

⚫ 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

6.17 Bulk data processing instructions

6.17.1 BKADD: Bulk data addition operation instruction

Applicable
VC3 VC5
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: BKADD (S1) (S2) (D) (S3) Step length 9


Operan Indexi
Type Applicable soft element
d ng
S1 INT D SD C T V R √
Consta
S2 INT D SD C T V R √
nt
D INT D SD C T V R √
Consta
S3 INT D V R
nt

⚫ 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

6.17.2 BKSUB: Bulk data subtraction operation instruction

Applicable
VC3 VC5
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: BKSUB (S1) (S2) (D) (S3) Step length 9


Operan Indexi
Type Applicable soft element
d ng
S1 INT D SD C T V R √
Consta
S2 INT D SD C T V R √
nt
D INT D SD C T V R √
Consta
S3 INT D V R
nt

⚫ 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

6.17.3 BKCMP=,>,<,<>,<=,>=: Bulk data comparison instruction

LAD: Applicable
VC3 VC5
model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: BKCMP=,>,<,<>,<=,>= (S1) (S2) (D) (S3) Step length 9


Operan Indexi
Type Applicable soft element
d ng

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

6.18 Datasheet instructions

6.18.1 LIMIT: Upper/lower limit control instruction

Applicable
VC3 VC5
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: LIMIT (S1) (S2) (S3) (D) Step length 9


Opera Indexi
Type Applicable soft element
nd ng
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 √

⚫ 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)

6.18.2 DBAND: Deadband control instruction

Applicable
VC3 VC5
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: DBAND (S1) (S2) (S3) (D) Step length 9


Opera Indexi
Type Applicable soft element
nd ng
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 √

⚫ Operand description Output (Output) D

S1: Lower limit value of the deadband


S1 (Lower limit)
S2: Upper limit value of the deadband
Input 0 S2 (Upper limit)
S3:Input value to be controlled by the
deadband
D: Number of the start soft element that stores
⚫ Application instance
the output value that has been controlled by the
deadband
⚫ Function description
LD M1
You can judge whether the input value specified
DBAND D0 D10 D100 D1000
in S3 is within the range of the deadband
specified by S1 and S2 so as to control and Performing the deadband control of D0–D10 on the content of
save the value in D. In this case, when S3 < S1, D100, and storing the obtained result in D1000 when M1=ON.In
D = S3-S1; when S3 > S2, D = S3-S2; When this case, D0 (-100)<D100(30)<D10(100), and D1000=0.
S1<=S3<=S2, D=0.

6.18.3 ZONE: Zone control instruction

Applicable
VC3 VC5
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: ZONE (S1) (S2) (S3) (D) Step length 9


Opera Indexi
Type Applicable soft element
nd ng

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 √

⚫ Operand description ⚫ Function description


S1: Negative deviation value that is added to You can judge the input value specified in S3 plus the deviation
the input value value specified by S1 or S2 so as to control and save the values
S2: Positive deviation value that is added to the in D. In this case, when S3<0, D=S3+S1; when S3>0, D=S3+S2;
input value when S3 =0, D=0.
S3: Input value to controlled by the zone control ⚫ Application instance
D: Number of the start soft element that stores
the output value that hasbeen controlled
LD M1
byzone
ZONE D0 D10 D100 D1000

Performing the zone control of D0–D10 on the content of D100,


and storing the obtained result in D1000 when M1=ON.In this case,
D100(30)>0,D1000=D100(30)+D10(100), and D1000=130.

6.18.4 SCL: Coordinatesetting instruction

Applicable
VC3 VC5
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: SCL (S1) (S2) (S3) (D) Step length 7


Opera Indexi
Type Applicable soft element
nd ng
Consta
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
nt
S2 INT D V R √
D INT KnY KnM KnS KnLM D SD C T V R √

⚫ 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

6.18.5 SER: Data search instruction

Applicable
VC3 VC5
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: SER (S1) (S2) (S3) (D) Step length 9


Opera Indexi
Type Applicable soft element
nd ng
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
Consta
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
nt
D INT KnY KnM KnS KnLM D SD C T V R √
Consta
S3 INT D V R
nt

⚫ Operand description ⚫ Function description


S1: Number of the start soft element to be searched. 1. Searching S3 data starting from S1, searching the
S2: Reference value or number of the soft element that same data as S2, and storing the obtained results in D-
stores the target value for search. D+4.
D: Number of the start soft element that stores the 2. When the same data exists, the number of the same
number of the pieces of same data, the position of the data, and positions of the initial value/final value, min.
maximum value, and the position of the minimum value. and max. value are stored in 5 soft elements starting from
S3: Number of units of data to be searched (1 ≤ S3 ≤ D.
256). 3. When the same data does not exist, the first 3 soft
elements store 0, and the other two are the same as
above.
⚫ Application instance

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

6.19 Character string instructions

6.19.1 STRADD: String combination instruction

Applicable
VC3 VC5
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: STRADD (S1) (S2) (D) Step length 7


Opera Indexi
Type Applicable soft element
nd ng
S1 INT String KnX KnY KnM KnS KnLM KnSM D SD C T V R √
S2 INT String KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √

⚫ Operand description ⚫ Note


S1: First string unit 1. When S1 and S2 specify a character string, a maximum of 32
S2: Second string unit characters are allowed. The comma and the double quotation
D: String storage unit after connection mark represent the separators in the host computer software, so
⚫ Function description the character cannot be recognized by the host computer software;
2. If '00H' is stored in both S1 and S2, then '0000H' can be added
1. Connecting the string units starting from S1
directly to D;
and S2, and storing them in the soft elements
starting from D when the energy flow is valid; 3. When the soft element addresses of the string unit of S1 and D
or S2 and D overlaps, the system reports the "The value of the
2. The combination of strings indicates that the
first character of the S2 stringis connected to Instruction operand is illegal" error.
the end character of the S1 string, and the end 4. When '00H' does not appear in the corresponding soft element
identifier of the S1string is ignored. range of the string unit starting from S1 or S2, the system reports
3. 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.
4. When the number of connected characters is
an odd number, '00H' is added to the high byte LD M1
of the last character soft element. When it is STRADD D10 D100 D1000
even, '0000H' is added to the next element of
Connecting the string unit starting from D10 and the string unit
the last character soft element.
starting from D100, and storing the obtained result in the unit
starting from D1000 when M1=ON.
B15---b8 b7---b0 B15---b8 b7---b0 B15---b8 b7---b0
D10 0x32 0x31 D100 0x38 0x37 D1000 0x32 0x31
D11 0x34 0x33 + D101 0x61 0x39 D1001 0x34 0x33
D12 0x36 0x35 D102 0x00 0x62 D1002 0x36 0x35
D13 0x00 0x00 D1003 0x38 0x37
D1004 0x61 0x39
D1005 0x00 0x62

216
VC Series Micro-PLC Programming Manual Application instructions

6.19.2 STRLEN: Instruction for detecting the string length

Applicable
VC3 VC5
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: STRLEN (S) (D) Step length 5


Opera Indexi
Type Applicable soft element
nd ng
S INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √

⚫ Operand description 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.

6.19.3 STRRIGHT: Instruction for reading a string from right

Applicable
VC3 VC5
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: STRRIGHT (S1) (D) (S2) Step length 7


Opera Indexi
Type Applicable soft element
nd ng
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √
Const
S2 INT D V R
ant

⚫ 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

6.19.4 STRLEFT: Instruction for reading a string from left

Applicable
VC3 VC5
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: STRLEFT (S1) (D) (S2) Step length 7


Opera Indexi
Type Applicable soft element
nd ng
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √
Consta
S2 INT D V R √
nt

⚫ Operand description ⚫ Note


S1: The string unit 1. When '00H' does not appear in the corresponding soft
D: Storing the extracted string unit element range of the string unit starting from S1, the
S2: Number of the extracted characters system reports the "The element number of the
instruction operand is out of range" error.
⚫ Function description
2. S2 is greater than or equal to 0.
1. Extracting S2 characters rightward starting from the
3. S2 needs to be less than or equal to the character
left side of the S1 string, and storing them in the soft
element starting from D when the energy flow is valid; number of the S1 string.
⚫ Application instance
2. Storing "00H" in D soft element when S2 is equal to
zero;
3. Adding '00H'to the high byte of the soft element that
LD M1
holds the last character when the number of extracted
characters is an odd number. Adding '0000H' to the next STRLEFT D10 D100 3

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

6.19.5 STRMIDR: Instruction for reading any characters of a string

Applicable
VC3 VC5
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: STRMIDR (S1) (D) (S2) Step length 7


Opera Indexi
Type Applicable soft element
nd ng
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √

⚫ Operand description ⚫ Note


S1: The string unit 1. S2 needs to be less than or equal to the character
D:The extracted string unit number of the S1 string.
S2: Start position of the characters to be extracted 2. n is greater than 2.
S2+1: Number of characters to be extracted (n) 3. S2 is greater than or equal to 1.
⚫ Function description 4. When '00H' does not appear in the corresponding soft
element range of the string unit starting from S1, the
1. Extracting n character data of the S1 string starting
from the S2 character, and storing them in the soft system reports the "The element number of the
element starting from D when the energy flow is valid; instruction operand is out of range" error.

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

6.19.6 STRMIDW: Instruction for replacing any characters of a string

Applicable
VC3 VC5
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: STRMIDW (S1) (D) (S2) Step length 7


Opera Indexi
Type Applicable soft element
nd ng
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √
S2 INT KnX KnY KnM KnS KnLM KnSM D SD C T V R √

⚫ Operand description D: The string unit to be replaced


S1: The string unit to be used S2: Start positionof the replacement

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

4. When n is -1, the contents to the final STRMIDW D10 D100 D0


character data specified by S1 is stored in the Replacing D1 (D1=3) characters after the D0 (D0=2) characters of
soft elements following the soft element the string unit starting from D100 with the first D1 (D1=3)
specified by D. characters of the string unit starting from D10 when M1=ON.
⚫ Note B15---b8 b7---b0 B15---b8 b7---b0 B15---b8 b7---b0

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

6.19.7 STRINSTR: String search instruction

Applicable
VC3 VC5
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: STRINSTR (S1) (S2) (D) (S3) Step length 9


Opera Indexi
Type Applicable soft element
nd ng
S1 INT String D SD C T V R √
S2 INT D SD C T V R √
D INT D SD C T V R √
Const
S3 INT D V R
ant

⚫ Operand description ⚫ Note


S1: The string unit to be searched 1. When '00H' does not appear in the corresponding soft
S2: Search source element range of the string unit starting from S1 or S2,
D: Search results the system reports the "The element number of the
instruction operand is out of range" error.
S3: Start positionof searching
2. S3 is less than or equal to the number of characters in
⚫ Function description
the S2 string.
1. Searching the same string as the S1 string starting
3. When S1 specifies a character string, a maximum of
from the the S3 character of the S2 string, and storing
32 characters are allowed. The comma and the double
the string position information of search results in D when
quotation mark represent the separators in the host
the energy flow is valid.
computer software, so the character cannot be
2. Storing "0" in D when there is no consistent string.
recognized by the host computer software.
3. No operation is performed when the position S3 where
4. When S1 is an empty character string ('00H'), the
the search is started is a negative number or "0".
position of the S2 character string '00H' is detected (if S2
4. The valid data of a string unit indicates the data is an even number of characters, it is the position of the
starting from the specified soft element for the string unit first '00H').
to the first data in which "00H" is detected.
⚫ Application instance

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

ASC D10 0x32 0x31


Searching the same string as the "45" starting fromthe
D11 0x34 0x33 D100 = 4
second character of the character string unit starting from B15---b8 b7---b0
D12 0x36 0x35
0x35 0x34
D13 0x00 0x37

6.19.8 STRMOV: String transmission instruction

Applicable
VC3 VC5
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: STRMOV (S) (D) Step length 5


Opera Indexi
Type Applicable soft element
nd ng
S INT String KnX KnY KnM KnS KnLM KnSM D SD C T V R √
D INT KnY KnM KnS KnLM D SD C T V R √

⚫ Operand description 3. When S1 specifies a character string, a maximum of


S: Source string unit 32 characters are allowed. The comma and the double
D: Destination unit quotation mark represent the separators in the host
computer software, so the character cannot be
⚫ Function description
recognized by the host computer software.
1. Transferring all data of the S string unit, including '00H',
⚫ Application instance
to the element unit starting from D.
2. The valid data of a string unit indicates the data
starting from the specified soft element for the string unit
to the first data in which "00H" is detected. LD M1

⚫ Note STRMOV D10 D100

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 Extension file register instructions

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

IL: LOADR (S1) (S2) Step length 5


Opera Indexi
Type Applicable soft element
nd ng
S1 INT R √

221
VC Series Micro-PLC Programming Manual Application instructions
Consta
S2 INT D
nt

⚫ Operand description ⚫ Note


S1: Soft element unit of the extension register for storing data 1. No operation is executed when S2 is specified as
S2: Number of data that has been read (1 ≤ S2 ≤ 1024) 0.
⚫ Function description 2. When the storage box is not connected, if you
Reading out S2 data from S1 of the extension file execute this instruction,the system reports that there
register stored in the storage box to the soft elements is no memory card.
starting from S1 of the extension register in the PLC; 3. When S2=1024, the execution time of the
instruction is about 80ms. You need to set the
watchdog time correctly in the practical applications.
⚫ Application instance

LD M1
LOADR R0 16

Reading 16 data starting from R0 of the memory card R


backup area, and storing these data in the 16 soft element
units starting from R0 when M1=ON.

6.20.2 SAVER: Instruction for writing data to an extension file register

Applicable model
LAD:
Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: SAVER (S1) (S2) (D) Step length 7


Opera Indexi
Type Applicable soft element
nd ng
S1 INT R √
Constan
S2 INT
t
D INT D √

⚫ 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

0 R0 R0–R2047 8 R16384 R16384–R18431


1 R2048 R2048–R4095 9 R18432 R18432–R20479
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

5. When no memory is connected, the system reports SAVER R0 64 D100


that there is no memory card. LD SM189
6. When hardware writing protection is performed for the SET Y0
memory card, the system reports a memory card
Storing 2048 soft element data starting from R0 in 2048
operation error.
units starting from ER0, and storing the number of units
⚫ Application instance that are already stored in D100 when M1=ON. When the
execution of the instruction is completed, SM189=ON,
and Y0=ON.

LD M1

6.20.3 INITR: Instruction for initializing an extension register

Applicable
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: INITR (S1) (S2) Step length 5


Opera Indexi
Type Applicable soft element
nd ng
S1 INT R √
Consta
S2 INT
nt
⚫ Operand description
S1: Units of the extension register and extension file register to be initialized (only the address of the start soft element in
the segment can be specified)
S2: Segments of the extension register and extension file register to be initialized (S2=1)
⚫ Function description
1. Initializing S2 extension registers and extension file registers starting from S1, and writing the initial value 0xFFFF.
2. The initialization is executed by segments.
⚫ Note
1. S1 needs to specify number of the start soft element in the segment. Number of the start soft element in each segment is
as follows.
Range of writing to the
Segment Number of the Segment Number of the start Range of writing to the
memory card R backup
number start soft element number soft element memory card R backup area
area
0 R0 R0–R2047 8 R16384 R16384–R18431
1 R2048 R2048–R4095 9 R18432 R18432–R20479
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

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.

6.20.4 LOGR: Instruction for logging on an extension register

Applicable
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: LOGR (S1) (S2) (S3) (S4) (D) Step length 11


Opera Indexi
Type Applicable soft element
nd ng
S1 INT D C T √
Consta
S2 INT D
nt
S3 INT R
Consta
S4 INT
nt
D INT D √

⚫ Operand description ⚫ Note


S1: Object unit that performs the login 1. When using the memory card, you need to initialize
S2: Number oflogined object units (1–1024) the segments to be logged. If the data logged on the
extension file register is inconsistent with the data
S3: Address of the start soft element unit used in login
starting from S1, the system reports that the operation on
S4: Number of soft element segments used in login (1–
the memory card is incorrect. In this case, you can
16) initialize the segments to be logged one by one through
D: Number of logined data the INITR or INITER command, or initialize all ER
⚫ Function description elements through the menu clear instruction of the
1. Continuously logining in S2 soft elements starting from background memory card (you need to select the user
S1 until S4 segments of the extension register and the program, global variables, data block, and system block
extension file register starting starting from S3 are filled simultaneously). To avoid data loss, you need to backup
in when the energy flow is valid. the memory card file content through the background
2. Performing login in each execution cycle. software before initialization.
3. Storing the number of logined data in D.
2. S3 needs to specify number of the start soft element in the segment. Number of the start soft element in each segment is
as follows.
Number of the Range of writing to the
Segment Segment Number of the Range of writing to the
start soft memory card R backup
number number start soft element memory card R backup area
element area
0 R0 R0–R2047 8 R16384 R16384–R18431
1 R2048 R2048–R4095 9 R18432 R18432–R20479
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

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.

6.20.5 INITER: Instruction for initializing an extension file register

Applicable
LAD: model

Influenced flag
Zero flag, carry flag, and borrow flag
bit

IL: INITER (S1) (S2) Step length 5


Opera Indexi
Type Applicable soft element
nd ng
S1 INT R √
Consta
S2 INT
nt

⚫ Operand description ⚫ Function description


S1: The same extension register unit that share the same 1. Initializing S2 segments of extension file registers
address with the extension file register unit to be starting from S1 in the storage box, and writing the value
initialized(only the start address of extension register in 0xFFFF into it.
the segment can be specified) 2. The initialization is executed by segments.
S2: Segments of the extension register and extension file
register to be initialized (S2=1)
⚫ Note
1. S1 needs to specify number of the start soft element in the segment. Number of the start soft element in each segment is
as follows.
Number of the Range of writing to the Range of writing to the
Segment Segment Number of the start
start soft memory card R backup memory card R backup
number number soft element
element area area
0 R0 R0–R2047 8 R16384 R16384–R18431
1 R2048 R2048–R4095 9 R18432 R18432–R20479

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

2. If there is memory hardware protection, the system ⚫ Application instance


reports that the operation on the memory card is incorrect.
3. When no storage box is connected, the system reports
that there is no memory card. LD M1

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

6.21 Positioning instructions

6.21.1 ZRN: Zero return instruction

LAD: Applicable model VC1S VC1 VC2 VC3

Influenced flag bit

IL: ZRN (S1) (S2) (S3) (D) Step length 11


Operan
Type Applicable soft element Indexing
d
Const
S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
ant
Const
S2 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
ant
S3 BOOL X Y M S
D BOOL Y

⚫ 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

6.21.2 PLSV:Variable speed pulse output instruction

Applicable model VC1S VC1 VC2 VC3


LAD:
Influenced flag bit

IL: PLSV (S) (D1) (D2) Step length


8
Operan
Type Applicable soft element Indexing
d
Const
S DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
ant
D1 BOOL Y
D2 BOOL Y M S

⚫ Operand description 3. During the process of the high-speed pulse output,


S: Output pulse frequency (Hz) when the energy flow driven by the instruction turns OFF,
the output stops without deceleration.
32-bit instruction.
D1: Start address of the high-speed pulse output. 4. If the high-speed pulse output monitoring is ON, the
energy flow driven by the instruction is not driven by the
D2: Start address of the rotating direction signal output.
instruction again after the energy flow turns OFF.
Corresponding to the positive/negative condition of S, it
acts as follows: 5. The direction is determined by the positive or negative
nature of S.
• When S is positive: D2 is ON.
⚫ Note
• When S is negative: D2 is OFF.
1. PLSY, PLS, and positioning instructions can output the
⚫ Function description high-speed pulses port. It is not allowed to use these
1. You can change the output pulse frequency (S) freely instructions for high-speed pulse output on the same port
even in the high-speed pulse output state. at the same time.
2. Because there is no acceleration or deceleration 2. For details, refer to Chapter 11 "User Guide for
during the start/stop, if buffer is needed during the start Positioning Function".
or stop, it is recommended to use the RAMP instruction
to change the value of the output pulse frequency (S).

228
VC Series Micro-PLC Programming Manual Application instructions

6.21.3 DRVI: Relative position control instruction

Applicable model VC1S VC1 VC2 VC3


LAD:
Influenced flag bit

IL: DRVI (S1) (S2) (D1) (D2) Step length


11
Operan
Type Applicable soft element Indexing
d
Const
S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
ant
Const
S2 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
ant
D1 BOOL Y
D2 BOOL Y M S

⚫ Operand description SD303


Current position value in the positioning
instructionoutputted through Y7 (LSB)
S1: Number of output pulses (relatively specified)
2. During the reverse rotation, the value of current value
S2: Output pulse frequency (Hz).
register decreases.
D1: Start address of the high-speed pulse output.
3. The rotating direction is determined by the positive or
D2: Start address of the rotating direction signal output.
negative nature of S1.
Corresponding to the positive/negative condition of S, it
4. During the execution of the instruction, even if the
actsas follows:
contents of the operands are changed, these changes
• When S1 is positive: D2 is ON.
cannot be displayed in the current operation and can only
• When S1 is negative: D2 is OFF. take effect at the next execution of instruction.
⚫ Function description 5. During the execution of the instruction, the output
1. S1 corresponds to the following current value decelerates to stop when the energy flow driven by the
registers as a relative position. instruction turns OFF. The execution completion flag SM
Current position value in the positioning does not act at the moment.
SD162
instructionoutputted through Y0 (MSB) 6. If the high-speed pulse output flag is ON, the energy
Current position value in the positioning flow driven by the instruction is not driven by the
SD163
instructionoutputted through Y0 (LSB)
instruction again after the energy flow turns OFF.
Current position value in the positioning
SD182 ⚫ Note
instructionoutputted through Y1 (MSB)
Current position value in the positioning 1. The min. output pulse frequency that can be outputted
SD183
instructionoutputted through Y1 (LSB) actually, is determined by the formula below:
Current position value in the positioning
SD202 Fmax  500
instructionoutputted through Y2 (MSB) Fmin_ acc =
Current position value in the positioning T
SD203
instructionoutputted through Y2 (LSB) In the above formula, Fmax indicates the max. speed
Current position value in the positioning
SD222 while T indicates the acceleration/deceleration time
instructionoutputted through Y3 (MSB)
Current position value in the positioning withthe unit of ms. The calculation result Fmin_ acc is the
SD223
instructionoutputted through Y3 (LSB) limit value of min. output frequency.
Current position value in the positioning
SD242 2. For the pulse output frequency, the calculated
instructionoutputted through Y4 (MSB)
Current position value in the positioning frequency is output even if a value less than the
SD243
instructionoutputted through Y4 (LSB) calculated one is assigned. The frequency of the starting
Current position value in the positioning section of ACC and end part of DEC cannot be less than
SD262
instructionoutputted through Y5 (MSB) the above calculation result. If the max. speed is lower
Current position value in the positioning
SD263 than the above calculation result, there is not pulse
instructionoutputted through Y5 (LSB)
output.
Current position value in the positioning
SD282
instructionoutputted through Y6 (MSB) 3. Crawling speed needs to be larger than zero and less
Current position value in the positioning than one tenth of the max. speed.
SD283
instructionoutputted through Y6 (LSB)
4. For details, refer to Chapter 11 "User Guide for
Current position value in the positioning
SD302 Positioning Function".
instructionoutputted through Y7 (MSB)

229
VC Series Micro-PLC Programming Manual Application instructions

6.21.4 DRVA: Absolute position control instruction

LAD: Applicable model VC1S VC1 VC2 VC3

Influenced flag bit

IL: DRVA (S1) (S2) (D1) (D2) Step length 11


Operan
Type Applicable soft element Indexing
d
Const
S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
ant
Const
S2 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
ant
D1 BOOL Y
D2 BOOL Y M S

⚫ Operand description Current position value in the positioning


SD303
instructionoutputted through Y7 (LSB)
S1: Target position (absolutelyspecified)
2. During the reverse rotation, the value of current value
S2: Output pulse frequency (Hz)
register decreases.
32-bit instruction.
3. The rotating direction is determined by the positive or
D1: Start address of the high-speed pulse output. For
negative nature of S1.
VC1S, only Y0 or Y1 can be designated.
4. During the execution of the instruction, even if the
The PLC output need to adopt transistor output mode.
contents of the operands are changed, these changes
D2: Start address of the rotating direction signal output.
cannot be displayed in the current operation and can only
If the pulse is transmitted in forward direction, D2 is ON, take effect at the next execution of instruction.
otherwise D2 is OFF.
5. During the execution of the instruction, the output
⚫ Function description decelerates to stop when the energy flow driven by the
1. S1 corresponds to the following current value registers instruction turns OFF. The execution completion flag SM
as a relative position. does not actat the moment.
Current position value in the positioning 6. If the high-speed pulse output flag is ON, the energy
SD162
instructionoutputted through Y0 (MSB)
flow driven by the instruction is not driven by the
Current position value in the positioning
SD163
instructionoutputted through Y0 (LSB)
instruction again after the energy flow turns OFF.
Current position value in the positioning ⚫ Note
SD182
instructionoutputted through Y1 (MSB) 1. The min. output pulse frequency that can be outputted
Current position value in the positioning
SD183 actually, is determined by the formula below:
instructionoutputted through Y1 (LSB)
Current position value in the positioning Fmax  500
SD202 Fmin_ acc =
instructionoutputted through Y2 (MSB) T
Current position value in the positioning
SD203 In the above formula, Fmax indicates the max. speed
instructionoutputted through Y2 (LSB)
Current position value in the positioning while T indicates the acceleration/deceleration time with
SD222
instructionoutputted through Y3 (MSB) the unit of ms. The calculation result Fmin_ acc is the limit
Current position value in the positioning
SD223 value of min. output frequency.
instructionoutputted through Y3 (LSB)
Current position value in the positioning
2. For the pulse output frequency, the calculated
SD242 frequency is output even if a value less than the
instructionoutputted through Y4 (MSB)
Current position value in the positioning calculated one is assigned. The frequency of the starting
SD243
instructionoutputted through Y4 (LSB) section of ACC and end part of DEC cannot be less than
Current position value in the positioning the above calculation result. If the max. speed is lower
SD262
instructionoutputted through Y5 (MSB)
than the above calculation result, there is not pulse
Current position value in the positioning
SD263
instructionoutputted through Y5 (LSB) output.
Current position value in the positioning 3. Crawling speed needs to be larger than zero and less
SD282
instructionoutputted through Y6 (MSB) than one tenth of the max. speed.
Current position value in the positioning
SD283 4. For details, refer to Chapter 11 "User Guide for
instructionoutputted through Y6 (LSB)
Current position value in the positioning
Positioning Function".
SD302
instructionoutputted through Y7 (MSB)

230
VC Series Micro-PLC Programming Manual Application instructions

6.21.5 DSZR: Instruction for zero return with DOG

Applicable
LAD:
VC1 VC2 VC3
model
DSZR (S1) (S2) (D1) (D2) Influenced flag
bit

IL: DSZR (S1) (S2) (D1) (D2) Step length 9


Operan Indexi
Type Applicable soft element
d ng
S1 BOOL X Y M S
S2 BOOL X
D1 BOOL Y
D2 BOOL Y M S

⚫ Operand description 2) Moving toward the opposite direction ofthe ZRN


S1: Specifying the soft element number of DOG. When direction atzero return speed.
an input soft element is designated, the position offset of 3) Decelerating to stop afterdetecting the front end
the zero point increases due to the influence of the PLC of DOG.(leaving DOG)
calculation cycle. 4) Moving toward the ZRN direction at zero return
S2: Specifying the soft element number of the input zero speed. (entering DOG again)
signal. Range: X0–X7. 5) Starting to decelerate to the crawling speed once
D1: Specifying the pulse number of the output pulses. the front end of DOG is detected.
D2: Specifying the output object number of the rotating 6) Stopping once the first zero signal is detected
direction signal. after detecting the back end of DOG.
⚫ Function description 3. When the starting position is in DOG OFF (after
passing DOG):
The ZRN instruction that permits the use of DOG signal
and zero signal. There is FWD and REV limits. The ZRN 1)Starting the ZRN action through executing the
action depends on the ZRN position. A clearing signal is ZRN instruction.
sent after the instruction ends. 2) Moving toward the ZRN direction atzero return
speed.
Back end Front end Zero return speed
3)Decelerating to stop after detecting the reverse
REV limit DOG FWD limit limit.
REV action 4) Moving toward the opposite direction ofthe ZRN
Crawling speed
Base speed direction at zero return speed.
4) 3)
Origin
2) 1)
5) Decelerating to stop after detecting the front end
of DOG.(detecting (leave) DOG)
FWD action
6) Moving toward the ZRN direction at zero return
speed.
1. When the starting position is before passing DOG:
7) Starting to decelerate to the crawling speed once
1)Starting the ZRN action through executing the
the front end of DOG is detected.
ZRN instruction.
8) Stopping once the first zero signal is detected
2) Moving toward the ZRN direction atzero return
after detecting the back end of DOG.
speed.
4. When the starting position is in limit switch position
3) Starting to decelerate to the crawling speed once
(FWD or REV limit):
the front end of DOG is detected.
1)Starting the ZRN action through executing the
4) Stopping once the first zero signal is detected
ZRN instruction.
again after detecting the back end of DOG.
2) Moving toward the opposite direction ofthe ZRN
2. When the starting position is within DOG:
direction at zero return speed.
1)Starting the ZRN action through executing the
3) Decelerating to stop after detecting the front end
ZRN instruction.
of DOG.(detecting (leave) DOG)
231
VC Series Micro-PLC Programming Manual Application instructions
4) Moving toward the ZRN direction at zero return than the above calculation result, there is not pulse
speed. (entering DOG again) output.
5) Starting to decelerate to the crawling speed once 4. Crawling speed needs to be larger than zero and less
the front end of DOG is detected. than one tenth of the max. speed.
6) Stopping once the first zero signal is detected 5. For details, refer to Chapter 11 "User Guide for
after detecting the back end of DOG. Positioning Function".
⚫ Note Application instance
1. PLSY, PLS, and positioning instructions can output the Parameters such as the max. speed, base speed,
high-speed pulses port. It is not allowed to use these acceleration/deceleration time, zero return speed, and
instructions for high-speed pulse output on the same port crawling speed can adopt default values or can be reset
at the same time. through the soft element assignment.
2. The min. output pulse frequency that can be outputted
actually, is determined by the formula below:
Fmax  500
Fmin_ acc =
T
In the above formula, Fmax indicates the max. speed,
while T indicates the acceleration/deceleration time,,
withthe unit of ms. The calculation result Fmin_ acc is the
limit value of min. output frequency.
3. For the pulse output frequency, the calculated Executingthe DSZR instruction:
frequency is output even if a value less than the
calculated one is assigned. The frequency of the starting
section of ACC and end part of DEC cannot be less than
the above calculation result. If the max. speed is lower

6.21.6 DVIT: Interrupt positioning instruction

Applicable
LAD: VC1
model
DVIT (S1) (S2) (D1) (D2) Influenced flag
bit

IL: DVIT (S1) (S2) (D1) (D2) Step length 11


Operan Indexi
Type Applicable soft element
d ng
Consta
S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
Consta
S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V R √
nt
D1 BOOL Y
D2 BOOL Y M S

⚫ Operand description pulses.SM284 is valid for interrupt input function; SD176


S1: Specifying the number of output pulses after the is the designation of interrupt input function; SM283 is
interrupt (relative address). the logic inversion soft element of the interrupt input
S2: Specifying the output pulse frequency. signal. The logic inversion determines whether the
D1:Specifying the output number of the output pulses. interrupt soft element generates an interrupt by ON or
OFF.
D2: Specifying the output object number of the rotation
direction signal. 2. The designation method of the interrupt input is as
below: SM284 is set to ON.
⚫ Function description
3. Designating a input number (X0–X7) as the interrupt
1. When the interrupt is generated, the pulse is output at
input in SD176, or designating the user interrupt
the specified frequency and the specified number of

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

1. PLSY, PLS, and positioning instructions can output


the high-speed pulses port. It is not allowed to use
these instructions for high-speed pulse output on the
same port at the same time.

2. The min. output pulse frequency that can be


outputted actually, is determined by the formula below:
Fmax  500
Fmin_ acc =
T

6.21.7 STOPDV: Pulse output stop instruction

Applicable
VC3
LAD: model
STOPDV (S1) (S2) (S3) (D)
Influenced flag
bit

IL: STOPDV (S1) (S2) (S3) (D) Step length 12


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
D BOOL Y

⚫ Operand description 1. Executing the STOPDV instruction. It can started


S1: Number of output pulses after the instruction is during the execution process of the PLSY, PLS, and
executed (relative address). positioning instructions, and stops the output action of
the specified axis.
S2: Base speed during the deceleration.
2. When the drive energy flow of the instruction is ON,
S3: Time for deceleration from the original output speed
the pulse output stops after running the specified number
to the base speed.
of pulses. When the specified number of pulses is 0, the
D: Number of the output point corresponding to the high-
instruction stops its output actionimmediately. When the
speed pulses.
specified number of pulses is greater than 0, the
⚫ Function description instruction continues the original output action first, then

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

1. The min. output pulse frequency that can be


outputted actually, is determined by the formula below:
Fmax  500 Adding the following statement to the interrupt
Fmin_ acc =
T subprogram:
In the above formula, Fmax indicates the max. speed, set
via SD85 and SD86 while T indicates the
acceleration/deceleration time, set via SD87, withthe unit
of ms. The calculation result Fmin_ acc is the limit value of
In the above instruction, when X6 is set to ON, Y0
min. output frequency.
outputs some pulses and then decelerates to stop. If X6
2. For the pulse output frequency S2, the calculated is set to ON until Y0 stops completely, 30,000 pulses are
frequency is output even if a value less than the outputted, which is not affected by the scan cycle.
calculated one is assigned.The frequency of the starting For example, operand 1 in the STOPDV instruction in
section of ACC and end part of DEC cannot be less than INT_1, is 0, the diagram is as shown below:
the above calculation result. If the max. speed is lower
than the above calculation result, there is not pulse
output.
3. When the number of output pulses is less than the
number of pulses required for deceleration, the When the interrupt source event occurs (hereby referring
frequency can be decelerated. to the rising edge of X6), Y0 stops immediately and is
notaffected by the scan cycle.
4. The output point number D corresponding to the high-
Note that when the STOPDV instruction is called, it is
speed pulses can specify Y0, Y1, Y2, Y3, Y4, Y5, Y6, and
necessary to cut off the energy flow of the high-speed
Y7.
instruction executed for Y0 in the main function to
5. When the instruction is executed, if the output axis is
prevent the high-speed output from being restarted by
already in the stop state, no operation is performed; if the
scanning the instruction in the main function after Y0 is
output axis is executing the LIN, CW, or CCW
stopped.
instructions, no operation is performed.

6.21.8 LIN: Linear trajectory interpolation instruction

Applicable
VC3
LAD: model
LIN (S) (D1) (D2) (D3) (D4)
Influenced flag
bit

IL: LIN (S) (D1) (D2) (D3) (D4) Step length 12


Operan
Type Applicable soft element Indexing
d

234
VC Series Micro-PLC Programming Manual Application instructions
S DINT D
D1 BOOL Y
D2 BOOL Y
D3 BOOL Y
D4 BOOL Y

⚫ Operand description (1) In the incremental mode, the trajectory target


S: The start address of the parameter table storage area. adopts the relative address, which refers to the moving
D1: The output point number corresponding to the X-axis distance from the current position to the X and Y axes
pulse signal (or positive pulse signal). Only Y0 can be during the target period.
specified. (2) In the absolute value mode, the trajectory target
D2: The output point number corresponding to the X-axis adopts an absolute address, which refers to the absolute
direction signal (or negative pulse signal). Only Y1 can position coordinates of the target position on the X and Y
axes.
be specified.
D3: The output point number corresponding to the Y-axis ⚫ Note
pulse signal (or positive pulse signal). Only Y2 can be 1. The output point numbers D1 and D3 corresponding
specified. to the two output axis pulse signals (or forward pulse
D4: The output point number corresponding to the Y-axis signals) in the instruction must be used in groups. When
the output group can only designatedas Y0 and Y2, Y1
direction signal (or negative pulse signal). Only Y3 can
and Y3 are used in combination with Y0 and Y2
be specified.
respectively to provide the direction signal or negative
⚫ Function description
pulse output signal.
1. Moving to the target position along a straight trajectory
2. The output group (Y0 and Y2) can be specified as
at the specified vector speed.
"Pulse + direction" mode or "Positive pulse + negative
2. Parameter table definition
pulse" mode, the max. speed of the single axis is 200k
D element Content
while the resultant speedis a max.of 200K.
S Reserved
Action mode and output logic relationship 3. The setting range of the moving distance for each axis
(configuration code in decimal) is -8388608-+8388607 pulses.
Con Mode Output logic
figur 4. It is not allowed to use multiple PLSY, PLS, or
atio positioning instructions on the same high-speed pulse
n output port at the same time.
Pulse+direction
Increment 5. The range of acceleration and deceleration time is 5-
00 (Forward:
al type
S+1 ON/reverse: OFF) 5000ms.
Increment Forward
01 6. Only trapezoidal acceleration/deceleration is
al type pulse+reverse pulse
Absolute Pulse+direction supported, and the deceleration time cannot be set alone.
10 value (Forward:
type ON/reverse: OFF) 7. The completion interrupt only supports one (Y0Y1)
Absolute
Forward interrupt.
11 value
type
pulse+reverse pulse ⚫ Application instance
Resultant speed initial speed Fmin (Hz)
S+2
(MSB)
Resultant speed initial speed Fmin (Hz)
S+3
(LSB)
Resultant speed max. speed Fmax (Hz)
S+4
(MSB)
Resultant speed max. speed Fmax (Hz)
S+5
(LSB)
Acceleration/deceleration time T (ms)
S+6
(MSB)
Acceleration/deceleration time T (ms)
S+7
(LSB)
X-axis target position (moving distance)
S+8
(MSB)
X-axis target position (moving distance)
S+9
(LSB)
Y-axis target position (moving distance)
S+10
(MSB)
Y-axis target position (moving distance)
S+11
(LSB)
Among which:

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

Configuration X-axis X-axis Y-axis Y-axis


code pulse direction pulse direction

236
VC Series Micro-PLC Programming Manual Application instructions

6.21.9 CW: Clockwise arc trajectory interpolation

Applicable
VC3
LAD: model
CW (S) (D1) (D2) (D3) (D4)
Influenced flag
bit

IL: CW (S) (D1) (D2) (D3) (D4) Step length 12


Operan
Type Applicable soft element Indexing
d
S DINT D
D1 BOOL Y
D2 BOOL Y
D3 BOOL Y
D4 BOOL Y

⚫ Operand description S+4 Resultant speed (MSB)


S+5 Resultant speed (LSB)
S: The start address of the parameter table storage area. Acceleration/deceleration time T (ms)
S+6
D1: The output point number corresponding to the X-axis (MSB)
Acceleration/deceleration time T (ms)
pulse signal (or positive pulse signal). Only Y0 can be S+7
(LSB)
specified X-axis moving distance (target position)
S+8
(MSB)
D2: The output point number corresponding to the X-axis
X-axis moving distance (target position)
direction signal (or negative pulse signal). Only Y1 can S+9
(LSB)
be specified. S+10
Y-axis moving distance (target position)
(MSB)
D3: The output point number corresponding to the Y-axis Y-axis moving distance (target position)
S+11
pulse signal (or positive pulse signal). Only Y2 can be (LSB)
X-axis coordinate of the circle center
specified. S+12
position/passing point (MSB)
D4: The output point number corresponding to the Y-axis X-axis coordinate of the circle center
S+13
direction signal (or negative pulse signal). Only Y3 can position/passing point (LSB)
Y-axis coordinate of the circle center
be specified. S+14
position/passing point (MSB)
⚫ Function description Y-axis coordinate of the circle center
S+15
position/passing point (LSB)
1. Moving to the target position along the arc trajectory in Among which:
the clockwise direction at the specified line speed.
(1) In the incremental mode, the trajectory target
2. Parameter table definition adopts the relative address, which refers to the moving
D element Content distance from the current position to the X and Y axes
Arc formation method
during the target period.
Con Mode
figur (2) In the absolute value mode, the trajectory target
S atio adopts an absolute address, which refers to the absolute
n
0 Center position designation position coordinates of the target position on the X and Y
1 Passing position designation axes.
Action mode and output logic relationship
(configuration code in decimal)
⚫ Note
Con Mode Output logic 1. The output point numbers D1 and D3 corresponding
figur
to the two output axis pulse signals (or forward pulse
atio
n signals) in the instruction must be used in groups. When
Increment
Pulse+direction the output group can only designatedas Y0 and Y2, Y1
00 (Forward:
S+1 al type
ON/reverse: OFF) and Y3 are used in combination with Y0 and Y2
Increment Forward respectively to provide the direction signal or negative
01
al type pulse+reverse pulse pulse output signal.
Absolute Pulse+direction
10 value (Forward: 2. The output group (Y0 and Y2) can be specified as
type ON/reverse: OFF) "Pulse + direction" mode or "Positive pulse+ negative
Absolute
11 value
Forward pulse" mode, and the max. speed is 200k.
pulse+reverse pulse
type 3. The setting range of the moving distance for each axis
S+2 Resultant speed initial speed (MSB)
is -8388608-8388607 pulses.
S+3 Resultant speed initial speed (LSB)

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

6. The range of acceleration and deceleration time is 5-


5000ms.
7. Only trapezoidal acceleration/deceleration is
supported, and the deceleration time cannot be set alone.
8. The completion interrupt only supports one (Y0Y1)
X-axis moving distance

interrupt.
⚫ Application instance Y-axis moving distance

Assuming the current position value of the SD element is


(2000, 5000), and you want to draw the arc shown in the Relative position of X-axis of the circle center

following figure:
Relative position of Y-axis of the circle center

Configuration X-axis X-axis Y-axis Y-axis


code pulse direction pulse direction
Y-axis (SD320)

Start point Center


(2000,5000) (6000,5000)

End point
(6000,1000)
X-axis (SD200)

6.21.10 CCW: Counterclockwise arc trajectory interpolation instruction

Applicable
VC3
LAD: model
CCW (S) (D1) (D2) (D3) (D4)
Influenced flag
bit

IL: CCW (S) (D1) (D2) (D3) (D4) Step length 12


Operan
Type Applicable soft element Indexing
d
S DINT D
D1 BOOL Y
D2 BOOL Y
D3 BOOL Y
D4 BOOL Y

⚫ 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)

X-axis moving distance

End point Center


(2000,5000) (6000,5000) Y-axis moving distance

Relative position of X-axis of the circle center


Start point
(6000,1000)
X-axis (SD200) Relative position of Y-axis of the circle center

You can adopt the incremental type, the displacement of


the end point to the start point is (4000, -4000), and the Configuration
code
X-axis
pulse
X-axis
direction
Y-axis
pulse
Y-axis
direction

240
VC Series Micro-PLC Programming Manual Application instructions

6.21.11 MOVELINK: Synchronous control instruction

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

S3: Number of pulses generated by the spindle axis


before reaching the constant speed synchronization
S4: Number of pulses generated by the spindle axisafter Slave
axis
ending the constant speed synchronization move Total
movement
ment
S5: Output point number corresponding to the slave axis
pulse signal. Range: Y4 and Y5.
Spindle axis
S6: Output point number corresponding to the spindle movement

axis pulse signalor high-speed counter number. Range:


Y0–Y7, C236–C263. Slave
axis
⚫ Function description speed

1. This instruction implements a simple synchronization


function for two-axis motion. The slave axis measures Speed Synchronization
Startup End
and follows the speed and position of the spindle axis. synchronization completed

The spindle axis can be used as a high-speed output or


2. As shown in the figure above, after this instruction is
input port of the module.
started, the slave axis starts from the stop state and
moves by following the spindle axis after a period of
acceleration and deceleration. When the spindle axis
outputs the specified number of pulses S3, the speed of
the slave axis is the same as that of the spindle axis, and
the constant speed synchronization starts. When there
are S4 pulses to be generated by the spindle axis before
it reaches the destination position, the constant speed
synchronization is stopped, and the slave axis starts to
decelerate the speed. When the spindle axis reaches the
target position, the slave axis stops.
3. When the spindle axis is defined as an output axis,
operand S6 is set to an output point number Y0–Y7;

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

6.21.12 GEARBOX: Electronic gear instruction

Applicable
LAD: model
GEARBOX (D1) (S1) (D2) (S2)
Influenced flag
bit

IL: GEARBOX (D1) (S1) (D2) (S2) Step length 9


Operan
Type Applicable soft element Indexing
d
D1 BOOL Y
Const
S1 DINT KnX KnY KnM KnS KnLM KnSM D SD C V √
ant
D2 BOOL Y
Const
S2 DINT KnX KnY KnM KnS KnLM KnSM D SD C V √
ant
⚫ Operand description
D1: The output point number corresponding to the spindle axis signal. Range: Y0–Y7.
S1: This operand together with S2 determines the ratio of the electronic gear.
D2: The output point number corresponding to the slave axis pulse signal. Range: Y4 and Y5.
S2: This operand together with S1 determines the ratio of the electronic gear.
The range of the electronic gear ratio (S1/S2): 1/10000–10000.
⚫ Function description
1. Enabling the slave axis to follow the spindle axis according to the electronic gear ratio (S1/S2). When the spindle axis
sends N pulses, the slave axis sends N × S1/S2 pulses. When the spindle axis outputs pulses at a frequency of F, the slave
axis outputs pulses at a frequency of F × S1/S2.
2. When the energy flow of the instruction is turned on, the slave axis starts running.
3. The direction signal of the output axis does not need to be specified, and it does not change its ON/OFF state of the
direction signalduring the follow-up process.
4. When the electronic gear ratio is less than 0, that is, one value of S1, S2 is positive and the other is negative, and the
relevant SD elements of the slave axis are decreased progressively with the pulse output.
⚫ Note
1. It is not allowed to use multiple PLSY, PLS, or positioning instructions on the same high-speed pulse output port at the
same time.
2. If the electronic gear ratio is outside the specified range, there is no pulse output.
3. The output point number D corresponding to the high-speed pulses can be specified as: Y0, Y2, Y4, Y5, Y6, and Y7. Y1
and Y3 are used in combination with Y0 and Y2 respectively to provide the direction signal or negative pulse output signal.
⚫ Application instance

243
VC Series Micro-PLC Programming Manual Application instructions

6.22 Data processing instructions

6.22.1 MEAN: Mean instruction

Applicable model VC3 VC5


LAD:
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: MEAN (S1) (D) (S2) Step length 7

Operand Type Applicable soft element Indexing


Consta
S1 INT KnX KnY KnM KnS KnLM KnSM D SD C T R √
nt
Consta
S2 INT D R √
nt
D INT KnY KnM KnS KnLM D SD C R √

⚫ Operand description ⚫ Application instance


S1: Number of the start word element that stores data on
which the mean operation is to be performed
S2: Number of pieces of data on which the mean LD M1
operation is to be performed (1–64)
MEAN D0 D10 4
D: Number of the word element that stores the obtained
Taking the average value of four unit
mean value
sof data starting from D0, and storing the obtained value
⚫ Function description
in D10 when M1 = ON. When D0=32, D1=10, D2=15,
1. Storing the mean of S2 16-bit data starting from S1 in and D3=-14, D10=10.
D, and rounding off the remainder.

6.22.2 WTOB: Byte-unit data separation instruction

Applicable model VC3 VC5


LAD:
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: WTOB (S1) (D) (S2) Step length 7

Operand Type Applicable soft element Indexing


S1 INT D SD C T R √
S2 INT D SD C T R √
Consta
D INT D R √
nt

⚫ 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

b15 -- -- -- -- -- --b8 b7 -- -- -- -- -- -- b0 b15 -- -- -- -- -- --b8 b7 -- -- -- -- -- -- b0

S . +0 MSB LSB
D . +0 00H MSB

+1 MSB LSB +1 00H LSB

… … +2 00H MSB

n/2※ MSB LSB n


+3 00H LSB bytes

※ When n is an odd number, the … …


carry is carried out to obtain a value. +n-
00H MSB
When n=5, the value is S . +2 2
+n-
00H LSB
1

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

+1 56H 78H +1 00H 39H


When
+2 FEH DCH +2 00H 56H
n=5

Omitted when +3 00H 78H


n=5. +4 00H FEH

Store H00.

3. When S2=0, the instruction is not executed.


4. The source and destination operands cannot overlap.
⚫ Application instance

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.

6.22.3 BTOW: Byte-unit data combination instruction

Applicable model VC3 VC5


LAD:
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: BTOW (S1) (D) (S2) Step length 7

Operand Type Applicable soft element Indexing


S1 INT D SD C T R √
S2 INT D SD C T R √
Consta
D INT D R √
nt

⚫ 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.

b15 -- -- -- b8 b7 -- -- -- -- -- -- -- -- -- b0 b15 -- -- -- -- -- --b8 b7 -- -- -- -- -- -- b0

S . +0 Data of 1st byte D . +0 1st byte 2nd byte

+1 Data of 2nd byte +1 3rd byte 4th byte


N …
+2 Data of 3rd byte …
bytes
… … n/2※ n-1th byte nth byte
+n-
Data of nth byte
1
MSB is omitted.

2. When S2 is odd, the least significant byte that is combined finally is cleared.
b15 -- -- -- -- -- --b8 b7 -- -- -- -- -- -- b0 b15 -- -- -- -- -- --b8 b7 -- -- -- -- -- -- b0

S. +0 ABH 12H D. +0 12H 34H

+1 CDH 34H +1 56H 78H


When +2 EFH 56H +2 9AH 00H
n=5
+3 ABH 78H
"H00" when
+4 CDH 9AH n=5

MSB is omitted.

3. When S2=0, the instruction is not executed.


4. The source and destination operands cannot overlap.
⚫ Application instance

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.

6.22.4 UNI: Instruction for combining 4bits of 16-bit data

Applicable model VC3 VC5


LAD:
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: UNI (S1) (D) (S2) Step length 7

Operand Type Applicable soft element Indexing


S1 INT D SD C T R √
S2 INT D SD C T R √
Consta
D INT D R √
nt

⚫ 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.

6.22.5 DIS: Instruction for separating 4bitsof 16-bit data

Applicable model VC3 VC5


LAD:
Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: DIS (S1) (D) (S2) Step length 7

Operand Type Applicable soft element Indexing


S1 INT D SD C T R √
S2 INT D SD C T R √
Consta
D INT D R √
nt

⚫ 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

Set to 0. Storage area

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.

6.22.6 ANS: Signal alarm set instruction

LAD: Applicable model VC3 VC5


Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: ANS (S1) (S2) (D) Step length 7

Operand Type Applicable soft element Indexing


S1 INT T √
Consta
S2 INT D R √
nt
D BOOL S √

⚫ Operand description SM401 is set to ON when


S1: Timing timer number for judging time, only applicable SM401 Signal alarm acts there is any action in state
S900-S999
for 100ms timer with the range of T0-T209
Mini.number of Storing the mini.number of
S2: Data for judging time (1—32767) SD401
the On state actions in S900-S999
D: Set signal alarm soft elements. Range: S900—S999 ⚫ Application instance
⚫ Function description
1. Setting D when the energy flow duration is greater than
S2; resetting the timer S1 and not setting D when the LD M0
energy flow duration of the instruction is less than S2; ANS T0 100 S901
resetting S1 when the energy flow is invalid, S1 reset. Setting S901 to on when the energy flow is valid, and not
Addre be disconnected within 10 seconds.
Name function
ss No.
When SM400 is set to ON,
Enable the signal
SM400 the following SM401 and
alarm
SD401 work

248
VC Series Micro-PLC Programming Manual Application instructions

6.22.7 ANR: Signal alarm reset instruction

LAD: Applicable model VC3 VC5


Influenced flag Zero flag, carry flag, and borrow
bit flag
IL: ANR Step length 1
Operand Type Applicable soft element Indexing

⚫ Operand description SM40 Signal alarm


SM401 is set to ON when
there is any action in state
No operand. 1 acts
S900-S999
⚫ Function description Mini.number of Storing the mini.number of
SD401
1. Resetting the running state of the signal alarms S900- the on state actions in S900-S999
S999 when the energy flow is valid; resetting the one with ⚫ Application instance
the mini. number if there are multiple state
actions;resetting the one with the next mini. number,
when the energy flow is valid again.
LD M1
Addre
Name function ANR
ss No.
Enable the When SM400 is set to ON, When the energy flow is valid, if there are multiple Ss set
SM40
0
signal alarm is the following SM401 and by ANS, the one with the mini. number is reset.
valid SD401 work

6.23 Other instructions

6.23.1 RND: Instruction for generating random numbers

LAD: Applicable model VC2 VC3 VC5

Influenced flag bit Zero flag bit

IL: RND (D) Step length 3


Operan
Type Applicable soft element Indexing
d
D INT KnX KnY KnM KnS KnLM KnSM D SD C T Z R √

⚫ Operand description ⚫ Application instance


D: Number of the start soft element that stores the
random number
⚫ Function description LD M1
1. When a pseudo-random number ranging from 0 to RND D0
32767 is generated,its value is stored in D as a random Generating a random number,storing it in D0, and
number; if the generated random number is 0, the zero D0=26406 when M1=ON.
flag bit (SM270) is set.

249
VC Series Micro-PLC Programming Manual Application instructions

6.23.2 DUTY: Instruction for generating timed pulses

LAD: Applicable model VC2 VC3 VC5

Influenced flag bit

IL: DUTY (S1) (S2) (D) Step length 7


Operan
Type Applicable soft element Indexing
d
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
D BOOL SM

⚫ 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

Chapter 7 SFC Tutor

This chapter introduces the basic programming concepts, basic and complex programming methods, and note ofSFC.
Chapter 7 SFC Tutor .......................................................................................................................................................251

7.1 Introduction to SFC............................................................................................................................................252


7.1.1 What is SFC ........................................................................................................................................... 252
7.1.2 What is SFC of VC series PLCs ............................................................................................................. 252
7.1.3 Basic concept of SFC ............................................................................................................................. 252
7.1.4 Programming symbols and their usage .................................................................................................. 252
7.1.5 SFC program structure ........................................................................................................................... 253
7.1.6 Execution of SFC program ..................................................................................................................... 257
7.2 Relationship between SFC and LAD .................................................................................................................258
7.2.1 STL instruction and step states .............................................................................................................. 258
7.2.2 SET instruction ....................................................................................................................................... 259
7.2.3 RET instruction and SFC program segment........................................................................................... 259
7.2.4 OUT instruction and RST instruction ...................................................................................................... 259
7.2.5 SFC selection branch, parallel branch and merge ................................................................................. 259
7.3 How to program With SFC .................................................................................................................................259
7.4 Notesin SFC programming ................................................................................................................................260
7.4.1 Common programming errors ................................................................................................................ 260
7.4.2 Programming tricks ................................................................................................................................ 263
7.5 Examples of SFC programming ........................................................................................................................264
7.5.1 Simple sequential structure .................................................................................................................... 265
7.5.2 Selection branch structure...................................................................................................................... 266
7.5.3 Parallel branch structure ........................................................................................................................ 269

251
VC Series Micro-PLC Programming Manual SFC Tutor

7.1 Introduction to SFC

7.1.1 What is SFC

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.

7.1.2 What is SFC of VC series PLCs

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.

7.1.3 Basic concept of SFC

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.

2. Execution of step state

In a SFC program, each step state is represented by a fixed S element.

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.

7.1.4 Programming symbols and their usage

⚫ Programming symbols
The VC series PLC SFC programming language consists of the following basic programming symbols:

Table 7-1 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 transfer. It can be built-in with a transfer condition (an embedded LAD).


You can compile the transfer condition so that the state of S element
Transfer
connected with this transfer is set when the condition is met, and enters the
next step state. The transfer symbol needs to be used between steps

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.

A merge of step branches, connected at the junction of the selection


Selection merge branches. When the transfer condition of one branch is met, the last step
state ends, and the next step state takes effect.

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.

A merge of parallel branches, connected at the junction of the parallel


Parallel merge branches. When the multiple parallel step branches are executed and the
transfer conditions are met, the next step state takes effect.

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.

⚫ Usage of programming symbols


1. An initial step symbol can be used alone. It cannot be preceded by other symbols, and can be followed only by the transfer
symbols.

2. A LAD block cannot be connected with other symbols.

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.

7.1.5 SFC program structure

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.

⚫ Simple sequential structure


The following figure shows a simple structured SFC program and its LAD counterpart.

253
VC Series Micro-PLC Programming Manual SFC Tutor

/*Validating step state S0 in the first scan cycle of the user


program*/

/*Processing step state S0*/

/*Processing step state S20*/

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.

⚫ Selection branch structure


The following figure shows a selection branch structure, with LAD on the left and SFC on the right.

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.

⚫ Parallel branch structure


The following figure shows a parallel branch structure, with LAD on the left and SFC on the right.

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).

7.1.6 Execution of SFC program

The similarity between the execution of a SFC program and that of a LAD program is that they both carry out 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.

7.2 Relationship between SFC and LAD


A SFC program can take the form of a LAD, which can help you understand the practical significance of the SFC program structure.

In a LAD, the SFC symbols are replaced with various corresponding SFC instructions, while the corresponding processes are
represented by various structures.

7.2.1 STL instruction and step states

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".

7.2.2 SET instruction

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.

7.2.3 RET instruction and SFC program segment

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.

The RET instruction can be used only in the main program.

7.2.4 OUT instruction and RST 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.

7.2.5 SFC selection branch, parallel branch and merge

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".

7.3 How to program With SFC


1. Analyzing the work flow and determining the program structure

The structure of a SFC program is classified into three types: simple sequential structure, selection branch structure and parallel
branch structure. Besides, the jump structure is also a special form of the selection branch structure.To program with SFC, the
first 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.

3. Making a SFC program according to a draft of the flow chart

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.

5. Inputting the steps and transfer conditions

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.

6. Programming the LAD program blocks

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.

7.4 Notesin SFC programming


The STL statement has some special characteristics, and the PLCs periodically scan the instruction statements by their display
order.Because of these reasons, there are several important notes in SFC programming.

7.4.1 Common programming errors

1. Reusing the stepstate symbols

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.

2. Setting branches after a transfer condition

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.

3. Connecting output coils to internal bus after a NC or NO contact instruction

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

4. Reusing the same soft element in the neighboring step states

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.

5. Failing to interlock the soft elements

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

6. Confusing jumps with transfers

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 same operation

Empty step state


Process 1 cannot end due

to the parallel structure

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

7.4.2 Programming tricks

1. Making use of empty step states

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.

2. Merging branches and transfer conditions

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

3. Using the function for saving data at power outage

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.

7.5 Examples of SFC programming


The examples in this section are just illustrations of SFC programming, with simplified operations and conditions. The device
configuration is conceptual and for study only. You cannot apply the example programs to actual use.

264
VC Series Micro-PLC Programming Manual SFC Tutor

7.5.1 Simple sequential structure

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

Tray in Battle plate Convey


complete

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.

The I/O points are listed in the following table.


SN Address Monitored objects SN Address Monitored objects
Cylinder solenoid valve for the
1 X0 Tray in limit switch 8 Y0
baffle plate
Cylinder solenoid valve for the
2 X1 In lift 1 limit switch 9 Y1
left lift
Cylinder solenoid valve for the
3 X2 Height OK limit switch 10 Y2
right lift
Conveying roller motor
4 X3 In lift 2 limit switch 11 Y3
contactor
Motor contactor for the left
5 X4 Convey complete switch 12 Y4
conveying belt
Motor contactor for the right
6 X5 Start switch 13 Y5
conveying belt
Auxiliary signal of
7 X6
emergency switch
This is a simple sequential process. Each tray is conveyed in several successive procedures, with no other choices or parallel
procedures, and no parallel flow. Writing the program with SFC would be faster and clearer than the conventional logic design
method.

265
VC Series Micro-PLC Programming Manual SFC Tutor
The following diagrams are the SFC program and its LAD counterpart.

Start, stop, and control the program section

Initial empty step

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.

Delay (0.8 s) time is up and start the next step


Start the roller motor (Y3)

In lift 2 limit switch (X3) acts to enter the next step


The left and right lifts lower and the conveying roller stops

X4 is reset to start a new round

7.5.2 Selection branch structure


The following example is a material mixing process flow. Through this flow, two kinds of products, namely A and B, are produced.
The following figure shows the illustration of the manufacturing device.
A minor
ingredient pipe B minor
Major ingredient Deionized water ingredient pipe
pipe Y0 valve
Y2 valve
Y1 major ingredient valve

Y5 stirring motor Y3 valve

Mixing pot

Rinsing nozzle Rinsing nozzle

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 I/O points are listed in the following table.


SN Address Monitored objects SN Address Monitored objects
1 X0 Deionized water valve open 10 X11 Evacuation valve open
2 X1 Deionized water valve closed 11 X12 Evacuation valve closed
Solenoid valve for deionized
3 X2 Major ingredient valve open 12 Y0
water
Solenoid valve for major
4 X3 Major ingredient valve closed 13 Y1
ingredient
Solenoid valve for minor
5 X4 Minor ingredient A valve open 14 Y2
ingredient A
Solenoid valve for minor
6 X5 Minor ingredient A valve closed 15 Y3
ingredient B
7 X6 Minor ingredient B valve open 16 Y4 Solenoid valve for evacuation
8 X7 Minor ingredient B valve closed 17 Y5 Mixing motor contactor
9 X10 Mixing motor running
Obviously this is a selection branch structured flow. You can select only one type of product, A or B, in a round of product production.
You can switch the type of product only when a round of production is completed.Meanwhile, there is a structure for selection and
jump in the process, namely the rinsing step.

The following diagrams are the SFC program and its LAD counter part.

Start and stop the


program section

Initial step

To process product To process the


different from last time, same product ,
enter the rinsing step as the last 。
time, enter next
Rinsing time (5 min) is up step

Add major ingredient

Branch for Branch for


product A product B

The mixing step


Time (20 min) is up
The evacuation step
Evacuation complete
Mark the product type
this time for the next
round
Enter the next round

267
VC Series Micro-PLC Programming Manual SFC Tutor

/*Reset M1-M3*/

/*D1 stands for the last product. 0: product A. 1: product B.*/

/*D2 stands for the next product. 0: product A. 1: product B.*/

/*M3 is the startup flag.*/

/*Start the operation*/

/*Stop the operation*/

/*Product selection operation*/

/*M1 is the screen operation bit of HMI interface.*/

/*M2 means the two adjacent products are different.*/

268
VC Series Micro-PLC Programming Manual SFC Tutor

/*Open the major ingredient value to add major ingredient.*/

/*Open ingredient A valve to add minor ingredient A.*/

/*Open ingredient B valve to add minor ingredient B.*/

/*Start the mixer.*/

/*Mix for 20 minutes.*/

/*Open the evacuation valve to evacuate finished product.*/

/*When the left material is less than 20 kg and half-minute has passed, enter the next step.*/

7.5.3 Parallel branch structure

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

Running direction of Bottled Bottled Bottled


the rotary palte product product product

Exit of rotary plate

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.

The I/O points are listed in the following table.

SN Address Monitored objects SN Address Monitored objects


Rotary plate station proximity
1 X0 8 X10 Capping cylinder rod BACK
switch
Bottle in position detection
2 X1 9 X11 Labelling cylinder rod BACK
switch
3 X2 Cap in position detection switch 10 X12 Eliminating cylinder rod BACK
4 X3 Labelling detection switch 11 Y0 Rotary plate motor
5 X5 Eliminating cylinder rod OUT 12 Y1 Capping cylinder
6 X6 Labelling cylinder rod OUT 13 Y2 Labelling cylinder
7 X7 Capping cylinder rod OUT 14 Y3 Eliminating cylinder
It is obvious that this is a parallel branch structured flow. After the rotating of the rotary plate, operations are performed in three
stations. After all the operations are performed in the three stations, the device performs the subsequent operations.The following
diagrams are the SFC program and its LAD counter part.

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

Start and stop the program section

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

Jump when no Jump upon Jump upon


Capping operations
bottle is in disqualified product qualified product
Mark the qualified position Elimination
product (M1) Labelling operation operation

Mark the qualified Reset the M3


product (M2) disqualification
flag

Parallel merge
Transfer the qualification flag states
from M1 to M2 and M2 to M3

/*…………Start a stop control program section……………*/

Start the switch Emergency switch

Start the switch


Capping qualified

Emergency switch

/*………SFC program section………*/

/*Initial step. Transfer condition: rising edge of X0, indicating rotary plate in position.*/

Rotary plate motor

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

/*Transfer condition for parallel merge*/

Capping rod Labelling Eiminating


back rod back rod back

/*Transfer capping qualified M1 state to labelling qualified state M2*/

/*Transfer labelling qualified M2 to elimination(of disqualified) success state M3*/

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

Chapter 8 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

8.1 High-speed counter ...........................................................................................................................................275


8.1.1 Configuration .......................................................................................................................................... 275
8.1.2 Relationship between high-speed counter and SM auxiliary relay ......................................................... 276
8.1.3 How to use the high-speed counters ...................................................................................................... 278
8.1.4 Notes about the VC1 series high-speed counters .................................................................................. 281
8.2 External pulse capture function .........................................................................................................................282
8.3 Notes on High-speed input application ..............................................................................................................282

274
VC Series Micro-PLC Programming Manual Operating guide for high-speed input function

8.1 High-speed counter

8.1.1 Configuration

The built-in high-speed counter for VC series micro-PLCs are configured as follows:

⚫ Configuration table of high-speed counter


Input
Max. frequency (kHz)
point

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

8.1.2 Relationship between high-speed counter and SM auxiliary relay

⚫ 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

8.1.3 How to use the high-speed counters

⚫ How to use the single-phase one point input high-speed counters


Characteristics: A single-phase one point input high-speed counter starts to count only when the pulse input changes from
OFF to ON, and the count direction is determined by its corresponding special auxiliary relay SM. An example of the action
is shown in the following figure.

The time sequence chart of the contact actions in the program is shown in the following figure.

⚫ How to use the single-phase bidirectional count inputhigh-speed counters


Characteristics: A single-phase bidirectional count input high-speed counter starts to count only when the pulse input
changes from OFF to ON, and the count direction is determined by their corresponding two input points. The state of the
high-speed counter is determined by its corresponding special auxiliary relay SM.

An example of the action 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.

⚫ How to use the two-phase count input high-speed counters


Characteristics: A two-phase count input high-speed counter starts to count only when the pulse input changes from OFF to
ON, 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.

An example of the action is shown in the following figure.


262

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.

An example of the action is shown in the following figure.

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.

8.1.4 Notes about the VC1 series high-speed counters

⚫ Classification of high-speed counters


C0-C235 are software counters, C236-C263 are hardware counters, Please select it according to the usage mode.

⚫ Max. frequency sum


The max. combined frequency cannot exceed 60kHz when multiple high-speed counters (hardware counting mode) are used
simultaneously or the high-speed counters (hardware counting mode) and the SPD instruction are used at the same time.

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.

• C256 is a two-phase counterwith max. counting frequency of 30kHz.

⚫ Max.frequency of software counters


281
VC Series Micro-PLC Programming Manual Operating guide for high-speed input function

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.

8.2 External pulse capture function


The input points that provide the external pulse capture function are X0–X7. The corresponding SM soft elements arelisted below:
Input hardware point SM element
X0 SM90
X1 SM91
X2 SM92
X3 SM93
X4 SM94
X5 SM95
X6 SM96
X7 SM97

 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.

8.3 Notes on High-speed input application


The input points X0–X7 are used as input signals in functions such as high-speed counter, SPD instruction, pulse capture, and
external interrupt. However, these functions cannot be used at the same time, because many different functions may use the
same one or multiple input points. Therefore, during the PLC programming, only one of the several functions that aninput point
can provide is available. If the X0–X7 input pointsare used repeatedly in the user program, the user program cannot be compiled.

282
VC Series Micro-PLC Programming Manual Using Interrupts

Chapter 9 Using Interrupts

This chapter detailedly describes the mechanisms, processing procedures, and usages of various interrupts.
Chapter 9 Using Interrupts ...............................................................................................................................................283

9.1 Interrupt program ...............................................................................................................................................284


9.2 Processing interrupt event .................................................................................................................................286
9.3 Using timed interrupt .........................................................................................................................................286
9.4 Using external interrupts ....................................................................................................................................289
9.5 Using high-speed counter interrupt....................................................................................................................290
9.6 Using PTO output completion interrupt ..............................................................................................................291
9.7 Using serial port-based interrupt........................................................................................................................292

283
VC Series Micro-PLC Programming Manual Using Interrupts

9.1 Interrupt program


When an interrupt event occurs, the normal scan cycle is interrupted and the interrupt program is called and executed with
priority,which is called the interrupt processing mechanism. For the time-critical and event-triggered control tasks, you often need
to adopt this special system processing mechanism.

The system provides many kinds of programmable interrupt resources. Each kind of interrupt resource can trigger a type of
interrupt events, and each type of interrupt eventsis independently numbered.

In order to deal with a certain interrupt event, you must compile a processing program, that is, an interrupt program,

which is an independent POU that constitutes the user 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

COM 0 frame Position-based interrupt 4 of


16 SM41 49 SM107
transmission interrupt high-speed output

COM 0 frame receiving Position-based interrupt 5 of


17 SM42 50 SM108
interrupt high-speed output

COM 1 frame Position-based interrupt 6 of


18 SM43 51 SM98
transmission interrupt high-speed output

COM 1 frame receiving Position-based interrupt 7 of


19 SM44 52 SM99
interrupt high-speed output
COM 2 frame
20 SM45
transmission interrupt
COM 2 frame receiving
21 SM46
interrupt
22 Timed interrupt 0 SM47
23 Timed interrupt 1 SM48
24 Timed interrupt 2 SM49
PTO (Y0) output
25 SM50
completioninterrupt
PTO (Y1) output
26 SM51
completion interrupt
PTO (Y2) output
27 SM52
completion interrupt

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

9.2 Processing interrupt event


1. When a certain interrupt event occurs, if it has been enabled, its corresponding event number is added to the interrupt request
queue record, which is afirst-in-first-out queue with 8-record long.

2. Processing of the interrupt request by the system:

(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.

9.3 Using timed interrupt


⚫ Description of the timed interrupt
The timed interrupt is the interrupt event generated by the system periodically based on the set intervals.

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.

Table 9-1 Timed interrupt resource list


(SD)Intervals of timed
Timed interrupt Interrupt event number Enable control (SM)
interrupt (SD)
0 22 SD47 SM47
1 23 SD48 SM48
2 24 SD49 SM49

 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.

⚫ Application instance of the timed interrupt


In the application instance, the system upsets the output of Y0 once a second based on the timed interrupt 0, which makes
Y0 flashing periodically.

1. Writing an interrupt program for the interrupt event.

2. Specifying an interrupt event number for the interrupt program:

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).

9.4 Using external interrupts


⚫ Description of the external interrupts
The external interrupts are related to the actual input points of the PLCs, which are classified into input rising edge interrupt
and input falling edge interrupt. In the user program, they add the actions related to external events to the external interrupt
program.

The highest response frequency of the system to the external event is 1K. The external events over 1K may be lost.

The rising edge interrupt and falling edge interrupt cannot be used on the same port simultaneously. All the external interrupts
are only valid when the global interrupt control EI and corresponding enabling SM are valid.

The detailed relationship is as follows:


Interrupt number Enabling element Interrupt number Enabling element
0 or 8 SM25/SM33 4 or 14 SM29/SM37
1 or 9 SM26/SM34 5 or 15 SM30/SM38
2 or 10 SM27/SM35 6 or 16 SM31/SM39
3 or 11 SM28/SM36 7 or 17 SM32/SM40

The external interrupts are numbered as follows:


Interrupt number Interrupt source Interrupt number Interrupt source
0 X0 input rising edge interrupt 9 X1 input falling edge interrupt
1 X1 input rising edge interrupt 10 X2 input falling edge interrupt
2 X2 input rising edge interrupt 11 X3 input falling edge interrupt
3 X3 input rising edge interrupt 12 X4 input falling edge interrupt
4 X4 input rising edge interrupt 13 X5 input falling edge interrupt
5 X5 input rising edge interrupt 14 X6 input falling edge interrupt
6 X6 input rising edge interrupt 15 X7 input falling edge interrupt
7 X7 input rising edge interrupt 16 Reserved
8 X0 input falling edge interrupt 17 Reserved
The single input pulse frequency of X0 - X7 is less than 200Hz.

289
VC Series Micro-PLC Programming Manual Using Interrupts

⚫ Application instance of the external interrupt


In the application instance, the system upsets the output of Y0 based on the corresponding external interrupt 0 function and
rising edge input event of X0.

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.

9.5 Using high-speed counter interrupt


⚫ Description of the high-speed counter interrupt
The high-speed counter interrupt is valid only when it is used together with the HCNT instruction or DHSCI instruction, and
generates high-speed counter interrupt based on the count value of the high-speed counter. You can compile programs
related to external pulse input in the high-speed interrupt program. All high-speed counter interrupts (33-40) arevalid only
when the EI instruction and corresponding interrupt enable flag are valid.

⚫ Application instance of the high-speed counter interrupt

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.

9.6 Using PTO output completion interrupt


⚫ Description of the PTO output completioninterrupt
The PTO output completion interrupt is triggered when the enable flag (SM50,SM51,SM52) is set and the high-speed pulse
output at Y0,Y1,Y2 is finished. You can carry out the relevant processing in the interrupt subprogram.

⚫ Application instance of the PTO output completion interrupt


In the application instance, the system uses the high-speed pulse output of Y0 to respond to the interrupt program (number
25) when Y0 high-speed pulse output is finished.

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.

9.7 Using serial port-based interrupt


⚫ Description of the serial port-based interrupt
When a serial port is in the free-port protocol mode, the system generates an interrupt event according to the sending or
receiving events of the serial port.

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.

Serial-port interrupt resource list:


Interrupt number Interrupt event Interrupt enabling SM
16 Frame sending interrupt of PORT0 SM41

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

Chapter 10 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

10.1 Communication resources ...............................................................................................................................296


10.2 Programming port communication protocol .....................................................................................................296
10.3 Free-port communication protocol ...................................................................................................................296
10.3.1 Introduction .......................................................................................................................................... 296
10.3.2 Parameters setting of free-port............................................................................................................. 296
10.3.3 Free-port instruction ............................................................................................................................. 298
10.4 Modbus communication protocol .....................................................................................................................299
10.4.1 Introduction .......................................................................................................................................... 299
10.4.2 Characteristics of links ......................................................................................................................... 299
10.4.3 RTU transmission mode ....................................................................................................................... 299
10.4.4 Supported Modbus function codes ....................................................................................................... 300
10.4.5 Addressing mode of the PLC elements ................................................................................................ 300
10.4.6 Modbus slave station ........................................................................................................................... 301
10.4.7 Reading and writing elements .............................................................................................................. 301
10.4.8 Processing of double word element ..................................................................................................... 302
10.4.9 Processing of LONG INT data .............................................................................................................. 302
10.4.10 Diagnostic function code .................................................................................................................... 302
10.4.11 Error code .......................................................................................................................................... 303
10.4.12 Modbus parameter setting.................................................................................................................. 303
10.4.13 Modbus instruction ............................................................................................................................. 304
10.5 N:N communication protocol ...........................................................................................................................306
10.5.1 N:N introduction ................................................................................................................................... 306
10.5.2 N:N network data transmission form .................................................................................................... 306
10.5.3 N:N network structure .......................................................................................................................... 307
10.5.4 N:N refresh mode ................................................................................................................................. 308
10.5.5 Enhanced refresh mode ....................................................................................................................... 312
10.5.6 N:N parameter setting .......................................................................................................................... 313
10.6 Several control strategies ................................................................................................................................315
10.6.1 Determination of the master station ..................................................................................................... 315
10.6.2 Maximum number of inspection stations .............................................................................................. 315
10.6.3 Multi-master and slave (M: N) .............................................................................................................. 315
10.6.4 Examples of using N:N ......................................................................................................................... 315

295
VC Series Micro-PLC Programming Manual Communication function guide

10.1 Communication resources


The baud rates applicable to VC series small PLC are listed in the following table:
Communication protocol Applicable baud rate
Free-port protocol, Modbus protocol 115200, 57600, 38400, 19200, 9600, 4800, 2400, 1200
N:N protocol 115200, 57600, 38400, 19200, 9600, 4800, 2400, 1200
Communication protocols supported by the VC series micro-PLCs are listed in the following table.
Main Communicati
Port type Supported protocol
module on port
Programming port protocol, free-port protocol, Modbus communication protocol
PORT0 RS232
VC1S (slave station), and N:N communication protocol (master and slave station)
(Planning) Free-port protocol, Modbus communication protocol (master station and slave
PORT1 RS485
station), and N:N communication protocol (master and slave station)
PORT0 RS232 Programming port protocol, Modbus communication protocol (slave station)
Free-port protocol, Modbus communication protocol (master station and slave
PORT1 RS485
station), and N:N communication protocol (master and slave station)
VC1
Free-port protocol, Modbus communication protocol (master station and slave
PORT2 RS485
station), and N:N communication protocol (master and slave station)
PORT3 USB Programming port protocol
Programming port protocol, free-port protocol, Modbus communication protocol
PORT0 RS232
(slave station), and N:N communication protocol (master and slave station)
Free-port protocol, Modbus communication protocol (master station and slave
VC2 PORT1 RS485
station), and N:N communication protocol (master and slave station)
VC3
Free-port protocol, Modbus communication protocol (master station and slave
VC5 PORT2 RS485
station), and N:N communication protocol (master and slave station)
(Planning)
PORT3 USB Programming port protocol
PORT4 Ethernet Programming port protocol, Modbus_TCP(master and slave station)
PORT5 CAN CANopen(master and slave station)
Besides, you can set the mode selection switch of the VC series micro-PLCs (RUN-STOP) so as to forcibly transfer PORT0 into
the programming port protocol.

10.2 Programming port communication protocol


The programming port protocol is an internal protocol dedicated to the communication between the PC software Auto Studio and
the main module.USB, network port, and serial port can be used to communicate with the main module. Only one of them can be
selected for monitoring, and they cannot be used simultaneously.

10.3 Free-port communication protocol

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).

10.3.2 Parameters setting of free-port

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.

Configurable items are listed in the following table.


Item Setting content Remark
115200, 57600, 38400, 19200, 9600, 4800,
Baud rate -
2400, 1200. Default: 9600
Data bit 7 or 8 (default) -
Parity check None (default), odd, even -
Stop bit 1 (default) or 2 -
Allow the start
Enabled or disabled (default) -
character detection
Start receiving after the designated start character is
Start character detected, and saving the received characters
0–255 (corresponding to 00–FF)
detection (including the start character) to the designated
buffer
Allow the end
Enabled or disabled (default) -
character detection
End character Stopping receiving after the preset end character is
0–255 (corresponding to 00–FF)
detection received, and saving the end character to the buffer
Allow the interframe
Enabled or disabled (default) -
timeout
Stop receiving if the interval between two received
Intercharacter timeout 0–65535 ms characters is longer than the preset intercharacter
timeout

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.

10.3.3 Free-port instruction

⚫ 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

1. First, you need to change the setting of


communication port in the system block to free-
port communication and set the related
parameters, such as baud rate and parity.
2. Storing the to-be-sent data in the
communication BFM buffer starting from D0,
sending data through the XMT instruction, and
resetting SM122 (sending completion flag bit)
before the sending when SM1 is valid.
3. Setting SM122 after the data is sent, and
beginning to receive data upon the rising edge.
The max. length for the received characters is 6.
4. Setting SM123 after the data is received, and
performing the corresponding operations based
on the receiving completion information register
(SD125).
5. Using X5 as the enable bit for interrupting the
sending and receiving.

Example 2: Sending the data through PORT1, and then receiving the data.

298
VC Series Micro-PLC Programming Manual Communication function guide

Different from "Example 1", before sending the


high and low bytes of a word element, the word
element needs to be divided into two parts: high
and low bytes.
For instance, if you want to send the content of D2,
you can store its high bytes and low by
tesseparately in D3 and D4, and then send D3 and
D4. You can also store the data in a K4MX (such
as K4M0 in this program)element, and then take
K2M0 as the high byte and K2M8 as the low byte.

10.4 Modbus communication protocol

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.

10.4.2 Characteristics of links

1. Physical layer: RS-232 and RS-485

2. Link layer: asynchronous transmission mode

(1) Data bit: 8 bits (RTU)

(2) Transmission rate: 1200, 2400, 4800, 9600, 19200, 38400, 57600, and 115200

(3) Parity method: even , odd, or none

(4) Stop bit: 1 or 2 stop bits

3. Networking configuration: a maximum of 31 sets of equipments. Address range: 1–247. Broadcast is supported.

10.4.3 RTU transmission mode

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.

4. Using the CRC16 check.

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.

The interval of 3.5 characters is 1/19200×11×3.5×1000 = 2ms.

10.4.4 Supported Modbus function codes

Supported Modbus function codesinclude 01, 02, 03, 05, 06, 08, 15, and 16.

10.4.5 Addressing mode of the PLC elements

1. Mapping between read-write element function codes and the elements:


Name of function
Function code Modicon data address Type of operable element Remark
code
01 Read coils 0note 1:xxxx Y, X, M, SM, S, T, and C Bit read
02 Read discrete input 1note 2:xxxx X Bit read
03 Read registers 4note 3:xxxxnote 4 D, SD, Z, T, C, and R 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, C, and R 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, C, and R 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 from 1 to 9999 (protocol address starts
from 0).
5. 0, 1 and 4 do not have the physical meaning and are not involved in actual addressing.
6. Users shall not write X element with function codes 05 and 15, otherwise, the system does not feed back the error information
if the
written operands and data are correct, but the system does not perform any operation on the write instruction.
2. Mapping between the PLC elements and Modbus communication protocol address:
Eleme Protocol Supported
Type Physical element Remark
nt address function code
Y0–Y777
Output state, element number: Y0–
Y Bit (octal code) 512 points in 0000–0511 01, 05, and 15
Y7 and Y10–Y17
total
X0–X777 Input state, it supports two kinds of
01, 02, 05 and
X Bit (octal code) 512 points in 1200–01711 addresses, and the element number
15
total is same as the above
M0–M2047 2000–4047
M Bit 01, 05, and 15
M2048–M10239 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

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.

10.4.6 Modbus slave station

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).

10.4.7 Reading and writing elements

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.

The examples are as follows:

1. Sending from the master station: 01 01 00 00 01 00 3D 9A

01 – address; 01- function code; 00 00 – starting address; 01 00 – number of read elements; 3D 9A – check

Response of the slave station: providing correct response

2. Sending from the master station: 01 01 00 00 01 01 FC 5A

The master station reads 01 01 (257) elements starting from 0000, which is beyond the defined number of Y elements.

Response of the slave station: 01 81 03 00 51

The response of the slave station is illegal data value, because 257>256, and 256 is the allowed max. number of Y elements.

3. Sending from the master station: 01 01 00 64 00 A0 7D AD

00 64 (decimal 100) is the start address for themaster station to read, and 00 A0 (decimal 160) is the number of elements.

Response of the slave station: 01 81 02 C1 91

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.

4. Sending from the master station: 01 04 00 02 00 0A D1 CD

The master station sends the frame of function code 04

Response of the slave station: 01 84 01 82 C0


301
VC Series Micro-PLC Programming Manual Communication function guide

The response of the slave station is illegal function codes.

 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.

10.4.8 Processing of double word element

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:

Sending from the master station: 01 03 25 E5 00 04 5E F2

The start address for the reading of master station: 4 word elements of 25 E5 (decimal 9701)

Response of the slave station: 01 83 02 C0 F1

Response of the slave station: illegal data address

Sending from the master station: 01 03 25 E4 00 05 CE F2

The start address for the master station reading: 5 word elements of 25 E5

Response of the slave station: 01 83 03 01 31

The slave station returns the illegal data.

10.4.9 Processing of LONG INT data

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.

10.4.10 Diagnostic function code

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

10.4.11 Error code

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.

10.4.12 Modbus parameter setting

⚫ Setting the communication port in the system block


There are two serial ports (PORT0 and PORT1) on the communication port interface. PORT0 only supports the Modbus
slave station while PORT1 and PORT 2 supports both the Modbus master and slave stations.

⚫ Setting the Modbus communication protocol parameters


There is a button of default value on the Modbus operand interface. The default value is the communication setting
recommended by the Modbus communication protocol. For details about the parameter setting items, you can refer to the
following table.
Item Setting content
Station No. 0–247
Baud rate 115200, 57600, 38400, 19200, 9600, 4800, 2400, 1200
Data bit Setting to 7 or 8 bits:7 bits for ASCII mode, and 8 bits for RTU mode
Parity check Setting to none, odd, and even
Stop bit Setting to 1 or 2: 1 for odd or even check, and 2 for none.
It can be set to master or slave station: PORT1 can be set to master/slave station, and PORT0 can
Modbus master/slave
only be set to slave station
Transmission mode Selecting RTU or ASCII mode

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.

10.4.13 Modbus instruction

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.

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 address of the register to be read is 11 (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.

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

1. Designating 5 as the address of the slave


station
to be accessed (it is saved to D0).
2. Designating 3 as the function code (it is saved
to D1).
3. The start address of the register to be read is
40 (it is saved to D2/D3 according to MSB and
LSB).
4. The number of the registers to be read is 4.
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.

10.5 N:N communication protocol

10.5.1 N:N introduction

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.

10.5.2 N:N network data transmission form

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).

Master station (1#) Master station (1#)

Token
1# Data 1# Data 1# Data

Slave Slave Slave Slave Slave Slave


station (2#) station (3#) station (N#) station (2#) station (3#) station (N#)

RS485
RS485

Figure 10-1 Master station broadcasts Figure 10-2 Master station sends the token to 2#
slave station

Master station (2#) Master station (1#)

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

Master station (1#)


Master station (1#)

3# Data

Slave
station (3#)
Slave Slave Slave
3# Data 3# Data station (2#) station (N#)
station (3#)

RS485

Slave Slave Figure 10-6 Token issue and flow orders


station (2#) station (N#)
RS485

Figure 10-5 3#slave station broadcasts


Figure 10-6 shows the flow order of tokens. The heavy line indicates the actual process of issuing the token, and the dashed line
indicates the order of the station in which the token is held and broadcasted. You need to note that the token is not passed by one
slave station(such as 2#PLC) to another slave station (such as 3#PLC), but the token is first issued by the master station to 2#PLC,
and then issued by the master station to 3# PLC.

10.5.3 N:N network structure

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

Figure10-7 N:N single-layer network

Figure10-8 N:N multiple-layer network

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.

10.5.4 N:N refresh mode

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# PLC 1# PLC 2# PLC ... 7# PLC

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.

⚫ Distribution of D element on N:N single-layer network


Distribution of D
elements in Mode 1 Mode 2 Mode 3 Mode 4 Mode 5
sending area
D7700–D7701 #0
#0
D7702–D7703 #1
#0
D7704–D7705 #2
#1
D7706–D7707 #3
#0
D7708–D7709 #4
#2
D7710–D7711 #5
#1
D7712–D7713 #6
#3
D7714–D7715 #7
#0
D7716–D7717 #8
#4
D7718–D7719 #9
#2
D7720–D7721 #10
#5
D7722–D7723 #11
#1
D7724–D7725 #12
#6
D7726–D7727 #13
#3
D7728–D7729 #14
#7
D7730–D7731 #15
D7732–D7733 #16
#8
D7734–D7735 #17
#4
D7736–D7737 #18
#9
D7738–D7739 #19
#2
D7740–D7741 #20
#10
D7742–D7743 #21
#5
D7744–D7745 #22
#11
D7746–D7747 #23
#1
D7748–D7749 #24
#12
D7750–D7751 #25
#6
D7752–D7753 #26
#13
D7754–D7755 #27
#3
D7756–D7757 #28
#14
D7758–D7759 #29
#7
D7760–D7761 #30
#15
D7762–D7763 #31
For example:

(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.

⚫ Distribution of M element on N:N single-layer network


Distribution of M
elements in Mode 1 Mode 2 Mode 3 Mode 4 Mode 5
sending area
M1400–M1415 #0
#0
M1416–M1431 #1 #0 #0 #0
M1432–M1447 #2 #1

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.

⚫ Distribution of D element on N:N multiple-layer network (layer 0)


Distribution of D
elements in sending Mode 6 Mode 7 Mode 8 Mode 9
area
D7700–D7701 #0
#0
D7702–D7703 #1
#0
D7704–D7705 #2
#1
D7706–D7707 #3
#0
D7708–D7709 #4
#2
D7710–D7711 #5
#1
D7712–D7713 #6
#3
D7714–D7715 #7
D7716–D7717 #8
#4
D7718–D7719 #9
#2
D7720–D7721 #10
#5
D7722–D7723 #11
#1
D7724–D7725 #12
#6
D7726–D7727 #13
#3
D7728–D7729 #14
#7
D7730–D7731 #15

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.

⚫ Distribution of D elements on N:N multiple-layer network (layer 1)


Distribution of D
elements in sending Mode 10 Mode 11 Mode 12 Mode 13
area
D7732–D7733 #0
#0
D7734–D7735 #1
#0
D7736–D7737 #2
#1
D7738–D7739 #3
#0
D7740–D7741 #4
#2
D7742–D7743 #5
#1
D7744–D7745 #6
#3
D7746–D7747 #7
D7748–D7749 #8
#4
D7750–D7751 #9
#2
D7752–D7753 #10
#5
D7754–D7755 #11
#1
D7756–D7757 #12
#6
D7758–D7759 #13
#3
D7760–D7761 #14
#7
D7762–D7763 #15
For example:

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.

⚫ Distribution of M elements on N:N multiple-layer network (layer 0)


Distribution of M
elements in sending Mode 6 Mode 7 Mode 8 Mode 9
area
M1400–M1415 #0
#0
M1416–M1431 #1
#0
M1432–M1447 #2
#1
M1448–M1463 #3
#0
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
M1624–M1639 #14
#7
M1640–M1655 #15

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.

⚫ Distribution of M elements on N:N multiple-layer network (layer 1)

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!

10.5.5 Enhanced refresh mode

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).

The M component areas (512) are shown in the following table:


Distribution of M elements Mode 14 Mode 15 Mode 16 Mode 17 Mode 18
M1400-M1415 #0
#0
M1416-M1431 #1
#0
M1432-M1447 #2
#1
M1448-M1463 #3
#0
M1464-M1479 #4
#2
M1480-M1495 #5
#1
M1496-M1511 #6
#3
M1512-M1527 #7
#0
M1528-M1543 #8
#4
M1544-M1559 #9
#2
M1560-M1575 #10
#5
M1576-M1591 #11
#1
M1592-M1607 #12
#6
M1608-M1623 #13
#3
M1624-M1639 #14
#7
M1640-M1655 #15
M1656-M1671 #16
#8
M1672-M1687 #17
#4
M1688-M1703 #18
#9
M1704-M1719 #19
#2 #1
M1720-M1735 #20
#10
M1736-M1751 #21
#5
M1752-M1767 #22
#11
M1768-M1783 #23

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

10.5.6 N:N parameter setting

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

10.6 Several control strategies

10.6.1 Determination of the master station

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.

10.6.2 Maximum number of inspection stations

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.

10.6.3 Multi-master and slave (M: N)

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.

10.6.4 Examples of using N:N

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:

Programming 0#: MOV D100 D7700

Programming 2#: MOV D305 D7716

Programming 4#: ADD D7700 D7716 D500

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

Chapter 11 Positioning function guide

Chapter 11 Positioning function guide .............................................................................................................................316

11.1 Positioning control system ...............................................................................................................................317


11.1.1 Absolute position system...................................................................................................................... 317
11.1.2 Positioning control system.................................................................................................................... 318
11.1.3 Process of positioning control .............................................................................................................. 319
11.2 Overview of the VC series PLC positioning functions ......................................................................................319
11.3 Note of using the positioning instructions ........................................................................................................322
11.4 Special elements related to the positioning instructions ..................................................................................323
11.4.1 Outputaxes of the VC series PLC ........................................................................................................ 323
11.4.2 Outputaxes of the VC1 series PLC ...................................................................................................... 324
11.5 Application instance.........................................................................................................................................324
11.5.1 Configuration method of the PLS envelope instruction ........................................................................ 324

316
VC Series Micro-PLC Programming Manual Positioning function guide

11.1 Positioning control system

11.1.1 Absolute position system

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.

PLC Instruction pulse output Servo amplifier AC power

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

Encoder Servo motor

Figure 11-1 Absolute position system function diagram

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

Front end Back end


Servo motor

Lead screw

DOG signal ON ON
state

OFF
OFF Table
position

317
VC Series Micro-PLC Programming Manual Positioning function guide

Figure 11-2 Mechanical example diagram of an absolute position system

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.

11.1.2 Positioning control system

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.

Figure 11-3 Open-loop control system diagram

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.

Figure 11-4 Closed-loop control systemdiagram

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

Figure 11-5Semi-closed loop control system diagram

11.1.3 Process of positioning control

Start

11.2 Overview of PLC positioning functions


Refer to chapters
Confirm the positioning function

11.3 Note of using the positioning instructions

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

Figure 11-6 Process of positioning control

11.2 Overview of the VC series PLC positioning functions


The positioning functions supported by VC series PLCs include simple pulse output positioning, two-axis linear and arc trajectory
interpolation, and inter-axis synchronous motion control, which can be widely used in positioning control systems to control the
stepping and servo drives of various brands. The absolute position data can be obtained by the means provided by the
corresponding servo drive.

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

FWD REV FWD REV

Figure 11-7 Definition of pulse output form

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.

Table 11-2 Positioning function list of VC series PLC main modules


Name Action Content VC3 VC2 VC1 VC1S
It acts according to the
specified zero return speed and
Origin return speed
can automatically search for the
DOG signal. Decelerating to the
Speed crawling speed once the DOG
DSZR Crawling speed
● ● ●
is detected (the sensor of DOG
Zero:ON DOG:ON Startup is ON). Stopping when a zero
signal is inputted, the ZRN is
completed.

It acts according to the


specified zero return speed and
Zero return speed decelerates to the crawling
speed once the DOG is
Speed detected (the sensor of DOG is
Crawling speed
ZRN ● ● ● ●
ON). Stopping when the sensor
DOG:OFF DOG:ON Startup
of DOG is OFF, and the ZRN is
completed.

It acts according to the set


Running speed
running speed, stops at the
Speed target position, and uses
DRVI Movement
● ● ● ●
relative coordinates for the
Startup Target position position.

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.

Reading the current absolute


ABS position data from the servo
drive.

It acts according to the set


Running speed
running speed.
Speed If the interrupt input is ON, it
DVIT ●
runs the specified number of
Interrupt input pulses and then decelerates to
Startup Movement
ON
stop.

When a positioning operation is


Running speed
being executed, if this
Speed instruction is started, it runs the
STOPDV ● ●
specified number of pulses and
Startup Movement then decelerates to stop.

Target position(x,y) It moves to the target position


along the circular trajectory in
CW ●
the clockwise direction at the
Target position specified linear speed.
Start point Circle center position
(x,y)

It moves to the target position


along the circular trajectory in
CCW ●
Start point
Passing position
the anti-clockwise direction at
the specified linear speed.

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 slave axis moves with the


spindle axis and keeps pace
Slave
axis
with it within a specified position
move Total
ment movement range, supporting the
MOVELIN
acceleration/deceleration
K
Spindle axis control during the transition
movement
process before and after the
synchronization.
Slave
axis
speed

Startup Speed Synchronization End


synchronization completed

It controls the slave axis to


move with the spindle axis
GEARBO
according to a certain electronic
X
gear ratio.

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.

11.3 Note of using the positioning instructions


When the positioning instruction or high-speed instruction is valid (including the output is completed), other operations on the
same port are invalid. Other instructions have the correct output only when the high-speed pulse output instruction is invalid.

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.

⚫ Requirements for positioning instructions in programming


Positioning instructions can be used repeatedly in the program, but you need to pay attention to:

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.

11.4 Special elements related to the positioning instructions

11.4.1 Outputaxes of the VC series PLC

The definition and assignment of the output axes of the VC1 series PLCs are shown in the table below.

Table 11-3 Definition of the VC1-1616MAT output axis


Output Supported Output mode definition
Definition of the output points
axis mode
Pulse Y0
Pulse + direction
Pulse +
0 Directi Any output points except OFF
direction Pulse
on Y0 ON

OFF
Pulse + Pulse Y1 Direction
ON
direction
FWD REV

1 Directi Any output points except


on Y1
FWD + REV
OFF
Pulse + Pulse Y2 FWD
ON
direction
OFF
REV
2 Directi Any output points except ON
on Y2
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

11.4.2 Outputaxes of the VC1 series PLC


The definition and assignment of the output axes of the VC1 series PLCs are shown in the table below.
Table 11-5 Definition of the VC1 series output axis
Output Supported Output mode definition
Definition of the output points
axis mode

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

11.5 Application instance

11.5.1 Configuration method of the PLS envelope instruction

⚫ Configuration method of the PLS envelope instruction


The PLS instruction is generated by using the PTO instruction wizard. In Auto Studio, you can select Tool ->Instruction
Wizard... to configure the PLS instruction. Selecting PTO as shown below.

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

Appendix A 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).

1. PLC working state flag


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
Monitoring This bit is always ON in RUN, and OFF in
SM0 R √ √ √ √ √
run bit STOP.
This bit is set high when the user program
Initial run
SM1 changes from STOP to RUN, and set low after R √ √ √ √ √
pulse bit
a scan cycle
Power-on This bit is set ON after the system is powered-
SM2 R √ √ √ √ √
flag bit on, and set OFF after a scan cycle
This bit is set when a system error occurs after
System
SM3 power-on or after PLC changes from STOP to R √ √ √ √ √
error
RUN, or reset if no system error occurs
This bit is set when the battery voltage is too
Battery
SM4 low, or reset if the battery voltage is detected R √ √ √ √
voltage low
to be higher than 2.4 V.
If this bit is set to 1 (configurable only through
No battery the system block), the system does not report
SM7 working errors caused by loss of battery backup data R √ √ √ √
mode or loss of forcing tables upon backup battery
failure.
Constant Setting this bit, and the scan time is constant
SM8 R √ √ √ √ √
scan mode (configurable only through the system block)
Setting this bit, and the PLC can changes
Startup
from STOP to RUN when the designated X
SM9 mode of the R √ √ √ √ √
input point is ON (configurable only through
input point
the system block)

2. Clock running bit


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
Clock oscillation in 10 ms cycle (reversing every
10 ms
SM10 half cycle. The first half cycle is 0 during the R √ √ √ √ √
clock
operation of the user program)
Clock oscillation in 100 ms cycle (reversing every
100 ms
SM11 half cycle. The first half cycle is 0 during the R √ √ √ √ √
clock
operation of the user program)
Clock oscillation in 1 s cycle (reversing every half
SM12 1 s clock cycle. The first half cycle is 0 during the operation R √ √ √ √ √
of the user program)
1 min Clock oscillation in 1 min cycle (reversing every
SM13 clock half cycle. The first half cycle is 0 during the R √ √ √ √ √
operation of the user program)
Clock oscillation in 1 hour cycle (reversing every
1 hour
SM14 half cycle. The first half cycle is 0 during the R √ √ √ √ √
clock
operation of the user program)
Scan
This bit is reversed once every scan cycle (The
cycle
SM15 first cycle is 0 during the operation of the user R √ √ √ √ √
oscillati
program)
on bit

328
VC Series Micro-PLC Programming Manual Special auxiliary relay

3. User program execution error


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
This bit is set upon the instruction execution error,
Instruction
and the corresponding error type code is written
SM20 execution R √ √ √ √ √
into SD20. This bit is reset after the application
error
instruction is correctly executed.
Instruction
element This bit is set upon the instruction execution
SM21 number error, and the corresponding error type code is R √ √ √ √ √
subscript written into SD20.
overflow
This bit is set upon the instruction execution error,
Instruction
and the corresponding error type code is written
SM22 parameter R √ √ √ √ √
into SD20. This bit is reset after the application
illegal
instruction is correctly executed.

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

6. 0peration flag bit


Address Name Function R/W VC1S VC1 VC2 VC3 VC5
This bit is set when the related
SM80 Zero flag bit calculated result is zero. You R/W √ √ √ √ √
can clear this bit manually
This bit is set when the related
SM81 Carry/overflow flag bit calculated result is a carry. You R/W √ √ √ √ √
can clear this bit manually
This bit is set when the related
SM82 Borrow flag bit calculated result is a borrow. R/W √ √ √ √ √
You can clear this bit manually

7. DHST/DHSP Table comparison completion flag


Address Name Function R/W VC1S VC1 VC2 VC3 VC5
Set to ON,when the table
SM83 Table comparison flag R/W √ √ √ √ √
record is completed.

8. ASCII code conversion instruction flag


Address Name Function R/W VC1S VC1 VC2 VC3 VC5
0: MSB/LSB of each word
ASCII instruction storage mode stores one ASCII code
SM85 R/W √ √ √ √ √
flag 1: LSB of each word stores one
ASCII code

9. Pulse capture monitoring bit


Address Name Function R/W VC1S VC1 VC2 VC3 VC5
Input X0 pulse capture
SM90 R/W √ √
monitoring bit
Input X0 pulse capture
SM91 (1) All the elements in the table are R/W √ √
monitoring bit
cleared when the PLC changes from
Input X0 pulse capture
SM92 STOP to RUN; R/W √ √
monitoring bit
(2) The pulse capture is valid when the
Input X0 pulse capture
SM93 HCNT and SPD instructions are being R/W √ √
monitoring bit
executed at the same input port. For
Input X0 pulse capture
SM94 details, refer to section 6.10.9 "SPD: R/W √ √
monitoring bit
frequency measurement instruction"
Input X0 pulse capture
SM95 and section 6.10.1 "HCNT: high-speed R/W √ √
monitoring bit
counter drive instruction".
Input X0 pulse capture
SM96 R/W √ √
monitoring bit
Input X0 pulse capture
SM97 R/W √ √
monitoring bit
Note:

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

11. Free port (PORT0)


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
This bit is set when the XMT instruction is
PORT0 used, and cleared after the transmission is
transmissio over. You can manually clear this bit to
SM110 R/W √ √ √ √ √
n enable suspend the current transmission at
flag bit PORT0. The transmission can continue
when the energy flow is on again
This bit is set when the RCV instruction is
PORT0 used, and cleared after the transmission is
receiving over. You can manually clear this bit to
SM111 R/W √ √ √ √ √
enable flag suspend the current transmission at
bit PORT0. The transmission can continue
when the energy flow is on again
PORT0
transmissio
SM112 n This bit is set after the transmission is over R/W √ √ √ √ √
completion
flag bit
PORT0
receiving
SM113 This bit is set after the receiving is over R/W √ √ √ √ √
completion
flag bit
PORT0 idle
SM114 This bit is set when the port is idle R √ √ √ √ √
flag bit

 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.

12. Free port (PORT1)


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
This bit is set when the XMT instruction is
used, and cleared after the transmission is
PORT1
over. You can manually clear this bit to
SM120 transmission R/W √ √ √ √ √
suspend the current transmission at PORT1.
enable flag bit
The transmission can continue when the
energy flow is on again

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.

13. Extended free port (PORT2)


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
This bit is set when the XMT instruction is
used, and cleared after the transmission is
PORT2
over. You can manually clear this bit to
SM130 transmission R/W √ √ √ √
suspend the current transmission at
enable flag bit
PORT2. The transmission can continue
when the energy flow is on again
This bit is set when the RCV instruction is
used, and cleared after the transmission is
PORT1 receiving over. You can manually clear this bit to
SM131 R/W √ √ √ √
enable flag bit suspend the current transmission at
PORT2. The transmission can continue
when the energy flow is on again
PORT2
SM132 transmission This bit is set after the transmission is over R/W √ √ √ √
completion flag bit
PORT2 receiving
SM133 This bit is set after the receiving is over R/W √ √ √ √
completion flag bit
SM134 PORT2 idle flag bit This bit is set when the port is idle R √ √ √ √
PORT2 MODBUS
This bit is set when the communication is
SM135 communication R √ √ √ √
completed
completion
PORT2 MODBUS
SM136 communication This bit is set when communication error R √ √ √ √
error

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.

14. N:N communication


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
SM140 Station 0 communication error flag R √ √ √ √ √
SM141 Station 1 communication error flag R √ √ √ √ √
SM142 Station 2 communication error flag R √ √ √ √ √
SM143 Station 3 communication error flag R √ √ √ √ √
SM144 Station 4 communication error flag R √ √ √ √ √
SM145 Station 5 communication error flag R √ √ √ √ √
SM146 Station 6 communication error flag R √ √ √ √ √
SM147 Station 7 communication error flag R √ √ √ √ √
SM148 Station 8 communication error flag R √ √ √ √ √
SM149 Station 9 communication error flag R √ √ √ √ √
SM150 Station 10 communication error flag R √ √ √ √ √
SM151 Station 11 communication error flag R √ √ √ √ √
SM152 Station 12 communication error flag R √ √ √ √ √
SM153 Station 13 communication error flag R √ √ √ √ √
SM154 Station 14 communication error flag R √ √ √ √ √
SM155 Station 15 communication error flag R √ √ √ √ √
SM156 Station 16 communication error flag R √ √ √ √ √
SM157 Station 17 communication error flag R √ √ √ √ √
SM158 Station 18 communication error flag R √ √ √ √ √
SM159 Station 19 communication error flag R √ √ √ √ √
SM160 Station 20 communication error flag R √ √ √ √ √
SM161 Station 21 communication error flag R √ √ √ √ √
SM162 Station 22 communication error flag R √ √ √ √ √
SM163 Station 23 communication error flag R √ √ √ √ √
SM164 Station 24 communication error flag R √ √ √ √ √
SM165 Station 25 communication error flag R √ √ √ √ √
SM166 Station 26 communication error flag R √ √ √ √ √
SM167 Station 27 communication error flag R √ √ √ √ √
SM168 Station 28 communication error flag R √ √ √ √ √
SM169 Station 29 communication error flag R √ √ √ √ √
SM170 Station 30 communication error flag R √ √ √ √ √
SM171 Station 31 communication error flag R √ √ √ √ √

15. System bus error flag


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
1. This bit is reset upon correct powering-
on addressing
2. This bit is reset when the PLC changes
Main module bus
SM190 from STOP to RUN R √ √ √ √ √
error flag bit
3. This bit is reset when a new program is
downloaded
4. This bit incurs system stop
1. This bit is set and the system raises an
alarm when a general module bus
General module
SM191 operation error occurs R √ √ √ √ √
bus error flag bit
2. This bit is reset automatically when the
system error is removed
1. This bit is set and the system raises an
alarm when a special module bus operation
Special module
SM192 error occurs R √ √ √ √ √
bus error flag bit
2. This bit is reset automatically when the
system error is removed

334
VC Series Micro-PLC Programming Manual Special auxiliary relay

16. Real-time clock error flag


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
This bit is set upon a real-time clock error
R/W real-time
SM193 This bit is automatically cleared if the R √ √ √ √
clock error
system error is removed

17. Enable flag of integrated analog channel


Corresponding
Address
counter address Function R/W VC1S VC1 VC2 VC3 VC2
no.
no.
SM200 C200 R/W √ √ √ √ √
SM201 C201 R/W √ √ √ √ √
SM202 C202 R/W √ √ √ √ √
SM203 C203 R/W √ √ √ √ √
SM204 C204 R/W √ √ √ √ √
SM205 C205 R/W √ √ √ √ √
SM206 C206 R/W √ √ √ √ √
SM207 C207 R/W √ √ √ √ √
SM208 C208 R/W √ √ √ √ √
SM209 C209 R/W √ √ √ √ √
SM210 C210 When SM2 _ _ is ON, its R/W √ √ √ √ √
SM211 C211 corresponding C2_ _ becomes a R/W √ √ √ √ √
SM212 C212 decrement counter R/W √ √ √ √ √
SM213 C213 When SM2 _ _ is OFF, its R/W √ √ √ √ √
SM214 C214 corresponding C2_ _becomes an R/W √ √ √ √ √
SM215 C215 increment counter R/W √ √ √ √ √
SM216 C216 R/W √ √ √ √ √
SM217 C217 R/W √ √ √ √ √
SM218 C218 R/W √ √ √ √ √
SM219 C219 R/W √ √ √ √ √
SM220 C220 R/W √ √ √ √ √
SM221 C221 R/W √ √ √ √ √
SM222 C222 R/W √ √ √ √ √
SM223 C223 R/W √ √ √ √ √
SM224 C224 R/W √ √ √ √ √
SM225 C225 R/W √ √ √ √ √
SM226 C226 R/W √ √ √ √ √
SM227 C227 R/W √ √ √ √ √
SM228 C228 When SM2 _ _ is ON, its R/W √ √ √ √ √
SM229 C229 corresponding C2_ _ becomes a R/W √ √ √ √ √
SM230 C230 decrement counter R/W √ √ √ √ √
SM231 C231 When SM2 _ _ is OFF, its R/W √ √ √ √ √
SM232 C232 corresponding C2_ _becomes an R/W √ √ √ √ √
SM233 C233 increment counter R/W √ √ √ √ √
SM234 C234 R/W √ √ √ √ √
SM235 C235 R/W √ √ √ √ √

18. Count direction and monitoring of high-speed counters


Differentia Address
Name Register content R/W VC1S VC1 VC2 VC3 VC5
tion no.
SM236 C236 The ON and low OFF of SM2 _ R/W √ √ √ √ √
Single-
SM237 C237 _correspond to counting up and R/W √ √ √ √ √
phase
SM238 C238 down of the counter respectively R/W √ √ √ √ √
one point
SM239 C239 When C2 _ _ of single-phase R/W √ √ √ √ √
count
SM240 C240 bidirectional count input counter and R/W √ √ √ √ √
input
SM241 C241 two-phase count input counter is in R/W √ √ √ √ √

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 √ √ √ √ √

19. High speed output and positioning instruction

1) Y0 Correlation flag bit


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
Y0 pulse output stop When this bit is ON, Y0 pulse is
SM270 R/W √ √ √
instruction disabled
Y0 pulse output
Use fo monitoring the status of Y0.
SM271 monitoring R/W √ √ √
Busy is ON, ready is OFF.
(busy/ready)
When this bit is ON, The PWM
PWM output
SM272 instruction of Y0 outputs in R/W √ √
microseconds
microseconds.
When this bit is ON, the interrupt
program and subroutine can call the
The interrupt drive PLSY instruction of Y0, and the call in
SM273 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
SM274 instruction loop of Y0 is executed R/W √ √ √
executes in a loop
repeatedly
When this bit is ON ,Y0 PSLV
PLSV progressive
instruction frequency changes
SM275 frequency R/W √ √
gradually, enabling acceleration and
conversion
deceleration function.
Enabling the clear The CLR signal output function Y0 of
SM276 R/W √ √ √ √
function the ZRN instruction is valid.
Y element Y (N) corresponding to the
The element value N in SD175 is used to indicate
SM277 specified by the the clear signal. If not specified, Y0 is R √ √ √ √
clear signal is valid Y10 by default, which is applicable to
DSZR and ZRN.
SM278 The ZRN direction Y0 is applicable to DSZR R √ √ √
SM279 FWD limit Y0 is applicable to DSZR/DVIT 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

2) Y1 Correlation flag bit


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
Y1 pulse output stop When this bit is ON, Y1 pulse is
SM290 R/W √ √ √
instruction disabled
Y1 pulse output
Use fo monitoring the status of Y1.
SM291 monitoring R/W √ √ √
Busy is ON, ready is OFF.
(busy/ready)
When this bit is ON, The PWM
PWM output
SM292 instruction of Y1 outputs in R/W √ √
microseconds
microseconds.
When this bit is ON, the interrupt
program and subroutine can call the
The interrupt drive PLSY instruction of Y1, and the call in
SM293 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
SM294 instruction loop of Y1 is executed R/W √ √ √
executes in a loop
repeatedly
When this bit is ON ,Y1 PSLV
PLSV progressive
instruction frequency changes
SM295 frequency R/W √ √
gradually, enabling acceleration and
conversion
deceleration function.
Enabling the clear The CLR signal output function Y1 of
SM296 R/W √ √ √ √
function the ZRN instruction is valid.
Y element Y (N) corresponding to the
The element value N in SD195 is used to indicate
SM297 specified by the the clear signal. If not specified, Y1 is R √ √ √ √
clear signal is valid Y11 by default, which is applicable to
DSZR and ZRN.
SM298 The ZRN direction Y1 is applicable to DSZR R √ √ √
SM299 FWD limit Y1 is applicable to DSZR/DVIT R √ √ √
SM300 REV limit Y1 is applicable to DSZR/DVIT R √ √ √
Logic reversal of the
SM301 Y1 is applicable to DSZR R √ √ √
DOG signal
Logic reversal of the
SM302 Y1 is applicable to DSZR R √ √ √
zero signal
Y1 is applicable to DVIT, but not
Logic reversal of the
SM303 applicable to the user interrupt input R/W √ √
interrupt signal
instruction
The positioning
SM304 Y1 is applicable to DSZR/DVIT R/W √ √ √
instruction is driving
User interrupt input
SM305 Y1 is applicable to DVIT R/W √
instruction

337
VC Series Micro-PLC Programming Manual Special auxiliary relay

3) Y2 Correlation flag bit


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
Y2 pulse output stop When this bit is ON, Y2 pulse is
SM310 R/W √ √ √
instruction disabled
Y2 pulse output
Use fo monitoring the status of Y2.
SM311 monitoring R/W √ √ √
Busy is ON, ready is OFF.
(busy/ready)
When this bit is ON, The PWM
PWM output
SM312 instruction of Y2 outputs in R/W √ √
microseconds
microseconds.
When this bit is ON, the interrupt
program and subroutine can call the
The interrupt drive PLSY instruction of Y2, and the call in
SM313 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
SM314 instruction loop of Y2 is executed R/W √ √ √
executes in a loop
repeatedly
When this bit is ON ,Y2 PSLV
PLSV progressive
instruction frequency changes
SM315 frequency R/W √ √
gradually, enabling acceleration and
conversion
deceleration function.
Enabling the clear The CLR signal output function Y2 of
SM316 R/W √ √ √ √
function the ZRN instruction is valid.
Y element Y (N) corresponding to the
The element value N in SD215 is used to indicate
SM317 specified by the the clear signal. If not specified, Y2 is R √ √ √ √
clear signal is valid Y12 by default, which is applicable to
DSZR and ZRN.
SM318 The ZRN direction Y2 is applicable to DSZR R √ √ √
SM319 FWD limit Y2 is applicable to DSZR/DVIT R √ √ √
SM320 REV limit Y2 is applicable to DSZR/DVIT R √ √ √
Logic reversal of the
SM321 Y2 is applicable to DSZR R √ √ √
DOG signal
Logic reversal of the
SM322 Y2 is applicable to DSZR R √ √ √
zero signal
Y2 is applicable to DVIT, but not
Logic reversal of the
SM323 applicable to the user interrupt input R/W √ √
interrupt signal
instruction
The positioning
SM324 Y2 is applicable to DSZR/DVIT R/W √ √ √
instruction is driving
User interrupt input
SM325 Y2 is applicable to DVIT R/W √
instruction

4) Y3 Correlation flag bit


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
Y3 pulse output stop When this bit is ON, Y3 pulse is
SM330 R/W √ √ √
instruction disabled
Y3 pulse output
Use fo monitoring the status of Y3.
SM331 monitoring R/W √ √ √
Busy is ON, ready is OFF.
(busy/ready)
When this bit is ON, The PWM
PWM output
SM332 instruction of Y3 outputs in R/W √ √
microseconds
microseconds.
When this bit is ON, the interrupt
The interrupt drive program and subroutine can call the
SM333 R/W √ √ √
pulse output valid PLSY instruction of Y3, and the call in
the main program will be continuously

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

5) Y4 Correlation flag bit


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
Y4 pulse output stop When this bit is ON, Y4 pulse is
SM350 R/W √ √ √
instruction disabled
Y4 pulse output
Use fo monitoring the status of Y4.
SM351 monitoring R/W √ √ √
Busy is ON, ready is OFF.
(busy/ready)
When this bit is ON, The PWM
PWM output
SM352 instruction of Y4 outputs in R/W √ √
microseconds
microseconds.
When this bit is ON, the interrupt
program and subroutine can call the
The interrupt drive PLSY instruction of Y4, and the call in
SM353 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
SM354 instruction loop of Y4 is executed R/W √ √ √
executes in a loop
repeatedly
When this bit is ON ,Y4 PSLV
PLSV progressive
instruction frequency changes
SM355 frequency R/W √ √
gradually, enabling acceleration and
conversion
deceleration function.
Enabling the clear The CLR signal output function Y4 of
SM356 R/W √ √ √ √
function the ZRN instruction is valid.
The element Y element Y (N) corresponding to the
SM357 specified by the value N in SD255 is used to indicate R √ √ √ √
clear signal is valid the clear signal. If not specified, Y4 is

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

6) Y5 Correlation flag bit


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
Y5 pulse output stop When this bit is ON, Y5 pulse is
SM370 R/W √ √ √
instruction disabled
Y5 pulse output
Use fo monitoring the status of Y5.
SM371 monitoring R/W √ √ √
Busy is ON, ready is OFF.
(busy/ready)
When this bit is ON, The PWM
PWM output
SM372 instruction of Y5 outputs in R/W √ √
microseconds
microseconds.
When this bit is ON, the interrupt
program and subroutine can call the
The interrupt drive PLSY instruction of Y5, and the call in
SM373 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
SM374 instruction loop of Y5 is executed R/W √ √ √
executes in a loop
repeatedly
When this bit is ON ,Y5 PSLV
PLSV progressive
instruction frequency changes
SM375 frequency R/W √ √
gradually, enabling acceleration and
conversion
deceleration function.
Enabling the clear The CLR signal output function Y5 of
SM376 R/W √ √ √ √
function the ZRN instruction is valid.
Y element Y (N) corresponding to the
The element value N in SD275 is used to indicate
SM377 specified by the the clear signal. If not specified, Y5 is R √ √ √ √
clear signal is valid Y15 by default, which is applicable to
DSZR and ZRN.
SM378 The ZRN direction Y5 is applicable to DSZR R √ √ √
SM379 FWD limit Y5 is applicable to DSZR/DVIT R √ √ √
SM380 REV limit Y5 is applicable to DSZR/DVIT R √ √ √
Logic reversal of the
SM381 Y5 is applicable to DSZR R √ √ √
DOG signal
Logic reversal of the
SM382 Y5 is applicable to DSZR R √ √ √
zero signal
Y5 is applicable to DVIT, but not
Logic reversal of the
SM383 applicable to the user interrupt input R/W √ √
interrupt signal
instruction
The positioning
SM384 Y5 is applicable to DSZR/DVIT R/W √ √ √
instruction is driving

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

7) Y6 Correlation flag bit


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
Y6 pulse output stop When this bit is ON, Y6 pulse is
SM390 R/W √ √ √
instruction disabled
Y6 pulse output
Use fo monitoring the status of Y6.
SM391 monitoring R/W √ √ √
Busy is ON, ready is OFF.
(busy/ready)
When this bit is ON, The PWM
PWM output
SM392 instruction of Y6 outputs in R/W √ √
microseconds
microseconds.
When this bit is ON, the interrupt
program and subroutine can call the
The interrupt drive PLSY instruction of Y6, and the call in
SM393 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
SM394 instruction loop of Y6 is executed R/W √ √ √
executes in a loop
repeatedly
When this bit is ON ,Y6 PSLV
PLSV progressive
instruction frequency changes
SM395 frequency R/W √ √
gradually, enabling acceleration and
conversion
deceleration function.
Enabling the clear The CLR signal output function Y6 of
SM396 R/W √ √ √ √
function the ZRN instruction is valid.
Y element Y (N) corresponding to the
The element value N in SD295 is used to indicate
SM397 specified by the the clear signal. If not specified, Y6 is R √ √ √ √
clear signal is valid Y16 by default, which is applicable to
DSZR and ZRN.
SM398 The ZRN direction Y6 is applicable to DSZR R √ √ √
SM399 FWD limit Y6 is applicable to DSZR/DVIT R √ √ √
SM400 REV limit Y6 is applicable to DSZR/DVIT R √ √ √
Logic reversal of the
SM401 Y6 is applicable to DSZR R √ √ √
DOG signal
Logic reversal of the
SM402 Y6 is applicable to DSZR R √ √ √
zero signal
Y6 is applicable to DVIT, but not
Logic reversal of the
SM403 applicable to the user interrupt input R/W √ √
interrupt signal
instruction
The positioning
SM404 Y6 is applicable to DSZR/DVIT R/W √ √ √
instruction is driving
User interrupt input
SM405 Y6 is applicable to DVIT R/W √
instruction

8) Y7 Correlation flag bit


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
Y7 pulse output stop When this bit is ON, Y7 pulse is
SM410 R/W √ √ √
instruction disabled
Y7 pulse output
Use fo monitoring the status of Y7.
SM411 monitoring R/W √ √ √
Busy is ON, ready is OFF.
(busy/ready)
When this bit is ON, The PWM
PWM output
SM412 instruction of Y7 outputs in R/W √ √
microseconds
microseconds.

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

20. Timed output instruction


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
SM430 Timer clock output 1 For use by the DUTY instruction R/W √ √ √
SM431 Timer clock output 2 For use by the DUTY instruction R/W √ √ √
SM432 Timer clock output 3 For use by the DUTY instruction R/W √ √ √
SM433 Timer clock output 4 For use by the DUTY instruction R/W √ √ √
SM434 Timer clock output 5 For use by the DUTY instruction R/W √ √ √

21. Signal alarm


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
After setting SM400 to ON, the
SM435 Signal alarm is valid R/W √ √ √
following SM401 and SD401 work
Setting SM401 to ON when there is any
SM436 Signal alarm action R/W √ √ √
action in state S900-S999

22. CANopen instruction


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
CANopen instruction R/
SM440 √ √ √
completed W
CANopen instruction
SM441 R/W √ √ √
is wrong

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

Appendix B 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.

1. PLC working state data


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5 Range
100 indicates VC1S
112 indicates VC1,
SD00 PLC type 40 indicates VC2, R √ √ √ √ √
30 indicates VC3
50 indicates VC5
SD01 Version no. For example, 100 indicates 1.00 R √ √ √ √ √
User
For example, 8 indicates an 8 k
SD02 program R √ √ √ √ √
step program
capacity
System error Storing the occurred system error
SD03 R √ √ √ √ √
code codes
Battery
Taking 0.1 V as unit, and 3.6V
SD04 voltage R √ √ √ √
indicates 36
value
Number of
SD07 extension R √ √ √ √ √
I/O modules
Number of
SD08 special R √ √ √ √ √
modules
Setting the input points for operation control.
Decimal (X0 is displayed as 0 and X10 is
SD09 R √ √ √ √ √
displayed as 8. Maximum: 15)
(Configurable through the system block only)
Number of
SD10 main module MSB: input; LSB: output R √ √ √ √ √
I/O points
Number of
extension
SD11 MSB: input; LSB: output R √ √ √ √ √
module I/O
points
Number of
main module
SD12 MSB: input; LSB: output R √ √ √ √
analog I/O
points

2. Operation error code FIFO area


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5 Range
Reserved
SD20 operation error R √ √ √ √ √
code 0
Reserved
In the order of arrival, the
SD21 operation error R √ √ √ √ √
latest five operation error
code 1
codes are reserved. SD20
Reserved
always stores the latest error
SD22 operation error R √ √ √ √ √
codes.
code 2
Reserved
SD23 operation error R √ √ √ √ √
code 3

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.

5. Input filtering constant setup


Address Name Action and function R/W VC1S VC1 VC2 VC3 VC5
Input filtering (configurable only through the system
SD35 R/W √ √
constant block)
Input filtering (configurable only through the system
SD36 R/W √ √
constant block)
Input filtering (configurable only through the system
SD37 R/W √ √
constant block)
Input filtering (configurable only through the system
SD38 R/W √ √
constant block)
Input filtering (configurable only through the system
SD39 R/W √ √
constant block)

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)

6. Timed interrupt cycle


Address Name Register content R/W VC1S VC1 VC2 VC3 VC5 Range
The interrupt is not
SD47 Cycle of timed interrupt 0 triggered when the value is R/W √ √ √ √ √ 1–32767 ms
not within 1–32767
The interrupt is not
SD48 Cycle of timed interrupt 1 triggered when the value is R/W √ √ √ √ √ 1–32767 ms
not within 1–32767
The interrupt is not
SD49 Cycle of timed interrupt 2 triggered when the value is R/W √ √ √ √ √ 1–32767 ms
not within 1–32767
An error of ±1ms may occur when the system processes a user timed interrupt. To ensure the normal operation of the timed
interrupt, it is recommended to set the cycle of timed interrupts to be bigger or equal to 5ms.

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

8. Usage of DHSP and DHST instructions


Address Name R/W VC1S VC1 VC2 VC3 VC5 Range
MSB of DHSP table comparison output
SD86 R/W √ √ √ √ √
data
LSB of DHSP table comparison output
SD87 R/W √ √ √ √ √
data
MSB of DHST or DHSP table
SD88 R/W √ √ √ √ √
comparison data
LSB of DHST or DHSP table
SD89 R/W √ √ √ √ √
comparison data
SD90 Record no. of the table being executed R/W √ √ √ √ √

346
VC Series Micro-PLC Programming Manual Special data register

9. Free-port receiving control and state (PORT0)


Address Name Register content R/W VC1S VC1 VC2 VC3 VC5 Range

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

SD100.3 0: 1 stop bit


Stop bit 1: 2 stop bits
SD100.4
0: even parity; 1: odd
Parity
parity
check
SD100.5
Parity 0: no parity check; 1:
check parity check
enabling
Data bit of each
SD100.6
character
Character
0: 8-bit character
data bit
1: 7-bit character
SD100.7
Free- Free-port 1: has specific start
port 0 receiving character
mode start 0: no specific start
SD110 R √ √ √ √ √
state character character
word mode
SD100.8
Free-port 1: has specific end
receiving character
end 0: no specific end
character character
mode
SD100.9
Free-port 1: has valid
interchara intercharacter timeout
cter 0: no valid
timout intercharacter timeout
enabling
SD100.10
1: has interframe
Free-port
timeout
interfram
0: no interframe
e timeout
timeout
enabling
SD100.11 Reserved
0: LSB of the word
SD100.12
element is valid
MSB/LSB
1: MSB/LSB of the
valid
word element is valid
SD100.13
Reserved

SD100.15
SD101 Start character R/W √ √ √ √ √ √
SD102 End character R/W √ √ √ √ √ √

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)

10. Free-port receiving control and state (PORT1)


Address Name Register content R/W VC1S VC1 VC2 VC3 VC5 Range
b2, b1, b0
000: 38,400 baud rate
Free-
001: 19,200 baud rate
port SD120.0
010: 9,600 baud rate
1 –
011: 4,800 baud rate
SD120 mod SD120.2 R/W √ √ √ √ √
100: 2,400 baud rate
e Port
101: 1,200 baud rate
state baud rate
110: 57,600 baud rate
word
111: 115,200 baud
rate

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

11. Free-port receiving control and state (PORT2)


Address Name Register content R/W VC1S VC1 VC2 VC3 VC5 Range
b2, b1, b0
000: 38,400 baud rate
Free-
001: 19,200 baud rate
port SD140.0
010: 9,600 baud rate
2 –
011: 4,800 baud rate
SD140 mod SD140.2 R/W √ √ √ √ √
100: 2,400 baud rate
e Port
101: 1,200 baud rate
state baud rate
110: 57,600 baud rate
word
111: 115,200 baud
rate

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

12. High-speed pulse output and positioning

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.

SD162 Current position of Y0 output


0 R/W √ √ √ √
SD163 positioning instruction.

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)

Deceleration time for decelerating from


max. speed to base speed when the
SD170 ZRN, DRVI, DRVA, DSZR and DVIT 1000 R/W √
instructions are executed Y0 (50 ms-
5000 ms)
Crawling speed Y0 is applicable to
SD171 1000 R/W √ √ √ √
DSZR
SD172 The zero return speed Y0 is applicable
50000 R/W √ √ √ √
SD173 to DSZR
Number of segments to which the PLS
SD174 output instruction is currently executed 0 R/W √ √ √ √
(Y0 applicable)
Y0 is specified as the soft element of
SD175 0 R/W √ √ √ √
the clear signal
DVIT interrupt signal soft element
SD176 0 R/W √ √ √ √
specification (applicable Y0)

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.

SD182 Current position of Y1 output


0 R/W √ √ √ √
SD183 positioning instruction.

SD184 Current frequency of Y1 output


0 R √ √ √ √ √
SD185 positioning instruction.

SD186 Max. speed at which the ZRN, PLSV,


DRVI, DRVA, DSZR and DVIT
100000 R/W √ √ √ √
SD187 instructions are executed (10- 100000)
(Y1)
Base speed when ZRN, PLSV, DRVI,
SD188 DRVA, DSZR and DVIT instructions are 5000 R/W √ √ √ √
executed (1/10 of max. speed) (Y1)
Acceleration/deceleration time for
accelerating from base speed (SD204)
to max. speed (SD202, SD203) when
SD189 the ZRN, DRVI, DRVA, DSZR and 1000 R/W √ √ √ √
DVIT instructions are executed (Y1)
(50ms-5000ms)

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.

SD202 Current position of Y2 output


0 R/W √ √ √ √
SD203 positioning instruction.

SD204 Current frequency of Y2 output


0 R √ √ √ √ √
SD205 positioning instruction.

SD206 Max. speed at which the ZRN, PLSV,


DRVI, DRVA, DSZR and DVIT
100000 R/W √ √ √ √
SD207 instructions are executed (10- 100000)
(Y2)
Base speed when ZRN, PLSV, DRVI,
SD208 DRVA, DSZR and DVIT instructions are 5000 R/W √ √ √ √
executed (1/10 of max. speed) (Y2)
Acceleration/deceleration time for
accelerating from base speed (SD204)
to max. speed (SD202, SD203) when
SD209 the ZRN, DRVI, DRVA, DSZR and 1000 R/W √ √ √ √
DVIT instructions are executed (Y2)
(50ms-5000ms)

Deceleration time for decelerating from


max. speed to base speed when the
SD210 ZRN, DRVI, DRVA, DSZR and DVIT 1000 R/W √
instructions are executed Y2 (50 ms-
5000 ms)
Crawling speed Y2 is applicable to
SD211 1000 R/W √ √ √ √
DSZR
SD212 The zero return speed Y2 is applicable
50000 R/W √ √ √ √
SD213 to DSZR
Number of segments to which the PLS
SD214 output instruction is currently executed 0 R/W √ √ √ √
(Y2 applicable)
Y2 is specified as the soft element of
SD215 0 R/W √ √ √ √
the clear signal

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.

SD222 Current position of Y3 output


0 R/W √ √ √ √
SD223 positioning instruction.

SD224 Current frequency of Y3 output


0 R √ √ √ √ √
SD225 positioning instruction.

SD226 Max. speed at which the ZRN, PLSV,


DRVI, DRVA, DSZR and DVIT
100000 R/W √ √ √ √
SD227 instructions are executed (10- 100000)
(Y3)
Base speed when ZRN, PLSV, DRVI,
SD228 DRVA, DSZR and DVIT instructions are 5000 R/W √ √ √ √
executed (1/10 of max. speed) (Y3)
Acceleration/deceleration time for
accelerating from base speed (SD204)
to max. speed (SD202, SD203) when
SD229 the ZRN, DRVI, DRVA, DSZR and 1000 R/W √ √ √ √
DVIT instructions are executed (Y3)
(50ms-5000ms)

Deceleration time for decelerating from


max. speed to base speed when the
SD230 ZRN, DRVI, DRVA, DSZR and DVIT 1000 R/W √
instructions are executed Y3 (50 ms-
5000 ms)
Crawling speed Y3 is applicable to
SD231 1000 R/W √ √ √ √
DSZR
SD232 The zero return speed Y3 is applicable
50000 R/W √ √ √ √
SD233 to DSZR
Number of segments to which the PLS
SD234 output instruction is currently executed 0 R/W √ √ √ √
(Y3 applicable)
Y3 is specified as the soft element of
SD235 0 R/W √ √ √ √
the clear signal
DVIT interrupt signal soft element
SD236 0 R/W √ √ √ √
specification (applicable Y3)

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.

SD242 Current position of Y4 output


0 R/W √ √ √ √
SD243 positioning instruction.

SD244 Current frequency of Y4 output


0 R √ √ √ √ √
SD245 positioning instruction.

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)

Deceleration time for decelerating from


max. speed to base speed when the
SD250 ZRN, DRVI, DRVA, DSZR and DVIT 1000 R/W √
instructions are executed Y4 (50 ms-
5000 ms)
Crawling speed Y4 is applicable to
SD251 1000 R/W √ √ √ √
DSZR
SD252 The zero return speed Y4 is applicable
50000 R/W √ √ √ √
SD253 to DSZR
Number of segments to which the PLS
SD254 output instruction is currently executed 0 R/W √ √ √ √
(Y4 applicable)
Y4 is specified as the soft element of
SD255 0 R/W √ √ √ √
the clear signal
DVIT interrupt signal soft element
SD256 0 R/W √ √ √ √
specification (applicable Y4)

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.

SD262 Current position of Y5 output


0 R/W √ √ √ √
SD263 positioning instruction.

SD264 Current frequency of Y5 output


0 R √ √ √ √ √
SD265 positioning instruction.

SD266 Max. speed at which the ZRN, PLSV,


DRVI, DRVA, DSZR and DVIT
100000 R/W √ √ √ √
SD267 instructions are executed (10- 100000)
(Y5)
Base speed when ZRN, PLSV, DRVI,
SD268 DRVA, DSZR and DVIT instructions are 5000 R/W √ √ √ √
executed (1/10 of max. speed) (Y5)
Acceleration/deceleration time for
accelerating from base speed (SD204)
to max. speed (SD202, SD203) when
SD269 the ZRN, DRVI, DRVA, DSZR and 1000 R/W √ √ √ √
DVIT instructions are executed (Y5)
(50ms-5000ms)

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.

SD282 Current position of Y6 output


0 R/W √ √ √ √
SD283 positioning instruction.

SD284 Current frequency of Y6 output


0 R √ √ √ √ √
SD285 positioning instruction.

SD286 Max. speed at which the ZRN, PLSV,


DRVI, DRVA, DSZR and DVIT
100000 R/W √ √ √ √
SD287 instructions are executed (10- 100000)
(Y6)
Base speed when ZRN, PLSV, DRVI,
SD288 DRVA, DSZR and DVIT instructions are 5000 R/W √ √ √ √
executed (1/10 of max. speed) (Y6)
Acceleration/deceleration time for
accelerating from base speed (SD204)
to max. speed (SD202, SD203) when
SD289 the ZRN, DRVI, DRVA, DSZR and 1000 R/W √ √ √ √
DVIT instructions are executed (Y6)
(50ms-5000ms)

Deceleration time for decelerating from


max. speed to base speed when the
SD290 ZRN, DRVI, DRVA, DSZR and DVIT 1000 R/W √
instructions are executed Y6 (50 ms-
5000 ms)
Crawling speed Y6 is applicable to
SD291 1000 R/W √ √ √ √
DSZR
SD292 The zero return speed Y6 is applicable
50000 R/W √ √ √ √
SD293 to DSZR
Number of segments to which the PLS
SD294 output instruction is currently executed 0 R/W √ √ √ √
(Y6 applicable)
Y6 is specified as the soft element of
SD295 0 R/W √ √ √ √
the clear signal

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.

SD302 Current position of Y7 output


0 R/W √ √ √ √
SD303 positioning instruction.

SD304 Current frequency of Y7 output


0 R √ √ √ √ √
SD305 positioning instruction.

SD306 Max. speed at which the ZRN, PLSV,


DRVI, DRVA, DSZR and DVIT
100000 R/W √ √ √ √
SD307 instructions are executed (10- 100000)
(Y7)
Base speed when ZRN, PLSV, DRVI,
SD308 DRVA, DSZR and DVIT instructions are 5000 R/W √ √ √ √
executed (1/10 of max. speed) (Y7)
Acceleration/deceleration time for
accelerating from base speed (SD204)
to max. speed (SD202, SD203) when
SD309 the ZRN, DRVI, DRVA, DSZR and 1000 R/W √ √ √ √
DVIT instructions are executed (Y7)
(50ms-5000ms)

Deceleration time for decelerating from


max. speed to base speed when the
SD310 ZRN, DRVI, DRVA, DSZR and DVIT 1000 R/W √
instructions are executed Y7 (50 ms-
5000 ms)
Crawling speed Y7 is applicable to
SD311 1000 R/W √ √ √ √
DSZR
SD312 The zero return speed Y7 is applicable
50000 R/W √ √ √ √
SD313 to DSZR
Number of segments to which the PLS
SD314 output instruction is currently executed 0 R/W √ √ √ √
(Y7 applicable)
Y7 is specified as the soft element of
SD315 0 R/W √ √ √ √
the clear signal
DVIT interrupt signal soft element
SD316 0 R/W √ √ √ √
specification (applicable Y7)

13. Timed output instruction


Address Action and function Initial value R/W VC1S VC1 VC2 VC3 VC5
Scan times used by the timed clock
SD330 R/W √ √ √
output 1
Scan times used by the timed clock
SD331 R/W √ √ √
output 2
Scan times used by the timed clock
SD332 R/W √ √ √
output 3
Scan times used by the timed clock R/W
SD333 √ √ √
output 4
Scan times used by the timed clock R/
SD334 √ √ √
output 5 W

358
VC Series Micro-PLC Programming Manual Special data register

14. Signal alarm instruction


Address Action and function Initial value R/W VC1S VC1 VC2 VC3 VC5
Keeping the min. No. of actions in
SD339 0 R/W √ √
S900-S999 ignal alarm instruction

359
VC Series Micro-PLC Programming Manual Reserved elements

Appendix C 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

Appendix D 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

Appendix E System error codes

Error code Meaning Error type Description


0 No error occurred
1–9 Reserved
User program stops
ERR indicator turns on. To remove this error, it
10 SRAM error System error
is required to power off the PLC and check the
hardware.
User program stops
ERR indicator turns on. To remove this error, it
11 FLASH error System error
is required to power off the PLC and check the
hardware.
User program stops
ERR indicator turns on. To remove this error, it
12 Communication port error System error
is required to power off the PLC and check the
hardware.
User program stops
ERR indicator turns on. To remove this error, it
13 Real-time clock error System error
is required to power off the PLC and check the
hardware.
User program stops
ERR indicator turns on. To remove this error, it
14 I2C error System error
is required to power off the PLC and check the
hardware.
User program stops
ERR indicator turns on. To remove this error, it
20 Serious local I/O error System error
is required to power off the PLC and check the
hardware.
ERR indicator blinks
21 Serious extension I/O error System error The alarm is cleared automatically upon the
removal of the error
ERR indicator blinks
Serious special module
22 System error The alarm is cleared automatically upon the
error
removal of the error
Refreshing error of real-
time clock ERR indicator blinks
23 (incorrect time is read System error The alarm is cleared automatically upon the
during the system removal of the error
refreshing)
ERR indicator blinks
EEPROM read/read
24 System error The alarm is cleared automatically upon the
operation error
removal of the error
ERR indicator blinks
25 Local analog signal error System error The alarm is cleared automatically upon the
removal of the error
ERR indicator blinks
System special module
26 System error The alarm is cleared automatically upon the
configuration error
removal of the error
User program stops, and ERR indicator turns
on
40 User program file error System error
To remove this error, it is required to download
new program or format the disk
User program stops
ERR indicator turns on
System configuration file
41 System error To remove this error, it is required to download
error
new system configuration files or format the
disk

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

Appendix F Modbus communication protocols

1. Overview of Modbus communication protocol


VC series micro-PLCS are configured with two or three communication ports: PORT0(also as a programming port) supports the
Modbus slave station, PORT1 and PORT2 supports Modbus master and slave stations (configurable through the background
software).

1. Using RS485 or RS232 interface, with RS232 3-line system as the physical interface.

2. Supporting RTU modes

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).

2. Supported Modbus function code and element addressing mode


The slave station supports function codes 01, 02, 03, 05, 06, 08, 15, and 16 (decimal).
⚫ Relationship between read/write element function code and the element

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.

⚫ Relationship between PLC element and Modbus communication protocol address

Eleme Protocol Supported


Type Physical element Note
nt address function code
Y0–Y777
Output state, element code: Y0–Y7
Y Bit (octal code) 512 points in 0000–0511 01, 05, and 15
and Y10–Y17
total
X0–X777 Input state. It supports two kinds of
01, 05, and 15
X Bit (octal code) 512 points in 1200–01711 addresses, and the element code is
02
total same as the above
M Bit M0–M2047 2000–4047 01, 05, and 15

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.

⚫ Abnormal response description:

Abnormal code Definition


0x01 Error function code
0x02 Error register address
0x03 Error data

⚫ 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

the combinations ofY0–Y7, Y10–Y17, Y20–Y27, etc.

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

3. Modbus function code description

3.1 Reading the coil state (0x01)

A maximum of 256 bit elements can be read in the VC series PLCs.

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

3.2 (0x02)Reading the discrete input state (0x02)

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

3.3 Reading holding registers (0x03)

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)

3.4 Forcing (writing) single coil (0x05)

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)

Note: The written value of the element is 0xFF00(ON,1) or 0x0000(OFF,0).

2. Response frame

Response frame is the repetition of request frame.


Function code Start address Written element value Check code
Address
(05H) H L H L (CRC or LRC)

3.5 Presetting (writing) single register (0x06)

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

Response frame is the repetition of request frame.


Function code Start address Written element value Check code
Address
(06H) H L H L (CRC or LRC)

3.6 Returning diagnostic check (0x08)

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

Returning the request frame intact.


Function code Function word code Any character Check code
Address
(0x08H) (0x00H) (0x00H) H L (CRC or LRC)

⚫ Restarting the communication option (0x01):

After receiving the frame, the PLC exit from the listen only mode (Broadcast frame is supported).

1. Request frame

The normal data field is 0x00 00 or 0xff 00.


Function code Function word code Data field Check code
Address
(0x08H) 0x00H 0x01H H L (CRC or LRC)
2. Response frame
Function code Function word code Data field Check code
Address
(0x08H) 0x00H 0x01H H L (CRC or LRC)

⚫ Listen only mode of the slave station(0x04):

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

Function code Function word code Data field Check code


Address
(0x08H) (0x00H) (0x04H) 0x00H 0x00H (CRC or LRC)

2. Response frame

No return.
⚫ Clearing counters and diagnostic registers(0x0A):

Clearing all counters (Broadcast frame is supported).

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

⚫ Returning the bus message count(0x0B):

Recording the total number of the messages to all master stations from the slave stations since the last starting, clearing

and power-on of counters, which excludes the message of CRC error.

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)

⚫ CRC error count (0x0C):

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)

⚫ Returningthe slave error count (0x0D):

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)

⚫ Returning the slave message count(0x0E):

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)

⚫ Returning the slave no response count(0x0F):

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)

⚫ Returning thebus character overrun count (0x12)

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)

3.7 Forcing (Writing) multiple coils(0x0F)

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)

3.8 Presetting (writing) multiple registers (0x10 Hex)

A maximum of 120 registers can be written (0x78).

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)

3.9 Fault response frame (0x80+function code)

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:

For Y element, the protocol address range is 0000–0255 (Y0-Y377):

• 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.

4. Example of Modbus communication control


Modbus slave station responds to the message from 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).
⚫ Reading and writing 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:

1. Sending from the master station: 0101 000001003D 9A

01 – address; 01- function code; 00 00 – start address; 01 00 – number of the read elements; 3D 9A – check

Response of the slave station: providing correct response

2. Sending from the master station: 01 01 00 00 01 01 FC 5A

The master station reads 01 01 (257) elements, which is beyond thedefined number of Y elements.

Response of the slave station: 01 81 03 00 51

The response of the slave station is illegal address, because 257>256, and 256 is the allowed max. number of Y
elements.

3. Sending from the master station: 01 01 00 64 00 A0 7D AD

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.

Response of the slave station: 01 81 02 C1 91

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.

4. Sending from the master station: 01 01 01 2C 00 0A 7C 38

The master station read 10 bit elements of 01 2C (decimal: 300).

Response of slave station: 01 81 02 C1 91

The response of the slave station is illegal address, because the protocol address 300 has no definition of bit elements.

5. Sending from the master station: 01 04 00 02 00 0A D1 CD

The master station sends the frame of function code 04

Response of the slave station: 01 84 01 82 C0

The response of the slave station is illegal function code.

6. Sending from the master station: 01 02 00 00 00 0A F8 0D

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

Response of the slave station:01 02 02 00 00 B9 B8

The slave station responds with correct information, which has 02 bytes, and the content is 00 00.

7. Sending from the master station: 01 01 04 B0 00 0A BC DA

The master station reads 10 bit elements (X0–X9) starting from 04 B0 (demical:1200).

Response of the slave station:01 01 02 00 00 B9 FC

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:

Sending from the master station: 0103 25E500 045E F2

The start address for the reading sent by the master station is 25 E5 (four word elements, decimal:9701).

Response of the slave station: 01 8302 C0 F1

Response of the slave station: Illegal data address

3. If the number of the read registers is not an even number, the system responds with error code of illegal data. For example:

Sending from the master station: 01 03 25 E4 00 05 CE F2

The start address for the master station reading is 25 E4 (5 word elements).

Response of the slave station: 01 83 03 01 31

The slave station returns the illegal data.


⚫ Processing of LONG INT data

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

Appendix G ASCII code character encoding table

Most significant 3 bits


ASCII HEX code
0 1 2 3 4 5 6 7
0 NUL DLE SPACE 0 @ P 、 p
1 SOH DC1 ! 1 A Q a q
2 STX DC2 " 2 B R b r
3 ETX DC3 # 3 C S c s
4 EOT DC4 $ 4 D T d t
5 ENQ NAK % 5 E U e u
6 ACK SYN & 6 F V f v
Least
7 BEL ETB ’ 7 G W g w
significant 4
8 BS CAN ( 8 H X h x
bits
9 HT EM ) 9 I Y i y
A LF SUB * : J Z j z
B VT ESC + ; K [ k {
C FF FS , < L l ∣
D CR GS - = M ] m }
E SO RS . > N ^ n –
F SI US / ? O _ o DEL

374
VC Series Micro-PLC Programming Manual Instruction order index table

Appendix H 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

Appendix I 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

You might also like