23 PLC Manual
23 PLC Manual
Version 1.1
SERVOWORKSPLC MANUAL
Contents
Table of Contents
Table of Contents............................................................................................................................ i
List of Figures ................................................................................................................................ v
List of Tables............................................................................................................................... viii
Chapter 1: What is a PLC Sequence Program?........................................................................ 1-1
1.1 Overview of PLC in the ServoWorks System ....................................................... 1-1
1.2 The ServoWorksPLC Application Suite................................................................ 1-3
1.3 PLC Sequence Programs........................................................................................ 1-4
Chapter 2: Installing and Initializing the ServoWorksPLC Application Suite ........................ 2-1
2.1 Overview................................................................................................................ 2-1
2.2 Starting the Installation .......................................................................................... 2-1
2.3 Installing and Initializing the ServoWorksPLC Application Suite........................ 2-2
2.4 Finishing Your Installation .................................................................................... 2-5
2.5 Uninstalling the ServoWorksPLC Application Suite ............................................ 2-6
Chapter 3: Using the ServoWorksPLC Utility Programs.......................................................... 3-1
3.1 Overview................................................................................................................ 3-1
3.2 Using the PLC Control Console Application to Compile Sequence Programs ..... 3-2
3.2.1 Starting the PLC Control Console Application .............................................. 3-2
3.2.2 Compiling Your Sequence Program ............................................................... 3-4
3.2.3 Setting Up Your Tables for PLC (Input/Output Declaration) ........................ 3-5
3.2.4 Setting Up Your Keep Relay for PLC ............................................................ 3-6
3.2.5 Setting Up Your Timer for PLC ..................................................................... 3-7
3.2.6 Setting Up Your Counters for PLC................................................................. 3-8
3.3 Verifying Sequence Programs Using the ServoWorksPLC Ladder
Monitor/Debugger........................................................................................................ 3-9
3.3.1 Overview of the Ladder Monitor/Debugger ................................................... 3-9
3.3.2 Using the Ladder Monitor/Debugger.............................................................. 3-9
3.3.3 Ladder Diagram Format (Interpreting the Ladder Diagram)........................ 3-10
3.3.3.1 Overview................................................................................................ 3-10
3.3.3.2 Addresses ............................................................................................... 3-11
3.3.3.3 Signal Names ......................................................................................... 3-12
3.3.3.4 Commenting........................................................................................... 3-12
3.3.3.5 Symbols.................................................................................................. 3-12
3.3.3.6 Rows ...................................................................................................... 3-13
3.3.3.7 Relay Junction Labeling ........................................................................ 3-14
3.3.3.8 Infinite Number of Relays ..................................................................... 3-14
3.3.4 Changing the Display of the Ladder Monitor/Debugger .............................. 3-15
3.3.5 Using the Search Function of the PLC Ladder Monitor/Debugger .............. 3-15
3.4 Using the PLC Bit Pattern Utility ........................................................................ 3-16
3.5 Using the PLC Time Chart Utility....................................................................... 3-17
Chapter 4: Setting Up A Sequence Program ............................................................................ 4-1
4.1 Description of the Sequence Program and Other PLC Files.................................. 4-1
4.1.1 Overview......................................................................................................... 4-1
4.1.2 .lad Files.......................................................................................................... 4-1
4.1.3 .mod Files........................................................................................................ 4-4
______________________________________________________________________________
i
SERVOWORKSPLC MANUAL
Contents
4.1.4 .bin Files, .div Files, .fig Files and .lst Files ................................................... 4-4
4.2 Overview of File Structure..................................................................................... 4-5
4.3 Coding Convention ................................................................................................ 4-6
Chapter 5: Inside the PLC Engine (How the PLC Engine Operates)....................................... 5-1
5.1 The Sequential Processing of the Sequence Program............................................ 5-1
5.2 Repetitive Sampling............................................................................................... 5-2
5.3 I/O Signals ............................................................................................................. 5-3
5.3.1 Input ................................................................................................................ 5-3
5.3.2 Output ............................................................................................................. 5-3
5.4 PLC Code Execution.............................................................................................. 5-4
Chapter 6: Memory Addresses .................................................................................................. 6-1
6.1 What Are Memory Addresses?.............................................................................. 6-1
6.2 Addresses Related to the PLC................................................................................ 6-1
6.3 Address Specifications........................................................................................... 6-2
6.4 PLC and Machine Tool Addresses (PLC ↔ MT) ................................................. 6-3
6.5 PLC Engine and ServoWorks Motion Engine Addresses (PLC ↔ NC) .............. 6-3
6.6 Internal Relay Addresses (R) ................................................................................. 6-4
6.7 Counter Addresses (C)........................................................................................... 6-5
6.8 Keep Relay and Static Memory Control Addresses (K)........................................ 6-6
6.9 Data Table Addresses (D)...................................................................................... 6-6
6.10 Timer Addresses (T) ............................................................................................ 6-7
6.11 Alarm Relay Addresses (A) ................................................................................. 6-8
Chapter 7: Static Memory........................................................................................................... 7-1
7.1 Timer, Counter, Keep Relay, Static Memory Control, Data Table ....................... 7-1
7.1.1 Overview of Static Memory............................................................................ 7-1
7.1.2 Timer............................................................................................................... 7-1
7.1.3 Counter (Addresses C0~C79) ......................................................................... 7-1
7.1.4 Keep Relay (Addresses K0~K99)................................................................... 7-2
7.1.5 Data Table (Addresses D0~D1999)................................................................ 7-2
7.2 Reading and Writing Static Memory ..................................................................... 7-3
7.3 PLC Data Table...................................................................................................... 7-3
7.3.1 Overview......................................................................................................... 7-3
7.3.2 Creation of Data in the Data Table ................................................................. 7-4
Chapter 8: PLC Basic Commands ............................................................................................. 8-1
8.1 Overview................................................................................................................ 8-1
8.1.1 Signal Addresses............................................................................................. 8-2
8.1.2 Types of Commands (Basic and Functional).................................................. 8-2
8.1.3 Storing the Results of Logic Operations in the Result History Register ........ 8-2
8.2 Basic Commands ................................................................................................... 8-3
8.2.1 Summary of Basic Commands........................................................................ 8-3
8.2.2 RD Command ................................................................................................. 8-4
8.2.3 RD.NOT Command ........................................................................................ 8-6
8.2.4 WRT Command .............................................................................................. 8-8
8.2.5 WRT.NOT Command..................................................................................... 8-9
8.2.6 AND Command ............................................................................................ 8-10
8.2.7 AND.NOT Command ................................................................................... 8-10
______________________________________________________________________________
ii
SERVOWORKSPLC MANUAL
Contents
8.2.8 OR Command ............................................................................................... 8-11
8.2.9 OR.NOT Command ...................................................................................... 8-11
8.2.10 RD.STK Command..................................................................................... 8-11
8.2.11 RD.NOT.STK Command............................................................................ 8-13
8.2.12 AND.STK Command.................................................................................. 8-15
8.2.13 OR.STK Command..................................................................................... 8-15
Chapter 9: PLC Functional Commands..................................................................................... 9-1
9.1 Overview................................................................................................................ 9-1
9.1.1 Functional Command Format ......................................................................... 9-3
9.1.2 Control Values ................................................................................................ 9-4
9.1.3 Command........................................................................................................ 9-5
9.1.4 Parameters....................................................................................................... 9-5
9.1.5 W1................................................................................................................... 9-5
9.1.6 Operation Data – Binary Coded Decimal or Binary Format .......................... 9-5
9.1.7 Numerical Data Examples .............................................................................. 9-6
9.1.7.1 BCD Format Data .................................................................................... 9-6
9.1.7.2 Binary Format Data.................................................................................. 9-6
9.1.8 Addresses for the Numerical Data Handled by Functional Commands ......... 9-8
9.1.9 Functional Command Register (R9000 ~ R9005) .......................................... 9-9
9.2 Descriptions of Functional Commands................................................................ 9-10
9.2.1 TMR (Timer) ................................................................................................ 9-10
9.2.2 TMRB (Fixed Timer).................................................................................... 9-12
9.2.3 TMRC (Timer).............................................................................................. 9-14
9.2.4 DEC (Decoding) ........................................................................................... 9-16
9.2.5 DECB (Binary Decoding Processing) .......................................................... 9-18
9.2.6 CTR (COUNTER) ........................................................................................ 9-20
9.2.7 CTRC (Counter)............................................................................................ 9-26
9.2.8 ROT (Rotational Control) ............................................................................. 9-29
9.2.9 ROTB (Binary Rotational Control) .............................................................. 9-33
9.2.10 COD (Code Transformation) ...................................................................... 9-37
9.2.11 CODB (Binary Code Conversion) .............................................................. 9-41
9.2.12 MOVE (Masked Data Transfer) ................................................................. 9-43
9.2.13 MOVOR (Bit-Wise Sum Data Transfer) .................................................... 9-46
9.2.14 COM (Common Line Control) ................................................................... 9-47
9.2.15 COME (Common Line Control Termination) ............................................ 9-50
9.2.16 JMP (Jump)................................................................................................. 9-51
9.2.17 JMPE (Jump Termination).......................................................................... 9-54
9.2.18 PARI (Parity Check) ................................................................................... 9-55
9.2.19 DCNV (Data Conversion)........................................................................... 9-58
9.2.20 DCNVB (Extended Data Conversion)........................................................ 9-60
9.2.21 COMP (Compare)....................................................................................... 9-62
9.2.22 COMPB (Binary Compare) ........................................................................ 9-64
9.2.23 COIN (Equality Check) .............................................................................. 9-66
9.2.24 SFT (Shift Register).................................................................................... 9-68
9.2.25 DSCH (Data Search)................................................................................... 9-71
9.2.26 DSCHB (Binary Data Search) .................................................................... 9-74
______________________________________________________________________________
iii
SERVOWORKSPLC MANUAL
Contents
9.2.27 XMOV (Index Modification Data Transfer)............................................... 9-76
9.2.28 XMOVB (Binary Index Modification Data Transfer) ................................ 9-80
9.2.29 ADD (Addition) .......................................................................................... 9-82
9.2.30 ADDB (Binary Addition) ........................................................................... 9-84
9.2.31 SUB (Subtraction)....................................................................................... 9-86
9.2.32 SUBB (Binary Subtraction) ....................................................................... 9-89
9.2.33 MUL (Multiplication) ................................................................................. 9-91
9.2.34 MULB (Binary Multiplication)................................................................... 9-94
9.2.35 DIV (Division) ............................................................................................ 9-96
9.2.36 DIVB (Binary Division) ............................................................................. 9-99
9.2.37 NUME (Constant Declaration) ................................................................. 9-101
9.2.38 NUMEB (Binary Constant Declaration)................................................... 9-103
Appendix A: S-100T Data Mapping Tables................................................................................A-1
Overview of Mapping Tables ..................................................................................... A-1
F Data Mapping Table ................................................................................................ A-2
G Data Mapping Table.............................................................................................. A-12
X Data Mapping Tables ............................................................................................ A-14
HandWheel I/P (FP-60) ........................................................................................ A-14
Home & Limit Switches (DC-120)....................................................................... A-14
Appendix B: S-100M and General Motion Applications (MC-Quad, MotionPro and SWSDK)
Data Mapping Tables ..................................................................................................................B-1
Overview of Mapping Tables ..................................................................................... B-1
F Data Mapping Table ................................................................................................ B-2
G Data Mapping Table................................................................................................ B-5
X Data Mapping Table................................................................................................ B-8
Y Data Mapping Table.............................................................................................. B-24
Index................................................................................................................................................. I
______________________________________________________________________________
iv
SERVOWORKSPLC MANUAL
Contents
List of Figures
Figure 1-1: Overview of the PLC Engine in the ServoWorks System ............................ 1-2
Figure 2-1: Welcome to ServoWorks MC-Quad Window .............................................. 2-2
Figure 2-2: ServoWorksPLC Installation Window.......................................................... 2-3
Figure 2-3: ServoWorksPLC Installation Summary Window ......................................... 2-3
Figure 2-4: PLC Control Screen ...................................................................................... 2-4
Figure 2-5: PLC Ladder Compiler Screen (1 of 2) .......................................................... 2-4
Figure 2-6: Select Module Definition Window ............................................................... 2-5
Figure 2-7: Compile Finish Dialog Box .......................................................................... 2-5
Figure 2-8: ServoWorksPLC Installation Window.......................................................... 2-6
Figure 3-1: Architecture of the ServoWorksPLC Application Suite ............................... 3-2
Figure 3-2: PLC Control Screen Window for “Run” Status............................................ 3-3
Figure 3-3: PLC Control Screen Window for “Stopped” Status ..................................... 3-3
Figure 3-4: PLC Ladder Compiler Screen ....................................................................... 3-4
Figure 3-5: Compile Finish Dialog Box .......................................................................... 3-5
Figure 3-6: PLC Table Setting Screen ............................................................................. 3-5
Figure 3-7: PLC Table Setting Screen Dialog Box ......................................................... 3-6
Figure 3-8: Edit Keep Relay Window ............................................................................. 3-6
Figure 3-9: Edit Timer Window ...................................................................................... 3-7
Figure 3-10: Edit Counter Window ................................................................................. 3-8
Figure 3-11: PLC Diagnose Window .............................................................................. 3-9
Figure 3-12: Module Selection Window........................................................................ 3-10
Figure 3-13: PLC Diagnose Window With Comments for an Example Module .......... 3-10
Figure 3-14: Format for an Address in a Ladder Diagram ............................................ 3-11
Figure 3-15: Ladder Diagram Rows .............................................................................. 3-14
Figure 3-16: Format for Relay Junction Labeling in Ladder Diagrams ........................ 3-14
Figure 3-17: Ladder Diagram Format for a Limited Number of Relays ....................... 3-14
Figure 3-18: Ladder Diagram Format for an Infinite Number of Relays ...................... 3-15
Figure 3-19: PLC Diagnose Window Without Comments for an Example Module..... 3-15
Figure 3-20: PLC Diagnose Search Window................................................................. 3-16
Figure 3-21: Bit Pattern Window................................................................................... 3-16
Figure 3-22: Time Chart Window.................................................................................. 3-17
Figure 4-1: Typical .lad File: SoftServo_0 (1 of 2) ......................................................... 4-2
Figure 4-2: Typical .lad File: SoftServo_0.lad (2 of 2) ................................................... 4-3
Figure 4-3: Example .mod File: SoftServo_0.mod.......................................................... 4-4
Figure 4-4: Sequence Program Setup Procedure (1 of 2) ................................................ 4-5
Figure 4-5: Sequence Program Setup Procedure (2 of 2) ................................................ 4-6
Figure 4-6: PLC Coding Example – Instruction List Format .......................................... 4-7
Figure 4-7: PLC Coding Example – Ladder Diagram Format ........................................ 4-8
Figure 5-1: First Example of a Circuit............................................................................. 5-1
Figure 5-2: Second Example of a Circuit ........................................................................ 5-2
Figure 5-3: Execution of Sequence Program by the PLC Engine ................................... 5-5
Figure 6-1: Addresses Related to the PLC Engine .......................................................... 6-1
Figure 6-2: Internal Relay Usable Region ....................................................................... 6-4
Figure 6-3: Counter Addresses ........................................................................................ 6-5
______________________________________________________________________________
v
SERVOWORKSPLC MANUAL
Contents
Figure 6-4: Keep Relay and Static Memory Control Addresses...................................... 6-6
Figure 6-5: Data Table Addresses.................................................................................... 6-6
Figure 6-6: Timer Addresses ........................................................................................... 6-7
Figure 6-7: Alarm Relay Addresses................................................................................. 6-8
Figure 7-1: Example of Counter Addresses..................................................................... 7-2
Figure 8-1: Signal Addresses ........................................................................................... 8-2
Figure 8-2: Structure of the Result History Register ....................................................... 8-2
Figure 8-3: Ladder Diagram Example for the RD Command ......................................... 8-4
Figure 8-4: Ladder Diagram Example for the RD.NOT Command ................................ 8-6
Figure 8-5: Ladder Diagram Example for the WRT Command ...................................... 8-8
Figure 8-6: Ladder Diagram Example for the WRT.NOT Command............................. 8-9
Figure 8-7: Ladder Diagram Example for the RD.STK Command............................... 8-12
Figure 8-8: Ladder Diagram Example for the RD.NOT.STK Command...................... 8-13
Figure 9-1: Functional Command Format – Ladder Diagram and Functional Command
Register .................................................................................................................... 9-3
Figure 9-2: Example of BCD Format Data...................................................................... 9-6
Figure 9-3: Memory Storage of Binary Format Data ...................................................... 9-7
Figure 9-4: Examples of Binary Format Data for 1 Byte Data........................................ 9-8
Figure 9-5: Addresses of Numeric Data .......................................................................... 9-9
Figure 9-6: Functional Command Register...................................................................... 9-9
Figure 9-7: Format for the TMR Command .................................................................. 9-10
Figure 9-8: Timer Behavior for the TMR Command .................................................... 9-11
Figure 9-9: Format for the TMRB Command................................................................ 9-12
Figure 9-10: Timer Behavior for the TMRB Command................................................ 9-12
Figure 9-11: Format for the TMRC Command.............................................................. 9-14
Figure 9-12: TMRC Address of the Time Set of the Timer .......................................... 9-15
Figure 9-13: Timer Register Address for the TMRC Command................................... 9-15
Figure 9-14: Timer Behavior for the TMRC Command................................................ 9-15
Figure 9-15: Format for the DEC Command................................................................. 9-16
Figure 9-16: Ladder Diagram Example Using the DEC Command .............................. 9-17
Figure 9-17: Function for the DECB Command............................................................ 9-18
Figure 9-18: Format for the DECB Command .............................................................. 9-18
Figure 9-19: Ring Counter Created Using the CTR Command..................................... 9-20
Figure 9-20: Format for the CTR Command ................................................................. 9-21
Figure 9-21: Count Signal (Action Command) for the CTR Command ....................... 9-22
Figure 9-22: Ladder Diagram For Counter Example #1................................................ 9-23
Figure 9-23: Ladder Diagram For Counter Example #2................................................ 9-24
Figure 9-24: Division of a Rotational Body for Counter Example #2........................... 9-24
Figure 9-25: Format for the CTRC Command .............................................................. 9-26
Figure 9-26: Count Signal (Action Command) for the CTRC Command..................... 9-28
Figure 9-27: Address of the Counter Preset Value for the CTRC Command ............... 9-28
Figure 9-28: Address of the Up Counter Output for the CTRC Command................... 9-28
Figure 9-29: Format for the ROT Command................................................................. 9-29
Figure 9-30: Rotation Direction Rule – 12-Division Example...................................... 9-32
Figure 9-31: Format for the ROTB Command .............................................................. 9-33
Figure 9-32: Ladder Diagram Example Using the ROTB Command ........................... 9-36
______________________________________________________________________________
vi
SERVOWORKSPLC MANUAL
Contents
Figure 9-33: Code Transformation Using the COD Command..................................... 9-37
Figure 9-34: Format for the COD Command ................................................................ 9-38
Figure 9-35: Code Transformation Using the CODB Command .................................. 9-41
Figure 9-36: Format for the CODB Command.............................................................. 9-41
Figure 9-37: Input Data and Logic Data for the MOVE Command .............................. 9-43
Figure 9-38: Format for the MOVE Command ............................................................. 9-44
Figure 9-39: Ladder Diagram Example Using the MOVE Command .......................... 9-45
Figure 9-40: Function of the MOVOR Command......................................................... 9-46
Figure 9-41: Format for the MOVOR Command .......................................................... 9-46
Figure 9-42: Function of the COM Command .............................................................. 9-47
Figure 9-43: Format for the COM Command................................................................ 9-47
Figure 9-44: Relay Circuit ............................................................................................. 9-48
Figure 9-45: Ladder Diagram Using the COM Command ............................................ 9-49
Figure 9-46: Ladder Diagram Example Using COM, MOVE and COIN Commands.. 9-49
Figure 9-47: Format for the COME Command ............................................................. 9-50
Figure 9-48: Function of the JMP Command ................................................................ 9-51
Figure 9-49: Format for the JMP Command.................................................................. 9-51
Figure 9-50: Ladder Diagram Example Using the JMP Command............................... 9-53
Figure 9-51: Format for the JMPE Command ............................................................... 9-54
Figure 9-52: Format for the PARI Command................................................................ 9-55
Figure 9-53: Ladder Diagram Example Using the PARI Command............................. 9-57
Figure 9-54: Format for the DCNV Command.............................................................. 9-58
Figure 9-55: Format for the DCNVB Command ........................................................... 9-60
Figure 9-56: Calculation Result Register for the DCNVB Command .......................... 9-61
Figure 9-57: Format for the COMP Command.............................................................. 9-62
Figure 9-58: Format for the COMPB Command........................................................... 9-64
Figure 9-59: Parameters Format Specification for the COMPB Command .................. 9-64
Figure 9-60: Calculation Result Register for the COMPB Command .......................... 9-65
Figure 9-61: Format for the COIN Command ............................................................... 9-66
Figure 9-62: Format for the SFT Command .................................................................. 9-68
Figure 9-63: Condition Specification CONT = 0 for the SFT Command – Shift Left
Example ................................................................................................................. 9-69
Figure 9-64: Condition Specification CONT = 1 for the SFT Command – Shift Left
Example ................................................................................................................. 9-69
Figure 9-65: Shift Data Address for the SFT Command ............................................... 9-70
Figure 9-66: Function of the DSCH Command............................................................. 9-71
Figure 9-67: Format for the DSCH Command .............................................................. 9-72
Figure 9-68: Function of the DSCHB Command .......................................................... 9-74
Figure 9-69: Format for the DSCHB Command............................................................ 9-74
Figure 9-70: Reading from and Writing to the Data Table for the XMOV Command . 9-76
Figure 9-71: Format for the XMOV Command............................................................. 9-77
Figure 9-72: Reading from and Writing to the Data Table for the XMOVB Command... 9-
80
Figure 9-73: Format for the XMOVB Command .......................................................... 9-80
Figure 9-74: Format for the ADD Command ................................................................ 9-82
Figure 9-75: Format for the ADDB Command.............................................................. 9-84
______________________________________________________________________________
vii
SERVOWORKSPLC MANUAL
Contents
Figure 9-76: Parameters Format Specification for the ADDB Command..................... 9-84
Figure 9-77: Calculation Result Register for the ADDB Command ............................. 9-85
Figure 9-78: Format for the SUB Command ................................................................. 9-86
Figure 9-79: Format for the SUBB Command .............................................................. 9-89
Figure 9-80: Parameters Format Specification for the SUBB Command...................... 9-89
Figure 9-81: Calculation Result Register for the SUBB Command .............................. 9-90
Figure 9-82: Format for the MUL Command ................................................................ 9-91
Figure 9-83: Format for the MULB Command ............................................................. 9-94
Figure 9-84: Parameters Format Specification for the MULB Command .................... 9-95
Figure 9-85: Calculation Result Register for the MULB Command............................. 9-95
Figure 9-86: Format for the DIV Command.................................................................. 9-96
Figure 9-87: Format for the DIVB Command ............................................................... 9-99
Figure 9-88: Parameters Format Specification for the DIVB Command ...................... 9-99
Figure 9-89: Calculation Result Register for the DIVB Command............................. 9-100
Figure 9-90: Format for the NUME Command ........................................................... 9-101
Figure 9-91: Format for the NUMEB Command ........................................................ 9-103
List of Tables
Table 3-1: Signal Letters and Their Meanings .............................................................. 3-11
Table 3-2: Ladder Diagram Symbols (1 of 2)................................................................ 3-12
Table 3-3: Ladder Diagram Symbols (2 of 2)................................................................ 3-13
Table 4-1: PLC Coding Example – Program Breakdown ............................................... 4-7
Table 6-1: Symbols for the Signal Types ........................................................................ 6-2
Table 8-1: PLC Basic Commands and Their Functions .................................................. 8-3
Table 8-2: Coding of the RD Command Example (Alternative #1)................................ 8-5
Table 8-3: Coding of the RD Command Example (Alternative #2)................................ 8-5
Table 8-4: Coding of the RD.NOT Command Example (Alternative #1)....................... 8-7
Table 8-5: Coding of the RD.NOT Command Example (Alternative #2)....................... 8-7
Table 8-6: Coding of the WRT Command ...................................................................... 8-8
Table 8-7: Coding of the WRT.NOT Command ............................................................. 8-9
Table 8-8: Coding of the RD.STK Command ............................................................... 8-12
Table 8-9: Coding of the RD.NOT.STK Command ...................................................... 8-14
Table 9-1: Summary of Functional Commands (1 of 2).................................................. 9-1
Table 9-2: Summary of Functional Commands (2 of 2).................................................. 9-2
Table 9-3: Functional Command Format – Coding......................................................... 9-4
Table 9-4: Coding Format of the TMR Command ........................................................ 9-10
Table 9-5: Coding Format of the TMRC Command ..................................................... 9-14
Table 9-6: Coding Format of the DEC Command......................................................... 9-16
Table 9-7: Coding Example of the DEC Command ...................................................... 9-17
Table 9-8: Coding Format of the CTR Command ......................................................... 9-21
Table 9-9: Coding Format of the CTRC Command ...................................................... 9-27
Table 9-10: Coding Format of the ROT Command....................................................... 9-30
Table 9-11: Coding Format of the COD Command ...................................................... 9-39
______________________________________________________________________________
viii
SERVOWORKSPLC MANUAL
Contents
Table 9-12: Coding Format of the MOVE Command ................................................... 9-44
Table 9-13: Coding Format of the JMP Command ....................................................... 9-52
Table 9-14: Coding Format of the PARI Command...................................................... 9-56
Table 9-15: Coding Format of the DCNV Command ................................................... 9-58
Table 9-16: Coding Format of the COMP Command ................................................... 9-62
Table 9-17: Coding Format of the COIN Command ..................................................... 9-66
Table 9-18: Coding Format of the DSCH Command .................................................... 9-72
Table 9-19: Coding Format of the XMOV Command................................................... 9-78
Table 9-20: Coding Format of the ADD Command ...................................................... 9-82
Table 9-21: Coding Format of the SUB Command ....................................................... 9-87
Table 9-22: Coding Format of the MUL Command...................................................... 9-92
Table 9-23: Coding Format of the DIV Command........................................................ 9-97
Table 9-24: Coding Format of the NUME Command ................................................. 9-101
Table B-1: SwPLC F Address Map for NC Mode Settings.......................................... B-30
Table B-2: SwPLC F/G Address Map for HandWheel Multiple Selection.................. B-30
Table B-3: SwPLC F/G Address Map for HandWheel and HandWheel Interrupt Axis
Selection................................................................................................................ B-30
Table B-4: SwPLC G Address Map for Manual Feedrate Override............................. B-31
Table B-5: SwPLC G Address Map for Feedrate Override.......................................... B-32
Table B-6: SwPLC G Address Map for Rapid Override .............................................. B-32
Table B-7: SwPLC G Address Map for NC Mode Settings ......................................... B-33
Table B-8: SwPLC G Address Map for Jog Axis Control............................................ B-33
______________________________________________________________________________
ix
SERVOWORKSPLC MANUAL
Chapter 1: What is a PLC Sequence Program?
Programmable logic control is the process of automating the monitoring and sequence
control of machines (machine tools, in this case). In the ServoWorks system, this process
is performed by the PLC Engine, which is included as part of ServoWorksPLC
application suite. In this text, the term “PLC” refers to the PLC programming language.
The ServoWorks Motion Engine controls the high-performance, multi-axis servo loops:
the motion of the machine tool. Based on its feedback loops for motion control, it may
want to send a command to the machine tool to slow down, speed up, etc. But let’s
imagine that there is a door open on the machine tool. The ServoWorks Motion Engine
doesn’t have access to the signal that would tell it about the open door. This is where the
PLC Engine comes in.
The PLC Engine has access to all the information about not only the ServoWorks system
(hardware and software), but also the machine tool inputs and outputs. The PLC Engine
is the one element that has access to everything there is to know about the ServoWorks
system and the machine tool. As such, it functions as the “central headquarters” for all
decision-making regarding the motion and the machine tool. It controls the sequencing
of everything that happens with the machine tool, the servomotors, etc.
The relationships between the ServoWorks application software, the ServoWorks Motion
Engine, the PLC Engine and the machine tool are as follows:
______________________________________________________________________________
1-1
SERVOWORKSPLC MANUAL
Chapter 1: What is a PLC Sequence Program?
Y Signals X Signals
The PLC Engine executes the sequence program in a cyclical fashion. The PLC Engine
has a timer, and uses it to run the following PLC cycle every scan time (by default, the
scan time is 8 msec):
1) The PLC Engine performs a full scan of inputs from both the ServoWorks Motion
Engine and inputs from the machine tool (which go through the ServoWorks Motion
Engine). In other words, it checks the status of each bit (“0” or “1”) for each F and
each X input signal (which will be discussed later).
2) The PLC Engine runs the executable sequence program based on these new input
values. It executes the program by reading and executing each command
sequentially, at high speed. The command may specify reading or writing inputs or
outputs, or performing logical operations such as AND or OR (arithmetic
processing).
3) The PLC Engine sends any outputs or commands generated by the sequence program
to the ServoWorks Motion Engine or to the machine tool (using the G and Y signals)
via the ServoWorks Motion Engine.
______________________________________________________________________________
1-2
SERVOWORKSPLC MANUAL
Chapter 1: What is a PLC Sequence Program?
This cycle of scan, execute sequence program, and generate outputs or commands is
repeated every 8 ms (the standard scan time for the PLC Engine, which can also be user-
defined). Every time the sequence program finishes executing, it starts again almost
immediately. This means that the PLC Engine is very responsive to any inputs or
commands.
For example, if a lathe operator gives a command (using the S-100T program) to start the
spindle on a lathe, that command gets relayed through the ServoWorks Motion Engine to
the PLC Engine. The command is picked up by the PLC Engine (in the form of an F
signal, which will be discussed later) the next time it scans all the inputs from the
ServoWorks Motion Engine and the machine tool. The PLC Engine then executes the
sequence program, which will check that the door is closed on the machine tool, the
collet is in position, etc. (It checks these by looking at the status of X signals from the
machine tool.) If all the conditions for starting the spindle are met, the PLC Engine will
issue a command to the ServoWorks Motion Engine, which is sent to the machine tool (in
the form of a Y signal) to start the spindle on the lathe.
The ServoWorks PLC Engine is a real-time soft PLC module that executes PLC sequence
programs, and is included in the base ServoWorks packages. This programmable logic
controller (PLC) for machine tools reads and executes the binary PLC file every 8 ms (or
some other user-defined scan time), decides if it needs to take any action based on these
inputs or changes in these inputs, and issues commands to the ServoWorks Motion
Engine or the machine tool, if necessary. The PLC Engine is seamlessly integrated with
the ServoWorks Motion Engine that performs the motion control into a single motion /
machine control application.
______________________________________________________________________________
1-3
SERVOWORKSPLC MANUAL
Chapter 1: What is a PLC Sequence Program?
The ServoWorksPLC Utility Tools includes utility tools such as bit pattern display, and
time charts showing the history of bit signals.
A sequence program is a program that is written in PLC code (Instruction List format) .
This sequence program tells the PLC Engine how to control the machine tool and how to
control the computer numerical control (ServoWorks Motion Engine).
The PLC language used by the ServoWorksPLC and described in this manual is
compatible with Fanuc’s PLC ladder logic.
Because each machine tool is different, you will need to write a unique PLC sequence
program for each machine tool setup, although sequence programs can be reused for
machine tool that are the exact same make and model.
______________________________________________________________________________
1-4
SERVOWORKSPLC MANUAL
Chapter 2: Installing & Initializing ServoWorksPLC
2.1 Overview
The ServoWorksPLC Application Suite may be provided with the MC-Quad CD-ROM,
the S-100T CD-ROM, the S-100M CD-ROM or the MotionPro CD-ROM.
The software installation procedure shown here for the ServoWorksPLC Application
Suite uses screen shots from the MC-Quad CD-ROM, but the same procedure applies to
the S-100T CD-ROM, the S-100M CD-ROM or the MotionPro CD-ROM.
The following steps will guide you through installing the ServoWorksPLC Application
Suite:
______________________________________________________________________________
2-1
SERVOWORKSPLC MANUAL
Chapter 2: Installing & Initializing ServoWorksPLC
3) Click the “Read Me” button to view the brief installation instructions. We
recommend that you print these instructions, so that you can refer to them for the
ServoWorksPLC Application Suite initialization that is the last step of your
installation procedure.
1) Click the “ServoWorksPLC” button. You will see the following window appear:
______________________________________________________________________________
2-2
SERVOWORKSPLC MANUAL
Chapter 2: Installing & Initializing ServoWorksPLC
2) Make sure the “Install” option is selected, and click the “Next” button to install
the ServoWorksPLC application suite. The installation software will copy the
ServoWorksPLC application suite files, and then you will see the window shown
in Figure 2-3 appear.
NOTE: If the “Install” option is not available, you should choose the “Remove”
option to remove any existing copies of the ServoWorksPLC Application Suite
from your computer, then restart this installation process from step #1.
______________________________________________________________________________
2-3
SERVOWORKSPLC MANUAL
Chapter 2: Installing & Initializing ServoWorksPLC
3) Click the “OK” button. You will see the following window appear:
4) Click the “Compile” button. You will see the PLC Ladder Compiler Screen
appear.
5) Click the “Refer” button. You will see the “Select Module Definition File”
window appear.
______________________________________________________________________________
2-4
SERVOWORKSPLC MANUAL
Chapter 2: Installing & Initializing ServoWorksPLC
7) Click the “Compile execute” button. You will see the “Compile Finish” window
appear.
8) Click the “OK” button and your initialization of the ServoWorksPLC Application
Suite will be complete.
9) To exit ServoWorksPLC, click the “Cancel” button in the PLC Ladder Compiler
Screen, and then click the exit button ( ) in the upper right hand corner of the
PLC Control Screen.
To finish your installation (after you have also installed either MC-Quad, the S-100T, the
S-100M or MotionPro), just click the “Exit” button in the “Welcome to ServoWorks”
window.
______________________________________________________________________________
2-5
SERVOWORKSPLC MANUAL
Chapter 2: Installing & Initializing ServoWorksPLC
1) Click the “ServoWorksPLC” button, and you will see the following
“ServoWorksPLC Installation” dialog box appear:
3) In some cases, you may need to manually delete the “SwPLC” folder that was
automatically created by the original ServoWorksPLC Application Suite
installation (typically “C:\SwPLC”). Manually deleting this folder may require
you to reboot your computer first.
______________________________________________________________________________
2-6
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
3.1 Overview
• PLC Time Chart Utility for showing the history of bit signals.
These four PLC utility programs interact with the ServoWorks applications and the
ServoWorks Real-Time Modules as shown in the following figure:
______________________________________________________________________________
3-1
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
Windows NT / 2000 / XP PC
Host
CPU ServoWorks PLC Link Service
Servo- RTSS
PLC Works Motion Subspace
Engine Motion Parser
Engine
Machine
This application enables you to start, stop and compile ladder logic, and set up the timer,
the counter, and table setup data. These are all necessary operations for setting up PLC
for your machine.
SwPLC_CONTROL.exe
file in C:\SwPLC.
If the status of ladder logic is “RUN,” you will see the PLC Control Screen window
shown in the following figure:
______________________________________________________________________________
3-2
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
If the status of ladder logic is “STOPPED,” you will see the PLC Control Screen
window shown in the following figure:
The first time you run the PLC Control Console application, the “K edit,” “T edit” and “C
edit” buttons will be disabled. These three buttons will be enabled only after the SwPLC
table has been set up – see Section 3.2.3 Setting Up Your Tables for PLC (Input/Output
Declaration).
To exit the PLC Control Console application at any time, click on the button in the
upper right hand corner.
______________________________________________________________________________
3-3
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
Before you can execute the ladder logic in PLC, you will have to compile the PLC
sequence program files. The following steps will guide you through compiling your
sequence program.
1) The PLC Control Console application must be started, and the PLC status must be
“Stopped.” If the status is “Run,” you must click on the “PLC stop” button, and
the ladder logic process will stop immediately.
CAUTION
The Emergency Stop for your machine MUST be activated before you
stop the PLC ladder logic process by clicking on the “PLC stop”
button.
2) Click on the “Compile” button, and you will see the following window:
3) In the above window, make sure the .mod file you want to compile is listed in the
“Module definite file name” text box. If you to compile a different file, click on
the “Refer” button and browse to the file you do want to compile.
______________________________________________________________________________
3-4
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
One of the steps necessary to convert a sequence program into machine language is I/O
declaration. After you define the specifications (commands) for the program, you need to
create the interface settings. In the interface table, you assign each I/O signal a name
(under six characters), depending on the signal type. This procedure also enables the “K
edit,” “T edit” and “C edit” buttons in the PLC Control Console application. If you don’t
create the interface settings, you won’t be able to edit the keep relays, the timers and the
counters.
The following steps will guide you through setting up your tables for PLC:
1) Click the “Table setting” button on the PLC Control Screen, and the following
window will appear:
2) Make sure the comment setup table shown in the “Table file” text box is the file
you want. If you to use a different file for your table, click on the “Refer” button
and browse to the file you do want to use as the comment setup table file for the
PLC Diagnose Screen of the PLC Monitor/Debugger.
3) Select either “BINARY” or “BCD” in the “C” frame, for the comment display.
______________________________________________________________________________
3-5
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
4) Click on the “Execute” button. The setting process will start automatically.
When the process has finished successfully, you will see the following dialog
box:
To set up your keep relay for PLC, click the “K edit” button on the PLC Control Screen,
and the following window will appear:
If the “K edit” button is disabled, you need to set up the SwPLC table – see Section 3.2.3
Setting Up Your Tables for PLC (Input/Output Declaration).
For each keep relay address, you can select “ON” or “OFF” for the status of the keep
relay.
To set all the keep relays back to “OFF,” click on the “Reload” button.
You can use the “Back” and “Forward” buttons to scroll through the keep relays.
Clicking on the “First” button displays the first page of keep relays, while clicking on the
______________________________________________________________________________
3-6
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
“Last” button displays the last page of keep relays. If you click on the “Page” button, a
Page Selection Window will appear, and you can scroll through all pages of keep relays,
and select one by clicking on the “OK” button.
When you have finished setting up your keep relays, click on the “OK” button to save the
settings.
To set up your timer for PLC, click the “T edit” button on the PLC Control Screen, and
the following window will appear:
If the “T edit” button is disabled, you need to set up the SwPLC table – see Section 3.2.3
Setting Up Your Tables for PLC (Input/Output Declaration).
To set all the timers back to “0,” click on the “Reload” button.
You can use the “Back” and “Forward” buttons to scroll through the timers. Clicking on
the “First” button displays the first page of timers, while clicking on the “Last” button
displays the last page of timers. If you click on the “Page” button, a Page Selection
Window will appear, and you can scroll through all pages of timers, and select one by
clicking on the “OK” button.
When you have finished setting up your timers, click on the “OK” button to save the
settings.
______________________________________________________________________________
3-7
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
To set up your counters for PLC, click the “C edit” button on the PLC Control Screen,
and the following window will appear:
If the “C edit” button is disabled, you need to set up the SwPLC table – see Section 3.2.3
Setting Up Your Tables for PLC (Input/Output Declaration).
To set all the counters back to “0,” click on the “Reload” button.
You can use the “Back” and “Forward” buttons to scroll through the counters. Clicking
on the “First” button displays the first page of counters, while clicking on the “Last”
button displays the last page of counters. If you click on the “Page” button, a Page
Selection Window will appear, and you can scroll through all pages of counters, and
select one by clicking on the “OK” button.
When you have finished setting up your counters, click on the “OK” button to save the
settings.
______________________________________________________________________________
3-8
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
This utility shows the status of an executing Ladder Logic as a Ladder circuit in real time.
By monitoring the real-time status of contacts, you can verify that you have properly set
up your PLC sequence program for your machine.
The following steps will guide you in using the ServoWorksPLC Ladder
Monitor/Debugger:
SwPLC_DIAGNOSE.exe
file in C:\SwPLC. You will see the PLC Diagnose
window shown in the following figure:
2) Click on “Module selection” from the menu, and you will see the window shown
in the following figure:
______________________________________________________________________________
3-9
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
3) Select your module, and click the “OK” button. A Ladder window will appear for
that module, similar to that shown in the following figure:
Figure 3-13: PLC Diagnose Window With Comments for an Example Module
3.3.3.1 Overview
The ladder diagram is interpreted by you. There are a set of consistent symbols described
below. The ladder diagram will contain addresses, signal names, and comments.
______________________________________________________________________________
3-10
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
3.3.3.2 Addresses
There is always a letter of the alphabet in front of the address number to indicate the kind
of signal it is. See Table 3-1 for letters used and their meanings.
X Input signal from the machine to the PLC Engine (MT → PLC)
Y Output signal from the PLC Engine to the machine (PLC → MT)
Input signal from the ServoWorks Motion Engine (NC) to the PLC
F
Engine (NC → PLC)
Output signal from the PLC Engine to the ServoWorks Motion Engine
G
(NC) (PLC → NC)
R Internal Relay
C Counter
K Keep Relay
D Data Table
T Variable Timer
______________________________________________________________________________
3-11
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
3.3.3.3 Signal Names
All signal names will be at most 8 characters. Each character can be a letter, a number,
or a special symbol.
3.3.3.4 Commenting
Up to 30 characters may be displayed to comment each relay coil and signal in the
sequence program.
3.3.3.5 Symbols
Symbol Description
Ajunction
Relay (for an internal variable)
inside of the PLC Engine.
Bjunction
Ajunction
Input signal from the
Bjunction ServoWorks Motion Engine.
Ajunction
Input signal from the machine
Bjunction tool.
______________________________________________________________________________
3-12
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
Symbol Description
3.3.3.6 Rows
______________________________________________________________________________
3-13
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
The relay junction will contain the name of the relay coil and either the line number or
the address of the signal.
Symbol Name
In a usual relay sequence circuit, the number of relay junctions is limited, so in order to
minimize the number of relays, relays are reused within the circuit.
A
R1
B
R2
In the PLC Engine, there are an infinite number of relays, so the ladder diagram is written
as shown below.
______________________________________________________________________________
3-14
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
A
R1
A B
R2
You can click on the symbol in the upper right hand corner of the window to
maximize the window, or use the scroll bar to scroll through the complete display.
You can also click on “Display” from the menu and uncheck the “comment display”, to
hide the comments to make the display more condensed, as shown in the following
window:
Figure 3-19: PLC Diagnose Window Without Comments for an Example Module
Click on “Search” from the menu in the PLC Diagnose Window, and you will see the
window shown in the following figure:
______________________________________________________________________________
3-15
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
To scan for an address in the PLC Diagnose Window, type the address you want to find
in the “Search address” text box. You can search for a contact point, or a coil, or both.
Click on either “Search upward” or “Search downward” buttons – if the address exists,
the first instance of it will be highlighted in the PLC Diagnose Window.
The PLC Bit Pattern utility shows the PLC bite data in binary format. You can see the 8-
bit address in a byte address that you specify.
SwPLC_BIT_PATTERN.exe
file in C:\SwPLC. You will see the Bit Pattern window shown
in the following figure:
______________________________________________________________________________
3-16
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
Type in a byte address, click the “Start” button, and you will see the current bit pattern.
For example, let’s say you type in the address “x12,” click on the “Start” button, and see
the bit pattern “11101110,” as shown:
Therefore, the “ON” bits are the following six values: x12.7, x12.6, x12.5, x12.3, x12.2,
and x12.1.
The PLC Time Chart Utility can show PLC internal data as a time chart.
Start the PLC Ladder Monitor/Debugger utility by double clicking on the
SwPLC_TIME_CHART.exe
file in C:\SwPLC. You will see the PLC Time Chart window
shown in the following figure:
______________________________________________________________________________
3-17
SERVOWORKSPLC MANUAL
Chapter 3: Using the ServoWorksPLC Utility Programs
The following steps will guide you in using the PLC Time Chart Utility:
1) Input the address(es) for which you need to see the status.
2) At the right side of the window, set up the sampling interval by selecting the time
in milliseconds.
3) Click on the “Start” button, and you will see the ON/OFF status in the center of
the screen. During the sampling, you can change the sampling intervals by
changing interval time.
At any time, you can click on the “Clear” button to clear the window and delete the
graph(s).
______________________________________________________________________________
3-18
SERVOWORKSPLC MANUAL
Chapter 4: Setting Up A Sequence Program
4.1.1 Overview
The actual sequence program (the “.lad” file) is one of a series of files with the same
name, but different file extensions, located by default in the folder “C:\SwPLC\Ladder.”
All but two of these files are automatically generated when you compile your sequence
program. The two that are not automatically generated, which you must write, are the
“.lad” and the “.mod” files.
A sequence program (the “.lad” file) is a way of expressing sequential logic to control
a machine. The ServoWorks PLC Control Console application takes a representation of
the system requirements (the PLC sequence program, in Instruction List Format) and
converts it to an executable binary format so that it can be executed by the PLC Engine.
The procedure of creating a sequence program usually starts with writing PLC code in
Instruction List (IL) Format using a text editor. This sequence program must be a text
file with a “.lad” extension. The .lad file that comes with the ServoWorksPLC
Application Suite needs to be modified or replaced with a sequence program that is
customized for your machine.
Any text editor or word processor can be used to create a sequence program. That text
file should then be saved as a .lad file.
A .lad file must have “%@3” for the first line, and “%” for the last line. Comments
can be included in sequence programs by beginning a line with “;” or “//”. Comments
must be on separate lines. Each command should be on a separate line.
You can view the PLC code of your sequence program in a ladder diagram format to
verify and debug your sequence program using the ServoWorksPLC Monitor/Debugger
(described in Chapter 3: Using the ServoWorksPLC Utility Programs).
We strongly recommend that you begin with our default ladder file, included in the
ServoWorksPLC Application Suite. A typical .lad file (which demonstrates how to
correctly handle the HandWheel E-STOP) is shown as follows:
______________________________________________________________________________
4-1
SERVOWORKSPLC MANUAL
Chapter 4: Setting Up A Sequence Program
%@3
RD X0.2
OR X0.3
WRT G41.1
WRT G18.1
RD X0.4
WRT G41.2
WRT G18.2
// Handwheel multiple
RD X1.0
WRT G19.4
RD X1.1
WRT G19.5
////////////////////////////////////////////////////////////////
// The following three sections work for M30 program restart //
// after rewind. If you would like to have this function, //
// Please enable these three sections by removing the "//" //
// comment signals and re-compile. //
////////////////////////////////////////////////////////////////
// Cycle Start Rising Edge Relay
RD F0.5
AND.NOT R1.5
WRT R1.6
RD F0.5
WRT R1.5
RD F9.4
WRT R1.0
______________________________________________________________________________
4-2
SERVOWORKSPLC MANUAL
Chapter 4: Setting Up A Sequence Program
// Cycle start
RD R1.4
//TMR 1 // With Timer delay
AND.NOT F0.5
WRT G7.2
RD F9.7
AND F7.0
OR R2.0
WRT G8.5
RD F7.0
AND R0.0
WRT R0.2
RD.NOT F7.0
AND R0.1
WRT R0.3
RD R0.2
AND.NOT R0.3
WRT G5.0
RD R0.0
WRT R0.1
______________________________________________________________________________
4-3
SERVOWORKSPLC MANUAL
Chapter 4: Setting Up A Sequence Program
The “.mod” is a text file which you must create or verify with a “.mod” extension that
tells the ServoWorksPLC Application Suite which files to reference. Specifically, the
“.mod” file refers to the “.lad” file, and tells the compiler to compile the “.lad” file and
generate a series of files with the same name as the “.lad” file, but with different
extensions. It is the “.mod” file that is actually compiled when you compile your
sequence program. The .mod file will always be one line. The default .mod file is
shown as follows:
SoftServo_0 1
In this case, the name of the series of files will all be named “SoftServo_0,” but will have
different extensions: SoftServo_0.lad, SoftServo_0.bin, SoftServo_0.div, SoftServo_0.fig
and SoftServo_0.lst.
4.1.4 .bin Files, .div Files, .fig Files and .lst Files
These files are automatically generated when you compile the .mod file.
______________________________________________________________________________
4-4
SERVOWORKSPLC MANUAL
Chapter 4: Setting Up A Sequence Program
The .bin file is the binary file for execution. The .div file contains the module divide
table. The .fig table is the file used for real-time ladder diagram display. The .lst file has
the assembly-code format and machine codes.
In order to control the machine using a PLC, the sequence program files will be
automatically set up according to Figures 4-4 and 4-5.
Text Editor
In name
Out name
OK
X,Y
F,G
R,K
T,C D
Address Specification Address Specification
File (*.dat) File (*.dat)
PLC Control
Comments,
Symbol Compile B
Declares the formats,
symbols, and comments
for each address into the
computer registry Change Parameter
______________________________________________________________________________
4-5
SERVOWORKSPLC MANUAL
Chapter 4: Setting Up A Sequence Program
B A
Module Table
Figure Data File Compile Data File (*.div) Ladder Execution
(*.fig) (*.lst) File (*.bin)
Read on start up
Commands
PLC Engine
PLC Diagnosis
Bit Information
Writing the PLC commands in Instruction List Format that make up your sequence
program and that represent the specifications of your machine is called “coding.” An
example of PLC code and the corresponding ladder diagram is shown in Figures 4-6 and
4-7, and Table 4-1.
______________________________________________________________________________
4-6
SERVOWORKSPLC MANUAL
Chapter 4: Setting Up A Sequence Program
%@3
RD X0.2
OR X0.3
WRT G41.1
WRT G18.1
RD X0.4
WRT G41.2
WRT G18.2
2 WRT G8 . 4 *ESP
3 RD X0 . 1 HW_1
4 OR X0 . 3 HW_3
7 RD X0 . 2 HW_2
8 OR X0 . 3 HW_3
11 RD X0 . 4 HW_4
______________________________________________________________________________
4-7
SERVOWORKSPLC MANUAL
Chapter 4: Setting Up A Sequence Program
HW_ESTP *ESP
Emergency Stop
X0.0 G8.4
HW_1 HS1IA
HandWheel Interrupt
Axis Selection
X0.1 G41.0
HW_3 HS1A
HandWheel Axis
Selection
X0.3 G18.0
HW_2 HS1IB
HandWheel Interrupt
Axis Selection
X0.2 G41.1
HW_3 HS1B
HandWheel Axis
Selection
X0.3 G18.1
HW_4 HS1IC
HandWheel Interrupt
Axis Selection
X0.4 G41.2
HS1C
HandWheel Axis
Selection
G18.2
______________________________________________________________________________
4-8
SERVOWORKSPLC MANUAL
Chapter 5: Inside the PLC Engine (How the PLC Engine Operates)
In a usual relay sequence circuit, all relays can work simultaneously. For example, in
Figure 5-1, when the relay A is turned on (and both B and C are turned off), both relays
D and E work at the exact same time.
With the PLC Engine, each relay in a circuit works sequentially. For example in Figure
5-1, when relay A is on (and both B and C are turned off), first relay D, and then relay E
is activated.
A B
D
A C
E
In other words, the sequence in a PLC program follows the sequence drawn on the ladder
diagram (programming order). Though the sequence’s execution is done very rapidly, it
may affect the order of execution. Therefore, in a ladder diagram as in Figure 5-2, you
can see a difference in execution between the PLC sequence and the relay circuit
sequence.
______________________________________________________________________________
5-1
SERVOWORKSPLC MANUAL
Chapter 5: Inside the PLC Engine (How the PLC Engine Operates)
A (P.B) C
NOTE: “P.B” B
refers to a
format of A
“position.bit” C
Circuit (A)
A (P.B)
C
A C
B
Circuit (B)
Figure 5-2: Second Example of a Circuit
In the relay circuit sequence: In Figure 5-2, both circuits (A) and (B) work
simultaneously. When A (P.B) is turned on, current runs through coils B and C, and B
and C are turned on at the same time. After C is turned on (after the relay execution), B
turns off the circuit.
In the PLC sequence: In circuit (A), as in the relay circuit, when A (P.B) is turned on, B
and C are both turned on, and after a certain period of time (1 cycle of PLC sequence), B
turns the circuit off. However, in circuit (B), when A (P.B) is turned on, C is turned on,
but B is not.
The ServoWorks PLC Engine samples values at discrete intervals (8 msec by default), so
the sequence is run until the end of the ladder diagram; the sequence is then executed
again from the beginning of the ladder diagram. The time it takes to complete the
execution of a program from beginning to end (1 cycle) is called the sequence program’s
execution time. The execution time is determined by the control level (number of steps),
and the size of the Number 1 level sequence, defined later. The faster the execution time,
the more responsive the program gets.
______________________________________________________________________________
5-2
SERVOWORKSPLC MANUAL
Chapter 5: Inside the PLC Engine (How the PLC Engine Operates)
There are two kinds of input signals to the PLC Engine: input signals from the
ServoWorks Motion Engine (i.e. signals sent as a result of M functions and T functions)
and input signals from the machine (i.e. cycle start and feed/hold signals). There are also
two kinds of output signals from the PLC Engine: output signals to the ServoWorks
Motion Engine (i.e. cycle start, feed/hold) and output commands to the machine (i.e. talet
rotation, spindle suspension). The input signals are fed into the input memory in the PLC
Engine, and the output signals are the output of the PLC Engine.
5.3.1 Input
1) Input Memory from the ServoWorks Motion Engine: The input signals from the
ServoWorks Motion Engine to the PLC Engine originate from the numerical
control (NC) input memory specified by the ServoWorks Motion Engine, and are
usually transferred to the PLC Engine in 5 ms periods.
2) Input Signals from the Machine: These signals are transferred from the input
circuit to the input signal memory.
3) Input Signal Memory: The input signal memory holds the signals transferred
from the machine to the PLC Engine in 8 ms periods.
5.3.2 Output
1) Output Memory to the ServoWorks Motion Engine: The output signal from the
PLC Engine to the ServoWorks Motion Engine is sent to the NC output memory
specified by the ServoWorks Motion Engine. The PLC Engine sends the data in 5
ms periods.
2) Output Signals to the Machine: The output signals to the machines are transferred
from the PLC’s output signal memory to the output circuit.
3) Output Signal Memory: Output signal memory is the memory specified by the
PLC sequence program. The signals to the output signal memory are sent to the
machine in 8 ms periods by the PLC Engine.
______________________________________________________________________________
5-3
SERVOWORKSPLC MANUAL
Chapter 5: Inside the PLC Engine (How the PLC Engine Operates)
PLC code is executed one command at a time. For example, the instruction sequence
“RD X0.0, AND R10.1, WRT Y0.0” does the following:
1) On the first command (RD X0.0), the input signal at address X0.0 is inserted into
the computation register.
2) On the next command (AND R10.1), it takes the internal relay value at the
address R10.1, computes the logical AND with the current computational register
value, and puts it back into the computational register.
3) On the last command (WRT Y0.0), it stores the value in the computational
register to the output signal at address Y0.0.
Once you write the PLC code for a sequence program, you can use the ServoWorksPLC
Control Console application to convert it into machine language for the computer
(Figures 4-4 and 4-5).
______________________________________________________________________________
5-4
SERVOWORKSPLC MANUAL
Chapter 5: Inside the PLC Engine (How the PLC Engine Operates)
CPU
Input Pathway
X0.0
X6.1
Output Pathway
Y0.0
R10.0
R20.3
______________________________________________________________________________
5-5
SERVOWORKSPLC MANUAL
Chapter 6: Memory Addresses
An address is the number that represents the location in memory of where I/O signals to
and from the machine, I/O signals to and from the ServoWorks Motion Engine, internal
relays, counters, keep relays (parameters for the PLC sequence program), and data cables
reside. An address consists of an address number (each one contains eight signals) and a
bit number (0-7) to specify which of the eight. The symbol table that shows the signal
name and the respective address is created using the PLC Control Console Application.
The addresses used by the PLC’s sequence program can be divided roughly into 4
different types, as shown in Figure 6-1:
Internal Relay
(R and A
addresses)
Signals Related to F
User the ServoWorks
Interface Motion Engine (NC) PLC Engine
Application (F and G addresses) G
Y X
Machine (MT) Static Memory:
Related Signals (1) Counter (C addresses)
(X and Y (2) Keep Relay (K addresses)
addresses) (3) Data Table (D addresses)
(4) Variable Timer (T addresses)
______________________________________________________________________________
6-1
SERVOWORKSPLC MANUAL
Chapter 6: Memory Addresses
X220. 2
The first character of the address is always a letter of the alphabet representing the type of
signal as shown in Table 6-1. When performing byte-level addressing within a function
command, use X220. The “·” and the bit number is not necessary in this case.
R Internal Relay
C Counter
K Keep Relay
D Data Table
T Variable Timer
A Alarm
______________________________________________________________________________
6-2
SERVOWORKSPLC MANUAL
Chapter 6: Memory Addresses
Within the byte ranges above, a maximum of 800/800 I/O signals can be declared, though
they must be allocated in one-byte increments (space for 8 signals).
For the addresses of specific signals, refer to Appendix A: S-100T Data Mapping Tables
or Appendix B: S-100M and General Motion Data Mapping Tables, which lists the name
and address of each specific signal included in the ServoWorks system. Input signals
from the ServoWorks Motion Engine have fixed addresses.
For the addresses of specific signals, refer to Appendix A: S-100T Data Mapping Tables
or Appendix B: S-100M and General Motion Data Mapping Tables, which lists the name
and address of each specific signal included in the ServoWorks system.
______________________________________________________________________________
6-3
SERVOWORKSPLC MANUAL
Chapter 6: Memory Addresses
The internal relay can use 1000 bytes, at addresses R0~R999 (see Figure 6-2). This
region will be refreshed every time the power is turned on.
The addresses R9000~R9099 are reserved by the PLC, so they cannot be used in the
sequence program. The results of the function commands are stored in this reserved
address space. Refer to the following figure:
Address No. 7 6 5 4 3 2 1 0
R0
R1
R2
R3
Internal Relay (1000 bytes)
···················
R999
R9000
Reserved by the PLC
····
______________________________________________________________________________
6-4
SERVOWORKSPLC MANUAL
Chapter 6: Memory Addresses
Addresses C0~C79 (80 bytes of memory) are designated for the counters. The contents
in this memory are not erased when the power is off because this region holds static
memory. Refer to the following figure:
Address No. 7 6 5 4 3 2 1 0
C0
Preset Value
C1
Counter #1
C2
Counter Register
C3
C4
Preset Value
C5
Counter #2
C6
·································
Counter Register
C7
················
C76
Preset Value
C77
Counter #20
C78
Counter Register
C79
______________________________________________________________________________
6-5
SERVOWORKSPLC MANUAL
Chapter 6: Memory Addresses
Addresses K0~K99 (100 bytes of memory) are used to store the keep relay data and the
PLC parameters. This is also static memory. Refer to the following figure:
Address No. 7 6 5 4 3 2 1 0
K0
K1
K2
··········
K96
K97
K98
K99
The data table is stored in static memory. The basic data table resides at addresses
D0~D1999 (2000 bytes of memory). Refer to the following figure:
Address No. 7 6 5 4 3 2 1 0
D0
D1
D2
Basic Data Table (2000 bytes)
··········
D1998
D1999
______________________________________________________________________________
6-6
SERVOWORKSPLC MANUAL
Chapter 6: Memory Addresses
The variable timers used in TMR commands are allocated 400 bytes of static memory, at
addresses T0~T399.
The addresses corresponding to each timer are shown in Figure 6-6. Since this region is
static memory, the contents are not erased when the power is turned off. Refer to the
following figure:
Address No. 7 6 5 4 3 2 1 0
T0
Timer #1
T1
T2
Timer #2
T3
·····················································
T4
T5
T6
T7
··················
T396
T397
T398
Timer #200
T399
______________________________________________________________________________
6-7
SERVOWORKSPLC MANUAL
Chapter 6: Memory Addresses
The alarm relay has 100 bytes of memory, at addresses A0~A99. Refer to the following
figure:
Address No. 7 6 5 4 3 2 1 0
A0
A1
A2
·············
A96
A97
A98
A99
______________________________________________________________________________
6-8
SERVOWORKSPLC MANUAL
Chapter 7: Static Memory
Static memory is the memory where the information contained in that memory is not
erased even when the power is off. The PLC Engine uses static memory for the
following:
• Timer
• Counter
• Keep Relay
• Data Table
7.1.2 Timer
Static memory is used to specify the time for the timer. You can display and set the timer
with the PLC Control Console application (the T Table). You can also read and write the
time using the sequence program.
Static memory is used to store the counter preset value and the increment value. You can
display and set the counter with the PLC Control Console application (the C Table). You
can also read and write into the counter using the sequence program. For details about
the counter addresses, refer back to Section 6.7: Counter Addresses (C). The format of
the data is either 2 bytes of BCD or binary with the higher digits corresponding to the
higher addresses. The address can be in BCD or binary, as specified in the PLC system
parameters.
______________________________________________________________________________
7-1
SERVOWORKSPLC MANUAL
Chapter 7: Static Memory
Example: When the PLC counter addresses are C0 and C1 and the preset value is 1578.
7 8
7 6 5 4 3 2 1 0
C1 0 0 0 1 0 1 0 1
1 5
Binary (1578)
7 6 5 4 3 2 1 0
C0 0 0 1 0 1 0 1 0
27 26 25 24 23 22 21 20
7 6 5 4 3 2 1 0
C1 0 0 0 0 0 1 1 0
In order to set the lower 2 digits of the value to the output of a command that outputs 1-
byte data, then specify C0 as the output address for that command.
Static memory holds parameters for the program such as the keep relay. You can read
out or set the value with the PLC Control Console application (the K Table). You can
also read and write from within the sequence program. The PLC control screen handles
data as an 8-bit binary, so each digit holds the value of “0” or “1.”
You can use a set of numeric data (a data table) for PLC sequence control. For details,
refer to Section 7.3: PLC Data Table.
______________________________________________________________________________
7-2
SERVOWORKSPLC MANUAL
Chapter 7: Static Memory
The sequence program can read and write any data in static memory. However, the
memory accessed by the sequence program is not the static memory, but an exact image
of the static memory (RAM). Therefore, data inside the image disappears when the
power is off, but that data is copied again from static memory when the power is turned
on, restoring properly.
The system uses a write-through cache, where data modified in RAM by the sequence
program is automatically transferred to the static memory.
Modifications of data in the image can be done at any time and at any frequency, and the
data will be transferred to static memory. Therefore, writing to static memory does not
require any special handling. However, it does take some time for the data to propagate,
or be written, to static memory (about 512 ms).
7.3.1 Overview
PLC sequential control sometimes requires a set of numeric data (henceforth called a data
table). Being able to write to and read from this data table is useful. For example, it can
supply the tool number of each tool in the ATC Magazine to the program. You can
create a maximum of 50 data tables.
Within the memory constraints of a table, you can set the data table to 1-, 2-, or 4-byte
length words encoded either in binary or BCD. Therefore, you can easily make useful
data structures that do not waste space.
You can access data in the data table through the static memory, which in turn is accessed
by the PLC control screen.
This data can also be accessed using functional commands in the program, such as Data
Search (DSCHB) and Index Modification Data Transfer (XMOVB).
______________________________________________________________________________
7-3
SERVOWORKSPLC MANUAL
Chapter 7: Static Memory
7.3.2 Creation of Data in the Data Table
The data in the data table is created with the PLC Control Console application (the D
Table).
NOTE: You can also read and write into the data table using the sequence program.
______________________________________________________________________________
7-4
SERVOWORKSPLC MANUAL
Chapter 8: PLC Basic Commands
8.1 Overview
The first step in designing a sequence program is to sketch out a ladder diagram. The
ladder diagram consists of relay junctions and functional command symbols described
later, in Chapter 9: PLC Functional Commands. Then you code the ladder diagram into
Instruction List format, and verify the coding by using the ServoWorks
Monitor/Debugger to view the ladder diagram representation of that Instruction List code,
and make sure the logic represented by the ladder diagram is what you intended. When
you are satisfied with your code, compile your Instruction List sequence program into
machine code with the ServoWorksPLC Control Console application. This machine code
is then fed into the PLC Engine as the sequence program.
You will be coding using mnemonic representation (PLC commands such as RD, AND,
and OR) of PLC logic. You should, however, understand relay symbols (such as
, , ) and the functional command symbols used in the ladder diagram.
You should have a thorough understanding of PLC basic commands to understand the
details of the functional commands presented later. Therefore, you should read carefully
through the rest of this chapter, and Chapter 9: PLC Functional Commands before
coding your sequence program for your ServoWorks system.
This chapter concerns itself with basic PLC commands. For each basic command, we
must concern ourselves with the following items:
• Signal addresses.
______________________________________________________________________________
8-1
SERVOWORKSPLC MANUAL
Chapter 8: PLC Basic Commands
An address can be assigned to all signals, relay coils and junctions, drawn in the ladder
diagram shown in Figure 8-1. An address consists of an address number and a bit
number. The leading zero can optionally be suppressed. For more details about
addresses, see Chapter 6: Memory Addresses.
A B
R0
X8.1 R 12.6 R 9.0
C
Bit Number
Y20.4 Address Number
Basic commands are the commands you will use most frequently in sequence programs.
There are twelve basic commands including AND, OR, and other byte level operations.
Functional commands are commands that make the programming of the complex controls
of machinery much easier than just using basic commands. Refer to Chapter 9: PLC
Functional Commands for descriptions of the functional commands.
A sequence program can store intermediate results in a FIFO (first-in, first-out) stack
register known as the Result History Register. This register contains 1 bit + 8 bits = 9
bits (see Figure 8-2).
Stack Register Current Execution
(stores temporary values) Value
______________________________________________________________________________
8-2
SERVOWORKSPLC MANUAL
Chapter 8: PLC Basic Commands
As a push command (i.e. RD.STK) is executed, the current execution value is stored in
ST1 and the other values shift to the left as shown in Figure 8-2. When a pop command
(i.e. AND.STK) is executed, the values shift to the right, and the value on the top of the
stack (ST1) is moved into the current execution environment. For the specifics of each
command, refer to their respective sections later in this chapter.
Table 8-1 shows the kinds of basic commands and their functions. Detailed descriptions
follow.
2 RD.NOT Reads the inverted value of the signal and puts it in ST0.
3 WRT Outputs the result (value of ST0) into the specified address.
4 WRT.NOT Outputs the inverted result (value of ST0) into the specified address.
10 RD.NOT.STK Same as RD.STK, but stores the inverted signal value into ST0.
Stores AND of ST0 and ST1 into ST1, then shifts all of the bits in the
11 AND.STK
register to the right one bit.
Stores OR of ST0 and ST1 into ST1, then shifts all of the bits in the
12 OR.STK
register to the right one bit.
______________________________________________________________________________
8-3
SERVOWORKSPLC MANUAL
Chapter 8: PLC Basic Commands
8.2.2 RD Command
Format
(Address)
RD c c c c · c
Address No. Bit No.
Function
This command reads the value of a signal at a specified address (“1” or “0”), and puts it
into the ST0 bit in the result history register.
Use
When the code starts with junction A ( ), RD is used. For an example, see the ladder
diagram in Figure 8-3 and the coding sheet entry example in Table 8-2.
Signal
The signal (junction) read by the RD command could be any signal used in the logical
expression for a coil (output).
A B C
W1
X10.1 X2.0 R2.1 R200.0
D G
W2
X5.1 R5.4 R200.1
E
Y5.2
F
Y5.3
______________________________________________________________________________
8-4
SERVOWORKSPLC MANUAL
Chapter 8: PLC Basic Commands
2 AND X2 . 0 A•B
__
3 AND.NOT R2 . 1 A•B•C
__
4 WRT R200 . 0 W1 out A•B•C
5 RD X5 . 1 D
__
6 OR.NOT Y5 . 2 D+E
__ __
7 OR Y5 . 3 D+E+F
__ __
8 AND R5 . 4 (D+E+F)•G
__ __
9 WRT R200 . 1 W2 out (D+E+F)•G
5 RD Y5 . 3 F
__
6 OR.NOT Y5 . 2 F+E
__
7 OR X5 . 1 F+E+D
__
8 AND R5 . 4 (F+E+D)•G
__
9 WRT R200 . 1 W2 out (F+E+D)•G
______________________________________________________________________________
8-5
SERVOWORKSPLC MANUAL
Chapter 8: PLC Basic Commands
8.2.3 RD.NOT Command
Format
(Address)
RD.NOT c c c c · c
Address No. Bit No.
Function
This command reads the inverted value of a specified signal and puts it into the ST0 bit in
the result history register.
Use
When the code starts with junction B ( ), use the RD.NOT command. For an example,
see the ladder diagram in Figure 8-4 and the coding sheet entry example in Table 8-4.
Signal
The signal (junction) read by the RD.NOT command could be any signal used in the
logical expression for a coil (output).
A B C
W1
R1.1 F2.2 F3.3 R210.1
D G
W2
G5.1 R10.5 R210.2
E
X4.2
F
Y10.7
______________________________________________________________________________
8-6
SERVOWORKSPLC MANUAL
Chapter 8: PLC Basic Commands
______________________________________________________________________________
8-7
SERVOWORKSPLC MANUAL
Chapter 8: PLC Basic Commands
8.2.4 WRT Command
Format
(Address)
WRT c c c c · c
Address No. Bit No.
Function
This command writes the result of the logic operation, the value of the ST0 bit in the
result history register (“1” or “0”), into the specified address.
Use
See Tables 8-2, 8-3, 8-4 and 8-5 for examples of how to use the WRT command.
Signal
You can output a logic operation result into two or more addresses, as shown in the
example that follows.
2 OR X4 . 2 D•E
3 AND G2 . 2 (D+E)•F
______________________________________________________________________________
8-8
SERVOWORKSPLC MANUAL
Chapter 8: PLC Basic Commands
8.2.5 WRT.NOT Command
Format
(Address)
WRT.NOT c c c c · c
Address No. Bit No.
Function
This command writes the inverse of the result (value of the ST0 bit in the Result History
Register) into the specified address.
2 OR X4 . 2 D•E
3 AND G2 . 2 (D+E)•F
______________________________________________________________________________
8-9
SERVOWORKSPLC MANUAL
Chapter 8: PLC Basic Commands
Format
(Address)
AND c c c c · c
Address No. Bit No.
Function
This command takes the value of a specified signal and executes the logical AND
(product) with the existing value.
Format
(Address)
AND.NOT c c c c · c
Address No. Bit No.
Function
This command inverts the value of a specified signal and executes the logical AND.NOT
(inverse product) with the existing value.
______________________________________________________________________________
8-10
SERVOWORKSPLC MANUAL
Chapter 8: PLC Basic Commands
8.2.8 OR Command
Format
(Address)
OR c c c c · c
Address No. Bit No.
Function
This command takes the value of a specified signal and executes the logical OR (sum)
with the existing value.
Format
(Address)
OR.NOT c c c c · c
Address No. Bit No.
Function
This command inverts the value of a specified signal and executes the logical OR.NOT
(inverse sum) with the existing value.
Format
(Address)
RD.STK c c c c · c
Address No. Bit No.
______________________________________________________________________________
8-11
SERVOWORKSPLC MANUAL
Chapter 8: PLC Basic Commands
Function
This command pushes the intermediate calculation onto the stack. It shifts each bit in the
register one bit to the left and puts the value of the signal with the specified address into
the ST0 bit of the result history register.
Use
Use this command when the specified address is the A junction ( ).
X1.3 Y1.4
E F
R2.1 R3.5
2 AND Y1 . 2 A•C
3 RD.STK X1 . 3 A•C B
5 OR.STK A•C+B•D
A•C+
6 RD.STK R2 . 1 E
B•D
A•C+
7 AND R3 . 5 E•F
B•D
A•C+B•D+
8 OR.STK
E•F
A•C+B•D+
9 WRT Y15 . 0
E•F
______________________________________________________________________________
8-12
SERVOWORKSPLC MANUAL
Chapter 8: PLC Basic Commands
8.2.11 RD.NOT.STK Command
Format
(Address)
RD.NOT.STK c c c c · c
Address No. Bit No.
Function
This command pushes the intermediate calculation onto the stack. It shifts each bit in the
register one bit to the left and puts the inverse of the value of the signal with the specified
address into the ST0 bit of the result history register.
Use
Use this command when the specified address is the B junction ( ).
A B E F
W1
X1.0 X1.1 Y1.2 Y1.3 Y15.7
C D G H
______________________________________________________________________________
8-13
SERVOWORKSPLC MANUAL
Chapter 8: PLC Basic Commands
______________________________________________________________________________
8-14
SERVOWORKSPLC MANUAL
Chapter 8: PLC Basic Commands
Format
(Address)
AND.STK c c c c · c
Address No. Bit No.
Function
This command sets the logical product of ST0 and ST1 into ST1, and shifts the bits of the
register one bit to the right to put the result into ST0.
Format
(Address)
OR.STK c c c c · c
Address No. Bit No.
Function
This command sets the logical sum of ST0 and ST1 into ST1, and shifts the contents of
the register one byte to the right to take the result from ST0.
Note
In the example shown in Table 8-8, the results are the same even if the OR.STK in step
number 5 is moved between steps number 7 and number 8. However, if you code with
OR.STK and AND.STK repeatedly it is easier to make mistakes.
______________________________________________________________________________
8-15
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
When you are already dealing with a program complex enough to control an NC
machine, creating a sequence program using only bit operation functions can be very
difficult. For example, digital controls of a rotational system can be made simpler with
these functional commands. So, for such programs, we have provided functional
commands (also known as “machine commands”). The different types of functional
commands and their descriptions are shown in Tables 9-1 and 9-2.
Command
No. Description
Ladder Format Code Format
1 TMR TMR Timer
2 TMRB SUB 24 Static Timer
3 TMRC SUB 54 Timer
4 DEC DEC Decode
5 DECB SUB 25 Binary Decode
6 CTR SUB 5 Counter
7 CTRC SUB 55 Counter
8 ROT SUB 6 Rotational Control
9 ROTB SUB 26 Binary Rotational Control
10 COD SUB 7 Code Transformation
11 CODB SUB 27 Binary Code Transformation
12 MOVE SUB 8 Masked Data Transfer
13 MOVOR SUB 28 Bit-Wise Sum Data Transfer
14 COM SUB 9 Common Line Control
15 COME SUB 29 Common Line Control Termination
16 JMP SUB 10 Jump
17 JMPE SUB 30 Jump Termination
18 PARI SUB 11 Parity Check
19 DCNV SUB 14 Data Conversion
20 DCNVB SUB 31 Extended Data Conversion
21 COMP SUB 15 Comparison
22 COMPB SUB 32 Binary Comparison
______________________________________________________________________________
9-1
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Command
No. Description
Ladder Format Code Format
23 COIN SUB 16 Equality Check
24 SFT SUB 33 Shift Register
25 DSCH SUB 17 Data Search
26 DSCHB SUB 34 Binary Data Search
27 XMOV SUB 18 Index Modify Data Transfer
28 XMOVB SUB 35 Binary Index Modify Data Transfer
29 ADD SUB 19 Addition
30 ADDB SUB 36 Binary Addition
31 SUB SUB 20 Subtraction
32 SUBB SUB 37 Binary Subtraction
33 MUL SUB 21 Multiplication
34 MULB SUB 38 Binary Multiplication
35 DIV SUB 22 Division
36 DIVB SUB 39 Binary Division
37 NUME SUB 23 Constant
38 NUMEB SUB 40 Binary Constant
! CAUTION
The command format and the general usage are described at the
beginning of each functional command description. Important
information, such as the functional command specifications, is included
in this chapter, so you should review it carefully for each functional
command.
______________________________________________________________________________
9-2
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Control Values
Parameter (Warning 1)
A B
(3)
L0 L1 NOTE:
C D
(2) The number inside the ( ) in
Parameter (1)
Parameter (2)
Parameter (3)
Parameter (4)
R5.7
ACT
(0)
R7.1 (E1)
7 6 5 4 3 2 1 0
R9000
R9001
R9002
R9003
R9004
R9005
Figure 9-1: Functional Command Format – Ladder Diagram and Functional Command
Register
______________________________________________________________________________
9-3
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
2 AND R1 . 1 B A•B
3 RD.STK R2 . 4 C A•B C
__
4 AND.NOT R3 . 1 D A•B C•D
__
5 RD.STK R5 . 7 RST A•B C•D RST
__
6 RD.STK R7 . 1 ACT A•B C•D RST ACT
__
7 SUB cc Command A•B RST ACT
C•D
__
8 cccc Param 1 A•B RST ACT
C•D
__
9 cccc Param 2 A•B RST ACT
C•D
__
10 cccc Param 3 A•B RST ACT
C•D
__
11 cccc Param 4 A•B RST ACT
C•D
__
12 WRT R10 . 1 W1 Out A•B C•D RST W1
Depending on the functional command, the number of control values and their
significances differ. Since the control values have specified locations in the Result
History Register to be put into, as shown in Table 9-3, there is a unique ordering of the
instructions. You cannot change the instruction order.
! CAUTION
Functional commands that have RST in their control inputs are all RST
prioritized. Therefore, even if ACT=0, the command executes the RST
operation if RST=1.
______________________________________________________________________________
9-4
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
9.1.3 Command
The different kinds of commands are as shown in Tables 9-1 and 9-2.
9.1.4 Parameters
Functional commands differ from basic commands in that they use numbers. These
numbers, such as basic data or an address for data, go into the system as parameters. The
number of parameters and their roles differ for each functional command.
9.1.5 W1
When the functional command results in an output of one bit (“1” or “0”), then the result
can be stored in the address specified by W1. You can arbitrarily choose the address.
The logic behind W1 depends on the functional command; some functional commands do
not output a value.
The data used in functional commands are either in BCD (Binary Coded Decimal) format
or binary format. The usual PLC sequence program uses BCD format for numerical data,
but for this PLC system, we recommend that you use binary format for the following
reasons:
2) Since the CPU processes all numeric data in binary format, if the data is already
in binary format, it is not necessary to convert it, and it will increase the
processing speed.
3) Binary format allows for a larger range of numbers. Numbers previously out of
range become valid, and the range of functional commands also increases. A
binary format can use different numbers of bytes: 1 byte ( -128 ~ +127 ), 2 bytes
( -32,768 ~ +32,767 ), or 4 bytes ( -99,999,999 ~ +99,999,999 ).
______________________________________________________________________________
9-5
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
For these reasons, all functional commands can and usually will use binary data.
7 6 5 4 3 2 1 0
R250 When specifying this data in a functional command, use
0 0 1 1 0 1 0 0 the earlier address R200.
3 4 (NOTE: The earlier address gets the lower two digits.)
7 6 5 4 3 2 1 0
R251 0 0 0 1 0 0 1 0
1 2
______________________________________________________________________________
9-6
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
7 6 5 4 3 2 1 0
R200 ± 2 6
2 5
2 4
2 3
2 2
2 1
20
0: Positive
Symbol
1: Negative
2 Byte Data (-32,768 ~ +32,767)
7 6 5 4 3 2 1 0
R200 2 7
26 5
2 4
2 3
2 2
2 1
2 20
0: Positive
Symbol
1: Negative
7 6 5 4 3 2 1 0
R200 2 7
2 6
2 5
2 4
2 3
2 2
2 1
20
0: Positive
Symbol
1: Negative
Functional commands use the earlier address R200 to specify the data. Furthermore,
negative numbers are represented using Two’s Complement notation.
2) Write the One’s Complement of that number. That is, take the number from Step
#1 and convert the ones into zeros and the zeros into ones.
3) Take the One’s Complement number from Step #2, and add one (1) to the result.
______________________________________________________________________________
9-7
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Example of the number -17 represented in Two’s Complement notation:
Several examples of data represented in binary format follow. The negative numbers are
represented with Two’s Complement notation.
7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 1 (+1)
1 1 1 1 1 1 1 1 (-1)
0 1 1 1 1 1 1 1 (+127)
1 0 0 0 0 0 0 1 (-127)
When the numerical data handled by a functional command is 2 bytes or 4 bytes long, we
recommend using an even address. By using an address that is even, you will slightly
decrease the execution time of the functional command.
The parameters of the functional commands with this feature, mainly on functional
commands that use binary data, are marked with an * on the parameter section of the
functional command format description. For an address to be even in an internal relay,
the numbers following the R are even, and for an address to be even in a data table, the
numbers following D are even.
______________________________________________________________________________
9-8
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
For addresses marked with an asterisk, when the data is either 2 or 4
bytes, you can optimize the command to speed up execution by using
an even number for that address.
A + B = C
RST
* * * Error
ADDB c cccc cccc cccc Output
W1
ACT (SUB36) Data to Increment
Increment Data Output
Command Format (Address) (Address) Address
This register holds the results of the functional commands. This register is shared by all
commands, so you must read the data immediately after the functional command finishes
executing; otherwise, it will be overwritten by the next command.
Furthermore, you cannot transfer the information in this register between the different
levels within the sequence program. For example, you cannot execute a subtraction
command (SUBB) in a level 1 program and then try to read this result within a level 2
program by looking at the address R9000.
The register is shared among programs in the same level, and it is stored until right before
the next command executes. The sequence program is able to read the value, but you
cannot write to it directly.
7 6 5 4 3 2 1 0
R9000
R9001
R9002
R9003
R9004
R9005
Figure 9-6: Functional Command Register
This register is a 6-byte register R9000 ~ R9005, and data can be entered 1 bit or 1 byte
at a time. In order to read the 1st bit of R9000, you use the command RD R9000.1.
______________________________________________________________________________
9-9
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This timer is an on-delay timer.
Format
Figure 9-7 shows the format for describing the command, and Table 9-4 shows the
coding format.
TMR cc Timer Relay
ACT
TMcc
Match
ccc·c Timer
Timer ccc·c
Control Command Number Number
Values
Coding Sheet
Step Address Bit
Command Description
No. No. No.
1 RD cccc · c ACT
2 TMR cc
Control Values
Action Command (ACT)
ACT = 0: Turns off (makes “0”) the Timer Relay (TMcc).
ACT = 1: Timer turns on.
______________________________________________________________________________
9-10
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
ACT
TMcc T
Time T specified by
command
Figure 9-8: Timer Behavior for the TMR Command
Parameters
Timer Number
The time on the timer is set in the PLC Control Console application and is in units of ms.
Timers 1 ~ 8 are checked every 48 ms, and timers 9 ~ 100 are checked every 8 ms.
Therefore, on timers 1 ~ 8, the time intervals are evaluated on 48 ms intervals, and
remaining values less than 48 are disregarded. The timers 9 ~ 100 are set with times that
are integer multiples of 8, and the remainders are disregarded. For example, if you set
the timer to 38 ms, 38 = 8 × 4 + 6, the remainder 6 is disregarded and the timer is set as
32 ms.
The spread of the timer times only includes the timing error that occurs when executing
the timer command. Other delays are not included. For example, if the timer command
is used in sequence section 2, the time delay observed after startup and before the
sequence is evaluated (worst case: 1 complete cycle time of sequence section 2) is not
included.
______________________________________________________________________________
9-11
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This timer is an on-delay timer where the time is fixed. Because the timer described by
Section 10.2.1: TMR stores the time in memory, it is a dynamic timer that can change the
specified time through the PLC control screen when necessary. The fixed timer
permanently writes the time when the program is written, so once the time is set, it cannot
be changed unless the sequence program itself is changed.
Format
Figure 9-9 shows the format for describing the command.
TMRB ccc
ACT
c···c Timer Relay
(SUB24) TMB
ccc
Timer Time
Command Number Length
Control Values
Action Command (ACT)
ACT = 0: Turns off (makes “0”) the timer relay (TMBccc).
ACT = 1: Timer turns on.
ACT
TMB
T
Time T set by
command
Parameters
1) Timer Number
A number (1 ~ 100) that identifies the fixed timer.
______________________________________________________________________________
9-12
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
2) Time Length
This fixed timer is processed every 8 ms. Therefore, the time specified should be
an integral multiple of 8 ms, as any remainders are disregarded. For example, if
the timer value is specified to 38 ms, 38 = 8 × 4 + 6 and the remainder of 6 is
disregarded, resulting in a final value of 32 ms on the timer. The time ranges
from 8 ~ 262, 136 ms.
______________________________________________________________________________
9-13
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This timer is an on-delay timer.
Format
Figure 9-11 shows the format for describing the command, and Table 9-5 shows the
coding format.
TMRC ccc cccc cccc
ACT Timer Relay
(SUB54) TM
cc
Accuracy Timer Timer
of the Setting Register
Command Timer Address Address
Figure 9-11: Format for the TMRC Command
TMRC
2 SUB 54
Command
c Accuracy of
3 (PRM)
the Timer
Control Values
Action Command (ACT)
ACT = 0: Turns off (makes “0”) the timer relay (TMcc).
ACT = 1: Timer turns on.
Parameters
1) Accuracy of the Timer
The timer’s accuracy can be specified as one of the following two choices:
0: 8 ms
1: 48 ms
______________________________________________________________________________
9-14
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
The time setting of the timer is in 8 ms or 48 ms intervals, and this value is stored
in binary format. The timer setting time becomes as follows:
8 ms: 8 ~ 262,136 ms
48 ms: 48 ~ 1,572,816 ms
TMR Reg.
Register +2
Register +3
ACT
TMcc T
Time T set by
command
______________________________________________________________________________
9-15
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
9.2.4 DEC (Decoding)
Function
This command compares a two-line BCD coded signal with a specified BCD coded
signal. This command outputs “1” if they match, “0” otherwise. This command is
mainly used in the decoding of M functions and T functions.
Format
Figure 9-15 shows the format for describing the command, and Table 9-6 shows the
coding format.
Decode
DEC cccc cccc Result
Output
ACT
W1
ccc·c
Signal Decode ccc·c
Control Command Address Setting
Values
cc cc
Number Digit
Decoding Sheet
Step Address Bit
Command Description
No. No. No.
1 RD ccc · c ACT
2 DEC cccc
3 (PRM) cccc
Control Values
Action Command (ACT)
ACT = 0: Turns off the output data (all 8) of the decode result output (W1).
ACT = 1: Starts the decoding, and outputs the decoded result to the decode output
address.
Parameters
1) Signal Address
The initial address of the two-line BCD coded signal.
______________________________________________________________________________
9-16
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
2) Decode Setting
There are two meanings to a decode setting: the number and the digit.
Decode setting: cc cc
Number Digit
MF DEN
DEC F10 3011 M30 M30
X
F7.0 F1.3 R228.1
Coding Sheet
Step Address Bit
Command Description
No. No. No.
1 RD F7 . 0
2 AND F1 . 3
3 DEC F10
4 (PRM) 3011
______________________________________________________________________________
9-17
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command decodes a 1-, 2-, or 4-byte binary format code data. If the code data
matches one of the pre-specified 8 numbers, it outputs a “1” to the output bit
corresponding to the number it matched. If it does not match, it outputs “0”. One of the
parameters is the address of the leading number (out of 8). This command is mainly used
in decoding M functions and T functions.
Decode Output
DECB 7 6 5 4 3 2 1 0
Code cccc
Data (SUB25) cccc
··············· Decoded
1-, 2-, or 4- +0
Number
byte binary
” +1
data
·······
” +7
8 numbers: Decode Number +0, +1, +2,
, +7 will be the basis for decoding. For
example, if the decode number is 62:
1) The 8 numbers 62~69 become the basis.
2) If the Code Data is 62, output data bit 0 turns
on.
3) If the Code Data is 69, output data bit 7 turns
on.
Format
Figure 9-18 shows the format for describing the command.
*
ACT DECB c cccc cccc cccc
cccc
(SUB25)
Decoder
Data Code Data Decode Output
Command Length Address Setting Address
Control Values
Action Command (ACT)
ACT = 0: Turns off the output data (all 8) of the decoding result (W1).
ACT = 1: Starts the decoding, and outputs the decoded result to the decode output
address.
______________________________________________________________________________
9-18
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Parameters
1) Data Length
The byte length of the code data.
When 1: Code data is 1-byte binary data.
When 2: Code data is 2-byte binary data.
When 4: Code data is 4-byte binary data.
3) Decode Setting
The lead number of the eight numbers that are used to decode.
______________________________________________________________________________
9-19
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
The most common use of the counter is to carry out addition. However, in the context of
machine control, the counter is used in various ways. The numbers in the counter (preset
value, addition value) can be specified to be in either BCD format or binary format,
depending on the system parameters of the PLC.
The counter has the following functionalities, which you can use appropriately depending
on the situation:
1) Preset Counter
This counter starts at a value, then when the counter exceeds the specified value,
it signals this event in the output. The preset value is set on the PLC control
screen. You can also specify the preset value within the sequence program.
2) Ring Counter
After passing the specified time, this counter continues and eventually loops back
to the starting number.
3) Up/Down Counter
This counter is a reversible counter; it can count both upwards and downwards.
4) Starting Value
Specifies the starting value of a counter as either “0” or “1.”
By combining the above functions, you can create not just an addition counter, but also a
two-way ring counter like the one shown in Figure 9-19. If you use the counter in this
way, you can determine the location of a rotation object.
. 8 1
7 2 Preset Value: 8
Default Value: 1
6 3
5 4
Format
Figure 9-20 shows the format for describing the command, and Table 9-8 shows the
coding format.
______________________________________________________________________________
9-20
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
CN0
ccc·c
UPDOWN Count Result
CTR cc Output
ccc·c W1
RST (SUB5)
ccc·c
ccc·c
ACT
Counter
Command Number
ccc·c
Control
Values
CTR
5 SUB 5 CN0 UPDOWN RST ACT
Command
cc Counter
6 (PRM) CN0 UPDOWN RST ACT
Number
Control Values
______________________________________________________________________________
9-21
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
2) Up/Down (UPDOWN)
UPDOWN = 0: Specifies an Up-Counter. The starting value is chosen by
CN0.
UPDOWN = 1: Specifies a Down-Counter. A preset value becomes the
starting value.
3) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. On a reset, W1 becomes 0 and the counter value is restored
to the starting value.
! CAUTION
You should set RST as “0” normally and change it to “1” only when
resetting is necessary. If not, the memory may not be read properly.
Parameters
Counter Number
There are 20 counters, each with 2 available bytes to use for the Preset Value and the
Addition Value, so the counter numbers that you can use are from 1~20.
______________________________________________________________________________
9-22
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
The preset counter counts, and when it reaches the specified number it outputs a signal.
• Since the count range is 0~9999, CN0 needs to be 0, so the B junction of signal L
is used.
• The input signal from the machine side, CRST · M, is used as a counter reset
signal.
• The counter signal is M30X, a decoded NC output M code. The B junction of the
CUP is in series with the M30X so that, after the counter reaches the designated
value, it does not count any more (unless it receives a reset signal).
L1
L1
R200.1
R200.1
L1
R200.1
L1
(3)
(CN0) (1)
R200.1
L1
(2) Count-Up Out
(UPDOWN)
R200.1 CTR 0001
CUP
CRST.M
(1) (SUB5)
(RST) Y6.1
X36.0
CUP M30X
(0)
(ACT)
Y6.1 R200.3
______________________________________________________________________________
9-23
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Counter Example #2: Using a Counter In Order To Record The Location Of The
Rotational Object (See Figures 9-23 and 9-24.)
L1
“1”
R200.1
R200.1
L1
R200.1
L1
(3)
(CN0) (1)
R200.1
REV
(2)
(UPDOWN)
CTR 0002
R200.1
L1 (SUB5)
(1)
(RST) R200.0
R200.1
POS
(0)
(ACT)
X36.0
2 6
1 7
12 8
11 9
10
Figure 9-23 is the ladder diagram that stores the location of the rotational body in Figure
9-24.
______________________________________________________________________________
9-24
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Counter Example #2 (con’t)
1) CONTROL VALUES
a) Counter Starting Number: If you think about the rotational body with twelve
angles in Figure 9-24, the count starting number is 1. With that in mind, in
order to make CN0 = 1, use the A junction of the signal L1.
b) Specifying the Up-Down Signal: REV is a signal that changes with the
rotational direction over time; REV changes into “0” when turning in the right
direction, and “1” when turning in the reverse direction. So, when the rotation
is in the right direction, the counter works as an up-counter, and when the
rotation is in the reverse direction, it works as a down-counter.
c) Reset: In the example, the W1 is not used. Therefore, RST = 0 all the time,
and the B junction of the signal L1 is used.
d) Count Signal: The count signal POS is a signal that alternates between ON-
OFF 12 times when the rotational body turns once.
In this example, counter 2 was used. Although the result of W1 is not used
elsewhere, you must designate an address for W1.
3) ACTION
a) Specifying the Preset Value: The rotational body controlled here has 12 edges
(Figure 9-24), so you must set the preset value of the counter as 12. To set the
preset value to 12, the PLC control screen is used.
b) Specifying the Current Value: You must first synchronize the rotational body
location with the current counter value. This value is set in the PLC control
screen. After this initialization is done once, the counter will correctly
represent the current location.
c) After the above a) and b) are done, then every time the rotational body rotates,
the POS turns ON and OFF and the counter 2 counts the number of rotations.
The counter counts in the following way:
______________________________________________________________________________
9-25
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
9.2.7 CTRC (Counter)
Function
This counter uses numeric data in binary format. The following types can be used
according to the situation:
1) Preset Counter
This counter is given a number to count to, previously specified, and when the
counter exceeds this value, the counter outputs a signal.
2) Ring Counter
After this counter reaches the preset value, it cycles to the starting value and starts
again.
3) Up/Down Counter
This counter is a reversible counter; it can count both upwards and downwards.
4) Starting Value
Specifies the starting value of a counter as either “0” or “1.”
Format
Figure 9-25 shows the format for describing the command, and Table 9-9 shows the
coding format.
CN0
CTRC cccc cccc
UPDOWN Up
(SUB55) Counter
Output
RST
W1
Counter
Preset Counter
ACT
Value Register
Command Address Address
Figure 9-25: Format for the CTRC Command
______________________________________________________________________________
9-26
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
CTRC
5 SUB 55
Command
Control Values
2) Up/Down (UPDOWN)
UPDOWN = 0: Up Counter. The starting values are:
0 when CN0 = 0
1 when CN0 = 1
UPDOWN = 1: Down Counter. A preset value becomes the starting value.
3) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. On a reset, W1 becomes 0 and the counter value is restored
to the starting value.
______________________________________________________________________________
9-27
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
“1” 0: Counter is off.
No change in W1.
ACT
“0” 1: Counts by reading
the rise from 0 to 1.
Count Count
Figure 9-26: Count Signal (Action Command) for the CTRC Command
Parameters
Preset Value +0
CTR CTR Preset Val (0 ~ 32,767)
Preset Value +1
Figure 9-27: Address of the Counter Preset Value for the CTRC Command
The counter preset value is given in binary format, so you can specify values 0 ~
32,767.
! CAUTION
If an address in the R region is used for a counter register, the value is
reset to 0 when the power is turned on.
Count Register +0
CTR Counter Value
Count Register +1
Count Register +2
WORK WORK: Unusable
Count Register +3
Figure 9-28: Address of the Up Counter Output for the CTRC Command
______________________________________________________________________________
9-28
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
9.2.8 ROT (Rotational Control)
Function
This command is used for controlling a rotational system like a rotational knife
sharpener, ATC, or a rotating table with the following functions:
2) Calculates the number of steps between the current location and the destination.
3) Calculates the location or the number of steps to the location one before the
destination.
Format
Figure 9-29 shows the format for describing the command, and Table 9-10 shows the
coding format.
RN0 (5)
(1) (2) (3) (4)
cccc·c
BYT (4)
cccc·c Rotational
DIR (3) Direction
ROT Output
cccc cccc cccc cccc
cccc·c W1
POS (SUB6)
(2)
cccc·c
cccc·c
INC (1)
______________________________________________________________________________
9-29
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
ROT
7 SUB 6 RN0 BYT DIR POS INC ACT
Command
cccc Number of
8 (PRM) RN0 BYT DIR POS INC ACT
Divisions
Current
9 (PRM) cccc Location RN0 BYT DIR POS INC ACT
Address
Destination
10 (PRM) cccc Location RN0 BYT DIR POS INC ACT
Address
Control Values
______________________________________________________________________________
9-30
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
3) Whether Or Not To Distinguish the Direction of Rotation (DIR)
DIR = 0: No distinction of direction of rotation; it will always be FOR
direction.
DIR = 1: Distinguishes the direction of rotation. See the Rotational Direction
Output (W1) section for more information.
Parameters
1) Number of Divisions
Specifies the rotational body’s calculation number.
______________________________________________________________________________
9-31
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
See Figure 9-30 for definitions for FOR (forward) and REV (reverse). When looking
from a specific point, the direction that increases the location number is FOR, the
direction that decreases the location number is REV. The address of W1 can be assigned
arbitrarily. In order to use the results from W1 you must make sure that ACT = 1.
(a) (b)
1 1
12 2 2 12
11 3 3 11
FOR REV REV FOR
10 4 4 10
9 5 5 9
8 6 6 8
7 7
______________________________________________________________________________
9-32
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command is used for controlling a rotational body such as ATC and a rotational
table. In contrast to the ROT command (Section 9.2.8) where the parameter of the
rotational calculation number is fixed, this command specifies an address to the data, so
the data can change while execution occurs. Also, all data used is in binary format. The
rest of the specifications are the same as the ROT command.
Format
Figure 9-31 shows the format for describing the command.
RN0
* * * *
DIR
Rotational
Direction
Output
POS
ROTB c cccc cccc cccc cccc
W1
(SUB26)
INC
Control Values
1) Rotational Body Starting Number (RN0)
RN0 = 0: The rotational body location number starts from 0.
RN0 = 1: The rotational body location number starts from 1.
______________________________________________________________________________
9-33
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
4) Calculate Location or the Number of Steps (INC)
INC = 0: Calculates the number of a location. (To calculate the location one
before the destination, specify INC = 0 and POS = 1.)
INC = 1: Calculates the number of steps. (To calculate the difference between
the current location and the destination, specify INC = 1 and POS =
0.)
Parameters
1) Data Length
Specifies the byte length of the data in the first digit of the parameters.
When 1: Data is 1-byte binary data.
When 2: Data is 2-byte binary data.
When 4: Data is 4-byte binary data.
The numeric data (rotational body divisions and the current location data) is in
binary format, and the specified number of bytes is necessary in memory.
______________________________________________________________________________
9-34
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
See Figure 9-30 for definitions for FOR (forward) and REV (reverse). When looking
from a specific point, the direction that increases the location number is FOR, the
direction that decreases the location number is REV. The address of W1 can be assigned
arbitrarily. In order to use the results from W1 you must make sure that ACT = 1.
• The current location is specified from the machine tool in the signal (address
X41) in binary.
• The location of the position one prior to the destination is output into address
R230.
• Execution start is designated by the signal TF (address F7.3), an output from the
ServoWorks Motion Engine.
• A comparator (COIN) is used to detect the speed reduction position and the
stopping position.
______________________________________________________________________________
9-35
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
A Logic 1
A
R0228.0
R0228.0
A
R0228.0
A (4) ROTB 4 D0000 X0041 F0026 R0230
R0228.0 (SUB26)
A (3) Normal Division Current Destin. Result
R0228.0 Data number Pos. Pos. Output
Format Address Address Address
A (2) CR- Shortcut
CCW Decision
R0228.0 R0228.1 Result
A (1)
R0228.0
TF (0)
R0228.3 Y0005.5
TF (0) COMPB 1004 F0026 X0041
(SUB32) Data Data Comp
F0007.3 Format Data Addr
Dest. Pos
TF TCO (Stop Pos)
MPB
R9000.0 F0007.3 Detection
R0228.3
TF CR-CCW TCOMPB Turn
CW-M
Forward
F0007.3 R0228.1 R0228.3 Y0005.6
TF CR-CCW TCOMPB CCW Turn
-M Backward
F0007.3 R0228.1 R0228.3 Y0005.7
______________________________________________________________________________
9-36
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
9.2.10 COD (Code Transformation)
Function
This command transforms BCD code to 2- or 4-digit BCD numbers. The input and
output address as well as the transformation data table are required, as shown in Figure 9-
33. The input address specifies, in 2-digit BCD, the row number of the table to access.
The values are entered into the transformation data table in 2-digit or 4-digit BCD. The
value at the output address will contain the value stored in the specified row in the
transformation data table. For example, as in Figure 9-33, the input contains the value 3,
so the contents of the transformation data table at row 3, 137, is output to the data output
address.
Row Transformation
No. Data Table
Input Data 0
Address 3
cccc 1
Specify row number here
(2-digit BCD). 2
3 137
4
········· ···········
Data Output
Address
cccc Data in the specified row
in the table is put into this
address. n
Format
Figure 9-34 shows the format for describing the command, and Table 9-11 shows the
coding format.
______________________________________________________________________________
9-37
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
BYT
COD cccc cccc cccc
ccc·c Error Output
RST (SUB7)
W1
ccc·c Input Output
ACT Number Data Data
Command of Rows Address Address
ccc·c
Control
Values
Row
Data Table
Number
1 c c c c
2 c c c c
3 c c c c
4 c c c c
______________________________________________________________________________
9-38
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
COD
4 SUB 7 BYT RST ACT
Command
cccc Number of
5 (PRM) BYT RST ACT
Rows (1)
Control Values
______________________________________________________________________________
9-39
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Parameters
1) Number of Rows
The size of the transformation data table (the number of rows). Possible values
lie within the range 00~99. If n is the last row number, then value n+1 should be
the table size.
______________________________________________________________________________
9-40
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Functions
This command converts binary style data into 1-, 2- or 4-byte size binary. To carry out
the data conversion, the command requires the input and output data address and the
transformation data table, as shown in Figure 9-35. CODB function differs from the
COD function (Section 9.2.10), in that it utilizes numeric data that is in 1-, 2-, or 4-byte
size binary style and the transformation data table size can be expanded to a maximum of
256 rows.
Row Transformation
Number Data Table
Input Data
Address 2 0
cccc
Put the Table Row 1
Number Here (1-byte NOTE:
binary) 2
2) This is for a 2-
byte binary case.
3
Data Output
······
is put here.
(nmax=255) n
Format
Figure 9-36 shows the format for describing the command.
. *
RST Error
CODB c ccc cccc cccc Output
(SUB27) W1
ACT
Input Output
Data Number Data Data
Command Length of Data Address Address
______________________________________________________________________________
9-41
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Control Values
1) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. In other words, W1 becomes “0.”
Parameters
1) Data Length
The byte length of the numeric binary data inside the transformation data table.
When 1: Numeric data is 1-byte binary data.
When 2: Numeric data is 2-byte binary data.
When 4: Numeric data is 4-byte binary data.
2) Number of Data
The size of the transformation data table. Size ranges from 0~255; the maximum
number of rows is 256.
______________________________________________________________________________
9-42
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
9.2.12 MOVE (Masked Data Transfer)
Function
This command performs a bit-wise product (AND) of the specified data and the input
data, the value output to the output address. Use this command when you are specifying
only certain bits of the 8-bit signal within an address, also called “masking the value.”
Input Data 0 0 0 0 0 0 0 0
Logic Data
c c c c c c c c
Upper 4 bits Lower 4 bits
Figure 9-37: Input Data and Logic Data for the MOVE Command
______________________________________________________________________________
9-43
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Format
Figure 9-38 shows the format for describing the command, and Table 9-12 shows the
coding format.
MOVE
2 SUB 8 ACT
Command
Control Values
Action Command (ACT)
ACT = 0: No execution of the MOVE command.
ACT = 1: Execution of the MOVE command.
______________________________________________________________________________
9-44
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
7 6 5 4 3 2 1 0
Address X35
Logic Data 0 0 0 1 1 1 1 1
Address R210 0 0 0
Code Signal
A
MOVE (1) (2) (3) (4)
______________________________________________________________________________
9-45
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command carries out the bit-wise sum (OR) of the input data and the logic sum data
(each is 1 byte) and transfers the data into the output address.
OR
Format
Figure 9-41 shows the format for describing the command.
Control Values
Action Command (ACT)
ACT = 0: No execution of the MOVOR command.
ACT = 1: Execution of the MOVOR command.
Parameter
______________________________________________________________________________
9-46
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command can force a region of coils to be in the off state. The region can be
specified by the number of successive coils, or until the common line control termination
command (COME). See Figure 9-42. If the number of coils is specified to be a non-zero
number, then that many coils are automatically turned off. If the number of coils is zero,
then the region up to the COME command is turned off. If the coil number is non-zero,
but a COME command is there, then an error is displayed when the program ends.
ACT
COM cccc
No. of Coils
(SUB9)
to Turn Off
0 ~ 9999
0: Region
Otherwise: Number
Format
Figure 9-43 shows the format for describing the command.
COM cccc
(SUB9)
No. of Coils
Command to Turn Off
______________________________________________________________________________
9-47
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Control Values
Action Command (ACT)
ACT = 0: Sets the coils in the specified region to “0” unconditionally.
ACT = 1: No action.
The command takes effect starting at the step after the COM command.
Parameters
Number of Coils to Turn Off
Must be a number between 0-9999.
When 0 is specified: Becomes area-specific as explained above.
When a number other than 0 is specified: Becomes coil number specific.
ACT A B
W1
ACT C
W2
E F G
W3
! CAUTION
The commands within the specified area are executed regardless of the
ACT value. However, when ACT=0, the result coil unconditionally
becomes 0.
! CAUTION
Nested COM calls are not allowed.
! CAUTION
Coils written with the command WRT.NOT are unconditionally set to
1 when ACT=0 for the COM.
______________________________________________________________________________
9-48
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Examples of COM Command Usage
See Figures 9-45 and 9-46 for examples of COM command usage.
ACT
NOTE: COM 2
E F G
W3
ACT=0
ACT
COM 3
Regardless of COM,
A B if ACT1=1, then the
W1 MOVE command is
executed, and data
is transferred.
ACT1 Upper 4 Lower 4
Input Output
Bits Bits
MOVE Data Data
Logic Logic
Address Address
Data Data
E
W3
Figure 9-46: Ladder Diagram Example Using COM, MOVE and COIN Commands
______________________________________________________________________________
9-49
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
9.2.15 COME (Common Line Control Termination)
Function
This command ends the region specified by a COM command. You cannot use this
command by itself; you must always pair it with the COM command.
Format
Figure 9-47 shows the format for describing the command.
COME
(SUB29)
Command
Figure 9-47: Format for the COME Command
______________________________________________________________________________
9-50
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command skips calculations for a region of coils. The region can be specified by the
number of successive coils, or until the Jump termination command (JMPE). If the
number of coils is specified to be a non-zero number, then that many coils are
automatically skipped. If the number of coils is zero, then the region up to the JMPE
command is turned off (skipped). If the coil number is non-zero, but a JMPE command
is there, then an error is displayed when the program ends.
cccc
ACT JMP
No. of
(SUB10) Coils to
Turn Off
0~9999
0: Region
Otherwise: Number
Format
Figure 9-49 shows the format for describing the command, and Table 9-13 shows the
coding format.
JMP cccc
ACT
(SUB10)
No. of
Coils to
Command Jump
Figure 9-49: Format for the JMP Command
______________________________________________________________________________
9-51
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
1 RD ccc · c ACT
JMP
2 SUB 10
Command
Control Values
Action Command (ACT)
ACT = 0: No jump. Program continues execution after the JMP command.
ACT = 1: Skips calculations for the specified area, restarting calculations from the
following step.
Parameter
Number of Coils to Jump
Must be a number between 0-9999.
When 0 is specified: Becomes an area specific jump.
When a value other than 0 is specified: Becomes a coil number specific jump.
______________________________________________________________________________
9-52
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
ACT JMP
2
(SUB10)
A
W1
ACT=0
10.1 20.1
B
W2
E F
W3
ACT=1
When ACT = 0, the program continues execution after the JMP command (i.e. no jump).
When ACT = 1, the sequences for the region delimited by the number of coils are
“jumped” and the results of the logic calculations do not affect the coil value. In other
words, when ACT = 1, in Figure 9-50, when the signal changes from “1”↔ “0”, W1
remains under the same condition as before ACT = 1. Similarly, even if signals B, C, and
D change, W2 is not changed. However, JMP commands do not decrease the execution
time of the program.
______________________________________________________________________________
9-53
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command marks the end of the region specified for the Jump Command (JMP). You
cannot use this command by itself; you must always pair it with the JMP command.
Format
Figure 9-51 shows the format for describing the command.
JMPE
(SUB30)
Command
Figure 9-51: Format for the JMPE Command
______________________________________________________________________________
9-54
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command carries out the parity check for the code signal and outputs an error if the
parity check fails. The check looks at 1 byte of data (8 bits) and performs odd or even
parity check.
A parity check is used to reveal errors in storage or transmission. An extra bit (called the
“parity bit”) is added to a byte or word. In even parity, that bit is set to either “0” or “1,”
whichever would make an even number of “1” bits in the byte. In odd parity, that bit is
also set to either “0” or “1,” whichever would make an odd number of “1” bits in the
byte.
For example, for even parity, if the first seven bits of a byte are 0 1 1 0 1 0 0, then the
parity bit needs to be “1” to make four (an even number) “1” bits. The entire byte would
be as follows: 1 0 1 1 0 1 0 0.
A single parity bit can only reveal odd bit errors, since if an even number of bits is
wrong, then the parity bit will not change. Also, if there is an error, the parity check
won’t be able to pinpoint which bit is wrong. However, parity checks are still quite
useful.
Format
Figure 9-52 shows the format for describing the command, and Table 9-14 shows the
coding format.
O ·E
(2)
PARI cccc
cccc·c Error Output
RST (SUB11)
(1)
W1
cccc·c Check cccc·c
ACT Data
(0)
Command Address
cccc·c
Control
Values
Figure 9-52: Format for the PARI Command
______________________________________________________________________________
9-55
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
PARI
4 SUB 11 O ·E RST ACT
Command
Control Values
2) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. In other words, W1 becomes “0”. If there is a parity error
and RST=1, then the program is reset.
______________________________________________________________________________
9-56
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Address X036 0
R228.0
A
(2)
R228.0
ERST.M PARI
(1) X036 ERR
(SUB11)
X32.7
TF
(0)
F7.3
! CAUTION
Out of bits 0~7, the bits that do not correspond to parity check have to
be “0”.
______________________________________________________________________________
9-57
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command converts binary code into BCD code, and vice versa.
Format
Figure 9-54 shows the format for describing the command, and Table 9-15 shows the
coding format.
BYT (3)
(1) (2)
ccc·c DCNV cccc cccc
CNV (2)
(SUB14) Error Output
ccc·c W1
RST (1)
ccc·c
ccc·c Output
ACT (0) Input Data Data
Command Address Address
ccc·c
Control Values
DCNV
5 SUB 14 BYT CNV RST ACT
Command
______________________________________________________________________________
9-58
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Control Values
3) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. When W1 = 1 and RST = 1, then W1 becomes “0.”
______________________________________________________________________________
9-59
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command converts binary code of 1, 2, or 4 bytes into BCD code, or BCD code into
binary code. Memory with specified byte length is necessary for the conversion result
output data.
Format
Figure 9-55 shows the format for describing the command.
SIN
* *
DCNVB c cccc cccc
CNV
(SUB31) Error
Output
RST
W1
Output
ACT Data Input Data Data
Command Length Address Address
Control Values
3) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. In other words, W1 becomes “0.”
______________________________________________________________________________
9-60
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Parameters
1) Data Length
Specifies the byte length of the data in the first digit of the parameters.
When 1: Numeric data is 1-byte binary data.
When 2: Numeric data is 2-byte binary data.
When 4: Numeric data is 4-byte binary data
7 6 5 4 3 2 1 0
R9000
Negative
______________________________________________________________________________
9-61
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command compares the sizes of the input value and the comparison value.
Format
Figure 9-57 shows the format for describing the command, and Table 9-16 shows the
coding format.
BYT COMP c cccc cccc Comparison
Result Output
(SUB15)
ccc·c W1
ACT
Input Comparison
Data Input Data cccc·c
ccc·c Command Format Data Address
Control
Values
Figure 9-57: Format for the COMP Command
COMP
3 SUB 15 BYT ACT
Command
c Input Data
4 (PRM) BYT ACT
Format
cccc Comparison
6 (PRM) BYT ACT
Data Address
W1,
7 WRT ccc · c Comparison BYT W1
Result Output
______________________________________________________________________________
9-62
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Control Values
Parameters
1) Input Data Format
0: Specifies the input data as a constant.
1: Specifies the input data as an address – indirection. (Specifies the address
where the input data is stored instead of directly specifying the data.)
2) Input Data
Input data can either be a constant or an address of a constant. The different types
can be distinguished by specifying the “Input Data Format” parameter.
______________________________________________________________________________
9-63
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command compares 1-, 2-, or 4-byte size binary data, putting the result to the
calculation result register (R500). The input data and the comparison data must be the
same length.
Format
Figure 9-58 shows the format for describing the command.
* *
ACT COMPB cccc cccc cccc
(SUB32) Data
Length & Comparison
Input Data Input Data
Command Format Data Address
Figure 9-58: Format for the COMPB Command
Control Values
Action Command (ACT)
ACT = 0: No execution of the COMPB command. No change in W1.
ACT = 1: Execution of the COMPB command. The comparison result is output to
W1.
Parameters
1) Data Length and Input Data Format
The data length (1, 2, or 4 bytes) and the input data format (constant data or data
address).
0 0
Data Length
Format 1: 1-byte data
0: Constant 2: 2-byte data
1: Address 4: 4-byte data
Figure 9-59: Parameters Format Specification for the COMPB Command
2) Input Data
The format of the input data is determined by the specification of the “Input Data
Format” parameter. Depending on what format was specified, this parameter
could be an input data address or an input data constant.
______________________________________________________________________________
9-64
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Calculation Result Register (R9000)
A “1” in the following bit locations signifies the following:
7 6 5 4 3 2 1 0
R9000
Overflow
______________________________________________________________________________
9-65
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command determines if the input value and the comparison value are the same. This
command can only be used when the data is in BCD format.
Format
Figure 9-61 shows the format for describing the command, and Table 9-17 shows the
coding format.
BYT (1) (1) (2) (3)
Comparison
COIN c cccc cccc Result Output
ccc·c (SUB16) W1
ACT (0) Input Comparison
Data Input Data cccc·c
ccc·c Command Format Data Address
Control
Values
Figure 9-61: Format for the COIN Command
COIN
3 SUB 16 BYT ACT
Command
c Input Data
4 (PRM) BYT ACT
Format
cccc Comparison
6 (PRM) BYT ACT
Data Address
W1,
7 WRT ccc · c Comparison BYT W1
Result Output
______________________________________________________________________________
9-66
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Control Values
Parameters
2) Input Data
Input data can either be an input data address or an input data constant. The
different types can be distinguished by the “Input Data Format” parameter.
______________________________________________________________________________
9-67
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command shifts 2 contiguous bytes (16 bits) of data 1 bit to the right or to the left.
W1=1 when the data “1” shifts out from the left margin (bit 15 was “1”) on a shift-left, or
the right margin (bit 0 was “1”) on a shift-right. W1 is basically the overflow value.
Format
Figure 9-62 shows the format for describing the command.
DIR
*
SFT cccc Shift
CONT Result
(SUB33) Output
RST W1
ACT
Shift Data
Command Address
Control Values
______________________________________________________________________________
9-68
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
2) Condition Specification (CONT)
CONT = 0: This is the normal shift, where every bit after the shift holds the
value of the bit next to it (left or right depending on DIR)
before the shift. If shifting left, bit 15 will get the value
previously in bit 14, etc. Furthermore, a 0 is inserted into the
first bit of the shift (bit 0 for shift left, 15 for shift right).
15 14 13 12 11 10 9 8
Figure 9-63: Condition Specification CONT = 0 for the SFT Command – Shift Left
Example
0 0 0 0 0 0 1 1
7 6 5 4 3 2 1 0
1 1 0 0 1 1 0 0
3) Reset (RST)
Resets (W1 = 0) the result from the shifting process, the value that got shifted out.
RST = 0: No reset.
RST = 1: Resets. In other words, W1 becomes “0.”
______________________________________________________________________________
9-69
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
4) Action Command (ACT)
ACT = 0: Shift process is not carried out.
ACT = 1: Carries out the shift process. In order to just shift 1 bit, after executing
ACT = 1, immediately change to ACT = 0.
Parameters
Shift Data Address
The address of the data to be shifted. The address needs to be 2 contiguous bytes of data.
The bit numbers below are described as bits 0~15, but when specifying for the program,
there is an address number for each byte (8 bits) and one can only specify from bit
numbers 0~7.
15 14 13 12 11 10 9 8
Specified Address
7 6 5 4 3 2 1 0
Specified Address +1
______________________________________________________________________________
9-70
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
In the ServoWorksPLC, you can use something called a data table, which will be
explained later (see Section 9.3: PLC Data Table). This command is related to this data
table. This command checks whether certain data is inside the data table, and if it is it
outputs the row number where the data resides in the data table. It also replies
accordingly if the data does not exist in the table.
Transformation
Row
Data Table
Number
0
Search Data 1
100 2
········· 100
················
Search Result
2
··········
! CAUTION
The leading data table address selected in the DSCH command
parameters becomes the 0th table internal number (row number). This
table internal number differs from the table internal number mentioned
in Section 9.3 for the data table for the PLC.
Format
Figure 9-67 shows the format for describing the command, and Table 9-18 shows the
coding format.
______________________________________________________________________________
9-71
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
BYT (2)
(1) (2) (3) (4)
DSCH
4 SUB 17 BYT RST ACT
Command
cccc Number of
5 (PRM) BYT RST ACT
Rows
Data Table
6 (PRM) cccc Leading BYT RST ACT
Address
______________________________________________________________________________
9-72
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Control Values
2) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. In other words, W1 becomes “0.”
Parameters
1) Number of Rows
This address holds the number of rows of the data table (table capacity). There
must be enough valid memory for the number of rows specified. If the first data
table number is Number 0 and the last is number “n,” “n+1” is specified as the
data number (number of rows) of the data table.
______________________________________________________________________________
9-73
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
9.2.26 DSCHB (Binary Data Search)
Function
This command searches the data inside the data table like the DSCH command (Section
9.2.25). This command differs in that the data is in binary format and the number of rows
for the data table (table capacity) changes to an address that contains the data, so even
after the sequence program is compiled into binary data, the table capacity can still
change.
Row
Number Table
0
Search Data
1
100 2 100
·····
················
Result Output
··········
n
Format
Figure 9-69 shows the format for describing the command.
RST * * * * Search
DSCHB c cccc cccc cccc cccc Results
Control Values
1) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. In other words, W1 becomes “0.”
______________________________________________________________________________
9-74
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Parameters
1) Data Length
Specifies the byte length of the data in the first digit of the parameters.
When 1: Data is 1-byte binary data.
When 2: Data is 2-byte binary data.
When 4: Data is 4-byte binary data.
______________________________________________________________________________
9-75
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
Similar to the DSCH command, this command operates on the data table; it reads to or
writes from the data table.
Row
No. Data Table
0
1
Input / Output
1
Data
2
2
Row Number 3
containing input /
········
2
output data
·········
1 Reading from Data Table
n
2 Writing to Data Table
Figure 9-70: Reading from and Writing to the Data Table for the XMOV Command
! CAUTION
The leading data table address selected in the XMOV command
parameters becomes the 0th table internal number (row number). This
table internal number differs from the table internal number mentioned
in Section 9.3: PLC Data Table.
______________________________________________________________________________
9-76
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Format
Figure 9-71 shows the format for describing the command, and Table 9-19 shows the
coding format.
BYT
(3)
(1) (2) (3) (4)
cccc·c XMOV cccc cccc cccc cccc
RW
(2) (SUB18)
Error Output
cccc·c W1
RST
(1) Input Table cccc·c
Data Output Internal
cccc·c Number Data Table Data Number
ACT
(0) Storage Leading Storage Storage
Command Address Address Address Address
cccc·c
Control
Values
Figure 9-71: Format for the XMOV Command
______________________________________________________________________________
9-77
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
XMOV
5 SUB 18 BYT RW RST ACT
Command
Data Number
6 (PRM) cccc Storage BYT RW RST ACT
Address
Data Table
7 (PRM) cccc Leading BYT RW RST ACT
Address
Input Output
8 (PRM) cccc Data Storage BYT RW RST ACT
Address
Table Internal
cccc Number
9 (PRM) BYT RW RST ACT
Storage
Address
Control Values
3) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. In other words, W1 becomes “0”.
______________________________________________________________________________
9-78
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Parameters
______________________________________________________________________________
9-79
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command is same as the XMOV Command in Section 9.2.27 in that it reads from
and writes to data in the data table. The only two differences are that all the numeric data
used is in binary format and that the data number specification of the data table (table
capacity) become address specified and even after the sequence program is converted into
binary data, the table capacity is variable.
Row
No. Data Table
0
1
Input / Output
1
Data
2
2
Row Number 3
containing input /
········
2
output data
·········
1 Reading from Data Table
n
2 Writing to Data Table
Figure 9-72: Reading from and Writing to the Data Table for the XMOVB Command
Format
Figure 9-73 shows the format for describing the command.
RW
* * * *
Error
XMOVB c cccc cccc cccc cccc
Output
RST
(SUB35) Input Table W1
Data Data Output Internal
ACT Number Table Data Number
Data Storage Leading Storage Storage
Command Length Address Address Address Address
Control Values
2) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. In other words, W1 becomes “0.”
______________________________________________________________________________
9-80
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Parameters
1) Data Length
Specifies the byte length of the data in the first digit of the parameters.
When 1: Data is 1-byte binary data.
When 2: Data is 2-byte binary data.
When 4: Data is 4-byte binary data.
______________________________________________________________________________
9-81
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
9.2.29 ADD (Addition)
Function
This command adds two 2- or 4-digit BCD numbers.
Format
Figure 9-74 shows the format for describing the command, and Table 9-20 shows the
coding format.
A + B = C
BYT
(2) (1) (2) (3) (4)
ADD Error
cccc·c c cccc cccc cccc
RST Output
(1) (SUB19) W1
Format of Add Add Addition
cccc·c Add Number Number Result
ACT ccc·c
(0) Number Data Data Output
Command Data Address Constant Address
cccc·c
Control
Values Figure 9-74: Format for the ADD Command
ADD
4 SUB 19 BYT RST ACT
Command
Format of Add
5 (PRM) c BYT RST ACT
Number Data
______________________________________________________________________________
9-82
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Control Values
2) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. In other words, W1 becomes “0.”
Parameters
______________________________________________________________________________
9-83
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command adds binary data of 1, 2, or 4 bytes. The numeric data from the
calculation result and other calculation information is set inside the calculation result
register (R9000). The add number data or the addition result output data needs
corresponding bytes of memory.
Format
Figure 9-75 shows the format for describing the command.
A + B = C
RST * * * Error
ADDB c cccc cccc cccc Output
Control Values
1) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. In other words, W1 becomes “0.”
Parameters
1) Data Length and Format of Add Number Data
The data size (1, 2, or 4 bytes) and the format of the add number data (constant
data or address data).
c c
Data Length
Format Setting 1: 1-byte data
0: Constant 2: 2-byte data
1: Address 4: 4-byte data
______________________________________________________________________________
9-84
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Zero
Negative
Overflow
______________________________________________________________________________
9-85
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command subtracts two 2- or 4-digit BCD numbers.
Format
Figure 9-78 shows the format for describing the command, and Table 9-21 shows the
coding format.
A - B = C
BYT (2)
(1)
______________________________________________________________________________
9-86
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
SUB
4 SUB 20 BYT RST ACT
Command
Format of
5 (PRM) c Subtract BYT RST ACT
Number Data
Subtract
6 (PRM) cccc Number Data BYT RST ACT
Address
Subtract
7 (PRM) cccc Number Data BYT RST ACT
Constant
Subtraction
8 (PRM) cccc Result Output BYT RST ACT
Address
Control Values
2) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. In other words, W1 becomes “0.”
______________________________________________________________________________
9-87
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Parameters
______________________________________________________________________________
9-88
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command carries out subtraction of 1-, 2-, or 4-byte size binary format data. The
numeric data from the calculation result and other calculation information is set inside the
calculation result register (R9000). The subtract number data or the subtraction output
data needs corresponding bytes of memory.
Format
Figure 9-79 shows the format for describing the command.
A - B = C
RST * * * Error
SUBB c cccc cccc cccc Output
Data
(SUB37) Length & Subtract Subtract Subtraction W1
ACT
Format of Number Number Result
Subtract Data Data Output
Command Number Address Constant Address
Control Values
1) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. In other words, W1 becomes “0.”
Parameters
c c
Data Length
Format Setting 1: 1-byte data
0: Constant 2: 2-byte data
1: Address 4: 4-byte data
______________________________________________________________________________
9-89
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
7 6 5 4 3 2 1 0
R9000
Zero
Negative
Overflow
______________________________________________________________________________
9-90
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command carries out multiplication of 2- or 4-digit BCD, but the calculation results
have to be within 2- or 4-digit BCD as well.
Format
Figure 9-82 shows the format for describing the command, and Table 9-22 shows the
coding format.
A x B = C
BYT
(2) (1) (2) (3) (4)
Error
ccc·c MUL c cccc cccc cccc Output
RST
(1) (SUB21) Multi-
Format of plication W1
ccc·c the Multiplier Multiplier Result
Multiplier Data Data Output cccc·c
ACT
(0) Command Data Address Constant Address
ccc·c
Control Figure 9-82: Format for the MUL Command
Values
______________________________________________________________________________
9-91
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
MUL
4 SUB 21 BYT RST ACT
Command
c Format of
5 (PRM) BYT RST ACT
Multiplier Data
Control Values
2) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. In other words, W1 becomes “0.”
Parameters
______________________________________________________________________________
9-92
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
______________________________________________________________________________
9-93
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command carries out multiplication of 1-, 2-, or 4-byte size binary format data. The
numeric data from the calculation result and other calculation information is set inside the
calculation result register (R9000). The multiplier data or the multiplication output data
needs corresponding bytes of memory.
Format
A x B = C
RST * * * Error
MULB c cccc cccc cccc Output
Data Multi-
(SUB38) Length & plication W1
ACT
Format of Multiplier Multiplier Result
Multiplier Data Data Output
Command Data Address Constant Address
Control Values
1) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. In other words, W1 becomes “0.”
______________________________________________________________________________
9-94
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Parameters
Zero
Negative
Overflow
______________________________________________________________________________
9-95
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
9.2.35 DIV (Division)
Function
This command carries out the division of 2- or 4-digit BCD. However, all decimals are
disregarded in the calculation results.
Format
Figure 9-86 shows the format for describing the command, and Table 9-23 shows the
coding format.
A / B = C
BYT
(2) (1) (2) (3) (4)
Error
cccc·c DIV c cccc cccc cccc Output
RST
(1) (SUB22) W1
Division
cccc·c Format of Divisor Divisor Result ccc·c
ACT
(0) the Divisor Data Data Output
Command Data Address Constant Address
cccc·c
Control Values
Figure 9-86: Format for the DIV Command
______________________________________________________________________________
9-96
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
DIV
4 SUB 22 BYT RST ACT
Command
c Format of
5 (PRM) BYT RST ACT
Divisor Data
Control Values
2) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. In other words, W1 becomes “0.”
______________________________________________________________________________
9-97
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Parameters
______________________________________________________________________________
9-98
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command carries out division of 1-, 2-, or 4-byte size binary format data. The
numeric data from the calculation result and other calculation information is set inside the
calculation result register (R9000), and the remainder is set inside R9002. The divisor
data and the division output (quotient) data need corresponding bytes of memory.
Format
Figure 9-87 shows the format for describing the command.
A / B = C
RST * * * Error
DIVB cccc cccc cccc cccc Output
Data
(SUB36) Length & Division W1
ACT
Format of Divisor Divisor Result
Divisor Data Data Output
Command Data Address Constant Address
Control Values
1) Reset (RST)
RST = 0: No reset.
RST = 1: Resets. In other words, W1 becomes “0.”
Parameters
c c
Data Length
Format Setting 1: 1-byte data
0: Constant 2: 2-byte data
1: Address 4: 4-byte data
______________________________________________________________________________
9-99
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
7 6 5 4 3 2 1 0
R9000
Zero
Negative
______________________________________________________________________________
9-100
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
When using a function command, there are cases when constants are necessary. In those
cases, this command may be used to declare 2- or 4-digit BCD constant data.
Format
Figure 9-90 shows the format for describing the command, and Table 9-24 shows the
coding format.
NUME
3 SUB 23 BYT ACT
Command
Constant
5 (PRM) cccc Output BYT ACT
Address
______________________________________________________________________________
9-101
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Control Values
Parameters
1) Constant
The constants are specified with the data size specified by the BYT control value.
______________________________________________________________________________
9-102
SERVOWORKSPLC MANUAL
Chapter 9: PLC Functional Commands
Function
This command declares 1-, 2-, or 4-byte size binary constant data. When programming,
if data is input in base 10 format, after the execution of the program, it changes into
binary format and the binary style constant from a specified address is stored into the
byte size memory.
Format
Figure 9-91 shows the format for describing the command.
*
NUMEB c c···c cccc
ACT
(SUB40)
Constant
Data Output
Command Length Constant Address
Control Values
Action Command (ACT)
ACT = 0: No execution of the NUMEB command.
ACT = 1: Execution of the NUMEB command.
Parameters
1) Data Length
Specifies the byte length of the data in the first digit in the parameters.
When 1: Data is 1-byte binary data.
When 2: Data is 2-byte binary data.
When 4: Data is 4-byte binary data.
2) Constant
The constant data is declared in base 10. In this case, the data has to be constant
data that can be stored within the capacity specified in the format specification
declared in the “Data Length” parameter.
______________________________________________________________________________
9-103
SERVOWORKSPLC MANUAL
Appendix A: S-100T Data Mapping Tables
Each physical input and output device has a specific location associated with it. The
binary value (“0” or “1”) of that memory location corresponds to the logical state or
value of the device.
The following mapping tables should be used in writing the sequence program for your
machine tool. For instance, as part of your program, you may want to check to see if a
“spindle stop” command has been issued through the ServoWorks Motion Engine. To do
so, you would check the F Data Mapping Tables, and find that the “Spindle STOP” signal
(called MSPLSTP) is at address F018.1. To read this signal, you might use the command
“RD F018.1.”
Every possible command or signal either to or from the PLC Engine has a designed
signal and address, as follows:
• F Data: Signals from the CNC (ServoWorks Motion Engine) to the PLC Engine.
• G Data: Signals from the PLC Engine to the CNC (ServoWorks Motion Engine).
______________________________________________________________________________
A-1
SERVOWORKSPLC MANUAL
Appendix A: S-100T Data Mapping Tables
______________________________________________________________________________
A-2
SERVOWORKSPLC MANUAL
Appendix A: S-100T Data Mapping Tables
F009.0
F009.1
F009.2
F009.3
F009.4 DM30 M30
F009.5 DM02 M02
F009.6 DM01 M01
______________________________________________________________________________
A-3
SERVOWORKSPLC MANUAL
Appendix A: S-100T Data Mapping Tables
______________________________________________________________________________
A-4
SERVOWORKSPLC MANUAL
Appendix A: S-100T Data Mapping Tables
______________________________________________________________________________
A-5
SERVOWORKSPLC MANUAL
Appendix A: S-100T Data Mapping Tables
______________________________________________________________________________
A-6
SERVOWORKSPLC MANUAL
Appendix A: S-100T Data Mapping Tables
______________________________________________________________________________
A-7
SERVOWORKSPLC MANUAL
Appendix A: S-100T Data Mapping Tables
______________________________________________________________________________
A-8
SERVOWORKSPLC MANUAL
Appendix A: S-100T Data Mapping Tables
______________________________________________________________________________
A-9
SERVOWORKSPLC MANUAL
Appendix A: S-100T Data Mapping Tables
______________________________________________________________________________
A-10
SERVOWORKSPLC MANUAL
Appendix A: S-100T Data Mapping Tables
______________________________________________________________________________
A-11
SERVOWORKSPLC MANUAL
Appendix A: S-100T Data Mapping Tables
______________________________________________________________________________
A-12
SERVOWORKSPLC MANUAL
Appendix A: S-100T Data Mapping Tables
______________________________________________________________________________
A-13
SERVOWORKSPLC MANUAL
Appendix A: S-100T Data Mapping Tables
______________________________________________________________________________
A-14
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
Each physical input and output device has a specific location associated with it. The
binary value (“0” or “1”) of that memory location corresponds to the logical state or
value of the device.
The following mapping tables should be used in writing the sequence program for your
machine tool. For instance, as part of your program, you may want to check to see if a
“cycle stop” command has been issued through the ServoWorks Motion Engine. To do
so, you would check the F Data Mapping Tables, and find that the “Cycle Stop” signal
(called SPL) is at address F000.4. To read this signal, you might use the command “RD
F000.4.”
Every possible command or signal either to or from the PLC Engine has a designed
signal and address, as follows:
• F Data: Signals from the ServoWorks Motion Engine to the PLC Engine.
• G Data: Signals to the ServoWorks Motion Engine from the PLC Engine.
• X Data: Signals from the machine tool to the PLC Engine (machine input).
• Y Data: Signals to the machine tool from the PLC Engine (machine output).
Tables B-1 through B-8 are located at the end of this appendix.
______________________________________________________________________________
B-1
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-2
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-3
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-4
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-5
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-6
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-7
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-8
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-9
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-10
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-11
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-12
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-13
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-14
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-15
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-16
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-17
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-18
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-19
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-20
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-21
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-22
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-23
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-24
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-25
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-26
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-27
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-28
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-29
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
Table B-2: SwPLC F/G Address Map for HandWheel Multiple Selection
Table B-3: SwPLC F/G Address Map for HandWheel and HandWheel Interrupt Axis
Selection
______________________________________________________________________________
B-30
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-31
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-32
SERVOWORKSPLC MANUAL
Appendix B: S-100M and General Motion Data Mapping Tables
______________________________________________________________________________
B-33
SERVOWORKSPLC MANUAL
Index
Index
AND.STK .................................... 8-15
. difference from functional commands
.bin files.............................................. 4-4 .................................................... 8-2
.div files.............................................. 4-4 OR ................................................ 8-11
.fig files .............................................. 4-4 OR.NOT....................................... 8-11
.lad file, default .................................. 4-3 OR.STK ....................................... 8-15
.lad files.............................................. 4-1 RD .................................................. 8-4
.lst files............................................... 4-4 RD.NOT......................................... 8-6
.mod file, default ................................ 4-4 RD.NOT.STK .............................. 8-13
.mod files............................................ 4-4 RD.STK ....................................... 8-11
signal addresses.............................. 8-2
A sumamry......................................... 8-3
ADD command ................................ 9-82 WRT............................................... 8-8
ADDB command ............................. 9-84 WRT.NOT ..................................... 8-9
address range BCD ................See binary coded decimal
F0~F399 ......................................... 6-3 binary coded decimal (BCD) ......9-5, 9-6
G0~G399........................................ 6-3 binary files ......................................... 1-3
addresses ............. See memory addresses binary format...............................4-1, 9-5
A0~A99.......................................... 6-8 advantages of ................................. 9-5
C0~C79 ...................................6-5, 7-1 example .......................................... 9-6
counter.....................................7-1, 7-2 memory storage of ......................... 9-7
D0~D1999...............................6-6, 7-2 Two's Complement notation .......... 9-7
data table ........................................ 7-2 bit pattern display........................1-4, 3-1
format in a ladder diagram........... 3-11 Bit Pattern Window.......................... 3-16
K0~K99...................................6-6, 7-2 bit patterns........................................ 3-16
keep relay ....................................... 7-2
C
R9000~R9099 ................................ 6-4
signal letters in a ladder diagram . 3-11 COD command ................................ 9-37
T0~T399 ........................................ 6-7 CODB command.............................. 9-41
X0~X99.......................................... 6-3 coding convention.............................. 4-6
Y0~Y99.......................................... 6-3 COIN command ............................... 9-66
addresses, numerical data................... 9-8 COM command................................ 9-47
alarm relay addresses ......................... 6-8 COME command ............................. 9-50
AND command ................................ 8-10 commands
AND.NOT command....................... 8-10 basic ............................................... 8-1
AND.STK command........................ 8-15 types of (basic and functional)....... 8-2
architecture, ServoWorksPLC comments in a ladder diagram ......... 3-12
Application Suite ........................... 3-2 COMP command ............................. 9-62
COMPB command........................... 9-64
B Compile Finish Dialog Box ............... 3-5
basic commands ................................. 8-1 compiling sequence programs.....1-3, 3-4
AND............................................. 8-10 Control Console Application ......1-3, 3-1
AND.NOT.................................... 8-10 control values ..................................... 9-4
______________________________________________________________________________
I
SERVOWORKSPLC MANUAL
Index
counter functional command register.............. 9-9
preset ......................... 9-20, 9-23, 9-26 functional commands ......................... 9-1
ring ......................................9-20, 9-26 ADD............................................. 9-82
up/down...............................9-20, 9-26 ADDB .......................................... 9-84
counter addresses ................ 6-5, 7-1, 7-2 COD ............................................. 9-37
counters, setting up ............................ 3-8 CODB .......................................... 9-41
CTR command ................................. 9-20 COIN............................................ 9-66
CTRC command .............................. 9-26 COM ............................................ 9-47
cycle, PLC.......................................... 1-2 COME .......................................... 9-50
COMP .......................................... 9-62
D COMPB........................................ 9-64
data table .....................................7-3, 7-4 control values ................................. 9-4
data table addresses.....................6-6, 7-2 CTR.............................................. 9-20
data, addresses for numbers ............... 9-8 CTRC ........................................... 9-26
DCNV command ............................. 9-58 DCNV .......................................... 9-58
DCNVB command........................... 9-60 DCNVB........................................ 9-60
debugging sequence programs....1-4, 3-9 DEC.............................................. 9-16
DEC command................................. 9-16 DECB........................................... 9-18
DECB command .............................. 9-18 difference from basic commands ... 8-2
default .lad file ................................... 4-3 DIV .............................................. 9-96
default .mod file ................................. 4-4 DIVB............................................ 9-99
description of PLC ............................. 1-1 DSCH........................................... 9-71
Diagnose Search Window................ 3-16 DSCHB .................................7-3, 9-74
display of bit patterns..................1-4, 3-1 format............................................. 9-3
DIV command.................................. 9-96 JMP .............................................. 9-51
DIVB command ............................... 9-99 JMPE............................................ 9-54
DSCH command .............................. 9-71 MOVE.......................................... 9-43
DSCHB .............................................. 7-3 MOVOR....................................... 9-46
DSCHB command ........................... 9-74 MUL............................................. 9-91
MULB .......................................... 9-94
E NUME........................................ 9-101
NUMEB ..................................... 9-103
Edit Counter Window ........................ 3-8 numerical data addresses................ 9-8
Edit Keep Relay Window .................. 3-6 operation data................................. 9-5
Edit Timer Window ........................... 3-7 parameters ...................................... 9-5
editing sequence programs................. 1-3 PARI ............................................ 9-55
E-STOP, HandWheel......................... 4-1 ROT.............................................. 9-29
executable binary files ....................... 1-3 ROTB........................................... 9-33
executable binary format.................... 4-1 SFT............................................... 9-68
execution of a sequence program....... 5-1 SUB.............................................. 9-86
execution time of a sequence program. 5- SUBB ........................................... 9-89
2 summary..................................9-1, 9-2
TMR............................................. 9-10
F
TMRB .......................................... 9-12
F data mapping tables ............... A-2, B-2 TMRC .......................................... 9-14
Fanuc-compatible ladder logic........... 1-4 W1.................................................. 9-5
files, sequence program ..................... 4-1
______________________________________________________________________________
II
SERVOWORKSPLC MANUAL
Index
XMOV ......................................... 9-76 relay junctions.............................. 3-14
XMOVB................................7-3, 9-80 rows.............................................. 3-13
signal names................................. 3-12
G symbols ........................................ 3-13
G data mapping tables............. A-12, B-5 ladder files.......................................... 4-1
ladder logic – Fanuc-compatible........ 1-4
H
M
HandWheel E-STOP.......................... 4-1
machine commands...........See functional
I commands
mapping tables
I/O addresses....... See memory addresses F data..................................... A-2, B-2
I/O declaration ................................... 3-5 G data .................................. A-12, B-5
I/O signals ...................................5-3, 6-2 overview................................ A-1, B-1
IL format ............................. 1-3, 1-4, 4-1 X data .................................. A-14, B-8
infinite number of relays .................. 3-14 Y data .......................................... B-24
initializing MC-Quad ........................................... 2-1
ServoWorksPLC Application Suite . 2- memory addresses.............................. 6-1
1, 2-2 alarm relay ..................................... 6-8
input signals to the PLC Engine......... 5-3 counter addresses ........................... 6-5
input/output ..................................See I/O data table ........................................ 6-6
installing description...................................... 6-1
ServoWorksPLC Application Suite . 2- internal relay .................................. 6-4
1, 2-2 keep relay and static memory control
Instruction List format ................1-3, 1-4 .................................................... 6-6
Instruction List Format ...................... 4-1 related to the machine tool............. 6-3
instruction sequence execution .......... 5-4 related to the ServoWorks Motion
interface settings ................................ 3-5 Engine ........................................ 6-3
interface table..................................... 3-5 signal types..................................... 6-2
intermediate results ............................ 8-2 specifications.................................. 6-2
internal relay ...................................... 6-4 timer ............................................... 6-7
types of........................................... 6-1
J
memory,static..................................... 7-1
JMP command ................................. 9-51 module files........................................ 4-4
JMPE command ............................... 9-54 Module Selection Window .............. 3-10
Monitor/Debugger.......................1-3, 3-1
K Motion Engine ................................... 1-1
keep relay addresses....................6-6, 7-2 MotionPro .......................................... 2-1
keep relays, setting up........................ 3-6 MOVE command ............................. 9-43
MOVOR command.......................... 9-46
L MUL command................................ 9-91
MULB command ............................. 9-94
ladder diagram ................................... 1-3
address format.............................. 3-11 N
address signal letters .................... 3-11
commenting.................................. 3-12 NUME command ........................... 9-101
format............................................. 4-1 NUMEB command ........................ 9-103
______________________________________________________________________________
III
SERVOWORKSPLC MANUAL
Index
numerical data addresses.................... 9-8 R
RD command ..................................... 8-4
O
RD.NOT command ............................ 8-6
operation data..................................... 9-5 RD.NOT.STK command ................. 8-13
OR command ................................... 8-11 RD.STK command........................... 8-11
OR.NOT command .......................... 8-11 relay junctions.................................. 3-14
OR.STK command........................... 8-15 relays,infinite number of.................. 3-14
order of execution .............................. 5-1 repetitive sampling............................. 5-2
output signals from the PLC Engine.. 5-3 Result History Register ...................... 8-2
structure.......................................... 8-2
P ring counter .............................9-20, 9-26
parameters .......................................... 9-5 ROT command................................. 9-29
PARI command................................ 9-55 ROTB command .............................. 9-33
PLC rows in a ladder diagram.................. 3-13
cycle ............................................... 1-2 RUN status ......................................... 3-2
data table ........................................ 7-3
description of ................................. 1-1 S
instruction sequence execution ...... 5-4 S-100M .............................................. 2-1
scan ................................................ 1-2 S-100T................................................ 2-1
scan time ........................................ 1-3 sampling, repetitive............................ 5-2
PLC Bit Pattern Utility..................... 3-16 scan time ............................................ 1-3
PLC Control Screen ....................2-4, 3-3 scan, PLC ........................................... 1-2
PLC data table.................................... 7-4 search function, PLC Ladder
PLC Diagnose Window .. 3-9, 3-10, 3-15 Monitor/Debugger........................ 3-15
PLC Engine........................................ 1-1 Select Module Definition Window .... 2-5
description...................................... 1-3 sequence programs
input signals ................................... 5-3 coding............................................. 4-6
integration with Motion Engine ..... 1-3 compiling ....................................... 1-3
integration within the ServoWorks debugging....................................... 3-9
system ........................................ 1-2 description...............................1-4, 4-1
output signals ................................. 5-3 editing ............................................ 1-3
schematic representation of sequence execution of.................................... 1-2
program execution ..................... 5-5 execution time................................ 5-2
PLC Ladder Compiler Screen .....2-4, 3-4 execution, schematic representation of
PLC Ladder Monitor/Debugger search .................................................... 5-5
function ........................................ 3-15 format......................................1-4, 4-1
PLC sequence programs .... See sequence repetitive sampling......................... 5-2
programs sequence of processing .................. 5-1
PLC Table Setting Screen.................. 3-5 setting up......................... 4-1, 4-5, 4-6
PLC Table Setting Screen Dialog Box 3- verifying..................................1-3, 3-9
6 sequence programs, compiling........... 3-4
PLC Time Chart Utility ................... 3-17 sequential processing of a sequence
preset counter ................ 9-20, 9-23, 9-26 program .......................................... 5-1
PRM ................................................... 9-5 ServoWorks Motion Engine .............. 1-1
programmable logic control......... See PC ServoWorks PLC Engine................... 1-1
description...................................... 1-3
______________________________________________________________________________
IV
SERVOWORKSPLC MANUAL
Index
input signals ................................... 5-3 SUBB command .............................. 9-89
integration with Motion Engine ..... 1-3 symbols in a ladder diagram ............ 3-13
integration within the ServoWorks
system ........................................ 1-2 T
output signals ................................. 5-3 tables, setting up................................. 3-5
schematic representation of sequence Time Chart Window ........................ 3-17
program execution ..................... 5-5 time charts......................... 1-4, 3-1, 3-17
ServoWorksPLC application suite..... 1-1 timer ................................................... 7-1
composition of ............................... 1-3 timer addresses................................... 6-7
ServoWorksPLC Application Suite ... 3-1 timers, setting up................................ 3-7
ServoWorksPLC Control Console TMR command ................................ 9-10
Application..............................1-3, 3-1 TMRB command ............................. 9-12
ServoWorksPLC installation ......2-1, 2-2 TMRC command ............................. 9-14
ServoWorksPLC Monitor/Debugger 1-3, Two's Complement notation .............. 9-7
3-1
ServoWorksPLC Utility Tools....1-3, 1-4 U
setting up
counters .......................................... 3-8 uninstalling the ServoWorksPLC
keep relays ..................................... 3-6 Application Suite ........................... 2-6
tables .............................................. 3-5 up/down counter......................9-20, 9-26
timers.............................................. 3-7 using the PLC Bit Pattern Utility..... 3-16
setting up a sequence program...4-1, 4-5, using the PLC Time Chart Utility.... 3-17
4-6 Utility Tools ................................1-3, 1-4
SFT command.................................. 9-68
V
signal addresses.................................. 8-2
signal names in a ladder diagram..... 3-12 verifying sequence programs ......1-3, 3-9
signals ..............................See I/O signals
stack register See Result History Register W
starting the PLC Control Console W1...................................................... 9-5
application...................................... 3-2 WRT command.................................. 8-8
static memory..............................6-5, 6-7 WRT.NOT command......................... 8-9
counter.....................................7-1, 7-2
data table ........................................ 7-2 X
keep relay ....................................... 7-2
X data mapping tables............. A-14, B-8
overview......................................... 7-1
XMOV command............................. 9-76
reading and writing ........................ 7-3
XMOVB............................................. 7-3
timer ............................................... 7-1
XMOVB command.......................... 9-80
static memory control addresses ........ 6-6
STOPPED status ................................ 3-3 Y
storing the results of logic operations in
the result history register................ 8-2 Y data mapping tables..................... B-24
SUB command ................................. 9-86
______________________________________________________________________________
V