Legend-MC User Manual PDF
Legend-MC User Manual PDF
User’s Manual
Upon receipt of the product and prior to initial operation, read these instructions
thoroughly, and retain for future reference
LEGEND-MC User’s Manual
WARNING
YASKAWA manufactures component parts that can be used in a wide variety
of industrial applications. The selection and application of YASKAWA
products remain the responsibility of the equipment designer or end user.
YASKAWA accepts no responsibility for the way its products may be
incorporated into the final system design.
TABLE OF CONTENTS
1 Introduction .............................................................................................................................1
Part Numbers .....................................................................................................................2
Start-up ..............................................................................................................................3
Mounting the LEGEND-MC to the LEGEND Amplifier ..........................................3
Mounting Orientation ............................................................................................3
Front Panel Description ..................................................................................................... 4
Power/Connections Wiring - Single Phase ........................................................................5
Power/Connections Wiring - Three Phase .........................................................................6
Cable Shielding, Segregation and Noise Immunity ...........................................................7
I/O Connections (50-pin CN5) ...........................................................................................8
Analog I/O ..........................................................................................................................9
Analog Input ..........................................................................................................9
Analog Output .....................................................................................................10
Digital I/O .........................................................................................................................11
Digital Input .........................................................................................................11
Digital Output .....................................................................................................12
Emergency Stop Chain ....................................................................................................13
Serial Communication ......................................................................................................14
External Encoder Specifications ......................................................................................15
Dedicated Inputs ..............................................................................................................16
Physical Specifications ....................................................................................................17
Hardware Specifications ..................................................................................................17
Cable Diagram and Dimensional Drawings .....................................................................18
I/O Cable with Terminal Block JUSP-TA50P ......................................................18
2 Theory of Operation .............................................................................................................21
Overview ..........................................................................................................................21
Level ................................................................................................................................22
Operation of Closed-Loop Systems .................................................................................24
System Modeling .............................................................................................................25
Controller ............................................................................................................25
Motor-Amplifier ...................................................................................................25
Current Drive ......................................................................................................25
Encoder ..............................................................................................................26
DAC ....................................................................................................................26
Digital Filter .........................................................................................................26
ZOH ....................................................................................................................27
System Analysis ..............................................................................................................27
System Design and Compensation .................................................................................30
The Analytical Method ........................................................................................30
Notch Filter .........................................................................................................32
3 Communications ..................................................................................................................37
Introduction ......................................................................................................................37
Controller Response to Data ..............................................................................37
RS232 Port .........................................................................................................37
SMC Protocol Guidelines .................................................................................................38
Ethernet Configuration .....................................................................................................39
Communication Protocols ...................................................................................39
Addressing ..........................................................................................................40
Ethernet Handles ................................................................................................40
Global vs. Local Operation .................................................................................41
Configuring Operation for Distributed Control
(Obsolete Method < 1.0c firmware) ....................................................................42
Operation of Distributed Control .........................................................................42
Accessing the I/O of the slaves ..........................................................................43
LEGEND-MC User’s Manual
EN (End) ........................................................................................................................105
ENDIF ............................................................................................................................106
EO (Echo) ......................................................................................................................107
EP (ECam Table Intervals and Start Point) ...................................................................108
EQ (ECam Quit (Disengage)) ........................................................................................109
ER (Error Limit) ..............................................................................................................110
ET (ECam Table) ...........................................................................................................111
FA (Acceleration Feedforward) ......................................................................................112
FE (Find Edge) ..............................................................................................................113
FI (Find Index) ...............................................................................................................114
FL (Forward Limit) .........................................................................................................115
@FRAC (Fraction) .........................................................................................................116
FV (Velocity Feedforward) .............................................................................................117
GA (Master Axis for Gearing) ........................................................................................118
GR (Gear Ratio) .............................................................................................................119
HC (Handle Configuration) ............................................................................................120
HM (Home) ....................................................................................................................122
HR (Handle Restore) .....................................................................................................123
HS (Handle Switch) .......................................................................................................124
HW (Handle Wait) ..........................................................................................................125
HX (Halt Execution) .......................................................................................................126
IA (Internet Address) ......................................................................................................127
IF ....................................................................................................................................128
IH (Internet Handle) .......................................................................................................129
II (Input Interrupt) ...........................................................................................................131
IL (Integrator Limit) ........................................................................................................133
IN (Input Variable) ..........................................................................................................134
@IN (Input) ....................................................................................................................135
@INT (Integer) ...............................................................................................................137
IP (Increment Position) ..................................................................................................138
IT (Independent Time Constant) ....................................................................................139
JG (Jog) .........................................................................................................................140
JP (Jump to Program Location) .....................................................................................141
JS (Jump to Subroutine) ................................................................................................142
KD (Derivative Constant) ...............................................................................................143
KI (Integrator) .................................................................................................................144
KP (Proportional Constant) ............................................................................................145
LA (List Arrays) ..............................................................................................................146
LC (Lock Controller) .......................................................................................................147
LE (Linear Interpolation End) .........................................................................................148
_LF* (Forward Limit) ......................................................................................................149
LI (Linear Interpolation) ..................................................................................................150
LL (List Labels) ..............................................................................................................152
LM (Linear Mode) ..........................................................................................................153
LO (Lockout) ..................................................................................................................154
_LR* (Reverse Limit) .....................................................................................................155
LS (List Program) ...........................................................................................................156
LT (Latch Target) ...........................................................................................................157
LV (List Variables) .........................................................................................................158
LZ (Leading Zeros) ........................................................................................................159
MB (Modbus) .................................................................................................................160
MC (Motion Complete) ...................................................................................................162
MF (Motion Forward) .....................................................................................................163
MG (Message) ...............................................................................................................164
MM (Master’s Modulus) .................................................................................................165
MO (Motor Off) ...............................................................................................................166
LEGEND-MC User’s Manual
1 Introduction
The LEGEND-MC is a single axis Ethernet motion controller designed for use exclu-
sively with Yaskawa’s LEGEND Digital Torque Amplifier.
It provides a structured text programming environment and the ability to perform many
modes of motion including camming, gearing, and contouring. High speed product reg-
istration is also available as a standard feature.
1
LEGEND-MC User’s Manual
Part Numbers
Description Part Number
SMC3010
b)
3.0m 50 Pin I/O Cable JZSP-CKI01-3 (A)
2
LEGEND-MC User’s Manual
Start-up
Mounting the LEGEND-MC to the LEGEND Amplifier
1. Insert the lower two mounting notches of the LEGEND-MC into the mounting holes at the bottom of the right
side of the LEGEND.
2. Push the LEGEND-MC in the direction indicated by the arrow in the figure below, and insert the upper
mounting notches of the LEGEND-MC into the upper mounting holes on the right side of the LEGEND.
Mounting Orientation
Mount the LEGEND-MC and LEGEND vertically for proper cooling, as shown below. Allow a minimum spacing
of 10mm around the left and right sides and 30mm around the top and bottom of the LEGEND-MC/LEGEND
unit.
3
LEGEND-MC User’s Manual
(8)
(9)
4
LEGEND-MC User’s Manual
R T
1MCCB Control Control
Power Power
Noise Filter
ON OFF 1MC
2MC SUP
YASKAWA
C
N
6
LEGEND01
2MC CHARGE POWER
L1
L2 C
L3 N
1 5
2
1MC
L1C
L2C C R
B1 N S
B2 1 T
B3 C
N
U 4
V C
W F
N
2 G
NOTES: The LEGEND-MC receives its power from the LEGEND amplifier through the side interface
connector, however, the digital I/O receives its power from pins 46, 47, 48, and 49 on the I/O connector.
For maximum noise immunity, connect the FG to a ground terminal on the sub panel or to the ground
terminal on the LEGEND.
5
LEGEND-MC User’s Manual
R S T
1MCCB Control Control
Power Power
Noise Filter
ON OFF 1MC
2MC SUP
YASKAWA
C
N
6
LEGEND01
2MC CHARGE POWER
L1
L2 C
L3 N
1 5
2
1MC
L1C
L2C C R
B1 N S
B2 1 T
B3 C
N
U 4
V C
W F
N
2 G
NOTES: The LEGEND-MC receives its power from the LEGEND amplifier through the side interface
connector, however, the digital I/O receives its power from pins 46, 47, 48, and 49 on the I/O connector.
For maximum noise immunity, connect the FG to a ground terminal on the sub panel or to the ground
terminal on the LEGEND.
6
LEGEND-MC User’s Manual
a)
PROPER
Shield connected across
terminal block.
b)
PROPER PROPER
Shield tied back at Shields of field
terminal block. cables grounded at
one point
Wrong
a)
WRONG
Shield grounded at
more than one point.
b)
WRONG
Shields of field
cables ungrounded
7
LEGEND-MC User’s Manual
8
LEGEND-MC User’s Manual
Analog I/O
Analog Input
Item Specifications
Input Voltage ± 10 V
Legend-MC I/O
Internal Circuitry Connector CN5 Field Wiring
DG403
MUX
1 Analog 1
2 Analog 2
5 +12V
-12V 28
-12V
SMC Signal
Ground
9
LEGEND-MC User’s Manual
Analog Output
Item Specifications
D/A Output Resolution 16 bit over a ± 10 V range or 328 µV/bit
Legend-MC I/O
Internal Circuitry Connector CN5 Field Wiring
TL084CN
Analog External Device
26 Output -10 ~ 10 V
Signal L
28 Ground
10
LEGEND-MC User’s Manual
Digital I/O
Digital Input
Item Specifications
Number of Input Points 8
Input Format Sinking
Isolation Optical
Voltage 24 VDC ± 20%
Current Rating (ON) 5.3 mA to activate
Input Impedance 2.2k Ω
Operation Voltage Logic 0 <5V
Logic 1 >15V
OFF Current 0.9 mA or less
Response Time OFF to ON: <0.5 ms
ON to OFF: <1.5 ms
Latch response time Less than 25 µsec
Minimum latch width 9 µsec
Legend-MC I/O
Internal Circuitry Connector CN5 Field Wiring
24VDC
47
2.2k 49
18 Digital Input 1
(Main Latch)
17 Digital Input 2
(External Latch)
45 Digital Input 3
44 Digital Input 4
43 Digital Input 5
42 Digital Input 6
19 Digital Input 7
20 Digital Input 8
11
LEGEND-MC User’s Manual
Digital Output
Item Specifications
Number of Output Points 4
Output Format Sinking
Output Classification Transistor Output
Isolation Optical
Load Voltage 24 VDC ± 20%
Load Current 200 mA/Output (600 mA if activated individually)
Response Time OFF to ON <0.25 ms
ON to OFF <0.5 ms
External Common Power 24 VDC ± 20% 15 mA
Common User Fuse Rating 1A
Individual User Fuse Rating 200 mA recommended
NOTE: The ULN 2803 output chip is capable of 600 mA at a single output, or 800mA for the four outputs simultaneously.
Legend-MC I/O
Internal Circuitry Connector CN5 Field Wiring
24VDC
47 Fuse
49
4.7k
PS2505-4
ULN2803
24 Digital Output 1 L
23 Digital Output 2 L
10k
22 Digital Output 3 L
21 Digital Output 4 L
46
48
12
LEGEND-MC User’s Manual
Legend-MC I/O
Internal Circuitry Connector CN5 Field Wiring
VCC
U17
50 E STOP1
25 E STOP2
Q1
-EROUT 2N7002
1k
The LEGEND-MC closes the relay contact under normal operating conditions.
Ratings:
1.0A @ 24 VDC
0.5A @ 125 VAC
13
LEGEND-MC User’s Manual
Serial Communication
Item Specifications
Baud Rate 9600 or 19200 settable by jumper JP1, default is 19200
Data Bits 8
Parity None
Stop Bits 1
Legend-MC Serial
Internal Circuitry Port Connector CN6 Field Wiring
U7
VCC
C1+ V+
.1 UF .1 UF
C1-
.1 UF
C2+ V-
C2- .1 UF
1 CTS Output
T1IN T1OUT
6 CTS Output
8 CTS Output
T2IN T2OUT
2 Transmit Output
3 Receive Input
A1OUT A1IN
7 RTS Input
4 RTS Input
A2OUT A2IN
MAX232A 9 N/C
5 Signal Ground
NOTE: Hardware handshaking must be used with the LEGEND-MC. If it is impossible to implement
hardware handshaking, use a jumper between pins 1 and 4 in the connector.
14
LEGEND-MC User’s Manual
Legend-MC I/O
Internal Circuitry Connector CN5 Field Wiring
VCC
External Encoder
4.7k
4.7k
6.8k
6.8k
+5V or +12V
9 A+phase
3486
8 A-phase
34 0V
Digital 10 B-phase
3486 Ground
11 B+phase
34
Digital Shield
2.4k
2.4k
Ground
Frame
Ground
Standard voltage levels are TTL (0V to 5V), however, voltage levels up to 12V are acceptable. If using differential
12V signals, no modification is required. Single ended 12V signals require a bias voltage applied to the compli-
mentary input, i.e.; use two 10k resistors, one connected to +12V and the other connected to the LEGEND signal
ground to hold the /A phase and /B phase at 6VDC. Do not use a 24VDC encoder.
15
LEGEND-MC User’s Manual
Dedicated Inputs
Item Specifications
Number of Input Points Forward limit, Reverse limit, Home, Abort, Reset
Isolation Optical
Legend-MC I/O
Internal Circuitry Connector CN5 Field Wiring
24VDC
47
14 Home Input
12 Abort Input
16 Reset Input
16
LEGEND-MC User’s Manual
Physical Specifications
Description Specifications
Depth: 130mm (5.12 in)
Hardware Specifications
Description Specifications
CPU: 25 mHz Motorola
17
LEGEND-MC User’s Manual
CN5
+10%
Length of cable supplied: 19.69 (500) -0%
1.77 (45)
1 49
2 50
9.74 (247.5)
10.01 (254.2)
0.14 (3.5) 0.14 (3.5)
0.61 (15.5)
1.77 (45)
(29.5)
1.16
18
MOUNTING CLIPS
LEGEND MOUNTING
CLIP
SIDE PIN CONNECTOR
20
(O.79)
LEGEND-MC User’s Manual
(0.79)
20
(5.12)
130
ND MOUNTING
CLIP STATUS LED'S CLIP ATTACHMENT TO LEGEND AM
C
N
6
SERIAL PORT
C
N
5
142
(5.59)
I/O
MODEL NP
R
S
T RESET
ETHERNET LED'S C
N
4
ETHERNET F
G GROUND
DIMENSIONS: MM (IN)
19
LEGEND-MC User’s Manual
NOTES:
20
LEGEND-MC User’s Manual
2 Theory of Operation
Overview
The following discussion covers the operation of motion control systems. A typical motion control
system consists of the elements shown in the following illustration:
ENCODER MOTOR
The operation of such a system can be divided into three levels, as shown in the following illustration
Levels of Control Functions. The levels are:
21
LEGEND-MC User’s Manual
Level
LEVEL
MOTION
3 PROGRAMMING
MOTION
2 PROFILING
CLOSED-LOOP
1 CONTROL
The three levels of control may be viewed as different levels of management. The top manager, the motion
program, may specify the following instruction, for example.
PR 6000,4000
SP 20000,20000
AC 200000,300000
BG X
AD 2000
BG Y
EN
This program corresponds to the velocity profiles shown in the following illustration - Velocity and Position
Profiles. Note that the profiled positions show where the motors must be at any instant of time.
Finally, it remains up to the servo system to verify that the motor follows the profiled position by closing
the servo loop.
The operation of the servo system is done in two manners. First, it is explained qualitatively, in the
following section. Later, the explanation is repeated using analytical tools for those who are more
theoretically inclined.
22
LEGEND-MC User’s Manual
X VELOCITY
Y VELOCITY
X POSITION
Y POSITION
TIME
23
LEGEND-MC User’s Manual
24
LEGEND-MC User’s Manual
System Modeling
Basic Block Diagram
Acceleration
Acceleration Feed Forward
[FA]
+
Speed
Velocity +
Feed Forward
[FV]
Proportional
Gain
[KP]
+ +
Motion
Generator
Scurve
Smoothing
+ Derivative
Gain
+ Notch Filter + Torque Limit D/A
[PA][PR][SP][AC] [NF] [NB] [NZ] [TL] To Legend Amp
[IT] [KD]
[DC][JG][IP]
- + +
Integral Integrator
Gain Limit Offset
[KI] [IL] [OF]
Encoder
Feedback
The elements of a servo system include the motor, driver, encoder and the controller. These elements are
shown in the following illustration. The mathematical model of the various components is given below:
Controller
CONTROLLER
R X DIGITAL Y V E
Σ FILTER
ZOH DAC AMP MOTOR
C
P
ENCODER
Motor-Amplifier
The motor amplifier is configured for current mode:
Current Drive
The current drive generates a current I, which is proportional to the input voltage, V, with a gain of Ka, a
torque constant of Kt, and inertia J. The resulting transfer function in this case is:
P/V = Ka Kt / Js2
25
LEGEND-MC User’s Manual
For example, a current amplifier with Ka = 2 A/V with the motor described by the previous example will
have the transfer function:
CURRENT SOURCE
V I W P
Kt 1
Ka
JS S
VELOCITY LOOP
V W P
1 1
Kg(ST 1+1) S
Encoder
The encoder generates N pulses per revolution. It outputs two signals, Channel A and B, which are in
quadrature. Due to the quadrature relationship between the encoder channels, the position resolution is
increased to 4N quadrature counts/rev.
The model of the encoder can be represented by a gain of:
Kf = 4N/2π [count/rad]
For example, a 1000 lines/rev encoder is modeled as:
Kf = 638
DAC
The DAC or D-to-A converter converts a 16-bit number to an analog voltage. The input range of the
numbers is 65536 and the output voltage range is +/-10V or 20V. Therefore, the effective gain of the DAC
is:
Digital Filter
The digital filter has a transfer function of D(z) = K(z-A)/z + Cz/z-1 and a sampling time of T.
The filter parameters, K, A and C are selected by the instructions KP, KD, KI or by GN, ZR and KI,
respectively. The relationship between the filter coefficients and the instructions are:
K = KP + KD or K = GN
A = KD/(KP + KD) or A = ZR
C = KI/8
26
LEGEND-MC User’s Manual
This filter includes a lead compensation and an integrator. It is equivalent to a continuous PID filter with
a transfer function G(s).
G(s) = P + sD + I/s
P = K(1-A) = KP
D = T* K * A = T.KD
I = C/T = KI/8 * TM
For example, if the filter parameters are KP = 4:
KD = 36
KI = 2
T = 0.001 s
the digital filter coefficients are:
K = 40
A = 0.9
C = 0.25
and the equivalent continuous filter, G(s), is:
G(s) = 4 + 0.036s + 250/s
ZOH
The ZOH, or zero-order-hold, represents the effect of the sampling process, where the motor command is
updated once per sampling period. The effect of the ZOH can be modeled by the transfer function
H(s) = 1/(1+sT/2)
If the sampling period is T = 0.001, for example, H(s) becomes:
H(s) = 2000/(s+2000)
However, in most applications, H(s) may be approximated as one.
This completes the modeling of the system elements. Next, we discuss the system analysis.
System Analysis
To analyze the system, we start with a block diagram model of the system elements. The analysis
procedure is illustrated in terms of the following example.
Consider a position control system with the LEGEND-MC controller and the following parameters:
KI = 0 No integrator
27
LEGEND-MC User’s Manual
Motor:
DAC:
Kd = 0.0012 [V/count]
Encoder:
ZOH:
2000/(s+2000)
Digital Filter:
KP = 12.5, KD = 245, T = 0.001
Therefore,:
D(z) = 12.5 + 245 (1-z-1)
Accordingly, the coefficients of the continuous filter are:
P = 12.5
D = 0.245
The filter equation may be written in the continuous equivalent form:
2000 500
Σ 0.245(S+51) 0.0012 4
S+2000 S2
ENCODER
318
The open loop transfer function, A(s), is the product of all the elements in the loop:
A = 390,000 (s+51)/[s2(s+2000)]
28
LEGEND-MC User’s Manual
To analyze the system stability, determine the crossover frequency, ωc at which A(j ωc) equals one. This
can be done by the Bode plot of A(j ωc), as shown in the following illustration:
Magnitude
1
50 200 2000 W (rad/s)
0.1
For the given example, the crossover frequency was computed numerically resulting in 200 rad/s.
Next, we determine the phase of A(s) at the crossover frequency:
PM = 180° + α = 70°
As long as PM is positive, the system is stable. However, for a well damped system, PM should be
between 30 degrees and 45 degrees. The phase margin of 70 degrees given above indicated overdamped
response.
Next, we discuss the design of control systems.
29
LEGEND-MC User’s Manual
The DAC of the LEGEND-MC outputs +/-10V for a 14-bit command of +/-8192 counts.
The design objective is to select the filter parameters in order to close a position loop with a crossover
frequency of ωc = 500 rad/s and a phase margin of 45 degrees.
The first step is to develop a mathematical model of the system, as discussed in the previous system.
Motor:
Ka = 2 [Amp/V]
DAC
Kd = 10/8192:
Encoder:
Kf = 4N/2π = 636
ZOH:
H(s) = 2000/(s+2000)
Compensation Filter:
G(s) = P + sD
The next step is to combine all the system elements, with the exception of G(s), into one function, L(s):
30
LEGEND-MC User’s Manual
Now, determine the magnitude and phase of L(s) at the frequency ωc = 500:
|L(j500)| = 0.025
and a phase:
|A(j500)| = 1
Arg [A(j500)] = -135°
However, since:
|G(j500)| = |A(j500)/L(j500)| = 40
and a phase:
G(s) = P + sD
so that at the frequency ωc =500, the function would have a magnitude of 40 and a phase lead of 59
degrees.
These requirements may be expressed as:
|G(j500)| = |P + (j500D)| = 40
and:
D = 0.0686
and:
G = 20.6 + 0.0686s
The function G is equivalent to a digital filter of the form:
D(z) = KP + KD(1-z-1)
where:
KP = P
and:
KD = D/T
31
LEGEND-MC User’s Manual
Assuming a sampling period of T=1ms, the parameters of the digital filter are:
KPX = 20.6
KDX = 68.6
The LEGEND-MC can be programmed with the instruction:
KP 20.6
KD 68.6
In a similar manner, other filters can be programmed. The procedure is simplified by the following table,
which summarizes the relationship between the various filters.
KP, KD, KI K = KP + KD
A = KD/(KP+KD)
C = KI/8
Mathematical model of the motor and amplifier in two operational modes
Digital D(z) = GN(z-ZR)/z + KI z/8(z-1)
GN, ZR, KI K = GN
A = ZR
C = KI/8
PID, T P = K(1-A) = KP
D = K *A * T = T * KD
I = C/T = KI / 8 * TM
Notch Filter
There are some applications in which the standard tuning procedure using the PID filter of the controller
cannot completely eliminate the resonance in a system. Resonance occurs when the natural frequency of a
system is excited in a way that increases the amplitude of oscillation. This is usually due to system
compliance, such as a mechanical coupling or inherent motor characteristics.
The notch filter is an advanced tuning technique that acts much like a “band-reject” filter in an electronic
circuit. Certain frequencies are rejected while others are allowed to pass through. This is particularly
helpful when trying to eliminate a resonance that always occurs at a single frequency.
If a system oscillates at a specific point, then the first thing to do is find out at what frequency it occurs.
The easiest way to do this is to graph the Actual Motor Position versus Time while the motor is oscillating.
A sine wave with a constant frequency of oscillation should be seen. To get the frequency, f (Hertz), count
the number of peaks that occur in 1 second. Or alternatively, measure the distance between two peaks,
called the Period T (seconds), and then use the equation: f = 1/T.
32
LEGEND-MC User’s Manual
This will be the center frequency for your notch filter, specified as NF. To get the other two parameters,
it is easiest to look at an example that shows their relationship to the command output. See the graphs
below:
33
LEGEND-MC User’s Manual
34
LEGEND-MC User’s Manual
These graphs show how NF, NB, and NZ determine the characteristics of the filter. In particular, NB
specifies the bandwidth that is rejected (Figure 1). A larger NB causes a larger range of frequencies to be
attenuated. The ratio of NB/NZ controls the amount of attenuation, or depth of the notch (Figure 2). A
larger ratio causes a higher amount of attenuation. However, a ratio equal to one should have very little,
or no effect, on the output (Figure 3). A ratio greater than one will amplify the output signal (Figure 3)
causing a resonance. For consistency, these notch waveforms all have a center frequency of 25Hz, except
for the last one (Figure 4) which has a NF of 35 and is therefore shifted to the right.
A simple method for attaining your NF,NB, and NZ parameters is the following:
•Estimate resonance frequency.
•Set NF to resonance frequency in Hz.
•Set NB = 1/2 NF.
•Set NZ between zero and 5.
Although the theory behind a notch filter is beyond the scope of this application note, a general overview
may clarify how the notch works. As shown, the notch filter compensates for a resonance in the system.
One method of illustrating this is by looking at the poles and zeroes of the transfer function plotted on the
s-plane.
35
LEGEND-MC User’s Manual
Resonance shows up as a pair of complex poles with a real part. A notch filter attempts to cancel the
unwanted poles by placing zeroes on top of them and placing new poles in a more desirable location. The
following diagram shows the pole-zero configuration of a general system with resonance and a notch
filter:
A notch filter can be extremely helpful when used properly, however it is not right for every system.
Incorrect placement of the Notch can cause system instability, and a notch filter puts extra overhead on the
CPU of the controller. A general rule of thumb is to only use a notch when resonance has been found that
cannot be eliminated with the controller’s standard PID filter of the controller. Also, the notch filter is
only effective with a single resonant frequency.
36
LEGEND-MC User’s Manual
3 Communications
Introduction
The LEGEND-MC has one RS232 port and one Ethernet port. The RS-232 is a standard serial link with
communication baud rates up to 19.2kbaud. The Ethernet port is a 10Base-T link.
RS232 Port
The LEGEND-MC has a single RS232 connection for sending and receiving commands from a PC or
other terminal. The pin connections for the RS232 connection are as follows.
Port 1 DATATERM
37
LEGEND-MC User’s Manual
Configuration
Although Yaskawa’s YTerm software automatically configures the port you may need to manually
configure the PC’s serial port if using third party software.
Configure your PC for 8-bit data, one start-bit, one stop-bit, full duplex and no parity. The baud rate for
the RS232 communication can be chosen by selecting the proper jumper configuration on the LEGEND-
MC according to the table below.
Handshaking Modes
The RS232 port is configured for hardware handshaking. In this mode, the RTS and CTS lines are used.
The CTS line will go high whenever the LEGEND-MC is not ready to receive additional characters. The
RTS line will inhibit the LEGEND-MC from sending additional characters.
NOTE: The RTS line goes high for inhibit. This handshake procedure ensures proper communication espe-
cially at higher baud rates.
If a device that is used in conjunction with the LEGEND-MC does not support hardware handshaking,
solder a jumper across the CTS and RTS lines in the cable. Remember that doing so may degrade
communication reliability. Software handshake is not supported.
1) Recommended method of querying variables: example `MG VAR<cr>' where MG is the message
command and VAR is a variable defined in the controller.
2) Recommended methods of querying commands: example `MG _TPX<cr>' or `TPX <cr>' where MG
is the controller's message command and TP is the command to return the current position. For other
details, see the command section of an SMC manual. It describes the possible methods of obtaining
data when multiple axes are involved.
5) Hardware Handshaking is always recommended when communicating with the SMC family of con-
38
LEGEND-MC User’s Manual
trollers. It is the primary method used by the controller to synchronize communication with external
devices. The controllers do not support software handshaking, and simply using three-wire commu-
nication will result in possible character loss.
6) When sending a command string of any kind to the controller, verify that the echo is active (EO1)
and matches the outgoing string before sending the carriage return. Compare the echo, then either
send the carriage return <cr> (if good) or send the backslash character <\> to flush the buffer in the
controller (if bad) then resend. Depending on the environment, retry the same string up to 3-5 times
before finally determining that there is a serious communication failure.
7) When a message retry is required, send the backslash <\> character to flush the buffer in the SMC so
the next command string can be correctly understood. If the buffer contains a partial message, an
additional message could look like a bad message to the SMC, causing another '?<cr><lf>' .
8) Do not use `VAR=<cr>' to request the SMC to return a variable value. If there was an error in trans-
mission, and the string that the SMC received was not a variable that already exists in the controller,
it creates a new variable. If this happens enough times, the controller will fill its variable space. We
recommend using `MG VAR<cr>' which is more reliable, meaning if a bad transmission occurs, the
SMC will respond with a '?<cr><lf>', and not create an unwanted variable. NOTE: Use the 'LV<cr>'
(List Variables) command to see if there are any erroneous variables in the controller.
9) Use the 'TC<cr>' command to get the error code if a question mark ever appears in a response string.
10) Use of 'MG_TC<cr>' (Tell Code) and 'MG_ED<cr>' (The last line that had an error), which are set
when the #CMDERR routine executes.
Ethernet Configuration
Communication Protocols
The Ethernet is a local area network through which information is transferred in units known as packets.
Communication protocols are necessary to dictate how these packets are sent and received. The
LEGEND-MC supports two industry standard protocols, TCP/IP and UDP/IP. The controller will
automatically respond in the format in which it is contacted.
TCP/IP is a "connection" protocol. The master must be connected to the slave in order to begin
communicating. Each packet sent is acknowledged when received. If no acknowledgement is received,
the information is assumed lost and is resent.
Unlike TCP/IP, UDP/IP does not require a connection. This protocol is similar to communicating via
RS232. If information is lost, the controller does not return a colon or question mark. Because the
protocol does not provide for lost information, the sender must re-send the packet.
Although UDP/IP is more efficient and simple, Yaskawa recommends using the TCP/IP protocol. TCP/
IP insures that if a packet is lost or destroyed while in transit, it will be resent.
Ethernet communication transfers information in ‘packets’. The packets must be limited to 470 data bytes
or less. Larger packets could cause the controller to lose communication.
NOTE: To avoid losing information in transit, Yaskawa recommends that the user wait for an acknowl-
edgement of receipt of a packet before sending the next packet.
NOTE: A command sent over an Ethernet Telnet session must reside in one packet. This means that a Tel-
net emulator must not send a command such as MG_TPX<CR> until the carriage return is present; i.e., do
not send one character at a time as the user enters them.
39
LEGEND-MC User’s Manual
Addressing
There are three levels of addresses defining Ethernet devices. The first is the Ethernet or hardware
address- a unique and permanent 6 byte number, or MAC address. No other device has the same Ethernet
address. The LEGEND-MC Ethernet address is set by the factory and the last two bytes of the address are
the serial number of the controller.
The second level of addressing is the IP address. This is a 32-bit (or 4 byte) number. The IP address is
constrained by each local network and must be assigned locally. Assigning an IP address to the controller
can be done in a number of ways.
The first method is to use the BOOT-P utility via the Ethernet connection (the LEGEND-MC must be
connected to the network and powered). For an explanation of BOOT-P see Third Party Software.
CAUTION: Be sure there is only one BOOT-P server running. If your network has DHCP or
BOOT-P running, it may automatically assign an IP address to the controller upon linking it to
the network. To ensure that the IP address is correct, please contact your system
administrator before connecting the controller to the Ethernet network.
PIC REQUIRED
The second method for setting an IP address is to send the IA command through the LEGEND-MC main
RS-232 port. The IP address you want to assign may be entered as a 4 byte number delimited by commas
(industry standard uses periods) or a signed 32 bit number. (Ex. IA 124,51,29,31 or IA 2083724575) Type
in BN to save the IP address to the controller's non-volatile memory.
NOTE: Yaskawa recommends that the IP address selected is not one that can be accessed across the Gate-
way. The Gateway is an application that controls communication between an internal network and the out-
side world.
The third level of Ethernet addressing is the UDP or TCP port number. The Yaskawa controller does not
require a specific port number. The port number is established by the master each time it connects to the
controller.
Ethernet Handles
An Ethernet handle is a communication resource within a device. The LEGEND-MC can have a
maximum of 16 Ethernet handles open at any time. When using TCP/IP, each connection to a device; i.e.,
the host computer, requires an individual Ethernet handle. In UDP/IP, one handle may be used for all the
masters, but each slave uses one. Pings and ARPS do not occupy handles. If all 8 handles are in use and a
9th master tries to connect, it will be sent a “reset packet” that generates the appropriate error in its native
application.
40
LEGEND-MC User’s Manual
Host Computer
Ethernet or RS 232
LEGEND-MC LEGEND-MC
X Axis LEGEND-MC LEGEND-MC X Axis
X Axis X Axis
The LEGEND-MC supports Yaskawa’s control system. This allows up to four LEGEND-MC controllers
to be connected together as a single virtual axis controller. In this system, one of the controllers is
designated as the master. The master can receive commands from the host computer that apply to all of
the axes in the system.
Here is a simple way to view Local and Global Operation; when the host communicates with a slave
controller, it considers the slave as a 1 axis controller. When the host communicates with a master, it
considers the master as a multi-axis controller. Similarly, an application program residing in a slave
controller deals only with 1 motor as A or X. An application program in a master deals with all motors
referenced A through H.
Global Operation
Host Computer
LEGEND-MC
X Axis
Ethernet
The controllers may operate under both Local and Global Mode. In general, operating in Global Mode
simplifies controlling the entire system. However, Local Mode operation is necessary in some situations;
using Local Mode for setup and testing is useful since this isolates the controller. Specific modes of
motion require operation in Local Mode. Also, each controller can have a program including the slave
controllers. When a slave controller has a program, this program would always operate in Local Mode.
41
LEGEND-MC User’s Manual
Configuring Operation for Distributed Control (Obsolete Method < 1.0c firmware)
Each LEGEND-MC must be assigned an IP address. This can be done with the BOOT-P procedure or the
IA command can be used to assign the IP address through the serial port. Once the IP address has been
assigned, a BN command should be issued to save this value in the controller’s non-volatile memory.
Upon power-up or reset, the master LEGEND-MC will establish each slave connection. The following
steps must be taken while connected to the master LEGEND-MC:
1. Using the IH command, open two handles for each slave. Each slave controller must have 2
open handles, one for commands from the master, the other for data returned from the slave. The
second internet handle for each slave controller must contain a specific port value. The value must
be an even number greater than 502. The command for opening the communication handle is:
IHh=ip0,ip1,ip2,ip3<p>2 h is the handle. ip is the slave IP address. <p specifies port number. >2
specifies TCP/IP.
2. Set the total number of axes in the system with the NA command. For example, assume there are
two LEGEND-MC slaves, therefore there will be three axes and the command would be NA3.
3. Connect each slave handle to the master. This is accomplished with the CH command. The
format of this command is:
CHa=h1,h2 where a is the first axis designator of the slave controller, h1 is the handle for
commands and h2 is the handle for slave status.
4. For the master controller to make decisions based on the status of the slave controllers, it is
necessary for the slaves to generate data records giving their current status. The record is sent at a
rate set by the QW command. The QW command must be executed by the master before the slave
can issue a record under any method. The format of the command is:
QWh=n where h is the handle. n is a number between 4 and 16000.
n sets the number of samples (msec with default TM1000).
n equal to 0 disables the mode.
42
LEGEND-MC User’s Manual
would be TE. The position operand for the F axis would be _TPF.
Some commands are inherently sent to all controllers. These include commands such as AB (Abort), CN
and TM.
Certain commands need to be launched specifically. For this purpose there is the SA command. In its
simplest form the SA command is:
SAh=”command string”
Here “command string” will be sent to handle h. For example, the SA command is the means for sending
an XQ command to a slave. A more flexible form of the command is:
SAh=field1,field2,field3,field4...field8 Where each field can be a string in quotes or a variable.
When the master sends an SA command to a slave, it is possible for the master to determine the status of
the command. The response _IHh4 will return the number 1 to 4. One means waiting for the
acknowledgement from the slave. Two means a colon (command accepted) has been received. Three
means a question mark (command rejected) has been received. Four means the command timed out.
If a command generates responses (such as the TE command), the values will be stored in _SAh0 through
_SAh7. If a field is unused its _SA value will be -2^31.
Example
Bit 2 on the slave using handle E for the data record would be 502. The arguments for SB, CB, and OB
use this format as does the @IN[ ] function.
For byte and word-wide I/O, use the SA command such as: SAC=”OP6” to set the output port of handle
C. SAC=”TI” will return the input port on handle C and the operand, _SAC0 will contain the response
from the TI command.
Modbus Support
The Modbus protocol supports communication between masters and slaves. The masters may be multiple
PC’s that send commands to the controller. The slaves are typically peripheral I/O devices that receive
commands from the controller.
NOTE: There are numerous ways to reset the controller; hardware reset (push reset button or power-down
controller) and software resets (through Ethernet or RS232 by entering RS). The only reset that will not
cause the controller to disconnect is a software reset via the Ethernet or RS232.
When the Yaskawa controller acts as the master, the IH command is used to assign handles and connect
to its slaves. The IP address may be entered as a 4 byte number separated with commas (industry standard
uses periods) or as a 32 bit number. A port may also be specified, but if not, it will default to 502. The
43
LEGEND-MC User’s Manual
protocol (TCP/IP or UDP/IP) to use must also be designated at this time, otherwise, the controller will not
connect to the slave. (Ex. IHB=151,25,255,9<179>2 This will open handle #2 and connect to the I/P
address 151.25.255.9, port 179, using TCP/IP).
An additional protocol layer is available for speaking to I/O devices. Modbus is an RS-485 protocol that
packages information in binary packets that are sent as part of a TCP/IP packet. In this protocol, each
slave has a 1 byte slave address.The LEGEND-MC can use a specific slave address or default to the
handle number.
Modbus protocol has commands called function codes. The LEGEND-MC supports 10 major function
codes:
The LEGEND-MC provides three levels of Modbus communication. The first level allows the user to
create a raw packet and receive raw data. It uses the MBh command with a function code of -1. The
command format is:
MBh=-1,len, array[ ] where len is the number of bytes
array [ ] is the array with the data
The second level incorporates the Modbus structure. This is necessary for sending configuration and
special commands to an I/O device. The formats vary depending on the function code that is called. For
more information, refer to Command Reference
The third level of Modbus communication uses standard Yaskawa commands. Once the slave has been
configured, the commands that may be used are @IN[ ], @AN[ ], SB, CB, OB, and AO. For example, AO
2020,8.2 would tell I/O number 2020 to output 8.2 volts.
If a specific slave address is not necessary, the I/O number to be used can be calculated with the following:
I/O Number= (HandleNum*1000)+((Module-1)*4)+(BitNum)
Where HandleNum is the handle number from 1 (A) to 16 (P). Module is the position of the module in the
rack from 1 to 16. BitNum is the I/O point in the module from 1 to 4.
If an explicit slave address is to be used, the equation becomes:
I/O Number=(SlaveAddress*1000)+(HandleNum*1000)+((Module-1)*4)+(Bitnum-1)
Which devices receive what information from the controller depends on a number of things. If a device
queries the controller, it will receive the response unless it explicitly tells the controller to send it to
another device. If the command that generates a response is part of a downloaded program, the response
will route to whichever port is specified as the default (unless explicitly told to go to another port). To
designate a specific destination for the information, add {Eh} to the end of the command. (Ex.
MG{EC}"Hello" will send the message "Hello" to handle #3. TP,,?{EF} will send the z axis position to
handle #6.)
44
LEGEND-MC User’s Manual
Multicasting
A multicast is only used in UDP/IP and is similar to a broadcast (everyone on the network gets the
information) but specific to a group. As such, all devices within a specified group will receive
information sent in a multicast. The many multicast groups on a network are differentiated by their
multicast IP address. To communicate with all devices in a specific multicast group, information can be
sent to the multicast IP address rather than to each device IP address. All LEGEND-MC controllers
belong to a default multicast address of 239.255.19.56. The controller's multicast IP address can be
changed by using the IA> u command.
45
LEGEND-MC User’s Manual
NOTES:
46
LEGEND-MC User’s Manual
4 Command Reference
AB (ABORT)
@ABS (ABSOLUTE VALUE)
AC (ACCELERATION)
@ACOS (ARC COSINE)
AD (AFTER DISTANCE)
AF (ANALOG FEEDBACK)
AI (AFTER INPUT)
AL (ARM LATCH)
AM (AFTER MOTION)
@AN (READ ANALOG)
AO (ANALOG OUTPUT)
AP (AFTER ABSOLUTE POSITION)
AR (AFTER RELATIVE DISTANCE)
AS (AT SPEED)
@ASIN (ARC SINE)
AT (AT TIME)
@ATAN (ARC TANGENT)
BG (BEGIN MOTION)
BL (REVERSE SOFTWARE LIMIT)
BN (BURN)
BP (BURN PROGRAM)
BV (BURN VARIABLES)
CB (CLEAR BIT)
CD (CONTOUR DATA)
CE (CONFIGURE ENCODER)
CF (CONFIGURE MESSAGES)
CH (CONNECT HANDLE)
CI (COMMUNICATION INTERRUPT)
CM (CONTOUR MODE)
CN (CONFIGURE LIMIT SWITCHES)
@COM (2’S COMPLEMENT)
@COS (COSINE)
CS (CLEAR SEQUENCE)
CW (COPYRIGHT INFORMATION / DATA ADJUSTMENT BIT ON/OFF)
DA (DE-ALLOCATE THE VARIABLES & ARRAYS)
DB (DYMANIC BRAKE)
DC (DECELERATION)
DE (DUAL (AUXILIARY) ENCODER POSITION)
DL (DOWNLOAD)
DM (DIMENSION)
DP (DEFINE POSITION)
DT (DELTA TIME)
DV (DUAL VELOCITY (DUAL LOOP))
EA (ECAM MASTER AXIS)
EB (ENABLE ECAM MODE)
47
LEGEND-MC User’s Manual
EC (ECAM COUNTER)
ED (EDIT)
EG (ECAM ENGAGE)
ELSE (ELSE FUNCTION FOR USE WITH IF CONDITIONAL STATEMENT)
EM (ECAM CYCLE)
EN (END)
ENDIF (END OF IF CONDITIONAL STATEMENT)
EO (ECHO)
EP (CAM TABLE INTERVALS AND STARTING POINT)
EQ (ECAM QUIT (DISENGAGE))
ER (ERROR LIMIT)
ET (ELECTRIC CAM TABLE)
FA (ACCELERATION FEED FORWARD)
FE (FIND EDGE)
FI (FIND INDEX)
FL (FORWARD SOFTWARE LIMIT)
@FRAC (FRACTION)
FV (VELOCITY FEED FORWARD)
GA (MASTER AXIS FOR GEARING)
GR (GEAR RATIO)
HC (HANDLE CONNECT)
HM (HOME)
HR (HANDLE RESTORE)
HS (HANDLE SWITCH)
HW (HANDLE WAIT)
HX (HALT EXECUTION)
IA (IP ADDRESS)
IF (IF CONDITIONAL STATEMENT)
IH OPEN INTERNET HANDLE)
II (INPUT INTERRUPT)
IL (INTEGRATOR LIMIT)
IN (INPUT VARIABLE)
@IN (STATUS OF DIGITAL INPUT)
@INT (INTEGER)
IP (INCREMENT POSITION)
IT (INDEPENDENT TIME CONSTANT - SMOOTHING FUNCTION)
JG (JOG)
JP (JUMP TO PROGRAM LOCATION)
JS (JUMP TO SUBROUTINE)
KD (DERIVATIVE CONSTANT)
KI (INTEGRATOR)
KP (PROPORTIONAL CONSTANT)
LA (LIST ARRAYS)
LC (LOCK CONTROLLER)
LE (LINEAR INTERPOLATION END)
LF (FORWARD LIMIT)
LI (LINEAR INTERPOLATION DISTANCE)
48
LEGEND-MC User’s Manual
LL (LIST LABELS)
LM (LINEAR INTERPOLATION MODE)
LO (LOCKOUT)
LR (REVERSE LIMIT)
LS (LIST PROGRAM)
LT (LATCH TARGET)
LV (LIST VARIABLES)
LZ (LEADING ZERO)
MB (MODBUS)
MC (MOTION COMPLETE - “IN POSITION”)
MF (FORWARD MOTION TO POSITION)
MG (MESSAGE)
MM (MASTER MODULUS)
MO (MOTOR OFF)
MR (REVERSE MOTION TO POSITION)
MT (MOTOR TYPE)
MW (MODBUS WAIT)
NA (NUMBER OF AXES)
NB (NOTCH BANDWIDTH)
NF (NOTCH FREQUENCY)
NO (NO OPERATION)
NZ (NOTCH ZERO)
OB (OUTPUT BIT)
OC (OUTPUT COMPARE)
OD (OUTPUT COMPARE - AUXILIARY ENCODER)
OE (OFF ON ERROR)
OF (OFFSET)
OP (OUTPUT PORT)
@OUT (STATUS OF DIGITAL OUTPUT)
PA (POSITION ABSOLUTE)
PF (POSITION FORMAT)
PR (POSITION RELATIVE)
PW (PASSWORD)
QD (DOWNLOAD ARRAY)
QL (REPORT LATCH - AUXILIARY ENCODER)
QR (DATA RECORD)
QU (UPLOAD ARRAY)
QW (SLAVE RECORD UPDATE RATE)
QZ (RETURN DATA RECORD INFORMATION)
RA (RECORD ARRAY)
RC (RECORD)
RD (RECORD DATA)
RE (RETURN FROM ERROR ROUTINE)
RI (RETURN FROM INTERRUPT ROUTINE)
RL (REPORT LATCHED POSITION)
@RND (ROUND)
RS (RESET)
49
LEGEND-MC User’s Manual
50
LEGEND-MC User’s Manual
Command Description
Each executable instruction is listed in the following section in alphabetical order.
The two letter op-code for each instruction is placed in the upper left corner. Below the op-code is a
description of the command and required arguments. As arguments, some commands require actual
values to be specified following the instruction. These commands are followed by lower case x, y, z, and
w. Values may be specified for any axis separately or any combination of axes. Axis values are separated
by commas. Examples of valid x,y, z, w syntax are listed below. For the SMC-3010, the axis designators
a,b,c,d,e,f,g,h are used where x,y,z,w can be used interchangeably with a,b,c,d.
AC ,y Specify y only
51
LEGEND-MC User’s Manual
The following table defines terms found in the usage chart for each command:
Classification Meaning
All Axes When this command is executed in the master, it causes
the command to be broadcast to all slaves in the distrib-
uted control system. Example CN, Limit Switch Config-
uration.
No, Local These commands cannot be sent from a master to a slave
over Ethernet or are not involved with an Ethernet fea-
ture in any way.
QW packet The information contained in this command is obtained
from the slave update packet. This packet is updated at
the QW rate. This is also the second parameter of the HC
command.
Specific Axis If Ethernet is configured for Distributed Control, when a
slave axis is specified in a command such as
BLW=-5000, the command is relayed to the slave once,
and the slave acknowledges once.
Use SA This command is possible over Ethernet, but only when
encapsulated inside an SA command to the appropriate
handle. Generally commands that have this listing are
not intended to be used with distributed control, but will
work normally when received by the slave.
52
LEGEND-MC User’s Manual
AB (Abort)
[Motion]
DESCRIPTION:
AB (Abort) stops motion instantly without controlled deceleration by freezing the profiler. If there is a
program executing, AB also aborts the program unless a 1 argument is specified. The command, AB, will
shut off the motors (disable the amplifier) for any axis in which the off-on-error function is enabled (see
command "OE"). AB aborts motion on all axes in motion and cannot stop individual axes. If a multi-axis
system is configured (distributed control) the AB command will abort all axes if issued to the master.
ARGUMENTS: AB n where
n = 0 aborts motion and program
n = 1 aborts motion without aborting program
n = 2 aborts motion on all axes that are connected via ethernet, does not cause error for axes that have lost
connection.
USAGE:
While Moving Yes Default Value n/a
In a Program Yes Default Format n/a
Command Line Yes
OPERAND USAGE:
_AB returns the state of the Abort Input on the local controller.
RELATED COMMANDS:
"SH" Turns servos back on if they were shut-off by
Abort and OE1.
EXAMPLES:
OE 0,0,0,0 Disable OFF/ON error for all axes
AB Aborts motion unconditionally, motors remain
enabled
OE 1,1,1,1 Enable off-on-error
AB Shuts off amplifier enable and aborts motion
#A Label - Start of program
JG 20000 Specify jog speed on X-axis
BGX Begin jog on X-axis
WT 5000 Wait 5000 msec
AB1 Abort motion without aborting program
WT 5000 Wait 5000 milliseconds
SH Servo Here
JP #A Jump to Label A
EN End of the routine
NOTE: Use parameter 1 following AB if you want the motion to be aborted or application program will be aborted.
53
LEGEND-MC User’s Manual
DESCRIPTION:
@ABS returns the absolute value of a number or variable given in square brackets. Note that the @ABS
command is a function, which means that it does not follow the convention of the commands, and does not
require the underscore when used as an operand.
EXAMPLES:
OE 0,0,0,0 Program TEST
VAR1=-45.6 Set a variable equal to -45.6
MG @ABS[VAR1] Display the absolute value of VAR1
VAR2=@ABS[VAR1]+100.404 Perform calculation
EN End of program
54
LEGEND-MC User’s Manual
AC (Acceleration)
[Motion]
DESCRIPTION:
The Acceleration (AC) command sets the linear acceleration rate for independent moves, such as PR, PA
and JG moves. The parameters input will be rounded down to the nearest factor of 1024. The units of the
parameters are counts per second squared. The acceleration rate may be changed during motion. The DC
command is used to specify the deceleration rate.
ARGUMENTS: AC x, y, z, w or ACX=x or AC a,b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are unsigned integers
USAGE:
While Moving Yes Minimum Value 1024
OPERAND USAGE:
RELATED COMMANDS:
"DC" Specifies deceleration rate.
EXAMPLES:
AC 150000 Set acceleration to 150000 counts/sec2
AC ? Request the current acceleration setting
NOTES: Specify realistic acceleration rates based on your physical system such as motor torque rating, loads, and amplifier
current rating. Specifying an excessive acceleration will cause large following error during acceleration and the motor will
not follow the commanded profile. The acceleration feedforward command FA will help minimize error during accelera-
tion.
55
LEGEND-MC User’s Manual
EXAMPLES:
#TEST Program TEST
VAR1=.707 Set a variable equal to .707
MG @ACOS[VAR1] Display the absolute value of VAR1
VAR2=@ACOS[VAR1]+100.404 Perform calculation
EN End of program
56
LEGEND-MC User’s Manual
AD (After Distance)
[Trippoint]
DESCRIPTION:
The After Distance (AD) command is a trippoint used to control the timing of events. This command will
hold up the execution of the following command until one of the following conditions have been met:
1. The commanded motor position crosses the specified relative distance from the start of the
move.
2. The motion profiling on the axis is complete.
3. The commanded motion is in the direction which moves away from the specified position.
The units of the command are quadrature counts. The motion profiler must be on or the trippoint will
automatically be satisfied.
NOTE: AD will be affected when motion smoothing time constant, IT, is not 1. See IT command for more
information.
RELATED COMMANDS:
"AR" After Relative distance for sequential
triggering
“AP” After Absolute Position
EXAMPLES:
#A;DP0 Begin Program
PR 10000 Specify position
BG Begin motion
AD 5000 Wait until profiler passes 5000 units from start
of move.
MG "Halfway" ;TP Send message
EN End Program
NOTE: The AD command is accurate to the number of counts that occur in 2 msec. Multiply speed by 2 msec to obtain the
maximum position error in counts. Remember AD measures incremental distance from start of move on one axis.
57
LEGEND-MC User’s Manual
AF (Analog Feedback)
[Configuration]
DESCRIPTION:
The Analog Feedback (AF) command is used to set an axis with analog feedback instead of digital feedback
(quadrature/pulse dir). As the analog feedback is decoded by a 12-bit A/D converter, an input voltage of 10
volts is decoded as a position of 2047 counts and a voltage of -10 volts corresponds to a position of -2048
counts.
ARGUMENTS: AF x,y,z,w or AFX=x or AF a,b,c,d,e,f,g,h where
x,y,z,w or a, b, c, d, e, f, g, h
1 = Enables analog feedback
0 = Disables analog feedback and switches to digital feedback
"?" returns a 0 or 1 which states whether analog feedback is enabled for the specified axes.
USAGE:
While Moving No Minimum Value 0
OPERAND USAGE:
_AFn returns the current feedback setting where n is an axis letter
RELATED COMMANDS:
"CE" Configure Encoder
EXAMPLES:
AF 1,0,0,1 Analog feedback on X and W axis
58
LEGEND-MC User’s Manual
AI (After Input)
[Trippoint]
DESCRIPTION:
The AI command is used in motion programs to wait until after the specified input condition has occurred.
If n is positive, it waits for the input to go high. If n is negative, it waits for n to go low. To wait for a
transition from high to low or low to high, put two AI commands together. AI is only available for local
inputs.
ARGUMENTS: AI +/-n where
n is a signed integer
USAGE:
While Moving Yes Minimum Value 1
RELATED COMMANDS:
@IN[n] Function to read digital input 1 through 8
EXAMPLES:
#A Begin Program
BG Begin motion
EN End Program
NOTE: The AI command actually halts execution until specified input is at desired logic level. Use the conditional Jump
command (JP) or input interrupt (II) if you do not want the program sequence to halt.
59
LEGEND-MC User’s Manual
AL (Arm Latch)
[Setting]
DESCRIPTION:
The AL command enables the latching function (high speed position capture) of the controller. When the
AL command is used to arm the position latch, the encoder position of the main encoder input will be
captured upon a low going signal on Input 1. When interrogated or used in an operand the AL command will
return a 1 if the latch is armed or a zero after the latch has occurred. The command RL returns the captured
position value. The CN command will change the polarity of the latch.
ARGUMENTS: ALn where
n = XYZW or ABCDEFGH for the main encoder latch and
n = SX, SY, SZ, SW or SA, SB, SC, SD, SE, SF, SG, SH for the auxiliary encoder latch
USAGE:
While Moving Yes Minimum Value n/a
OPERAND USAGE:
1 Main Armed
2 Auxiliary Armed
3 Both Armed
RELATED COMMANDS:
"RL" Report Latch
"CN" Configure
EXAMPLES:
#START Start program
JP #LOOP,_ALX=1
EN End of program
60
LEGEND-MC User’s Manual
AM (After Motion)
[Trippoint]
DESCRIPTION:
The AM command is a trippoint used to control timing of events. This command holds up execution of the
following commands until the current move on the specified axis or axes is completed. AM occurs when
the profiler is finished generating the last position command. However, the servo motor may not be in final
position. Use TE to verify position error for servos or use the MC trippoint to wait until final position is
reached by the servo.
ARGUMENTS: AM XYZWS or ABCDEFGH where
X, Y, Z, W or A, B, C, D, E, F, G, H are axis designators. S indicates an interpolation sequence. No argu-
ment specifies that motion on all axes is complete.
USAGE:
While Moving Yes Minimum Value n/a
In a Program Yes Maximum Value n/a
Command Line Yes Default Value ---
Can be Interrogated No Default Format ---
Used as an Operand No Distributed Control Specific Axis
RELATED COMMANDS:
"BG" _BG returns a 0 if motion complete
“MC” Actual Motion Complete
EXAMPLES:
#MOVE Start of program
PR 5000 Position relative move
BG Begin motion
AM Wait until motion is complete
EN End of Program
#F;DP 0 Program F
PR 5000 Position relative move
BG Begin motion
AM Wait until motion is complete
MG "DONE";TP Print message
EN End of Program
NOTE: AM command controls the timing between multiple move sequences. If the motor is in the middle of a position rela-
tive move (PR), a position absolute move (PA, BG) cannot be made until the first move is complete. Use AM to pause the
program sequences until the first motion is complete. AM tests for profile completion. Another testing method is to query the
operand, _BG. This is equal to 1 during motion, and 0 when motion profiling is complete.
61
LEGEND-MC User’s Manual
EXAMPLES:
#TEST Program TEST
MG @AN[2] Display the value of analog input #2 as a
voltage
JGX=@AN[2]*10000 Set jog speed according to analog input
SAA=”MG @AN[2]” Sends command MG @AN[2] to slave on
handle A
Analog3=_SAA Returns slave response to SA command
BGX Begin Move
EN End of program
62
LEGEND-MC User’s Manual
AO (Analog Out)
[I/O]
DESCRIPTION:
The AO command sets the analog output voltage of the local analog output or ModBus devices connected
via Ethernet.
ARGUMENTS: AO m, n where
m is either the local analog output voltage ranging from 9.9982 to -9.9982 or the I/O number calculated
using the following equations:
m = (SlaveAddress*1000) + (HandleNum*1000) + (Module-1)*4) + (Bitnum-1)
Slave Address is used when the ModBus device has slave devices connected to it and specified as
Addresses 0 to 225. Please note that the uses for ModBus are very rare and this number will usually be 0.
HandleNum is the handle specifier from A to P (1 - 16).
Module is the position of the module in the rack from 1 to 16.
BitNum is the I/O point in the module from 1 to 4.
n = the voltage which ranges from 9.9982 to –9.9982. If m is < 1000, n is omitted.
USAGE:
While Moving Yes Minimum n Value -9.9982
OPERAND USAGE: _AO returns the value of the local analog output in volts.
RELATED COMMANDS:
"SB" Set Bit
"MB" Modbus
EXAMPLES:
AO -3.4 Sets local analog output to -3.4V
AO 6016, 8.2 Sets analog output on modbus device on
handle F to 8.2V
SAA=”AO”,2.7 Set analog output of slave on handle A to 2.7V
SAA=”MG”,”_AO” Send command MG_AO to slave controller on
handle A
VAR1=_SAA Store the returned value to VAR1
63
LEGEND-MC User’s Manual
USAGE:
While Moving Yes Minimum Value -2147483648
In a Program Yes Maximum Value 2147483647
Command Line Yes Default Value ---
Can be Interrogated No Default Format ---
Used as an Operand No Distributed Control Specific Axis
RELATED COMMANDS:
"AR" Trippoint for relative distances
“AD” After Distance
"MF" Trippoint for forward motion
EXAMPLES:
#TEST Program B
DP0 Define position as zero
JG 1000 Set jog with speed of 1000 counts/sec
BG Begin move
AP 2000 After passing position 2000
V1=_TP Assign V1 the Xaxis X position
MG "Position is", V1 Print Message
ST Stop axis
EN End of Program
NOTE: The accuracy of the AP command is the number of counts that occur in 2 msec. Multiply the speed by 2 msec to
obtain the maximum error. AP tests for absolute position. Use the AD command to measure incremental distances.
64
LEGEND-MC User’s Manual
AR (After Relative)
[Trippoint]
DESCRIPTION:
The After Relative (AR) command is a trippoint used to control the timing of events. This command will
hold up the execution of the following command until one of the following conditions have been met:
1. The commanded motor position crosses the specified relative distance from either the start of
the move or the last AR or AD command.
2. The motion profiling on the axis is complete.
3. The commanded motion is in the direction which moves away from the specified position.
The units of the command are quadrature counts. The motion profiler must be active or the trippoint will
automatically be satisfied.
ARGUMENTS: AR x, y, z, w or ARX=x or AR a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are unsigned integers
USAGE:
While Moving Yes Minimum Value 0
RELATED COMMANDS:
“AD” After Distance
EXAMPLES:
#A;DP 0 Begin Program
BG Begin motion
#B Label
JP #B Jump to Label #B
EN End Program
NOTE: AR is used to specify incremental distance from last AR or AD command. Use AR if multiple position trippoints are
needed in a single motion sequence.
65
LEGEND-MC User’s Manual
AS (At Speed)
[Trippoint]
DESCRIPTION:
The AS command is a trippoint that occurs when the generated motion profile has reached the specified
speed. This command will hold up execution of the following command until the speed is reached. The AS
command will operate after either accelerating or decelerating. If the commanded speed is not reached, the
trippoint will be triggered after the motion is stopped (after deceleration).
ARGUMENTS: AS XYZWS or ABCDEFGH where
X, Y, Z, W or A, B, C, D, E, F, G, H are axis designators. S indicates an interpolation sequence. No argu-
ment specifies that motion on all axes is complete.
USAGE:
While Moving Yes Minimum Value n/a
EXAMPLES:
#SPEED Program A
EN End of Program
WARNING: The AS command applies to a trapezoidal velocity profile only with linear acceleration. AS used with S-curve
profiling may be inaccurate.
66
LEGEND-MC User’s Manual
EXAMPLES:
#TEST Program TEST
MG @ASIN[VAR1] Set variable
VAR1=.707 Display the arc sine of .707
VAR2=@ASIN[VAR1]+5 Perform calculation
EN End of program
67
LEGEND-MC User’s Manual
AT (After Time)
[Trippoint]
DESCRIPTION:
The AT command is a trippoint which is used to hold up execution of the next command until after the
specified time has elapsed. The time is measured with respect to a defined reference time. AT 0 establishes
the initial reference. AT n specifies n msec from the reference. AT -n specifies n msec from the reference
and establishes a new reference after the elapsed time period. This command is useful for waiting an
accurate amount of time duration while still being able to perform some other operations as long as they
require less time than the AT time.
ARGUMENTS: AT n where
n is a signed integer
n = 0 defines a reference time at current time
positive n waits n msec from reference
negative n waits n msec from reference and sets new reference after elapsed time period
(AT -n is equivalent to AT n; AT 0)
USAGE:
While Moving Yes Minimum Value -2147483647
EXAMPLES:
The following commands are sent sequentially:
AT 0 Establishes reference time 0 as current time
68
LEGEND-MC User’s Manual
EXAMPLES:
#TEST Program TEST
MG @ATAN[VAR1] Set variable
VAR1=.707 Display the arc sine of .707
VAR2=@ATAN[VAR1]+5 Perform calculation
EN End of program
69
LEGEND-MC User’s Manual
BG (Begin)
[Motion]
DESCRIPTION:
The BG command starts motion. When used as an operand, the BG command will return a 1 if there is a
commanded motion in progress, a 0 otherwise. The BG command will result in a command error if a move
is already in progress, the servo is not enabled or a limit switch is preventing motion.
ARGUMENTS: BG XYZWS or ABCDEFGH where
X, Y, Z, W, S or A, B, C, D, E, F, G, H specify the axis or sequence. No argument specifies that motion on
all axes is complete.
USAGE:
While Moving No Default Value ---
Can be Interrogated No
NOTE: BG, for a distributed control axis, forces the slave to send a QW packet immediately.
_BGn data comes from QW packet.
OPERAND USAGE:
_BGn contains a ‘0’ if motion complete on the axis, otherwise contains a ‘1’ where n is an axis letter.
RELATED COMMANDS:
"AM" After motion complete
EXAMPLES:
PR 2000 Set up for a relative move
BG Begin motion
BG Begin motion
BG Begin motion
NOTE: You cannot give another BG command until current BG motion has been completed. Use the AM trippoint to wait
for motion complete between moves. Another method for checking motion complete is to test for _BG being equal to 0.
70
LEGEND-MC User’s Manual
BL (Backward Limit)
[Setting]
DESCRIPTION:
The BL command sets the reverse software limit. If this limit is exceeded during a commanded motion, the
motion will decelerate to a stop. Reverse motion beyond this limit is not permitted. The reverse limit is
activated at position n-1 count. To disable the reverse limit, set n to -2147483648. The units are in
quadrature counts.
ARGUMENTS: BLx, y, z, w or BLX=x or BL a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are signed integers
“?” returns the reverse software limit value
-2147483648 turns off the reverse limit.
USAGE:
While Moving Yes Minimum Value -2147483648
OPERAND USAGE:
_BLn contains the value of the reverse software limit where n is an axis letter.
RELATED COMMANDS:
EXAMPLES:
"FL" Forward Limit
71
LEGEND-MC User’s Manual
BN (Burn Parameters)
[General]
DESCRIPTION:
The BN command saves certain controller parameters in non-volatile EEPROM memory. This command
takes approximately one second to execute and must not be interrupted. If the burn is disrupted by power
failure, a memory checksum error will result. The controller returns a <:> when the Burn is complete.
AC EO KI OP
AF EP KP PF
BL ER LZ SB
ET (table) MM SP
CE FA MO (MOTOR OFF or ON) TL
CF FL MT TM
CN GA NA TR
CW GR NB VA
DC IA NF VD
DV IL NZ VF
EA IT OE VS
EM KD OF VT
ARGUMENTS: None
USAGE:
While Moving Yes Default Value ---
Can be Interrogated No
VERY IMPORTANT!
Realize that the current values of the above parameters are saved in the EEPROM when the BN command
is executed.
72
LEGEND-MC User’s Manual
BP (Burn Program)
[General]
DESCRIPTION:
The BP command saves the application program in non-volatile EEPROM memory. This command
typically takes up to 10 seconds to execute and must not be interrupted. If the burn is disrupted by power
failure, a memory checksum error will result. The controller returns a <: >when the Burn is complete.
ARGUMENTS: None
USAGE:
While Moving No Default Value ---
In a Program No
Can be Interrogated No
73
LEGEND-MC User’s Manual
BV (Burn Variables)
[General]
DESCRIPTION:
The BV command saves the defined variables and arrays in non-volatile EEPROM memory. This command
typically takes up to 2 seconds to execute and must not be interrupted. If the burn is disrupted by power
failure, a memory checksum error will result. The controller returns a <:> when the Burn variables are
complete.
ARGUMENTS: None
USAGE:
While Moving No Default Value ---
In a Program Yes
Can be Interrogated No
74
LEGEND-MC User’s Manual
CB (Clear Bit)
[I/O]
DESCRIPTION:
The CB command clears a bit on the output port by setting it to logic zero. Slave controller or Modbus
outputs can be cleared also.
When using this command to access I/O on a slave controller in distributed control mode, use it with the
handle for outbound master commands. Do not use the handle which is for incoming slave update packets.
For example, if a slave is connected on handles E and F, reference the I/O for the slave on handle E.
ARGUMENTS: CB n where
n is an integer corresponding to a specific output on the controller to be cleared (set to 0). The first output
on the controller is denoted as output 1. A LEGEND-MC controller has 4 digital outputs plus applicable I/
O connected by Modbus.
DISTRIBUTED CONTROL:
MODBUS:
NOTE: When using Modbus devices, the I/O points of the modbus devices are calculated
using the following formula:
n = (SlaveAddress*1000) + (HandleNum*1000) + ((Module-1)*4) + (Bitnum-1)
Slave Address is used when the ModBus device has slave devices connected to it and specified as
Addresses 0 to 255. The use of slave devices for modbus are very rare and this number will usually be 0.
HandleNum is the handle specifier from A to P (1 - 16).
Module is the position of the module in the rack from 1 to 16.
BitNum is the I/O point in the module from 1 to 4.
USAGE:
While Moving Yes Default Value ---
In a Program Yes Default Format ---
Command Line Yes
Can be Interrogated No
RELATED COMMANDS:
"SB" Set Bit
"OP" Define all outputs
75
LEGEND-MC User’s Manual
EXAMPLES:
CB 1 Clear output bit 1
CB 2 Clear output bit 2
CB 3 Clear output bit 3
CB 602 Clear output 2 on slave controller on handle F
CB 1505 Clear the fifth output on the SMC3010
connected on handle "O."
76
LEGEND-MC User’s Manual
CD (Contour Data)
[Motion]
DESCRIPTION:
The CD command specifies the incremental position for an arbitrary motion profile. The units of the
command are in quadrature counts. This command is only applicable in the Contour Mode (CM).
ARGUMENTS: CD x, y, z, w or CDX=x or CD a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are signed integers
USAGE:
While Moving Yes Minimum Value -32767
RELATED COMMANDS:
"CM" Contour Mode
EXAMPLES:
CM Specify Contour Mode
CD 0 Exit Mode
77
LEGEND-MC User’s Manual
CE (Configure Encoder)
[Configuration]
DESCRIPTION:
The CE command configures the encoder inputs to the quadrature type or the pulse and direction type. It
also allows inverting the polarity. The configuration applies independently to the main axis encoder and the
auxiliary encoder inputs.
Warning: This command interacts with the CE command, which reverses the incoming encoder signals. Use
caution (motor off, machine estopped) when changing the MT or CE commands. If the two commands are
not in agreement with each other, the motor will run away at full speed when enabled.
For example: CEX = 10 implies r = 2 and s = 8, both encoders are reversed quadrature.
USAGE:
While Moving Yes Minimum Value 0
In a Program Yes Maximum Value 10
Command Line Yes Default Value 0
Can be Interrogated Yes Default Format 2.0
Used as an Operand Yes Distributed Control Specific Axis
OPERAND USAGE:
_CEn contains the value of encoder type for the main and auxiliary encoder where n is an axis letter.
RELATED COMMMANDS:
"MT" Specify motor type
EXAMPLES:
CE 0 Configure encoders
CE ? Interrogate configuration
V = _CE Assign configuration to a variable
78
LEGEND-MC User’s Manual
CF (Configure Messages)
[Configuration]
DESCRIPTION:
Sets the controller’s default port for unsolicited messages. By default, the LEGEND-MC controller will
send unsolicited responses to the RS-232 serial port. An unsolicited message is one generated in the
controller, i.e.; a program fault message or a message resulting from the MG command with no port
designation specified.
ARGUMENTS: CF n where
n is A through P for Ethernet handles 1 thru 16, S for serial port.
USAGE:
While Moving Yes Default Value 83 (“S”)
OPERAND USAGE:
_CF will return the current port selected for unsolicited responses from the controller. The _CF will return
a decimal value of the ASCII code.
EXAMPLES:
CFA Select Ethernet handle A to return unsolicited
responses.
79
LEGEND-MC User’s Manual
CH (Connect Handle)
[General]
DESCRIPTION:
The CH command is used to associate master and slave controllers in a distributed control system. The
master controller must associate one Ethernet handle for sending commands to each slave, and one Ethernet
handle for receiving status information from each slave. Note that these handles must first be opened before
assigning them with this command, see the command IH. This command is obsolete. Please use the HC
command instead.
RELATED COMMANDS:
EXAMPLE:
CHY=A,B Using one LEGEND-MC as a master and one LEGEND-MC as a slave
under TCP/IP. This command assigns a slave, identified by the Y axis
designator, with Handle A for commands and Handle B for status
returned from the slave.
80
LEGEND-MC User’s Manual
81
LEGEND-MC User’s Manual
CM (Contour Mode)
[Setting]
DESCRIPTION:
The Contour Mode is initiated by the instruction CM. This mode allows the generation of an arbitrary
motion trajectory. The CD command specifies the position increment, and the DT command specifies the
time interval.
The CM? or _CM commands can be used to check the status of the Contour Buffer. A value of 1 returned
indicates that the Contour Buffer is full. A value of 0 indicates that the Contour Buffer is empty.
ARGUMENTS: CM XYZW or ABCDEFGH
CM? Returns a 1 if the contour buffer is full, and 0 if the contour buffer is empty.
USAGE:
While Moving No Default Value ---
Can be Interrogated No
OPERAND USAGE:
_CM contains a ‘0’ if the contour buffer is empty, otherwise contains a ‘1’ meaning the buffer is
full.
RELATED COMMANDS:
"CD" Contour Data
EXAMPLES:
V=_CM;V= Return Contour Buffer Status
82
LEGEND-MC User’s Manual
n= 1 Home switch configured to drive motor in forward direction when input is high
upon initial HM execution. See HM and FE commands
-1 Home switch configured to drive motor in reverse direction when input is high
upon initial HM execution. See HM and FE commands
*
NOTE: The latch function will occur within 25usec only when used in active low mode, the opto
isolator requires more time if active high.
USAGE:
While Moving Yes Default Value -1.-1.-1
Can be Interrogated No
OPERAND USAGE:
_CN0 Contains the limit switch configuration.
_CN1 Contains the home switch configuration.
_CN2 Contains the latch input configuration.
RELATED COMMANDS:
"MT" Motor Type
EXAMPLES:
CN 1,1 Sets limit and home switches to active high
83
LEGEND-MC User’s Manual
EXAMPLES:
#TEST Program TEST
VAR1=1234 Set variable
MG @COM[VAR1] Display the complement of 1234
VAR2=@COM[VAR1]+99 Perform calculation
EN End of program
84
LEGEND-MC User’s Manual
@COS (Cosine)
[Function]
DESCRIPTION:
@COS returns the cosine of a number or variable given in square brackets using units of degrees. Note
that the @COS command is a function, which means that it does not follow the convention of the
commands, and does not require the underscore when used as an operand.
ARGUMENTS: @COS [n] where
n is a number
USAGE:
While Moving Yes Minimum n value -32768
In a Program Yes Maximum n value 32768
Not in a program Yes Default Value ---
Can be Interrogated No Default Format ---
Used as an Operand Yes Distributed Control No, Local
EXAMPLES:
#TEST Program TEST
VAR1=60 Set variable
MG @COS[VAR1] Display the value of the sine of VAR1
VAR2=@COS[VAR1]+9 Perform calculation
EN End of program
85
LEGEND-MC User’s Manual
CS (Clear Sequence)
[General]
DESCRIPTION:
The CS command will remove VP or LI commands stored in a motion sequence. Please note that after a
sequence has been run, the CS command is not necessary to enter a new sequence. This command is
useful if you have correctly specified VP or LI commands.
When used as an operand, _CS returns the number of the segment in the sequence, starting at zero. The
instruction _CS is valid in the Linear Mode, LM, Vector Mode, VM and Contour Mode, CM .
ARGUMENTS: none
USAGE:
While Moving No Default Value ---
In a Program Yes Default Format ---
Not in a program Yes
Can be Interrogated No
EXAMPLES:
#CLEAR Label
VP 1000,2000 Vector position
VP 4000,8000 Vector position
CS Clear vectors
VP 1000,5000 New vector
VP 8000,9000 New vector
VE End sequence
BGS Begin motion sequence
EN End of program
86
LEGEND-MC User’s Manual
CW (Copyright)
[General]
DESCRIPTION:
The CW command has a dual usage. The CW command will return the copyright information when the
argument, n is 0. Otherwise, the CW command is used as a communications enhancement. When CW = 1,
the communication enhancement sets the MSB of unsolicited, returned ASCII characters to 1. Unsolicited
ASCII characters are those characters which are returned from the controller without being directly queried
from an external source. This is the case when a program has a command that requires the controller to
return a value or string. The benefit of this is that two-way unsolicited messages can be filtered by an
external source to retrieve answers to strings that were sent by the external source.
ARGUMENTS: CW n,m where
n is a number, either 0,1 or 2:
0 Causes the controller to return the copyright information
1 Causes the controller to set the MSB of unsolicited returned characters to 1
2 Causes the controller to not set the MSB of unsolicited characters.
“?”Returns the copyright information for the controller
m is 0 or 1 (optional)
0 Causes the controller to pause program execution when output FIFO is full until FIFO
no longer full.
1 Causes the controller to continue program execution when output FIFO is full - output
characters after FIFO is full will be lost.
USAGE:
While Moving Yes* Default Value 2
Can be Interrogated No
OPERAND USAGE:
_CW contains the value of the data adjustment bit. 1 =on, 2 = off
*NOTE: The CW command can cause garbled characters to be returned by the controller. The
default state of the controller is to disable the CW command, however, the Yaskawa Y-Term soft-
ware may sometimes enable the CW command for internal usage. If the controller is reset while
the Yaskawa software is running, the CW command could be reset to the default value which
would create difficulty for the software. It may be necessary to re-enable the CW command. The
CW command status can be stored in EEPROM.
87
LEGEND-MC User’s Manual
DA (De-allocate Variables)
[General]
DESCRIPTION:
The DA command frees array and/or variable memory space. With this command, more than one array or
variable can be specified for memory de-allocation. Different arrays and variables are separated by comma
when specified in one command. The * argument de-allocates all variables, and *[0] de-allocates all arrays.
ARGUMENTS: DA c[0],d,etc. where
c[0] - Defined array name
d - Defined variable name
* - De-allocates all the variables
*[0] - De-allocates all the arrays
DA? Returns the number of arrays available on the controller.
USAGE:
While Moving Yes Default Value ---
In a Program Yes Default Format ---
Command Line Yes
OPERAND USAGE:
_DA contains the total number of arrays available. For example, before any arrays have been defined, the
operand _DA is 14. If one array is defined, the operand _DA will return 13.
RELATED COMMANDS:
EXAMPLES:
‘Cars’ and ‘Salesmen’ are arrays and ‘Total’ is a variable.
TEMP=5 Assign 5 to the variable TEMP
DM Cars[400],Salesmen[50] Dimension 2 arrays
Total=70 Assign 70 to the variable Total
DA Cars[0],Salesmen[0],Total De-allocate the 2 arrays & variables
DA*[0] De-allocate all arrays
DA *,*[0] De-allocate all variables and all arrays
DA TEMP De-allocate variable TEMP
NOTE: Since this command de-allocates the spaces and compacts the array spaces in the memory, it
is possible that execution of this command may take longer time than 2 ms.
88
LEGEND-MC User’s Manual
DB (Dynamic Brake)
[Configuration]
DESCRIPTION:
The DB command (Dynamic Brake) is used to set or disable the dynamic brake function of the Legend
Amplifier. When Dynamic Braking is enabled, a relay inside the amplifier shorts the motor winding
together to absorb energy from the load quickly in an E-Stop situation. More specifically, when the
power is removed from the main power input or the servo is disabled (MO) motor off, the dynamic brake
function is automatically enabled if the DB command is set.
x, y z, w, or a, b, c, d, e, f, g, h are either 0 or 1.
USAGE:
While Moving Yes Minimum Value 0
In a Program Yes Maximum Value 1
Command Line Yes Default Value 1
Can be Interrogated Yes Default Format 8.0
Used as an Operand Yes Distributed Control Specific Axis
OPERAND USAGE:
_DBn contains the dynamic brake setting where n is an axis letter.
EXAMPLES:
DB1 Enable the Dynamic Brake function of the
amplifier.
89
LEGEND-MC User’s Manual
DC (Deceleration)
[Motion]
DESCRIPTION:
The Deceleration command (DC) sets the linear deceleration rate for independent moves such as PR, PA
and JG moves. The parameters will be rounded down to the nearest factor of 1024 and have units of counts
per second squared.
ARGUMENTS: DC x, y, z, w or DCX=x or DC a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are unsigned integers
USAGE:
While Moving Yes* Minimum Value 1024
In a Program Yes Maximum Value 67107840
Command Line Yes Default Value 256000
Can be Interrogated Yes Default Format 8.0
Used as an Operand Yes Distributed Control Specific Axis
OPERAND USAGE:
RELATED COMMANDS:
"AC" Acceleration
"PR" Position Relative
"SP" Speed
"JG" Jog
"BG" Begin
"IT" Smoothing constant - S-curve
EXAMPLES:
PR 10000 Specify relative position
AC 2000000 Specify acceleration rate
DC 1000000 Specify deceleration rate
SP 5000 Specify slew speed
BG Begin motion
*NOTE: The DC command may be changed during the move in JG move, but not in PR or PA
move. For controlled deceleration in abort conditions, use the ST command.The deceleration rate
can be changed after ST.
90
LEGEND-MC User’s Manual
USAGE:
While Moving Yes Minimum Value -2147483647
OPERAND USAGE:
_DEn returns the current position of the specified auxiliary encoder where n is an axis letter.
EXAMPLES:
:DE 0 Set the auxiliary encoder position to 0
NOTE: Dual encoders are useful when you need an encoder on the motor and on the load. The encoder on the load is typi-
cally the auxiliary encoder and is used to verify the true load position. Any error in load position is used to correct the motor
position.
91
LEGEND-MC User’s Manual
DL (Download)
[General]
DESCRIPTION:
The DL command prepares a controller to accept a data file from the host computer. Instructions in the file
will be accepted as a data stream without line numbers. The file is terminated using <control> Z, <control>
Q, <control> D, or \.
If no parameter is specified, downloading a data file will clear any programs in the LEGEND-MC RAM.
The data is entered beginning at line 0. If there are too many lines or too many characters per line, the
LEGEND-MC will return a “?”. To download a program after a label, specify the label name following DL.
The # argument may be used with DL to append a file at the end of the LEGEND-MC program in RAM.
ARGUMENTS: DL n
n = no argument Downloads program beginning at line 0 and erases programs in RAM.
n = #Label Begins download at line following #Label where label may be any valid program label.
n = #Begins download at end of program in RAM.
USAGE:
While Moving Yes Default Value ---
Can be Interrogated No
OPERAND USAGE:
When used as an operand, _DL gives the number of available labels. The total number of labels is 126.
RELATED COMMANDS:
"UL" Upload
EN Data
92
LEGEND-MC User’s Manual
DM (Dimension Array)
[General]
DESCRIPTION:
The DM command defines a single dimensional array with a name and total elements. The first element of
the defined array starts with element number 0 and the last element is at n-1.
ARGUMENTS: DM c[n] where
c is a name of up to eight alphanumeric characters, starting with an uppercase alphabetic character.
n is the number of entries from 1 to 8000.
DM? Returns the number of array elements available.
USAGE:
While Moving Yes Default Value ---
OPERAND USAGE:
_DM contains the available array space. For example, before any arrays have been defined, the operand
_DM will return 8000. If an array of 100 elements is defined, the operand _DM will return 7900.
RELATED COMMANDS:
"DA" Deallocate Array
EXAMPLES:
DM Pets[5],Dogs[2],Cats[3] Define dimension of arrays, pets with 5
elements; Dogs with 2 elements; Cats with 3
elements
93
LEGEND-MC User’s Manual
DP (Define Position)
[Setting]
DESCRIPTION:
The DP command sets the current motor position and current command positions to a user specified value.
The units are in quadrature counts. This command will set both the TP and RP values.
OPERAND USAGE:
_DPn reports the current position where n is an axis letter.
EXAMPLES:
:DP 0 Sets the current position of the X axis to 0
:DP ?
94
LEGEND-MC User’s Manual
DT (Delta Time)
[Motion]
DESCRIPTION:
The DT command sets the time interval for Contouring Mode. Sending the DT command once will set the
time interval for all following contour data until a new DT command is sent. 2n samples is the time
interval. Sending DT0 followed by CD0 command terminates the Contour Mode.
ARGUMENTS: DT n where
n is an integer. 0 terminates the Contour Mode.
n=1 thru 8 specifies the time interval of 2n samples. By default the sample period is 1 msec (set by TM
command); with n=1, the time interval would be 2 msec.
USAGE:
While Moving Yes Minimum Value 0
OPERAND USAGE:
_DT contains the value for the time interval for Contour Mode
RELATED COMMANDS:
"CM" Contour Mode
EXAMPLES:
DT 4 Specifies time interval to be 16 msec
#CONTOUR Begin
WC Wait
EN End
95
LEGEND-MC User’s Manual
OPERAND USAGE:
_DVn contains the state of dual velocity mode where n is an axis letter and 0 = disabled, 1 = enabled.
RELATED COMMANDS:
"KD" Damping constant
EXAMPLES:
DV 1 Enables dual loop PID
DV 0 Disables DV
96
LEGEND-MC User’s Manual
EA (ECAM Master)
[Setting]
DESCRIPTION:
The EA command selects the master axis for the electronic cam mode.
ARGUMENTS: EASX is the only applicable cam master configuration on the SMC3010.
USAGE:
While Moving Yes Default Value n/a
RELATED COMMANDS:
"EB" Enable ECAM
EXAMPLES:
EASX Select auxiliary encoder as the master for ECAM
97
LEGEND-MC User’s Manual
EB (ECAM Enable)
[Setting]
DESCRIPTION:
The EB function enables or disables the cam mode. In this mode, the master axis is modularized within the
cycle. This command does not initiate camming but it readies the controller for cam mode.
ARGUMENTS: EB n where
n = 1 starts cam mode and n = 0 stops cam mode.
EB? Returns a 0 if ECAM is disabled and 1 if enabled.
USAGE:
While Moving Yes Default Value 0
OPERAND USAGE:
_EB contains the state of Ecam mode. 0 = disabled, 1 = enabled
RELATED COMMANDS:
”EM“ Specify Ecam Cycle
EXAMPLES:
EB1 Starts ECAM mode
EB0 Stops ECAM mode
NOTE: See the example section for more detailed cam examples.
98
LEGEND-MC User’s Manual
EC (ECAM Counter)
[Setting]
DESCRIPTION:
The EC function sets the index into the ECAM table. This command is only useful when entering ECAM
table values without index values and is most useful when sending commands in binary. See the command,
ET.
ARGUMENTS: EC n where
n is an integer between 0 and 256.
n = ? Returns the current value of the index into the ECAM table.
USAGE:
While Moving Yes Default Value ---
OPERAND USAGE:
_EC contains the current value of the index into the ECAM table.
RELATED COMMANDS:
"EA" Choose ECAM master
EXAMPLES:
EC0 Set ECAM index to 0
99
LEGEND-MC User’s Manual
ED (Edit Mode)
[General]
DESCRIPTION:
Using Yaskawa YTerm Software or any other terminal emulator: The ED command puts the controller into
the Edit subsystem. In the Edit subsystem, programs can be created, changed or destroyed. The commands
in the Edit subsystem are:
<cntrl>D Deletes a line
<cntrl>I Inserts a line before the current one
<cntrl>P Displays the previous line
<cntrl>Q Exits the Edit subsystem
<return> Saves a line
Because the download time for a complete program is usually very short, we recommend all editing be
performed by Yaskawa’s YTerm software. This command is primarily documented for it’s usefulness when
a command error occurs. _ED indicates the line that had the error.
ARGUMENTS: ED n where
n specifies the line number to begin editing. The default line number is the last line of program space with
commands.
USAGE:
While Moving No Default Value n/a
Can be Interrogated No
OPERAND USAGE:
_ED Contains the line number of the last line to have an error. Very useful in tracing field problems.
EXAMPLES:
000 #START
001 PR 2000
002 BG
100
LEGEND-MC User’s Manual
006 V=_ED
009 ST
010 ZS0
011 EN
NOTE: Remember to quit the Edit Mode prior to executing or listing a program.
101
LEGEND-MC User’s Manual
EG (ECAM Engage)
[Motion]
DESCRIPTION:
The EG command engages an ECAM operation at a specified position of the master encoder. If a value is
specified outside of the master’s range, the slave will engage immediately. Once a slave motor is engaged,
its position is redefined to fit within the cycle.
ARGUMENTS: EG n where
n is the master position at which the slave axis must be engaged.
“?” returns 1 if specified axis is engaged and 0 if disengaged
USAGE:
While Moving Yes Minimum value -2147483648
OPERAND USAGE:
_EGn contains ECAM status where n is an axis letter. 0 = axis is not engaged, 1 = axis is engaged.
RELATED COMMANDS:
“EB” Enable Ecam
EXAMPLES:
EG 700 Engages slave at master position 700.
NOTE: This command is not a trippoint. This command will not hold the execution of the program
flow. If the execution needs to be held until master position is reached, use MF or MR command.
102
LEGEND-MC User’s Manual
ELSE
[Program Flow]
DESCRIPTION:
The ELSE command is an optional part of an IF conditional statement. The ELSE command must occur
after an IF command and it has no arguments. It allows for the execution of a command only when the
argument of the IF command evaluates False. If the argument of the IF command evaluates false, the
controller will skip commands until the ELSE command. If the argument for the IF command evaluates
true, the controller will execute the commands between the IF and ELSE command.
ARGUMENTS: none
USAGE:
While Moving Yes Default Value ---
RELATED COMMANDS:
"ENDIF" End of IF conditional Statement
EXAMPLES:
IF (@IN[1]=0) IF conditional statement based on input 1
IF (@IN[2]=0) 2nd IF conditional statement executed if 1st IF
conditional true
103
LEGEND-MC User’s Manual
EM (ECAM Cycle)
[Setting]
DESCRIPTION:
The EM command is part of the ECAM mode. It is used to define the change in position over one complete
cycle of the slave. If a slave will return to its original position at the end of the cycle, the change is zero. If
the change is negative, specify the absolute value.
ARGUMENTS: EM n where
n is the net change in the slave axis.
USAGE:
While Moving Yes Minimum n parameter -2147483648
OPERAND USAGE:
_EMn contains the cam cycle of the slave where n is an axis letter.
RELATED COMMANDS:
"EB" Enable Ecam
"EP" CAM table intervals & starting point
EXAMPLES:
EM 2000 Define the net change in the slave to be 2000.
104
LEGEND-MC User’s Manual
EN (End)
[Program Flow]
DESCRIPTION:
The EN command is used to designate the end of a program or subroutine. If a subroutine was called by the
JS command, the EN command ends the subroutine and returns program flow to the point just after the JS
command.
The EN command is also used to end the automatic subroutines #MCTIME and #CMDERR.
ARGUMENTS: none
NOTE: Use the RE command to return from the interrupt handling subroutines #LIMSWI and
#POSERR. Use the RI command to return from the #ININT subroutine.
USAGE:
While Moving Yes Default Value n/a
Command Line No
Can be Interrogated No
RELATED COMMANDS:
"RE" Return from error subroutine
EXAMPLES:
#A Program A
AMX Pause the program until the X axis completes the motion
EN End of Program
NOTE: Instead of EN, use the RE command to end the error subroutine and limit subroutine. Use
the RI command to end the input interrupt) subroutine.
105
LEGEND-MC User’s Manual
ENDIF
[Program Flow]
DESCRIPTION:
The ENDIF command is used to designate the end of an IF conditional statement. An IF conditional
statement is formed by the combination of an IF and ENDIF command. An ENDIF command must always
be executed for every IF command that has been executed. It is recommended that the user not include jump
commands inside IF conditional statements since this causes re-direction of command execution. In this
case, the command interpreter may not execute an ENDIF command.
ARGUMENTS: ENDIF
USAGE:
While Moving Yes Default Value n/a
RELATED COMMANDS:
"ELSE" Optional command to be used only after IF command
EXAMPLES:
IF (@IN[1]=0) IF conditional statement based on input 1
106
LEGEND-MC User’s Manual
EO (Echo)
[Setting]
DESCRIPTION:
The EO command turns the echo on or off. If the echo is off, characters input to the serial port or Ethernet
will not be echoed back.
ARGUMENTS: EO n where
n=0 or 1. 0 turns echo off, 1 turns echo on.
USAGE:
While Moving Yes Default Value 1
Can be Interrogated No
EXAMPLES:
EO 0 Turns echo off
EO 1 Turns echo on
107
LEGEND-MC User’s Manual
OPERAND USAGE:
_EP contains the value of the interval m.
RELATED COMMANDS:
"EB" Enable Ecam
EXAMPLES:
EP 20,100 Sets the cam master points to 100,120,140 . . .
108
LEGEND-MC User’s Manual
OPERAND USAGE:
_EQn contains 1 if engage command is issued and slave is waiting to engage, 2 if disengage command is
issued and slave is waiting to disengage, and 0 if ECAM engaged or disengaged.
RELATED COMMANDS:
"EB" Enable Ecam
EXAMPLES:
EQ 300 Disengages the motor at master position 300.
NOTE: This command is not a trippoint. This command will not hold the execution of the program
flow. If the execution needs to be held until master position is reached, use MF or MR command.
109
LEGEND-MC User’s Manual
ER (Error Limit)
[Setting]
DESCRIPTION:
The ER command sets the magnitude of the position error that will trigger an error condition. When the
limit is exceeded, the Error LED will illuminate. If the Off-On-Error (OE1) command is active, the
amplifier will be disabled. The units of ER are quadrature counts. An ER value of 0 will disable the error
function, meaning that a #POSERR in the program will not execute, the red alarm LED will not illuminate
for excessive following error, and the motor will not be disabled if OE is set.
ARGUMENTS: ER x, y, z, w or ERX=x or ER a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are unsigned integers
“?” returns the value of the ERror limit.
USAGE:
While Moving Yes Minimum Value 0
OPERAND USAGE:
_ERn contains the value of the ERror limit where n is an axis letter.
RELATED COMMANDS:
OE Off on Error
EXAMPLES:
ER 200 Set the error limit to 200
ER ? Return value
00200
V1= Returns V1
00200
NOTE: The error limit specified by ER should be high enough as not to be reached during normal operation. Examples of
exceeding the error limit would be a mechanical jam, or a fault in a system component such as encoder or amplifier.
110
LEGEND-MC User’s Manual
ET (ECam Table)
[Setting]
DESCRIPTION:
The ET command sets the ECAM table entries for the slave axis. The values of the master are not required.
The slave entry (n) is the position of the slave when the master is at the point (n ∗ i) + o, where i is the
interval and o is the offset as determined by the EP command.
ARGUMENTS: ET [n] = m where
n is an integer.
m is an integer.
USAGE:
While Moving Yes Minimum n Value 0
RELATED COMMANDS:
"EB" Enable Ecam
EXAMPLES:
ET [7] = 1000 Specifies the position of the slave that must be
synchronized with the eighth increment of the
master.
111
LEGEND-MC User’s Manual
FA (Acceleration Feedforward)
[Setting]
DESCRIPTION:
The FA command sets the acceleration feedforward coefficient, or returns the previously set value. This
coefficient, when scaled by the acceleration, adds a torque bias voltage during the acceleration phase and
subtracts the bias during the deceleration phase of a motion.
OPERAND USAGE:
_FAn contains the value of the feedforward acceleration coefficient where n is an axis letter.
RELATED COMMANDS:
"FV" Velocity feedforward
EXAMPLES:
AC 500000 Set acceleration
NOTE: If the feedforward coefficient is changed during a move, then the change will not take effect
until the next move.
112
LEGEND-MC User’s Manual
FE (Find Edge)
[Motion]
DESCRIPTION:
The FE command moves a motor until a transition is seen on the homing input for the associated axis. The
direction of motion depends on the initial state of the homing input (use the CN command to configure the
polarity of the home input). Once the transition is detected, the motor decelerates to a stop.
This command is useful for creating your own homing sequences. See the example section.
USAGE:
While Moving No Default Value ---
Can be Interrogated No
RELATED COMMANDS:
"FI" Find Index
"HM" Home
"BG" Begin
EXAMPLES:
FE Set find edge mode
BG Begin
NOTE: Find Edge only searches for a change in state on the Home Input. Use FI (Find Index) to search for the encoder
“C” channel. Remember to specify BG after each of these commands. Use HM (Home) to search for both the Home input
and the Index.
113
LEGEND-MC User’s Manual
FI (Find Index)
[Motion]
DESCRIPTION:
The FI and BG commands move the motor until an encoder index pulse, or “C” channel, is detected. The
controller looks for a transition from low to high. When the transition is detected, motion stops and the
position is defined as zero. To improve accuracy, the speed during the search should be specified as 1000
counts/s or less. The FI command is useful in custom homing sequences. The direction of motion is
specified by the sign of the JG command.
ARGUMENTS: FI XYZW or ABCDEFGH
USAGE:
While Moving No Default Value ---
Can be Interrogated No
RELATED COMMANDS:
"FE" Find Edge
"HM" Home
"BG" Begin
EXAMPLES:
#HOME Home Routine
JG 500 Set speed and forward direction
FI Find index
BG Begin motion
AM After motion
MG "FOUND INDEX"
EN
NOTE: Find Index only searches for a change in state on the Index. Use FE to search for the Home input. Use HM (Home)
to search for both the Home input and the Index. Remember to specify BG after each of these commands.
114
LEGEND-MC User’s Manual
FL (Forward Limit)
[Setting]
DESCRIPTION:
The FL command sets the forward software position limit. If this limit is exceeded during commanded
motion, the motor will decelerate to a stop. Forward motion beyond this limit is not permitted. The forward
limit is activated at position n + 1. The forward limit is disabled at position 2147483647. The units are in
counts.
When the reverse software limit is activated, the automatic subroutine #LIMSWI will be executed if it is
included in the program and the program is executing. See section on Automatic Subroutines.
ARGUMENTS: FL x, y, z, w or FLX=x or FL a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are unsigned numbers
USAGE:
While Moving Yes Minimum Value -2147483648
In a Program Yes Maximum Value +2147483647
Command Line Yes Default Value 2147483647
Can be Interrogated Yes Default Format Position Format
Used as an Operand Yes Distributed Control Specific Axis
OPERAND USAGE:
_FLn contains the value of the forward software limit where n is an axis letter.
RELATED COMMANDS:
"BL" Reverse Limit
EXAMPLES:
#TEST Test Program
AC 1000000 Acceleration Rate
DC 1000000 Deceleration Rate
FL 15000 Forward Limit
JG 5000 Jog Forward
BGX Begin
AMX After Motion
TPX Tell Position
EN End
115
LEGEND-MC User’s Manual
@FRAC (Fraction)
[Function]
DESCRIPTION:
@FRAC returns only the fractional portion of a number or variable given in square brackets. Note that the
@FRAC command is a function, which means that it does not follow the convention of the commands,
and does not require the underscore when used as an operand.
ARGUMENTS: @FRAC [n] where
n is a number
USAGE:
While Moving Yes Minimum n value -2147483647.9999
In a Program Yes Maximum n value 2147483647.9999
Not in a program Yes Default Value ---
Can be Interrogated No Default Format ---
Used as an Operand Yes Distributed Control No, Local
EXAMPLES:
#TEST Program TEST
VAR1=123.456 Set variable
MG @FRAC[VAR1] Display only the fractional portion of VAR1
VAR2=@FRAC[VAR1]+.5 Perform calculation
EN End of program
116
LEGEND-MC User’s Manual
FV (Velocity Feedforward)
[Setting]
DESCRIPTION:
The FV command sets the velocity feedforward coefficient, or returns the previously set value. This
coefficient generates an output bias signal in proportion to the commanded velocity.
OPERAND USAGE:
_FV contains the velocity feedforward coefficient where n is an axis letter.
RELATED COMMANDS:
EXAMPLES:
FV 10 Set feedforward coefficients to 10
010
117
LEGEND-MC User’s Manual
RELATED COMMANDS:
"GR" Gear Ratio
EXAMPLES:
#GEAR Gear program
118
LEGEND-MC User’s Manual
GR (Gear Ratio)
[Motion]
DESCRIPTION:
GR specifies the Gear Ratio for the slave axis in electronic gearing mode. The master axis for the
LEGEND-MC is specified with the GA command. Gear ratio may range between +/-127.9999. The slave
axis will be geared to the actual position of the master. The master can go in both directions. GR 0 disables
gearing. If a limit switch is hit during gearing, then gearing is automatically disabled.
ARGUMENTS: GR n where
n is a signed number.
0 disables gearing
USAGE:
While Moving Yes Minimum Value -127.9999
OPERAND USAGE:
_GRn contains the value of the gear ratio where n is an axis letter.
EXAMPLES:
#GEAR
GADX
EN End program
119
LEGEND-MC User’s Manual
HC (Handle Configuration)
[Configuration]
DESCRIPTION:
The HC command performs all the operations of IH, NA and the QW command for a simplified connection
method.
The command is executed in the master controller and addresses all slaves. The slaves must be at addresses
of the (master IP address + (2*SlaveNum)). The master opens handles to the slaves, and initiates the QW
packets.
The IP address for the master must be established with the IA command prior to issuing the HC command.
The controller requires firmware version 1.0c or greater to use the HC command.
This command is only for connecting to SMC slaves. It can only be executed once per power on session.
Include a delay of about 5 seconds to allow a sufficient time for all network devices to power up
and be ready for network communication. Devices such as an Ethernet switch take some time at
power up to discover the network before they allow communication. If _HC=0 after issuing the
command, the network conditions will not allow communication.
ARGUMENTS: HC a,b,c where
120
LEGEND-MC User’s Manual
RELATED COMMANDS:
"CH" Configure Handles
"IA" Internet Address
"IH" Internet Handle
“NA” Number of Axes
“QW” Slave Data Update
EXAMPLES:
HC 2,10,2 Set two axes, 10mSec Update, TCP
#WTHC Label
JP #WTHC,_HC<>2 Jump to label if HC not complete
MG “Connected.” Message
121
LEGEND-MC User’s Manual
HM (Home)
[Motion]
DESCRIPTION:
The HM command performs a three-stage homing sequence.
The first stage is the motor moving at the user programmed speed until detecting a transition on the Home
input. The direction for this first stage is determined by the initial state of the Home input. Once the Home
input changes, the motor decelerates to a stop. The state of the Home input can be configured using the CN
command.
The second stage consists of the motor changing directions and slowly approaching the transition again.
When the transition is detected, the motor is stopped instantaneously.
The third stage consists of the motor slowly moving forward until it detects an index pulse from the encoder.
It stops at this point and defines it as position 0.
Can be Interrogated No
OPERAND USAGE:
_HMn contains the state of the Home input. Regardless of the limit switch polarity, where n is an axis letter,
0 always means the home input is active, 1 means inactive.
RELATED COMMANDS:
EXAMPLES:
HM Set Homing Mode
BG Begin Homing
NOTE: You can customize homing sequence by using the FE (Find Home Sensor only) and FI (Find Index only) com-
mands.
122
LEGEND-MC User’s Manual
HR (Handle Restore)
[Configuration]
DESCRIPTION:
The HR command is used to enable the automatic restoration of handles that have closed during distributed
control communications. Once enabled with the HC command, handles that have been assigned as data or
communications channels for distributed control are monitored by the master. If a handle closes, attempts
are made to re-establish connection and restore communications with the handle. This command is
executed in the master as it controls the handle assignments and monitoring of those handles.
Handles must be connected using the simplified HC command for the HR function to operate. This
command is always set to “disabled” at power up. Use HR1 in the program in your subroutine.
RELATED COMMANDS:
EXAMPLES:
123
LEGEND-MC User’s Manual
HS (Handle Switch)
[Configuration]
DESCRIPTION:
The HS command is used to switch the handle assignments between two handles. Handles are assigned by
the controller when the handles are opened with the HC command, or are assigned explicitly with the IH
command. Should those assignments need modifications, the HS command allows the handles to be
reassigned. This command is very useful if the program uses commands such as SB, CB, MB, and SA which
imply that a specific handle is to be used.
Can be Interrogated No
RELATED COMMANDS:
"HC" Handle Connect
EXAMPLES:
HSC=D Connection for handle C is assigned to handle D. Connection for
handle D is assigned to handle C.
This example demonstrates a master controller, M2, searching for other controllers on each handle and
forcing them to communicate at a specific handle. This is necessary when using the @IN (Input), SB (Set
Bit), CB (Clear Bit), SA (Send Command) or MB (Modbus) commands, because they reference specific
handles.
The Jump condition logic below ((_IHA0+4)<>_IA)|(_IHA2<>-2) is basically running the SH (Servo
Here) command on the given line if the IP address is not equal to the controller own IP address + 4 and if
the connection type is not TCP/IP.
),1'B0
-3),1'B0B,+$!B,$_B,+$!-3),1'B0
-3),1'B0B,+%!B,$_B,+%!+6% $-3),1'B0
-3),1'B0B,+&!B,$_B,+&!+6& $-3),1'B0
-3),1'B0B,+'!B,$_B,+'!+6' $-3),1'B0
-3)B0B'1B,++!B,$_B,++ +6+ $-3),1'B0
)B0B'1$%
),1'B0
124
LEGEND-MC User’s Manual
HW (Handle Wait)
[Configuration]
DESCRIPTION:
This command is used to set the master to wait for acknowledgements from the slaves for each command
sent. If an error is generated on the slave, the master will treat it as a command error of it’s own. If this com-
mand is disabled, the master will assume that the slaves were able to perform the commands and proceed
without error.
If an error is generated on a slave while in the HW1 mode, the master will respond with a “?”. Issuing TC to
the master will respond with the error code from the slave. Also, issuing TCA through TCP will respond with
the text of the error from the slave on the specified handle.
_TCA through _TCP will respond with the error code from the slave on a specified handle.
ARGUMENTS: HW n where
n=0 Turns Handle Wait Off
n=1 Turns Handle Wait On.
USAGE:
While Moving Yes Default Value 0
RELATED COMMANDS:
"HC" Handle Configure
EXAMPLES:
IA 192,168,3,125 Set controllers IP Address
125
LEGEND-MC User’s Manual
HX (Halt Execution)
[Program Flow]
DESCRIPTION:
The HX command halts the execution of any of the programs that may be running independently via
multitasking. The parameter n specifies the program to be halted.
ARGUMENTS: HX n where
n is 0 to 3 to indicate the task number
USAGE:
While Moving Yes Default Value n/a
Can be Interrogated No
OPERAND USAGE:
When used as an operand, _HX n contains the running status of thread n with:
0 Thread not running
1 Thread is running
2 Thread has stopped at trippoint
RELATED COMMANDS:
126
LEGEND-MC User’s Manual
IA (Internet Address)
[Setting]
DESCRIPTION:
The IA command assigns the controller an IP address.
The IA command may also be used to specify the time out value. This is only applicable when using the
TCP/IP protocol.
The IA command can only be used via RS-232. Since it assigns an IP address to the controller,
communication with the controller via internet cannot be accomplished until after the address has been
assigned.
ARGUMENTS: IA ip0, ip1, ip2, ip3 or IA n or IA<t where
ip0, ip1, ip2, ip3 are 1 byte numbers separated by commas and represent the individual fields of the IP
address.
n is the IP address for the controller which is specified as an integer representing the signed 32 bit number
(two’s complement).
<t specifies the time in update samples between TCP retries.
>u specifies the multicast IP address where u is an integer between 0 and 63.
IA? will return the IP address of the controller
USAGE:
While Moving No Default Value n = 0, t=250
OPERAND USAGE:
_IA0 contains the IP address representing a 32 bit signed number (Two’s complement)
_IA1contains the value for t (retry time)
_IA2 contains the number of available handles
_IA3 contains the number of the handle using this operand where the number is 0 to 15. 0 represents handle
A, 1 handle B, etc.
_IA4 reports the last handle that had a TCP error.
RELATED COMMANDS:
IH Internet Handle
EXAMPLES:
IA 151, 12, 53, 89 Assigns the controller with the address
151.12.53.89
127
LEGEND-MC User’s Manual
IF
[Program Flow]
DESCRIPTION:
The IF command is used in conjunction with an ENDIF command to form an IF conditional statement. The
arguments are one or more conditional statements. If the conditional statement(s) evaluates true, the
command interpreter will continue executing commands which follow the IF command. If the conditional
statement evaluates false, the controller will ignore commands until the associated ENDIF command OR an
ELSE command occurs in the program. The conditional statements MUST be enclosed on parentheses for
the expression to be evaluated correctly. See the example below.
ARGUMENTS: IF condition where
Conditions are tested with the following logical operators:
USAGE:
While Moving Yes Default Value ---
RELATED COMMANDS:
"ELSE" Optional command used only after IF command
EXAMPLES:
IF (_TEX<1000) IF conditional statement based on X motor position
IF ((TEMP=126) | (TEMP=123))
JS # RELEASE
JS # ASSIGN
JS # CONNECT
ENDIF
128
LEGEND-MC User’s Manual
IH (Internet Handle)
[Setting]
DESCRIPTION:
The IH command is used when the LEGEND-MC is operated as a network master. This command opens a
handle and connects to a slave.
Each controller may have 16 handles open at any given time. They are designated by the letters A through
P. To open a handle, the user must specify:
The IP address of the slave
The type of session: TCP/IP or UDP/IP
The port number of the slave. This number isn’t necessary if the slave device doesn’t
require a specific port value. If not specified, the controller specifies the port value as
502.
ARGUMENTS: IHh= ip0, ip1, ip2, ip3 <p > q or IHh=n <p > q orIHh= >r where
h A P Internet handle
S=>C -1 (UDP) -2 (TCP) Close the handle that sent the command
T=>C -1 (UDP) -2 (TCP) Close handles except the one sending the
command
OPERAND USAGE:
_IHh0 contains the IP address as a 32 bit number
_IHh1 contains the slave port number
_IHh2 contains a 0 if the handle is free
contains a 1 if it is for a UDP slave
contains a 2 if it is for a TCP slave
contains a -1 if it is for a UDP master
contains a -2 if it is for a TCP master
contains a -5 if attempting to connect by UDP
contains a -6 if attempting to connect by TCP
_IHh3 contains a 0 if the ARP was successful
contains a 1 if it has failed or is still in progress.
129
LEGEND-MC User’s Manual
USAGE:
While Moving Yes Default Value ----
RELATED COMMANDS:
“HC” Handle Connect
EXAMPLES:
IHA=251,29,51,1 Open handle A at IP address 251.29.51.1
#WAITHC
NOTE: When the IH command is given, the controller initializes an ARP on the slave device
before opening a handle. This operation can cause a small time delay before the controller
responds.
NOTE: The HC command is recommended over the IH command for establishing a connection
with slave controllers because it is a simplified process.
130
LEGEND-MC User’s Manual
II (Input Interrupt)
[Configuration]
DESCRIPTION:
The II command enables the interrupt function for the specified inputs. This function triggers when the
controller sees a logic change from high to low on a specified input.
If the #ININT special label is included in the program and any of the specified inputs go low during
program execution, the program will jump to the subroutine with label #ININT. Any trippoints set by the
program will be cleared but can be re-enabled by the proper termination of the interrupt subroutine using
RI.
To avoid returning to the main program on an interrupt, use the ZS command to zero the subroutine stack
and use the II command to re-enable the interrupt.
ARGUMENTS: II m,n,o,p are integers where
n 2 7 Optional argument used with “m” to II 2, 4 Input #2, Input #3, and Input #4
specify a range of inputs. When the “n” are enabled for interrupt.
argument is omitted, only the input
specified by the “m” parameter will be
enabled.
OPERAND USAGE:
_II will return the m parameter.
USAGE:
While Moving Yes Default Value n/a
Command Line No
131
LEGEND-MC User’s Manual
RELATED COMMANDS:
"RI" Return from Interrupt
EXAMPLES:
#A Program A
BG Begin motion
EN End Program
AM After stopped
BG Begin motion
132
LEGEND-MC User’s Manual
IL (Integrator Limit)
[Tuning]
DESCRIPTION:
The IL command limits the effect of the integrator function in the filter to a certain voltage. For example,
IL 2 limits the output of the integrator to the +/-2 Volt range. This is very effective in allowing higher KI
values without adding instability.
A negative parameter also freezes the effect of the integrator during a move. For example, IL -3 limits the
integrator output to +/-3V. If, at the start of motion, the integrator output is 1.6 Volts, that level will be
maintained through the move. Note, however, that the KD and KP terms remain active in any case.
ARGUMENTS: IL x, y, z, w or ILX=x or IL a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are unsigned integers
USAGE:
While Moving Yes Minimum Value -10
OPERAND USAGE:
_ILn contains the value of the integrator limit in volts where n is an axis letter.
RELATED COMMANDS:
"KI" Integrator
EXAMPLES:
KI 2 Integrator constants
IL 3 Integrator limits
3.0000
133
LEGEND-MC User’s Manual
IN (Input Variable)
[General]
DESCRIPTION:
The IN command allows a variable to be input from the serial port or Ethernet. An optional prompt message
can be displayed. The variable value must be followed by a carriage return. The entered value is assigned to
the specified variable name.
The IN command holds up execution of following commands in the program thread until a carriage return or
semicolon is entered. If no value is given prior to a semicolon or carriage return, the previous variable value
is kept. Input Interrupts, Error Interrupts and Limit Switch Interrupts will still be active.
ARGUMENTS: IN{P1} ”m” , n {So} where
"m" is the prompt message. May be letters, numbers, or symbols up to maximum line length and must be
placed in quotations.
n is the name of variable to store the new value in.
{P1} specifies the port, if omitted, the default port is assumed.
{So} specifies string data where o is the number of characters from 1 to 6
NOTE 1: The IN command defaults to {P1}, and must only be used with the serial port.
NOTE 2: IN command can only be used in thread 0.
USAGE:
While Moving Yes Default Value
Command Line No
Can be Interrogated No
EXAMPLES: Operator specifies material length in inches and speed in inches/sec (2 pitch lead screw, 2000 counts/rev
encoder).
#A Program A
SP V3 Speed command
PR V4 Position command
EN End Program
134
LEGEND-MC User’s Manual
@IN (Input)
[I/O]
DESCRIPTION:
@IN returns the status of the digital input number or variable given in square brackets. Note that the @IN
command is a function, which means that it does not follow the convention of the commands, and does
not require the underscore when used as an operand.
When using this command to access I/O on a slave controller in distributed control mode, use it with the handle for
outbound master commands. Do not use the handle which is for incoming slave update packets. For example, if a
slave is connected on handles E and F, reference the I/O for the slave on handle E.
ARGUMENTS: @IN [n] where
n is an integer corresponding to a specific output on the controller to be cleared (set to 0). The first output
on the controller is denoted as output 1. A LEGEND-MC controller has 4 digital outputs plus applicable I/
O connected by Modbus.
DISTRIBUTED CONTROL:
MODBUS:
NOTE: With Modbus devices, I/O points of the devices are calculated using the following formula:
n = (SlaveAddress*1000) + (HandleNum*1000) + ((Module-1)*4) + (Bitnum-1)
Slave Address is used when ModBus device has slave devices connected to it and specified as Addresses
0 to 255. Note that the use of slave devices for modbus are very rare and this number will usually be 0.
HandleNum is the handle specifier from A to P (1 - 16).
Module is the position of the module in the rack from 1 to 16.
BitNum is the I/O point in the module from 1 to 4.
USAGE:
While Moving Yes Minimum n value 1
In a Program Yes Maximum n value 8
Not in a program Yes Default Value ---
Can be Interrogated No Default Format ---
Used as an Operand Yes Distributed Control Offset, 100
EXAMPLES:
#TEST Program TEST
VAR1=2 Set variable
MG @IN[VAR1] Display the status of digital input 2
VAR2=@IN[VAR1]+1 Perform calculation
135
LEGEND-MC User’s Manual
EN End of program
IF(@IN[604])
MG”Slave input 4 is ON”
ELSE
MG”Slave input 4 is OFF”
ENDIF
136
LEGEND-MC User’s Manual
@INT (Integer)
[Function]
DESCRIPTION:
@INT returns only the whole number part of a number or variable given in square brackets. Note that the
@INT command is a function, which means that it does not follow the convention of the commands, and
does not require the underscore when used as an operand.
ARGUMENTS: @INT [n] where
n is a number
USAGE:
While Moving Yes Minimum n value -2147483648.9999
In a Program Yes Maximum n value 2147483648.9999
Not in a program Yes Default Value ---
Can be Interrogated No Default Format ---
Used as an Operand Yes Distributed Control No, Local
EXAMPLES:
#TEST Program TEST
VAR1=123.456 Set variable
MG @INT[VAR1] Display only the whole number portion of
VAR1
VAR2=@INT[VAR1]+25 Perform calculation
EN End of program
137
LEGEND-MC User’s Manual
IP (Increment Position)
[Motion]
DESCRIPTION:
The IP command allows for an update in the commanded position while the motor is moving. This
command does not require a BG. The command has three effects depending on the motion being executed.
The units of this command are quadrature counts.
Case 1: Motor is standing still
An IP n command is equivalent to a PR n and BG command. The motor will move to the specified position
at the requested slew speed and acceleration.
Case 2: Motor is moving towards specified position
An IP n command will cause the motor to move to a new position target, which is the old target plus n. n
must be in the same direction as the existing motion (final target cannot be closer).
Case 3: Motor is in Jog Mode
An IP n command will cause the motor to instantly try to servo to a position n from the present
instantaneous position. The SP and AC parameters have no effect. This command is useful for making small
corrections when synchronizing 2 axes in which one of the axis' speed is indeterminate due to a variable
diameter pulley.
WARNING: When the motor is in jog mode, an IP will create an instantaneous position error. In this
mode, the IP should only be used to make small incremental position movements.
EXAMPLES:
:IP 50 50 counts with set acceleration and speed
#CORRECT Label
AC 100000 Set acceleration
JG 10000;BG Jog at 10000 counts/sec rate
WT 1000 Wait 1000 msec
IP 10 Move the motor 10 counts instantaneously
ST Stop Motion
138
LEGEND-MC User’s Manual
An IT value less then 1 will make the move longer. This can be compensated for by increasing the
acceleration and deceleration paraemters
OPERAND USAGE:
_ITn will return the value of the independent time constant where n is an axis letter.
EXAMPLES:
IT 0.8 Set independent time constants
0.8
139
LEGEND-MC User’s Manual
JG (Jog)
[Motion]
DESCRIPTION:
The JG command sets a speed in jog mode. The parameters following the JG set the slew speed and
direction of motion. Use of the question mark returns the previously entered value or default value. The
units of this are counts/second. The AC (acceleration) and DC (deceleration) commands work in this mode.
ARGUMENTS: JG x, y, z, w or JGX=x or JG a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are signed integers
USAGE:
While Moving Yes Minimum Value -12,000,000
OPERAND USAGE:
_JGn will return the absolute value of the jog speed in counts per second where n is an axis letter.
RELATED COMMANDS:
"BG" Begin
"ST" Stop
"AC" Acceleration
"DC" Deceleration
EXAMPLES:
JG 100 Set for jog mode with a slew speed of 100
counts/sec
BG Begin Motion
140
LEGEND-MC User’s Manual
NOTE: Each condition must be in parenthesis for controller evaluation as a boolean expression.
USAGE:
While Moving Yes Default Value n/a
In a Program Yes Default Format n/a
Command Line No
Can be Interrogated No
EXAMPLES:
JP #POS1, (V1<5) Jump to label #POS1 if variable V1 is less than 5
JP #A, (V7*V8=0) Jump to #A if V7 times V8 equals 0
JP #B Jump to #B (no condition)
NOTE: JP is similar to an IF, THEN command. Text to the right of the comma is the condition that must be met for a jump
to occur. The destination is the specified label before the comma.
141
LEGEND-MC User’s Manual
JS (Jump to Subroutine)
[Program Flow]
DESCRIPTION:
The JS command will change the sequential order of execution of commands in a program. If the jump is
executed, the program will continue at the label specified by the destination parameter. The line number of
the JS command is saved and after the next EN command is encountered (End of subroutine), program
execution will continue with the instruction following the JS command. The JS command can be nested 16
deep.
Multiple conditions can be used in a single jump subroutine statement. The conditional statements are
combined in pairs using the operands “&” and “|”. The “&” operand between any two conditions requires
that both statements must be true for the combined statement to be true. The “|” operand between any two
conditions requires that only one statement be true for the combined statement to be true.
NOTE: Each condition must be placed in parenthesis for proper evaluation by the controller as a
boolean expression. Subroutines can be nested 16 deep in the standard controller.
USAGE:
While Moving Yes Default Value ---
In a Program Yes Default Format ---
Command Line No
Can be Interrogated No
RELATED COMMANDS:
"EN" End
EXAMPLES:
JS #SQUARE, (V1<5) Jump to subroutine #SQUARE if V1 is less than 5
JS #LOOP, (V1<>0) Jump to #LOOP if V1 is not equal to 0
JS #A Jump to subroutine #A (no condition)
142
LEGEND-MC User’s Manual
KD (Derivative Constant)
[Tuning]
DESCRIPTION:
KD designates the derivative constant in the controller filter. The filter transfer function is
D(z) = 4 * KP + 4 * KD(z-1)/z + KIz/2 (z-1)
For further details on the filter see the section Theory of Operation.
ARGUMENTS: KD x, y, z, w or KDX=x or KD a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are unsigned integers
USAGE:
While Moving Yes Minimum Value 0
OPERAND USAGE:
_KDn contains the value of the derivative constant where n is an axis letter.
RELATED COMMANDS:
"KP" Proportional Constant
"KI" Integral
EXAMPLES
KD 100 Specify KD
KD ? Return KD
0100.00
143
LEGEND-MC User’s Manual
KI (Integrator)
[Tuning]
DESCRIPTION:
The KI command sets the integral gain of the control loop. It fits in the control equation as follows:
D(z) = 4 * KP + 4 * KD(z-1)/z + KI z/2(z-1)
The integrator term will reduce the position error at rest to zero.
ARGUMENTS: KI x, y, z, w or KIX=x or KI a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are unsigned integers
USAGE:
While Moving Yes Minimum Value 0
OPERAND USAGE:
_KIn contains the value of the integrator where n is an axis letter.
RELATED COMMANDS:
"KP" Proportional Gain
"KD" Derivative
EXAMPLES:
KI 12 Specify integral
KI ? Return value
0012
144
LEGEND-MC User’s Manual
KP (Proportional Constant)
[Tuning]
DESCRIPTION:
KP designates the proportional constant in the controller filter. The filter transfer function is
D(z) = 4 * KP + 4 * KD(z-1)/z + KI z/2(z-1)
For further details see the section Theory of Operation.
ARGUMENTS: KP x, y, z, w or KPX=x or KP a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are unsigned integers
USAGE:
While Moving Yes Minimum Value 0
OPERAND USAGE:
_KPn contains the value of the proportional constant where n is an axis letter.
RELATED COMMANDS:
"KP" Proportional Gain
145
LEGEND-MC User’s Manual
LA (List Arrays)
[General]
DESCRIPTION:
The LA command returns a list of all arrays in memory. The listing will be in alphabetical order. The size of
each array will be included next to each array name in square brackets.
ARGUMENTS: None
USAGE:
While Moving Yes Default Value -
RELATED COMMANDS:
"LL" List Labels
EXAMPLES:
: LA
CA [10]
LA [5]
NY [25]
VA [17]
146
LEGEND-MC User’s Manual
LC (Lock Controller)
[Configuration]
DESCRIPTION: LC
The (LC) Lock Controller command is used to prohibit the execution of certain commands from the
serial port by setting a security password. See the table below for a list of commands that are disabled in
the "Locked" mode. When this command is successfully executed, it automatically burns the new
configuration into the EEPROM.
ARGUMENTS: LC p,l
where p is the password as previously established with the "PW" command.
"l" is the Lock setting, 0=Unlock, 1=Lock commands (see table), 2=Lock commands and prohibit setting
any commands from the serial port.
USAGE:
While Moving Yes Default Value ---
OPERAND USAGE:
_LC will return the lock state of the controller, 0 = not locked, 1 = specific commands locked, 2 = All
commands locked including from serial port and ethernet port except the LC command.
RELATED COMMANDS:
"PW" Password
UL (Upload) ED (Edit)
EXAMPLES:
LC apple,2 Locks controller, assuming the valid password
is “apple.”
147
LEGEND-MC User’s Manual
OPERAND USAGE:
_LE contains the total vector move length in encoder counts.
RELATED COMMANDS:
"LI" Linear Distance
EXAMPLES:
LM XY Specify linear interpolation mode for X and Y
axes
148
LEGEND-MC User’s Manual
USAGE:
While Moving Yes Default Value ---
EXAMPLES:
MG _LFX Display the status of the forward limit switch
149
LEGEND-MC User’s Manual
LI (Linear Interpolation)
[Motion]
DESCRIPTION:
The LI command specifies the incremental distance of travel for Linear Interpolation (LM) mode. LI
parameter are relative distances given with respect to the current axis positions. Up to 511 LI specifications
may be given ahead of the Begin Sequence (BGS) command. Additional LI commands may be sent during
motion when the controller sequence buffer frees additional spaces for new vector segments. The Linear
End (LE) command must be given after the last LI specification in a sequence, it causes deceleration to a
stop at the last LI command. It is the responsibility of the user to keep enough LI segments in the controller
sequence buffer to ensure continuous motion.
LM? returns the available spaces for LI segments that can be sent to the buffer. 511 returned means the
buffer is empty and 511 LI segments can be sent. A zero means the buffer is full and no additional segments
can be sent. The parameters o and p are optional and can be used to define the vector speed that is attached
to the motion segment.
Linear Interpolation is useful for making contoured or continuous move profiles.
NOTE: Linear mode can NOT be used on multiple axes controlled via ethernet.
n -8388607 8388607 The incremental move LI 500 500 encoder count move on the
distance. X axis.
o 0 12000000 Vector speed to be taken into LI 500 <40000 500 encoder count move on the
effect at the execution of this X axis. Change to a vector speed
segment. of 40000 counts per second.
p 0 12000000 Vector speed to be taken into LI 500 >40000 500 encoder count move on the
effect at the end of this X axis. Change to a vector speed
segment. of 40000 counts per second at
the end of the segment.
USAGE:
While Moving Yes Default Value -
RELATED COMMANDS:
"LE" Linear End
150
LEGEND-MC User’s Manual
EXAMPLES:
LM X Specify Linear interpolation Mode for X axis
151
LEGEND-MC User’s Manual
LL (List Labels)
[General]
DESCRIPTION:
The LL command returns a listing of all of the program labels in memory. The listing will be in alphabetical
order.
ARGUMENTS: None
USAGE:
While Moving Yes Default Value ---
RELATED COMMANDS:
"LV" List Variables
EXAMPLES:
: LL
# FIVE
# FOUR
# ONE
# THREE
# TWO
152
LEGEND-MC User’s Manual
LM (Linear Mode)
[Setting]
DESCRIPTION:
The LM command specifies the linear interpolation mode and specifies the axes for linear interpolation. LI
commands are used to specify the travel distances for linear interpolation. The LE command specifies the
end of the linear interpolation sequence. Several LI commands may be given as long as the controller
sequence buffer has room for additional segments. Once the LM command has been given, it does not need
to be given again unless the VM command has been used.
Only one axis can be used in interpolation mode. Axes connected in a distributed control system cannot be
coordinated over ethernet. The Linear mode feature is useful for specifying positions where the final end
target is not known at the time the move is begun.
OPERAND USAGE:
_LMx contains the number of spaces available in the sequence buffer for the coordinate system.
RELATED COMMANDS:
EXAMPLES:
LM XY Specify linear interpolation mode
VS 10000; VA 100000;VD 1000000 Specify vector speed, acceleration and deceleration
LI 100 Specify linear distance
LI 200 Specify linear distance
LE; BGS Last vector, then begin motion
153
LEGEND-MC User’s Manual
LO (Lockout)
[Configuration]
DESCRIPTION:
The LO command is used to lock-out a particular handle or serial port with the master controller on a
distributed control system. This function ignores all data received to the master on the specified
communication channel.
ARGUMENTS: LO h,n where
h is the handle, A thru P, or the letter S for the serial port. This identifies the communication channel to be
locked out.
n = 1 or no argument to enable the lockout
n = -1 to remove the lockout
The lockout command is not burnable, and all locks will be cleared at power up.
USAGE:
OPERAND USAGE:
_LOh contains the state of the lockout for handle A - P or S.
EXAMPLES:
LOS Lockout information received from the serial port
WT10000 Wait 10 seconds
LOS,-1 Re-enable the serial port
154
LEGEND-MC User’s Manual
USAGE:
EXAMPLES:
MG _LRX Display the status of the reverse limit switch
155
LEGEND-MC User’s Manual
LS (List Program)
[General]
DESCRIPTION:
The LS command sends a listing of the program memory out of the port that issued the command. The
listing will start with the line pointed to by the first parameter, which can be either a line number or a label.
If no parameter is specified, it will start with line 0. The listing will end with the line pointed to by the
second parameter--again either a line number or label. If no parameter is specified, the listing will go to the
last line of the program.
ARGUMENTS: LS n,m where
n,m are valid numbers from 0 to 499, or labels. n is the first line to be listed, m is the last.
_LS returns the line number the program will return to after the current subroutine ends. If a program is not
running, the value is negative and reports the number of program lines in the controller.
USAGE:
While Moving Yes Default Value 0,Last Line
Can be Interrogated No
EXAMPLES:
:LS #A,6 List program starting at #A through line 6
002 #A
003 PR 500
004 BG
005 AM
006 WT 200
NOTE: Remember to quit the Edit Mode <cntrl> Q prior to giving the LS command.
156
LEGEND-MC User’s Manual
LT (Latch Target)
[Motion]
DESCRIPTION:
The LT command is used for stopping an axis a defined distance after a registration mark (latch) input.
The distance specified by the LT command is in encoder counts. The distance must be sufficiently large
for the controller to decelerate normally at the specified deceleration rate. A stop code will be generated
if the distance is too small to stop for the deceleration rate or if the speed is too high. To Disable the latch
target, set LTX=0.
USAGE:
While Moving Yes Default Value n/a
RELATED COMMANDS:
EXAMPLES:
ALX Set latch function
157
LEGEND-MC User’s Manual
LV (List Variables)
[General]
DESCRIPTION:
The LV command returns a listing of all of the program labels in memory. The listing will be in alphabetical
order.
ARGUMENTS: None
USAGE:
While Moving Yes Default Value n/a
RELATED COMMANDS:
"LL" List Labels
EXAMPLES:
: LV
APPLE = 60.0000
BOY = 25.0000
ZEBRA = 37.0000
158
LEGEND-MC User’s Manual
LZ (Leading Zeros)
[Setting]
DESCRIPTION:
The LZ command is used for formatting the values returned from interrogation commands or interrogation
of variables and arrays. By enabling the LZ function, all leading zeros of returned values will be removed.
This will reduce transmission time and potentially ease formatting issues on connected devices.
ARGUMENTS: LZ n where
1 to remove leading zeros
0 to disable the leading zero removal
USAGE:
While Moving Yes Default Value 0
EXAMPLES:
TE Tell error
0004
TE Tell error
159
LEGEND-MC User’s Manual
MB (Modbus)
[I/O]
DESCRIPTION:
The MB command is used to communicate with I/O devices using the first two levels of the Modbus
protocol.
The format of the command varies depending on each function code. The function code, -1, designates that
the first level of Modbus is used (creates raw packets and receives raw data). The other codes are the 10
major function codes of the second level that the LEGEND-MC supports.
NOTE: For those command formats that have “addr”, this is the slave address. The slave address
may be designated or defaulted to the device handle number.
NOTE: All formats contain an h parameter. This designates connection handle number (A thru P).
ARGUMENTS:
Function Meaning Example
g Register number
160
LEGEND-MC User’s Manual
USAGE:
While Moving Yes Default Value ---
EXAMPLES:
IHF=>-2 Disconnect handle
This program was designed to read four analog inputs from 2 analog input cards (the first two cards) in
the rack of a Wago I/O system. Note Modbus function 3 is used to read the four regsiters starting at
register 0 (The E & R variables.) Register 0 correlates to Modbus address 40000. The data received is a
binary value that reporesents a +/- 10 volt input, thus the conversion calculation.
7(67
'0:$*2>@
:7
,$:70:
,+& !
:7:7-3:7B,+&!
,+& !
:7+&:7-3:7+&B,+&!
( 5 L
0$,1
0%& (5:$*2>@
0*/3
,):$*2>L@
92/76 :$*2>L@)))
(/6(
92/76 :$*2>L@)))
(1',)
0*92/76^)`^1`L L
-30*/3L5L
0*:7
-30$,1
161
LEGEND-MC User’s Manual
MC (Motion Complete)
[Trippoint]
DESCRIPTION:
The MC command is a trippoint used to control the timing of events. This command will hold up execution
of the following commands until the current move is completed and the encoder reaches or passes the
specified target position. TW sets the timeout to declare an error if the encoder is not in position within a
specified time. If a timeout occurs, the trippoint will clear and the stopcode (SC command) will be set to 99.
The application program will jump to the special label #MCTIME, if included in your program.
Can be Interrogated No
RELATED COMMANDS:
"BG" Begin
"AM" After Move
"TW" Timeout
#MCTIME Motion Complete Timeout Special Label
EXAMPLES:
#MOVE Program MOVE
PR 5000 Position relative moves
BG Start the axis
MC After the move is complete
SB1 Set output 1 to logic 1
EN End of Program
NOTE: MC can be used to verify that the actual motion has been completed. In certain applications, that have very little KI
(integration), it is possible that the axis does not get to the exact position specified. This means the MC command will wait
the entire time of the TW command. Set the TW command to a realistic value.
162
LEGEND-MC User’s Manual
MF (Motion Forward)
[Trippoint]
DESCRIPTION:
The MF command is a trippoint used to control the timing of events. This command will hold up the
execution of the following command until the specified motor moves forward and crosses the position
specified. The units of the command are in quadrature counts. The MF command can also be used when
the encoder is the master and not under servo control, because the actual position is monitored.
ARGUMENTS: MFx, y, z, w or MFX=x or MFa, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are signed integers
USAGE:
While Moving Yes Minimum Value -2147483648
RELATED COMMANDS:
"AR" Trippoint for after Relative Distance
EXAMPLES:
#TEST Program B
DP0 Define zero
JG 1000 Jog mode (speed of 1000 counts/sec)
BG Begin move
MF 2000 After passing the position 2000
V1=_TP Assign V1 position
MG "Position is", V1= ST Print Message Stop
EN End of Program
NOTE: The accuracy of the MF command is the number of counts that occur in 2 msec. Multiply the speed by 2 msec to
obtain the maximum error. MF tests for absolute position. The MF command can also be used when the specified motor is
driven independently by an external device.
163
LEGEND-MC User’s Manual
MG (Message)
[General]
DESCRIPTION:
The MG command sends data out the specified port. This can be used to alert an operator, send instructions
or return a variable value.
ARGUMENTS: MG {Ex or P1} "m", {^n}, V {Fm.n or $m.n} {N} {Sn}
"m" is a text message including letters, numbers, symbols or <ctrl>G. Make sure that maximum line length
is not exceeded.
{^n} is an ASCII character specified by the value n in decimal.
V is a variable name or array element where the following specifiers can be used for formatting:
{Fm.n} Display variable in decimal format with m digits to left of decimal, and n to the right.
{$m,n} Display variable in hexadecimal format with m digits to left of decimal, and n to the right.
{Sn} Display variable as a string of length n where n is 1 thru 6
{N} Suppress carriage return line feed.
{Ex}For Ethernet and ‘x’ specifies the Ethernet handle (A,B,C,D,E, ... P). NOTE: if {Ex} is used, it must be
the first option after the MG command.
{P1} forces a message to the serial port.
NOTE: Multiple text, variables, and ASCII characters may be used, each must be separated by a
comma.
USAGE:
While Moving Yes Default Value -
Can be Interrogated No
RELATED COMMANDS:
"MG" Message
EXAMPLES:
Case 1: Message command displays ASCII strings
MG "Good Morning" Displays the string
Case 2: Message command displays variables or arrays
MG "The Answer is", TOTAL {F4.2} Displays the string with the content of variable TOTAL in local
format of 4 digits before and 2 digits after the decimal point.
Case 3: Message command sends any ASCII characters to the port.
MG {^13}, {^30}, {^37}, {N} Sends carriage return, characters 0 and 7 followed by no carriage return line
feed command to the port.
164
LEGEND-MC User’s Manual
MM (Master’s Modulus)
[Setting]
DESCRIPTION:
The MM command is part of the ECAM mode. The MM command replaces the master modulus setting of
the EM command. This allows camming with the auxiliary encoder as the master.
OPERAND USAGE:
_MMx contains the master modulus
RELATED COMMANDS:
"EA" Select master cam axis
EXAMPLES:
EADX Select Auxiliary X axis as Ecam master
165
LEGEND-MC User’s Manual
MO (Motor Off)
[Setting]
DESCRIPTION:
The MO command shuts off the PID control algorithm and the servo enable signal. The controller will
continue to monitor the motor position. To turn the motor back on use the Servo Here command (SH). This
command is not allowed while the servo is commanded in motion. Use the ST command first in that case.
The servo cannot be turned off (MO) while it is commanded to move. Issuing the MO command in this
mode will cause a command error. Use the ST, AM or AB commands before MO.
The action of performing MO then SH will clear any non critical amplifier alarms.
USAGE:
While Moving No Default Value 1
OPERAND USAGE:
_MOn will return the state of the motor where n is an axis letter, 0 = servo loop on and 1 = servo loop off.
RELATED COMMANDS:
"SH" Servo Here
“AB” Abort
“ST” Stop
EXAMPLES:
MO Turn off motor
SH Turn motor on
NOTE: The MO command is useful for positioning the motors by hand. Turn them back on with the SH command.
166
LEGEND-MC User’s Manual
MR (Motion Reverse)
[Trippoint]
DESCRIPTION:
The MR command is a trippoint used to control the timing of events. This command will hold up the
execution of the following command until the specified motor moves backward and crosses the position
specified. The units of the command are in quadrature counts. The MR command can also be used when
the encoder is the master and not under servo control.
ARGUMENTS: MR x, y, z, w or MRX=x or MR a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are signed integers
USAGE:
While Moving Yes Minimum Value -2147483648
In a Program Yes Maximum Value 2147483647
Command Line Yes Default Value ---
Can be Interrogated No Default Format ---
Used as an Operand No Distributed Control Specific Axis
RELATED COMMANDS:
"AR" Trippoint for after Relative Distance
"MF" Forward motion to position
"AP" Trippoint After absolute position
EXAMPLES:
#TEST Program B
DP0 Define zero
JG 1000 Jog mode (speed of 1000 counts/sec)
BG Begin move
MR -3000 After passing the position -3000
V1=_TP Assign current position to variable V1.
MG "Position is", V1 Print Message
ST Stop
EN End of Program
NOTE: MR command accuracy is the number of counts that occur in 2 msec. Multiply speed by 2 msec to obtain maximum
error. MR tests for absolute position. The MR command can also be used when the specified motor is driven externally.
167
LEGEND-MC User’s Manual
MT (Motor Type)
[Configuration]
DESCRIPTION:
The MT command selects the type of the motor and the polarity of the drive signal. Motor types include
standard servo motors which require a voltage in the range of +/- 10 Volts. The polarity reversal inverts the
analog signals.
Warning: This command interacts with the CE command, which reverses the incoming encoder signals. Use
caution (motor off, machine estopped) when changing the MT or CE commands. If the two commands are
not in agreement with each other, the motor will run away at full speed when enabled.
OPERAND USAGE:
_MTn contains the value of the motor type where n is an axis letter.
EXAMPLES:
MT 1 Configure x as servo
168
LEGEND-MC User’s Manual
MW (Modbus Wait)
[Configuration]
DESCRIPTION:
The MW command sets the controller to wait for the ACK signal from a remote I/O device before going
to the next command. With this setting disabled, the controller will continue executing commands after
an I/O command that requires it to send a modbus packet. In this mode, the I/O state cannot be
guaranteed. Enabling this setting is the default, and is recommended. This is a configuration command
and only needs to be set once in the program. This configuration is not burnable, and is set to “enabled” at
power up.
ARGUMENTS: MW n where
n is 0 to disable the Modbus Wait function.
n is 1 to enable the Modbus Wait function.
USAGE:
While Moving Yes Minimum Value 0
In a Program Yes Maximum Value 1
Command Line Yes Default Value 1
Can be Interrogated Yes
Used as an Operand Yes Distributed Control No, Local
OPERAND USAGE:
_MW contains the contains current setting of the MW command.
RELATED COMMANDS:
"CB" Clear Bit
"MB" Modbus Function Code
"SB" Set Bit
“HW” Handle Wait
EXAMPLES:
MW1 Enable Modbus Wait function.
Typically this command would be set once at the top of the application program.
169
LEGEND-MC User’s Manual
NA (Number of Axes)
[Configuration]
DESCRIPTION:
This command is obselete. Use the HC command instead.
NA defines the total number of axes used in a distributed network control system. This command is used on
the master controller. For example; using 3 LEGEND-MC controllers. The command NA3 would be given
to the master controller.
ARGUMENTS: NA n where
n is an integer. this number represents the number of axes in a distributed control system.
USAGE:
While Moving Yes Minimum Value 1
In a Program Yes Maximum Value 8
Command Line Yes Default Format ---
Can be Interrogated Yes
Used as an Operand Yes Distributed Control No, Local
OPERAND USAGE:
_NA contains the contains the number of axes.
RELATED COMMANDS:
"CH" Connect to the internet handles for slave operation
"IH" Set internet handles
"QW" Set Slave Data Record Update Rate
EXAMPLES:
NA2 Command given to an LEGEND-MC acting as
a multi-axis network master with one slave.
NOTE: executing the HC command to connect to other axes will automatically set the NA command.
170
LEGEND-MC User’s Manual
NB (Notch Bandwidth)
[Tuning]
DESCRIPTION:
The NB command sets real part of the notch poles
ARGUMENTS: NB x, y, z, w or NBX=x or NB a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are unsigned integers
USAGE:
While Moving Yes Minimum value 0
OPERAND USAGE:
_NBn contains the contains the value of the notch bandwidth where n is an axis letter.
RELATED COMMANDS:
"NF" Notch Filter
"NZ" Notch Zero
EXAMPLES:
NBX = 10 Sets the real part of the notch pole to 10 Hz
171
LEGEND-MC User’s Manual
NF (Notch Filter)
[Tuning]
DESCRIPTION:
The NF command sets the frequency of the notch filter, which is placed in series with the PID
compensation.
ARGUMENTS: NF x, y, z, w or NFX=x or NF a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are unsigned integers
USAGE:
While Moving Yes Minimum value 0
OPERAND USAGE:
_NFn contains the value of notch filter for the specified axis where n is an axis letter.
RELATED COMMANDS:
"NB" Notch bandwidth
EXAMPLES:
NF, 20 Sets the notch frequency of Y axis to 20 Hz
172
LEGEND-MC User’s Manual
NO (No Operation)
[General]
DESCRIPTION:
The NO command performs no action in a sequence, but can be used as a comment in a program. After the
NO, characters can be given to form a program comment up to the maximum line length. This helps to
document a program.
An apostrophe (‘) may also be used instead of the NO to document a program. Comments designated with
either the NO or ‘ remain in the program as it is downloaded to the controller, thus occupying some
memory space.
ARGUMENTS: NO m where
m is any group of letters, numbers, symbols or <cntrl>G
USAGE:
While Moving Yes Default Value ---
Can be Interrogated No
RELATED COMMANDS:
"//" This is a comment command YTerm filters out
EXAMPLES:
#A Program A
NO No Operation
NO Nothing No Operation
EN End of Program
173
LEGEND-MC User’s Manual
NZ (Notch Zero)
[Tuning]
DESCRIPTION:
The NZ command sets the real part of the notch zero.
ARGUMENTS: NZ x, y, z, w or NZX=x or NZ a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are unsigned integers
USAGE:
While Moving Yes Minimum value 0
OPERAND USAGE:
_NZn contains the value of the Notch filter zero for the specified axis where n is an axis letter.
RELATED COMMANDS
"NB" Notch Bandwidth
EXAMPLES:
NZX = 10 Sets the real part of the notch pole to 10 Hz
174
LEGEND-MC User’s Manual
OB (Output Bit)
[I/O]
DESCRIPTION:
The OB n, logical expression command defines output bit n = 1 through 4 as either 0 or 1 depending on the
result from the logical expression. Any non-zero value of the expression results in a one on the output.
When using this command to access I/O on a slave controller in distributed control mode, use it with the
handle for outbound master commands. Do not use the handle which is for incoming slave update packets.
For example, if a slave is connected on handles E and F, reference the I/O for the slave on handle E.
This command also works for Modbus outputs.
ARGUMENTS: OB n, expression where
n is 1 to 4 for the local controller. However, remote local outputs can be used (i.e. Offset 100 per handle for
SMC outputs; Offset 1000 per handle for Modbus outputs)
expression is any valid logical expression, variable or array element.
USAGE:
While Moving Yes Default Value ---
Can be Interrogated No
MODBUS:
NOTE: When using Modbus devices, the I/O points of the modbus devices are calculated
using the following formula:
n = (SlaveAddress*1000) + (HandleNum*1000) + ((Module-1)*4) + (Bitnum-1)
Slave Address is used when the ModBus device has slave devices connected to it and specified as
Addresses 0 to 255. The use of slave devices for modbus are very rare and this number will usually be 0.
HandleNum is the handle specifier from A to P (1 - 16).
Module is the position of the module in the rack from 1 to 16.
BitNum is the I/O point in the module from 1 to 4.
EXAMPLES:
OB 1, POS 1 If POS1 is non-zero, Bit 1 is high. If POS1 is zero, Bit 1 is low
OB 2, (@IN[1]&@IN[2]) If Input 1 and Input 2 are both high, then Output 2 is set high
OB 3, COUNT[1] If the element 1 in the array is zero, clear bit 3, otherwise set bit 3
175
LEGEND-MC User’s Manual
OC (Output Compare)
[I/O]
DESCRIPTION:
The OC command allows the generation of output pulses based on the main encoder positions. The output is
a low-going pulse with a duration of approximately 600 nanoseconds and is available at the output compare
signal.
The auxiliary encoder cannot be used while using this function.
NOTE: The OC function requires that the main encoder and auxiliary encoders be configured
exactly the same (see the command, CE). For example: CE 0, CE 10.
The output on pin 7 of the 5 CN connector is a TTL signal and requires JP3 to be installed. The output is
accurate to +/- 40 nanoseconds.
m = Absolute position for first pulse. Integer between -2⋅ 109 and 2 ⋅ 109
n = Incremental distance between pulses. Integer between -65535 and 65535.
OCx = 0 will disable the Output Compare function.
The sign of the parameter, n, will designate the expected direction of motion for the output compare
function. When moving in the opposite direction, output compare pulses will occur at the incremental
distance of 65536-|n| where |n| is the absolute value of n.
USAGE:
While Moving Yes Default Value -
Can be Interrogated No
OPERAND USAGE:
_OCx contains the state of the OC function
_OCx = 0: OC function has been enabled but not generated any pulses.
_OCx = 1: OC function not enabled or has generated the first output pulse.
EXAMPLES:
OCX=300,100 Select X encoder as position sensor. First
pulse at 300. Following pulses at 400, 500…
176
LEGEND-MC User’s Manual
OE (Off On Error)
[Setting]
DESCRIPTION:
The OE command causes the controller to shut off the motor command if the position error exceeds the
limit specified by the ER command or an abort occurs from either the abort input or an AB command.
OPERAND USAGE:
_OEn contains the status of the off-on-error function where n is an axis letter.
RELATED COMMANDS:
"ER" Error limit
EXAMPLES:
OE 1 Enable OE
OE 0 Disable OE
NOTE: The OE command is useful for preventing system damage on excessive error.
177
LEGEND-MC User’s Manual
OF (Offset)
[Tuning]
DESCRIPTION:
The OF command sets a bias voltage in the motor command output or returns a previously set value. This
can be used to counteract gravity or an offset in an amplifier. If the PID values are zero, then the output
voltage will be the OF value.
This command is useful when compensating for gravity in a vertical load application.
OPERAND USAGE:
_OFn contains the offset in volts where n is an axis letter.
EXAMPLES:
OF 1 Set offset to 1 volt
OF ? Return offset
1.0000
178
LEGEND-MC User’s Manual
OP (Output Port)
[I/O]
DESCRIPTION:
The OP command sets 4 bits of data on the output port of the controller simultaneously.
The n parameter is used to specify the number of bits affected starting with the LSB. The other bits are
masked. For example, if n=2, only outputs 1 and 2 will be changed by OP m. If the n parameter is not
specified, all bits will be changed.
To set or read outputs on a slave controller use the SA command.
ARGUMENTS: OP m where
m is an integer
USAGE:
While Moving Yes Minimum m Value 0
OPERAND USAGE:
_OP contains the status of the outputs.
RELATED COMMANDS:
"SB" Set output bit
EXAMPLES:
OP 0 Clear Output Port -- all bits
179
LEGEND-MC User’s Manual
@OUT (Output)
[Function]
DESCRIPTION:
@OUT returns the status of the digital output number or variable given in square brackets. Note that the
@OUT command is a function, which means that it does not follow the convention of the commands, and
does not require the underscore when used as an operand.
ARGUMENTS: @OUT [n] where
n is an integer corresponding to a specific output on the controller. The first output on the controller is
denoted as output 1. A LEGEND-MC controller has 4 digital outputs plus applicable I/O connected by
Modbus.
NOTE: When using Modbus devices, the I/O points of the modbus devices are calculated using the
following formula:
n = (SlaveAddress*1000) + (HandleNum*1000) + ((Module-1)*4) + (Bitnum-1)
Slave Address is used when the ModBus device has slave devices connected to it and specified as
Addresses 0 to 255. Please note that the use of slave devices for modbus are very rare and this number will
usually be 0.
HandleNum is the handle specifier from A to P (1 - 16).
Module is the position of the module in the rack from 1 to 16.
BitNum is the I/O point in the module from 1 to 4.
USAGE:
While Moving Yes Minimum n value 1
In a Program Yes Maximum n value 8
Not in a program Yes Default Value ---
Can be Interrogated No Default Format ---
Used as an Operand Yes Distributed Control No, Local
EXAMPLES:
#TEST Program TEST
VAR1=3 Set variable
MG @OUT[VAR1] Display only the whole number portion of
VAR1
EN End of program
180
LEGEND-MC User’s Manual
PA (Position Absolute)
[Motion]
DESCRIPTION:
The PA command will set the absolute destination of the next move. The position is referenced to absolute
zero. If a ? is used, then the current destination (current commanded position if not moving, destination if
in a move) is returned. For each single move, the largest position move possible is +/- 2147483647. Units
are in quadrature counts.
ARGUMENTS: PA x, y, z, w or PAX=x or PA a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are signed integers
USAGE:
While Moving No Minimum Value -2147483647
OPERAND USAGE:
_PAn contains current command position if not moving, start position if given during motion where n is an
axis letter.
RELATED COMMANDS:
"PR" Position relative
"SP" Speed
"AC" Acceleration
"DC" Deceleration
"BG" Begin
EXAMPLES:
:PA 400 X-axis will go to 400 counts
0000000
:BG
181
LEGEND-MC User’s Manual
PF (Position Format)
[Setting]
DESCRIPTION:
The PF command allows the user to format the position numbers such as those returned by TP. The number
of digits of integers and the number of digits of fractions can be selected with this command. An extra digit
for sign and a digit for decimal point will be added to the total number of digits. If PF is minus, the format
will be hexadecimal and a dollar sign will precede the characters. Hex numbers are displayed as 2's
complement with the first bit used to signify the sign.
If a number exceeds the format, the number will be displayed as the maximum possible positive or negative
number (i.e. 999.99, -999, $8000 or $7FF).
The PF command can be used to format values returned from the following commands:
USAGE:
BL ? PA ?
DE ? PR ?
DP ? TE
FL ?
IP ?
TP
USAGE:
While Moving Yes Minimum m Value -8
Default n Value 0
OPERAND USAGE:
_PF contains the value of position format parameter.
EXAMPLES:
:TP Tell position
182
LEGEND-MC User’s Manual
00021.00
183
LEGEND-MC User’s Manual
PN (Legend Parameter)
[Configuration]
DESCRIPTION:
The PN command sets or returns data residing in the Legend amplifier. The PN command causes the
controller to communicate to the amplifier via a serial connection on the mating connector. The available
parameter numbers are listed below. If the parameter was not accepted by the amplifier, a command error
will result. (TC=131 Amplifier Error) Paraemters that are successfully sent to the amplifier are stored in
EEPROM memory and effective immediately. This memory is separate from the controller memory, so
performing a master reset on the controller will not reset these values.
OPERAND USAGE:
_PNp will return the value of the parameter where p is the parameter number.
RELATED COMMANDS:
"TS" Tell Switches
ADDITIONAL INFORMATION:
Parameter Description Default Min Max
$400 Maximum Torque Reference Gain 10000 1000 10000
Input (mV)
$401 Torque Reference Filter Frequency 10 0 65535
(0.01 ms)
$402 Forward Torque Limit (%) 800 0 800
$403 Negative Torque Limit (%) 800 0 800
$407 Speed Limit under torque control 1000 0 1000
(0.1%)
EXAMPLES:
PN $400,2000 Set torque reference gain
MG _PN$407 Read Speed Limit
184
LEGEND-MC User’s Manual
PR (Position Relative)
[Motion]
DESCRIPTION:
The PR command sets the incremental distance and direction of the next move. The move is referenced
with respect to the current position. Units are in quadrature counts.
ARGUMENTS: PR x, y, z, w or PRX=x or PR a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are signed integers
USAGE:
While Moving No Minimum n Value -2147483648
OPERAND USAGE:
_PRn will return the current incremental distance where n is an axis letter.
RELATED COMMANDS:
"BG" Begin
"AC" Acceleration
"DC" Deceleration
"SP" Speed
"IP" Increment Position
EXAMPLES:
:PR 100 On the next move the X-axis will go 100
counts,
:BG
185
LEGEND-MC User’s Manual
PW (Password)
[Configuration]
DESCRIPTION: PW
The (PW) Password command sets or changes the controller's security password. The command requires
two parameters; p,p. Both parameters are the new password up to 8 characters in length. Both parameters
must be identical for the new password to be accepted. The password can only be set or changed while the
controller is in the "Unlocked" mode, (see the LC command) or a command error will result. Once a valid
password is entered, it is automatically burned into the controller EEPROM.
ARGUMENTS: PW p,p
where p,p are identical passwords up to 8 characters in length.
All characters can be alphabetic or numeric.
USAGE:
While Moving Yes Default Value ---
Used as an Operand No
RELATED COMMANDS:
"LC" Lock Controller
EXAMPLES:
PW MOTION,MOTION Set a new password "MOTION"
186
LEGEND-MC User’s Manual
QD (Download Array)
[General]
DESCRIPTION:
The QD command transfers array data from the host computer to the LEGEND-MC. QD array[ ],start,end
requires that the array name be specified along with the first element of the array and last element of the
array. The array elements can be separated by a comma (,) or by <CR><LF>. The downloaded array is
terminated by a <control>Z, <control>Q, <control>D or \.
ARGUMENTS: QD array[ ], start, end where
“array[ ]” is a valid array name
“start” is the first element of the array (default=0)
“end” is the last element of the array (default=last element)
USAGE:
While Moving No Default Value 0
In a Program Yes Default Format Position Format
Can be Interrogated No
RELATED COMMANDS:
"UL" Upload Program
QU Array Upload
187
LEGEND-MC User’s Manual
USAGE:
While Moving Yes Default Value n/a
Can be Interrogated No
OPERAND USAGE:
_QLn contains the latched position where n is an axis letter.
RELATED COMMANDS:
"AL" Arm Latch
EXAMPLES:
JG 5000 Set up to jog
BG Begin jog
188
LEGEND-MC User’s Manual
QR (Data Record)
[General]
DESCRIPTION:
The QR command causes the controller to return a record of information regarding controller status. This
status information includes 4 bytes of header information and specific blocks of information as specified
by the command arguments. The details of the status information is described in the communication
chapter of the user’s manual. This command is not designed to be used in the application program, it is
designed for data exchange with a computer.
ARGUMENTS: QR xx where
x is X,Y,Z,W,A,B,C,D,E,F,G,H or I or any combination to specify the axis, axes, or I/O status
I represents the status of the I/O
The Communication chapter of the users manual provides the definition of the data record information.
USAGE:
While Moving Yes Default Value -
RELATED COMMANDS:
"QZ" Return DMA / Data Record information
189
LEGEND-MC User’s Manual
QU (Upload Array)
[General]
DESCRIPTION:
The QU command transfers array data from the LEGEND-MC to a host computer. QU requires that the
array name be specified along with the first element of the array and last element of the array. The uploaded
array will be followed by a <control>Z as an end of text marker.
ARGUMENTS: QU array[], start, end, delim where
“array[ ]” is a valid array name
“start” is the first element of the array (default=0)
“end” is the last element of the array (default=last element)
“delim” specifies the character used to delimit the array elements. If delim is 1, then the array elements will
be separated by a comma. Otherwise, the elements will be separated by a carriage return.
USAGE:
While Moving No Default Value 0
Can be Interrogated No
RELATED COMMANDS:
"DL" Download program
190
LEGEND-MC User’s Manual
RELATED COMMANDS:
"CH" Connect Handle
"NA" Number of Axes
"SA" Send Command
EXAMPLES:
CHC=A,B Using one LEGEND-MC as a master and one
LEGEND-MC as a slave. This command
assigns the slave, identified by the C axis
designator, with Handle A for commands and
Handle B for status returned from the slave.
QWB=20 Sets the update rate for the slave controller to
20 msec (TM=1000).
NOTE: The recommended value for QW is (11mSec * number of slave axes) Example, a system with three
total axes should have a QW setting of 22.
191
LEGEND-MC User’s Manual
USAGE:
While Moving Yes Default Value ---
RELATED COMMANDS:
“DR” DMA update rate
192
LEGEND-MC User’s Manual
RA (Record Array)
[General]
DESCRIPTION:
The RA command selects up to four arrays for automatic data capture. The selected arrays must have been
dimensioned by the DM command. The data to be captured is specified by the RD command and time
interval by the RC command.
ARGUMENTS: RA n [ ],m [ ],o [ ],p [ ] where
n,m,o,p are dimensioned arrays as defined by DM command. The [ ] contain nothing.
USAGE:
While Moving Yes Default Value ---
Can be Interrogated No
RELATED COMMANDS:
"DM" Dimension Array
EXAMPLES:
#Record Label
EN End
NOTE: The record array mode is useful for recording the real-time motor position during motion. The data is automatically
captured in the background and does not interrupt the program sequencer. The record mode can also be used for a teach or
learn of a motion path.
193
LEGEND-MC User’s Manual
RC (Record)
[General]
DESCRIPTION:
The RC command begins recording for the Automatic Record Array Mode (RA). RC 0 stops recording.
ARGUMENTS: RC n,m where
OPERAND USAGE:
_RC contains status of recording '1' if recording, '0' if not recording.
RELATED COMMANDS:
"DM" Dimension Array
"RD" Record Data
"RA" Record Array Mode
EXAMPLES:
#RECORD Record
DM Torque[1000] Define Array
RA Torque[] Specify Record Mode
RD _TT Specify Data Type
RC 2 Begin recording, set 4 servo samples between
records
JG 1000;BG Begin motion
#A;JP #A,_RC=1 Loop until done
MG "DONE RECORDING" Print message
EN End program
194
LEGEND-MC User’s Manual
RD (Record Data)
[General]
DESCRIPTION:
The RD command specifies the data type to be captured for the Record Array (RA) mode. The data types
include:
_TP Position
_TI Inputs
_OP Outputs
Can be Interrogated No
OPERAND USAGE:
_RD contains the address for the next array element for recording.
RELATED COMMANDS:
"RA" Record Array
195
LEGEND-MC User’s Manual
EXAMPLES:
DM ERRORX[50] Define array
196
LEGEND-MC User’s Manual
RELATED COMMANDS:
#POSERR Excessive Position Error Special Label
EXAMPLES:
#A;JP #A;EN Label for main program
NOTE: An application program must be executing for the #LIMSWI and #POSERR subroutines
to function.
197
LEGEND-MC User’s Manual
RELATED COMMANDS:
#ININT Input interrupt subroutine
EXAMPLES:
#A;II1;JP #A;EN Program label
NOTE: An applications program must be executing for the #ININT subroutine to function.
198
LEGEND-MC User’s Manual
RL (Report Latch)
[General]
DESCRIPTION:
The RL command will return the last position captured by the latch. The latch must first be armed by the
AL command. The armed state of the latch can be configured using the CN command.
NOTE: Use QL to read the value of the auxiliary latch on input #2.
USAGE:
While Moving Yes Default Value n/a
In a Program Yes Default Format Position Format
Can be Interrogated No
OPERAND USAGE:
_RLn contains the main encoder latched position where n is an axis letter.
RELATED COMMAND:
"AL" Arm Latch
EXAMPLES:
JG 5000 Set up to jog
BG Begin jog
10000
199
LEGEND-MC User’s Manual
@RND (Round)
[Function]
DESCRIPTION:
@RND rounds a number or variable given in square brackets. Note that the @RND command is a
function, which means that it does not follow the convention of the commands, and does not require the
underscore when used as an operand.
EXAMPLES:
#TEST Program TEST
VAR1=123.456 Set variable
MG @RND[VAR1] Display the value of VAR1 rounded to the
nearest integer
VAR2=@RND[VAR1]+25 Perform calculation
EN End of program
200
LEGEND-MC User’s Manual
RP (Reference Position)
[Motion]
DESCRIPTION:
The RP command will return the commanded position of the servo. This is updated every sample period by
the profiler. RP-TP=TE. The units are in counts.
USAGE:
While Moving Yes Default Value n/a
OPERAND USAGE:
_RPn contains the commanded position where n is an axis letter.
RELATED COMMAND:
"TP" Tell Position
EXAMPLES:
PR 10000 Position Relative move
BG Begin motion
AM After Motion
10000
201
LEGEND-MC User’s Manual
RS (Reset)
[General]
DESCRIPTION:
The RS command resets the processor to its power-on condition. The previously saved (burned) state of the
controller, along with parameter values, and saved sequences are restored.
ARGUMENTS: RSn where
0 (or no parameter) restores burned parameters and clears application program
1 restores burned parameters only
2 clears application programs only
USAGE:
Can be Interrogated No
EXAMPLES:
RS Reset the controller
202
LEGEND-MC User’s Manual
Can be Interrogated No
203
LEGEND-MC User’s Manual
Can be Interrogated No
204
LEGEND-MC User’s Manual
SA (Send Command)
[General]
DESCRIPTION:
SA sends a command from the master to the slave controller of a distributed control system. Any command
can be sent to a slave controller and will be interpreted by the slave as a “local” command. Some
commands are only “local” commands and must be sent with the SA command. Refer to the discussion of
local vs. global commands in this manual. Yaskawa recommends using a TCP handle when sending the SA
command.
When using this command to access I/O on a slave controller in distributed control mode, use it with the
handle for outbound master commands. Do not use the handle which is for incoming slave update packets.
For example, if a slave is connected on handles E and F, reference the I/O for the slave on handle E.
ARGUMENTS: SAh=arg or SAh= arg, arg, arg, arg, arg, arg, arg, arg where
h is the handle being used to send commands to the slave controller.
arg is a number, controller operand, variable, mathematical function, or string; the range for numeric
values is 4 bytes of integer (231) followed by two bytes of fraction (+/- 2,147,483,647.9999). The
maximum number of characters for a string is 6. Strings are identified by quotations.
Typical usage would have the first argument as a string such as “KI” and the subsequent arguments as the
arguments to the command: Example SAF= “KI”,2 would send the command KI2 to the slave controller on
handle F.
USAGE:
While Moving Yes Default Value ---
OPERAND USAGE:
_SAhn gives the value of the response to the command sent with an SA command. The h value represents
the handle A thru P and the n value represents the specific field returned from the controller (1-8). If the
specific field is not used, the operand will be (-231).
RELATED COMMANDS:
"IH" Set Internet handles
“HC” Handle Connect
"LO" Lock out communication channels
EXAMPLES:
SAA=”KI”,2 Sends the command to Handle A (slave controller): KI 2
SAA=”KIX=2”
SAA=”TE” Sends the command to Handle A (slave controller): TE
MG_SAA : 132 Display the content of the operand _SAA (first response to TE command
205
LEGEND-MC User’s Manual
SB (Set Bit)
[I/O]
DESCRIPTION:
The SB command sets one of four bits on the output port, slave controller, or Modbus I/O.
When using this command to access I/O on a slave controller in distributed control mode, use it with the
handle for outbound master commands. Do not use the handle which is for incoming slave update packets.
For example, if a slave is connected on handles E and F, reference the I/O for the slave on handle E.
ARGUMENTS: SB n where
n is an integer in the range 1 to 4 decimal or Modbus address. See chart below for setting outputs on slave
controllers.
DISTRIBUTED CONTROL:
MODBUS:
NOTE: When using Modbus devices, the I/O points of the modbus devices are calculated using the
following formula:
n = (SlaveAddress*1000) + (HandleNum*1000) + ((Module-1)*4) + (Bitnum-1)
Slave Address is used when the ModBus device has slave devices connected to it and specified as
Addresses 0 to 255. Please note that the use of slave devices for modbus are very rare and this number will
usually be 0.
HandleNum is the handle specifier from A to P (1 - 16).
Module is the position of the module in the rack from 1 to 16.
BitNum is the I/O point in the module from 1 to 4.
USAGE:
While Moving Yes Default Value ---
In a Program Yes Default Format ---
Command Line Yes
Can be Interrogated No
Used as an Operand No Distributed Control Offset 100
RELATED COMMAND:
CB Clear Bit
EXAMPLES:
SB 3 Set output line 3
SB 1 Set output line 1
SB 602 Set output 2 on slave controller on handle F
206
LEGEND-MC User’s Manual
SC (Stop Code)
[Status]
DESCRIPTION:
The SC command allows the user to determine why a motor stops. The controller responds with the stop
code as follows:
USAGE:
While Moving Yes Default Value ---
Can be Interrogated No
OPERAND USAGE:
_SCn contains the value of the stop code where n is an axis letter.
EXAMPLES:
Tom=_SCX Assign the Stop Code to variable Tom
207
LEGEND-MC User’s Manual
SH (Servo Here)
[General]
DESCRIPTION:
The SH command tells the controller to use the current motor position as the commanded position and to
enable servo control here. PID control starts when this command is issued.
This command can be useful when the position of a motor has been manually adjusted following a motor off
(MO) command.
The SH command is integrated with the RUN output of the LEGEND amplifier. If the RUN output does not
come ON within 100 msec, the controller returns to MO status and issues a command error. If this occurs,
check the power on L1, L2, and L3.
The action of performing MO then SH will clear any non critical amplifier alarms.
Can be Interrogated No
RELATED COMMANDS:
"MO" Motor-off
EXAMPLES:
SH Servo motor
208
LEGEND-MC User’s Manual
@SIN (Sine)
[Function]
DESCRIPTION:
@SIN returns the sin of a number or variable given in square brackets using units of degrees. Note that
the @SIN command is a function, which means that it does not follow the convention of the commands,
and does not require the underscore when used as an operand.
EXAMPLES:
#TEST Program TEST
VAR1=60 Set variable
MG @SIN[VAR1] Display the value of the sine of VAR1
VAR2=@SIN[VAR1]+9 Perform calculation
EN End of program
209
LEGEND-MC User’s Manual
SP (Speed)
[Motion]
DESCRIPTION:
This command sets the slew speed for independent moves. The parameters input will be rounded down to
the nearest factor of 2 and the units of the parameter are in counts per second.
OPERAND USAGE:
_SPn contains the current speed setting where n is an axis letter.
RELATED COMMANDS:
"AC" Acceleration
"DC" Deceleration
"PR" Position Relation
"BG" Begin
EXAMPLES:
PR 2000 Specify position relative move
SP 5000 Specify speeds
BG Begin motion of all axes
AM After motion is complete
210
LEGEND-MC User’s Manual
EXAMPLES:
#TEST Program TEST
VAR1=60 Set variable
MG @SQR[VAR1] Display the value of the sine of VAR1
VAR2=@SQR[VAR1]+9 Perform calculation
EN End of program
211
LEGEND-MC User’s Manual
ST (Stop)
[Motion]
DESCRIPTION:
The ST command stops commanded motion. The motor will come to a decelerated stop.
ARGUMENTS: ST XYZWS or ABCDEFGH where
XYZW or ABCDEFGH are axis designators. S indicates an interpolation sequence. No argument specifies
that motion on all axes is complete.
USAGE:
While Moving Yes Default Value ---
Can be Interrogated No
RELATED COMMANDS:
"BG" Begin Motion
EXAMPLES:
ST Stop motion
NOTE: Use the after motion complete command, AM, to wait for motion to be stopped.
212
LEGEND-MC User’s Manual
TA (Tell Alarm)
[Status]
DESCRIPTION:
The TA command checks the alarm output of the amplifier on the side connector. If no alarm is present, the
controller returns 153 decimal, or 99 hex, which is the code for “No Alarm.” If the alarm output is active,
the controller requests the alarm code serially from the amplifier via the mating connector. See the Sigma
II documentation for all the possible alarm codes.
NOTE: The amplifier requires special firmware to transmit the alarm code to the controller. Consult the
factory for details. Firmware in the amplifier is not field upgradable.
ARGUMENTS: None
USAGE:
While Moving Yes Default Value ---
RELATED COMMANDS:
"TS" Tell Switches
EXAMPLES:
FAULT=_TA Store amp alarm into a user variable
213
LEGEND-MC User’s Manual
BIT STATUS
Bit 6 N/A
Bit 5 Contouring
Bit 1 N/A
Bit 0 Echo on
ARGUMENTS: None
USAGE:
While Moving Yes Default Value ---
OPERAND USAGE:
_TB contains the status byte.
EXAMPLES:
TB Tell status information from the controller
214
LEGEND-MC User’s Manual
TC (Tell Code)
[Status]
DESCRIPTION:
The TC command returns a number between 1 and 255. This number is a code that reflects why a
command was not accepted by the controller. This command is useful when the controller halts execution
of a program at a command or when the response to a command is a question mark. Entering the TC
command will provide the user with a code as to the reason. After TC has been read, it is set to zero. TC 1
returns the text message as well as the numeric code.
ARGUMENTS: TC n
n=0 returns code only
n=1 returns code and message
CODE EXPLANATION
1 Unrecognized command
4 Operand error
9 Variable error
215
LEGEND-MC User’s Manual
53 Error in {}
55 Missing [ or []
59 Mismatched parentheses
82 Undefined Array
216
LEGEND-MC User’s Manual
USAGE:
While Moving Yes Default Value ---
OPERAND USAGE:
_TC contains the value of the error code.
EXAMPLES:
:GF32 Bad command
217
LEGEND-MC User’s Manual
Can be Interrogated No
OPERAND USAGE:
_TDn contains the dual encoder position where n is an axis letter.
RELATED COMMANDS:
"DE" Dual Encoder
EXAMPLES:
:PF 7 Position format of 7
0000200
218
LEGEND-MC User’s Manual
TE (Tell Error)
[Status]
DESCRIPTION:
This command returns the current position error of the motor. It is up-dated every servo cycle.
ARGUMENTS: TE XYZW or ABCDEFGH
USAGE:
While Moving Yes Minimum Value -2147483648
OPERAND USAGE:
_TEn contains the value of the position error where n is an axis letter.
RELATED COMMANDS:
"ER" Error Limit
EXAMPLES:
TE Return position error
00005
NOTE: Under normal operating conditions with servo control, the position error should be small. The position error is typ-
ically largest during acceleration.
219
LEGEND-MC User’s Manual
TH (Tell Handle)
[Status]
DESCRIPTION:
This command returns a formatted text display including the controllers MAC address, IP Address, and the IP
address of the device connected to each of the handles. Also included are the port type and master / slave
configuration.
This command is most useful from an external device, such as a terminal window or other program that can
interpret the information.
ARGUMENTS: none
USAGE:
While Moving Yes Default Value n/a
Can be Interrogated No
RELATED COMMANDS:
"IH" Internet Handle
EXAMPLES:
TH Tell Handle
220
LEGEND-MC User’s Manual
TI (Tell Inputs)
[I/O]
DESCRIPTION:
This command returns the state of all 8 of the general digital inputs. Response is a decimal number which
when converted to binary represents the status of all 8 digital inputs.
When using this command to access I/O on a slave controller in distributed control mode, use it with the
handle for outbound master commands. Do not use the handle which is for incoming slave update packets.
For example, if a slave is connected on handles E and F, reference the I/O for the slave on handle E.
BIT TI PIN
Bit 7 Input 8 20
Bit 6 Input 7 19
Bit 5 Input 6 42
Bit 4 Input 5 43
Bit 3 Input 4 44
Bit 2 Input 3 45
Bit 1 Input 2 17
Bit 0 Input 1 18
DISTRIBUTED CONTROL:
ARGUMENTS: TI n where
n is an optional integer which indicates the handle as described above.
USAGE:
While Moving Yes Default Value ---
In a Program Yes Default Format 3.0
Command Line Yes
OPERAND USAGE:
_TI contains the status byte of the input block. This can be masked to return only specified bit information.
221
LEGEND-MC User’s Manual
EXAMPLES:
TI
222
LEGEND-MC User’s Manual
Format TIME
EXAMPLES:
MG TIME Display the value of the internal clock
223
LEGEND-MC User’s Manual
TL (Torque Limit)
[Setting]
DESCRIPTION:
The TL command sets the limit on the motor command output. For example, TL of 5 limits the motor
command output to 5 volts. Maximum output of the motor command is 9.998 volts.
ARGUMENTS: TL x, y, z, w or TLX=x or TL a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are unsigned integers
USAGE:
While Moving Yes Minimum n Value 0
OPERAND USAGE:
_TLn contains the value of the torque limit where n is an axis letter.
EXAMPLES:
TL 1 Limit X-axis torque to 1volt
1.0000
224
LEGEND-MC User’s Manual
TM (Time Base)
[Configuration]
DESCRIPTION:
The TM command sets the sampling period of the control loop. Changing the sampling period will
uncalibrate the speed and acceleration parameters. A negative number turns off the internal clock allowing
for an external source to be used as the time base. The units of this command are µsec. If a multi-axis
system is configured the TM value is set in all controllers if set in the master.
ARGUMENTS: TM n where
n is an integer in microseconds with a resolution of 125 microseconds.
USAGE:
While Moving Yes Minimum n Value 250
OPERAND USAGE:
_TM contains the value of the sample time.
EXAMPLES:
TM 250 Set sample rate to 250 µsec (This will multiply all
speeds by four and all acceleration by eight)
NOTE: Although this manual refers to times in msec, think in terms of servo cycles. This includes
everything from a WT command to SP commands.
225
LEGEND-MC User’s Manual
TP (Tell Position)
[Status]
DESCRIPTION:
This command returns the current position of the motor in quadrature counts.This value is up-dated every
servo cycle.
ARGUMENTS: TP XYZW or ABCDEFGH
USAGE:
While Moving Yes Default Value n/a
OPERAND USAGE:
_TPn contains the current position value where n is an axis letter.
EXAMPLES:
:PF 7 Position format of 7
0000200
TP Return in hex
$0000C8
226
LEGEND-MC User’s Manual
TR (Trace Mode)
[Debug]
DESCRIPTION:
The TR command causes each instruction in a program to be sent out the communications port prior to
execution. TR1 enables this function and TR0 disables it. The trace command is useful in debugging
programs. It is not recommended to leave the TR command on for long durations (over 30 seconds)
because it takes much longer to output the data from the controller than to execute it, hence, program
execution will be affected. If no program lines are coming from the controller, issue “MG_XQn” or
“MG_HXn” to see what line the controller is on. If the controller is at a trippoint, no lines will be output.
Another way to take advantage of this command is to insert it in your program at a location previous to a
suspected trouble spot (TR1) and just after the trouble spot (TR0). This way the trace will only show
program lines that pertain to the debugging process.
ARGUMENTS: TR n where
n=0 or 1
0 disables function
1 enables function
USAGE:
While Moving Yes Default Value 0
Can be Interrogated No
227
LEGEND-MC User’s Manual
TS (Tell Switches)
[Status]
DESCRIPTION:
TS returns the state of the Home switch, Forward and Reverse Limit switch, error conditions, motion
condition and motor state. The value returned by this command is decimal and represents an 8 bit value
(decimal value ranges from 0 to 255). Each bit represents the following status information.
Bit Status
Bit 7 Axis in motion if high
NOTE: The value for bits 1, 2 and 3 depend on the limit switch and home switch configuration (see
CN command). For active low configuration (default), these bits are ‘1’ when the switch is inactive
and ‘0’ when active. For active high configuration, these bits are ‘0’ when the switch is inactive and
‘1’ when active.
OPERAND USAGE:
_TSX contains the current status of the switches.
228
LEGEND-MC User’s Manual
EXAMPLES:
Assigns value of TS to the variable V1
V1=
229
LEGEND-MC User’s Manual
TT (Tell Torque)
[Status]
DESCRIPTION:
The TT command reports the value of the analog servo command output signal, which is a number between
-9.998 and 9.998 volts. This value is up-dated every servo cycle.
ARGUMENTS: TT XYZW or ABCDEFGH
USAGE:
While Moving Yes Minimum Value -9.9988
OPERAND USAGE:
_TTn contains the value of the torque where n is an axis letter.
RELATED COMMANDS:
"TL" Torque Limit
EXAMPLES:
V1=_TT Assigns value of TT to variable, V1
TT Report torque
230
LEGEND-MC User’s Manual
TV (Tell Velocity)
[Status]
DESCRIPTION:
The TV command returns the actual velocity in units of quadrature count/s. The value returned includes the
sign. This value is averaged over 256 servo cycles.
ARGUMENTS: TV XYZW or ABCDEFGH
USAGE:
While Moving Yes Minimum Value -12,000,000
OPERAND USAGE:
_TVn contains the value for the velocity where n is an axis letter.
EXAMPLES:
VELX=_TV Assigns value of velocity to the variable VELX
0003420
231
LEGEND-MC User’s Manual
TW (Time Wait)
[Setting]
DESCRIPTION:
The TW n command sets the timeout in msec to declare an error if the MC command is active and the motor
is not at or beyond the actual position within n msec after the completion of the motion profile. If a timeout
occurs, then the MC trippoint will clear and the stopcode will be set to 99. An application program will jump
to the special label #MCTIME. If included, the RE command should be used to return from the #MCTIME
subroutine.
ARGUMENTS: TW x, y, z, w or TWX=x or TW a, b, c, d, e, f, g, h where
x, y z, w, or a, b, c, d, e, f, g, h are signed integers
n specifies timeout in msec, -1 disables the timeout
USAGE:
While Moving Yes Minimum n Value -1
OPERAND USAGE:
_TW contains the timeout in msec for the MC command .
RELATED COMMANDS:
"MC" Motion Complete - "In Position"
232
LEGEND-MC User’s Manual
UL (Upload)
[General]
DESCRIPTION:
The UL command transfers data from the LEGEND-MC to a host computer. Programs are sent without
line numbers. The Uploaded program will be followed by a <control>Z or a \ as an end of Text marker.
ARGUMENTS: None
USAGE:
While Moving Yes Default Value n/a
Can be Interrogated No
OPERAND USAGE:
When used as an operand, _UL gives the number of available variables. The total number of variables is
126.
RELATED COMMAND:
"DL" Download
EXAMPLES:
UL; Begin upload
#A Line 0
NO Program Line 2
EN Line 3
<cntrl>Z Terminator
233
LEGEND-MC User’s Manual
VA (Vector Acceleration)
[Motion]
DESCRIPTION:
This command sets the acceleration rate of the vector in a coordinated motion sequence.
ARGUMENTS: VA n where
n is an unsigned integer. The parameter input will be rounded down to the nearest factor of 1024. The units
of the parameter is counts per second squared.
USAGE:
While Moving Yes Minimum n Value 1024
In a Program Yes Maximum n Value 67107840
Command Line Yes Default Value 256000
Can be Interrogated Yes Default Format Position Format
Used as an Operand Yes Distributed Control No, Local
OPERAND USAGE:
_VA contains the value of the vector acceleration.
RELATED COMMANDS:
"VS" Vector Speed
"VP" Vector Position
"VE" End Vector
"VM" Vector Mode
"BGS" Begin Sequence
"VD" Vector Deceleration
"VS" Vector smoothing constant - S-curve
EXAMPLES:
VA 1024 Set vector acceleration to 1024 counts/sec2
VA ? Return vector acceleration
00001024
234
LEGEND-MC User’s Manual
VD (Vector Deceleration)
[Motion]
DESCRIPTION:
This command sets the deceleration rate of the vector in a coordinated motion sequence.
ARGUMENTS: VD n where
n is an unsigned integer. The parameter input will be rounded down to the nearest factor of 1024. The units
of the parameter is counts per second squared.
USAGE:
While Moving Yes Minimum n Value 1024
In a Program Yes Maximum n Value 67107840
Command Line Yes Default Value 256000
Can be Interrogated Yes Default Format Position Format
Used as an Operand Yes Distributed Control No, Local
OPERAND USAGE:
_VD contains the value of the vector deceleration.
RELATED COMMANDS:
"VA" Vector Acceleration
"VS" Vector Speed
"VP" Vector Position
"VE" Vector End
"VM" Vector Mode
"BGS" Begin Sequence
"VT" Smoothing constant - S-curve
EXAMPLES:
235
LEGEND-MC User’s Manual
VE (Vector End)
[Motion]
DESCRIPTION:
VE is required to specify the end segment of a coordinated move sequence. VE follows the final VP or CR
command in a sequence. VE is equivalent to the LE command. If a VE command is not issued before the
controller runs all the linear segments, motion will stop instantaneously.
ARGUMENTS: None
USAGE:
While Moving Yes Default Value -
OPERAND USAGE:
_VE contains the length of the vector in counts.
RELATED COMMANDS:
"VM" Vector Mode
EXAMPLES:
VM XY Vector move in XY
VE End sequence
236
LEGEND-MC User’s Manual
VF (Variable Format)
[General]
DESCRIPTION:
The VF command allows the variables and arrays to be formatted for number of digits before and after the
decimal point. When displayed, the value m represents the number of digits before the decimal point, and
the value n represents the number of digits after the decimal point. When in hexadecimal, the string will be
preceded by a $. Hex numbers are displayed as 2's complement with the first bit used to signify the sign.
If a number exceeds the format, the number will be displayed as the maximum possible positive or
negative number (i.e. 999.99, -999, $8000 or $7FF).
ARGUMENTS: VF m.n where
m and n are unsigned numbers. A negative m specifies hexadecimal format.
USAGE:
While Moving Yes Minimum m Value -8
Default n Value 4
OPERAND USAGE:
_VF contains the value of the format for variables and arrays.
EXAMPLES:
VF 5.3 Sets 5 digits of integers and 3 digits after the
decimal point
237
LEGEND-MC User’s Manual
USAGE:
While Moving Yes Minimum n Value 0.0001
In a Program Yes Maximum n Value 10
Command Line Yes Default Value 1
Default Format -
Distributed Control No, Local
OPERAND USAGE:
_VR contains the vector speed ratio.
RELATED COMMANDS:
"VS" on page Vector Speed
EXAMPLES:
#A Vector Program
VMXY Vector Mode
VP 1000,2000 Vector Position
VE End Sequence
VS 2000 Vector Speed
BGS Begin Sequence
AMS After Motion
JP#A Repeat Move
#SPEED Speed Override
VR@AN[1]*.1 Read analog input compute ratio
JP#SPEED Loop
XQ#A,0; XQ#SPEED,1 Execute task 0 and 1 simultaneously
NOTE: UseVR for feedrate override, when specifying the speed of individual segments using the
operator ‘<’.
238
LEGEND-MC User’s Manual
VS (Vector Speed)
[Motion]
DESCRIPTION:
The VS command specifies the speed of the vector in a coordinated motion sequence in either the LM or
VM modes. VS may be changed during motion.
Vector Speed can be calculated by taking the square root of the sum of the squared values of speed for each
axis specified for vector or linear interpolated motion.
ARGUMENTS: VS n where
n is an unsigned even number. The units are counts per second.
USAGE:
While Moving Yes Minimum n Value 2
OPERAND USAGE:
_VS contains the vector speed.
RELATED COMMANDS:
"VA" Vector Acceleration
EXAMPLES:
VS 2000 Define vector speed
002000
NOTE: Vector speed can be attached to individual vector segments. For more information, see description of VP, CR, and
LI commands.
239
LEGEND-MC User’s Manual
USAGE:
While Moving Yes Minimum n Value 0.004
OPERAND USAGE:
_VT contains the vector time constant.
RELATED COMMANDS:
"IT" Independent Time Constant for smoothing
independent moves
EXAMPLES:
VT 0.8 Set vector time constant
0.8
240
LEGEND-MC User’s Manual
Can be Interrogated No
RELATED COMMANDS:
"CM" Contour Mode
EXAMPLES:
CM Specify contour mode
CD 100
DT 0 Stop contour
CD 0 Exit mode
241
LEGEND-MC User’s Manual
WT (Wait)
[Trippoint]
DESCRIPTION:
The WT command is a trippoint used to time events. After this command is executed, the controller will
wait for the number of samples specified before executing the next command. If the TM command has not
been used to change the sample rate from 1 msec, then the units of the Wait command are milliseconds.
ARGUMENTS: WT n where
n is an integer
USAGE:
While Moving Yes Minimum Value 0
EXAMPLES:
Assume that 10 seconds after a move is over a relay must be closed.
#A Program A
SB 1 Turn on relay
EN End Program
242
LEGEND-MC User’s Manual
XQ (Execute Program)
[General]
DESCRIPTION:
The XQ command begins execution of a program residing in the program memory of the controller.
Execution will start at the label or line number specified. Four programs may be executed simultaneously
to perform multitasking. The XQ command cannot be used to execute a thread that is already running.
ARGUMENTS: XQ #A,n XQm,n where
A is a program label of up to seven characters
m is a line number
n is the thread number 0 through 3
NOTE: The arguments for the command, XQ, are optional when issued via external device. If no
arguments are given, the first line of the program will be executed as thread 0.
USAGE:
While Moving Yes Default Value n=0
Can be Interrogated No
OPERAND USAGE:
_XQn contains the current line number of execution for thread n, and -1 if thread n is not running.
RELATED COMMANDS:
"HX" on page Halt execution
EXAMPLES:
XQ Start execution issued from serial port or
Ethernet to start at the top of the program as
thread 0.
243
LEGEND-MC User’s Manual
OPERAND USAGE:
_ZSn contains the stack level for the specified thread where n = 0 or 1. The response, an integer between
zero and seven, indicates zero for beginning condition and 15 for the deepest value.
EXAMPLES:
II1 Input Interrupt on 1
S= Print stack
ZS Zero stack
S= Print stack
EN End
244
LEGEND-MC User’s Manual
_CN2 Returns the configuration of the latch input configuration -1 = Active Low 1 = Active High -1 = Active Low
_CW Port #1 data adjustment (MG from prog, status 1=SET 2=OFF 2=OFF
chars have bit 8 set)
_DA Number of available arrays quantity 0 14 14
_DB State of Dynamic Brake Setting configuration 0 = OFF 1 = ON 1
_DCx Axis deceleration rate counts/sec2 1024 67107840 256000
_DEx Encoder position of the auxiliary encoder counts -2147483648 2147483647 n/a
_DL Number of available labels quantity 0 254 254
_DM Number of available array locations quantity 0 2000 2000
_DPx Current encoder position of axis counts -2147483648 2147483647 n/a
_DT Time interval for contour mode 2N mSec 0 8 0
_DVx Is the axis using dual loop PID? status 0=NO 1=YES 0=NO
_EB Is CAM mode enabled? status 0=NO 1=YES 0=NO
_EC returns the current index into the cam table pointer 0 359 0
_ED The last line that caused a CMDERR line number 0 999 n/a
_EGx Is CAMMING axis engaged? status 0=NO 1=YES 0=NO
_EMx Cam cycle for camming (master or slave) counts 0 2147483647 0
_EO Is echo mode on? status 0=NO 1=YES 0=NO
_EP CAMMING interval (resolution) counts 1 32767 256
_EQx Status of ECAM slave status 0 3 0
_ERx Axis following error limit counts 0 32767 16384
_ES Ellipse scale ratio n/a 0.0001 1 1
_FAx Axis acceleration feedforward constant 0 8191 0
_FLx Forward software limit counts -2147483648 2147483647 2147483647
_FVx Axis velocity feedforward constant 0 8191 0
_GRx Gear ratio of the axis constant -127.9999 127.9999 0
_HC Status of Handle Connect Command status 0 = FAIL 2 = SUCCESS 0
_HMx State of the home switch status 0=ACTIVE 1=INACTIVE n/a
_HR Configuration of Handle Restore Command configuration 0 = OFF 1 = SET 0
245
LEGEND-MC User’s Manual
P1NM The last number received from serial port number -2147483648 2147483647 n/a
P1ST The last string received from serial port string 6 chars max n/a
_PAx Last commanded absolute position if counts -2147483648 2147483647 0
moving, otherwise current position
246
LEGEND-MC User’s Manual
247
LEGEND-MC User’s Manual
NOTES:
248
LEGEND-MC User’s Manual
5 Programming Basics
Introduction
The LEGEND-MC provides over 100 commands for specifying motion and machine parameters.
Commands are included to initiate action, interrogate status and configure the digital filter.
The LEGEND-MC instruction set is BASIC-like and easy to use. Instructions usually consist of two
uppercase letters that normally correspond phonetically with the appropriate function. For example, the
instruction BG begins motion, and ST stops motion.
Commands can be sent "live" for immediate execution by the LEGEND-MC, or an entire group of
commands (a program) can be downloaded into the LEGEND-MC memory for execution at a later time.
Combining commands into groups for later execution is referred to as Applications Programming and is
discussed in the following chapter.
This section describes the LEGEND-MC instruction set and syntax. A complete listing of all LEGEND-
MC instructions is included in the command reference section.
Program Maximums
Commands per line Until 80 characters
Labels among all threads 126
Lines among all threads 500
Subroutine nesting level 16
Threads 4
Command Syntax
LEGEND-MC instructions are represented by two ASCII upper case characters followed by applicable
arguments. A space may be inserted between the instruction and arguments. A semicolon or <enter> is
used to terminate the instruction for processing by the LEGEND-MC command interpreter.
All axes data may be specified at once using the * symbol. This sets all axes to have the same data. For
example:
PR*=1000 Sets all axes to 1000
Instead of data, some commands request action to occur on an axis or group of axes. For example, ST XY
stops motion on both the X and Y axes. Commas are not required in this case since the particular axis is
specified by the appropriate letter X Y Z or W. If no parameters follow the instruction, action will take
place on all axes. The letter S is used to specify a coordinated motion sequence.
BG X Begin X only
BG Y Begin Y only
BG D Begin D only
250
LEGEND-MC User’s Manual
For example, if the command bg is sent in lower case, the LEGEND-MC will return a ?.
? LEGEND-MC returns a ?
VERY IMPORTANT!
The command Tell Code, TC1, will return the reason for the “?” received for the last invalid command.
There are several coded reasons for receiving a ?. Example codes include unrecognized command (such
as typographical entry or lower case), a command given at improper time, or a command out of range,
such as exceeding maximum speed. A complete listing of all codes is listed in the TC command in the
Command Reference section.
For interrogation instructions such as Tell Position (TP) or Tell Status (TS), the LEGEND-MC returns
the requested data on the next line followed by a carriage return and line feed. The data returned is in
decimal format.
The format of the returned data can be set using the Position Format (PF) and Variable Format (VF)
command.
251
LEGEND-MC User’s Manual
Command Summary
Each LEGEND-MC command is described fully in the command reference section of this manual. A
summary of the commands follows.
The commands are grouped in this summary by the following functional categories:
• Motion
• Program Flow
• General Configuration
• Control Settings
• Status and Error/Limits
Motion commands are those to specify modes of motion such as Jog Mode or Linear Interpolation, and to
specify motion parameters such as speed, acceleration and deceleration, and distance.
Program flow commands are used in Application Programming to control the program sequencer. They
include the jump on condition command and event triggers such as after position and after elapsed time.
General configuration commands are used to set controller configurations such as setting and clearing
outputs, formatting variables, and motor/encoder type.
The control setting commands include filter settings such as KP, KD, and KI and sample time.
Error/Limit commands are used to configure software limits and position error limits.
Motion
AB Abort Motion
AC Acceleration
BG Begin Motion
CD Contour Data
CM Contour Mode
DC Deceleration
ES Ellipse Scaling
FE Find Edge
FI Find Index
252
LEGEND-MC User’s Manual
GR Gear Ratio
HM Home
IP Increment Position
JG Jog Mode
LT Latch Target
PA Position Absolute
PR Position Relative
SP Speed
ST Stop
VA Vector acceleration
VD Vector Deceleration
VP Vector Position
VS Vector Speed
253
LEGEND-MC User’s Manual
Program Flow
AD After Distance
AI After Input
AS At Speed
AT After Time
EN End Program
HX Halt Task
IF IF Conditional Statement
IN Input Variable
II Input Interrupt
JS Jump To Subroutine
MG Message
NO No operation
WT Wait
XQ Execute Program
254
LEGEND-MC User’s Manual
General Configuration
AF Analog Feedback
AL Arm Latch
BN Burn
BP Burn Program
BV Burn Variables
CB Clear Bit
CE Configure Encoder
CN Configure Switches
DA De-Allocate Arrays
DB Dynamic Brake
DL Download
DM Dimension Arrays
DP Define Position
EO Echo Off
HC Handle Connect
HR Handle Restore
HS Handle Switch
HW Handle Wait
LC Lock Controller
LS List
MO Motor Off
MT Motor Type
MW Modbus Wait
OB Output Bit
OP Output Port
PF Position Format
PW Password
QD Download Array
QU Upload Array
RA Record Array
RC Record
RD Record Data
RS Reset
SB Set Bit
255
LEGEND-MC User’s Manual
UL Upload
VF Variable Format
IL Integrator Limit
KD Derivative Constant
KI Integrator Constant
KP Proportional Constant
NB Notch Bandwidth
NF Notch Filter
NZ Notch Zero
OF Offset
SH Servo Here
TL Torque Limit
TM Sample Time
Status
RL Report Latch
SC Stop Code
TB Tell Status
TE Tell Error
TI Tell Input
TP Tell Position
TA Tell Alarm
TH Tell Handle
QL Query Latch
RL Report Latch
TR Trace
TS Tell Switches
256
LEGEND-MC User’s Manual
TT Tell Torque
TV Tell Velocity
ER Error Limit
OE Off on Error
Arithmetic Functions
@COS Cosine
@RND Round
@SIN Sine
+ Add
- Subtract
* Multiply
/ Divide
& And
| Or
() Parentheses
257
LEGEND-MC User’s Manual
NOTES:
258
LEGEND-MC User’s Manual
6 Programming Motion
Overview
The LEGEND-MC provides several modes of motion, including independent positioning and jogging,
coordinated motion, electronic cam motion, and electronic gearing. Each one of these modes is discussed
in the following sections.
The LEGEND-MC is a single axis controller and uses X-axis motion only. The example applications
described below will help guide you to the appropriate mode of motion.
259
LEGEND-MC User’s Manual
260
LEGEND-MC User’s Manual
NOTE: The actual motor motion may not be complete when the profile has been completed, however, the
next motion command may be specified.
The Begin (BG) command can be issued for all axes either simultaneously or independently. X or Y axis
specifiers are required to select the axes for motion. When no axes are specified, this causes motion to
begin on all axes.
The speed (SP) and the acceleration (AC) can be changed at any time during motion, however, the
deceleration (DC) and position (PR or PA) cannot be changed until motion is complete. Remember,
motion is complete (AM) when the profiler is finished, not when the actual motor is in position. The Stop
command (ST) can be issued at any time to decelerate the motor to a stop before it reaches its final
position.
An incremental position movement (IP) may be specified during motion as long as the additional move is
in the same direction. Here, the user specifies the desired position increment, n. The new target is equal to
the old target plus the increment, n. Upon receiving the IP command, a revised profile will be generated
for motion towards the new end position. The IP command does not require a begin. NOTE: If the motor
is not moving, the IP command is equivalent to the PR and BG command combination.
Command Description
PR x,y Specifies relative distance
PA x,y Specifies absolute position
SP x,y Specifies slew speed
AC x,y Specifies acceleration rate
DC x,y Specifies deceleration rate
BG XY Starts motion
ST XY Stops motion before end of move
IP x,y Changes position target
IT x,y Time constant for independent motion smoothing
AM XY Trippoint for profiler complete
MC XY Trippoint for "in position"
The lower case specifiers (x,y) represent position values for each axis. The Legend-MC also allows use
of single axis specifiers such as PRY=2000.
261
LEGEND-MC User’s Manual
The following illustration - Velocity Profiles of XY shows the velocity profiles for the X and Y axis.
Instruction Interpretation
#A Begin Program
PR 2000,100 Specify relative position movement of 2000 and 100 counts for the X
and Y axes.
WT 40 Wait 40 msec
EN End Program
VELOCITY
(COUNTS/SEC)
15000
Y axis velocity profile
10000
5000
TIME (ms)
0 20 40 60 80 100
Velocity Profiles of XY
Notes on Velocity Profiles of XY illustration: The X axis has a ‘trapezoidal’ velocity profile, while the Y axis has a
‘triangular’ velocity profile. The X axis accelerates to the specified speed, moves at this constant speed, and then
decelerates such that the final position agrees with the commanded position, PR. The Y axis accelerates, but before the
specified speed is achieved, must begin deceleration such that the axis will stop at the commanded position.
262
LEGEND-MC User’s Manual
Independent Jogging
The jog mode of motion is very flexible because speed, direction and acceleration can be changed during
motion. The user specifies the jog speed (JG), acceleration (AC), and the deceleration (DC) rate for each
axis. The direction of motion is specified by the sign of the JG parameters. When the begin command is
given (BG), the motor accelerates up to speed and continues to jog at that speed until a new speed or stop
(ST) command is issued. If the jog speed is changed during motion, the controller will make an
accelerated (or decelerated) change to the new speed.
An instant change to the motor position can be made with the use of the IP command. Upon receiving
this command, the controller commands the motor to a position which is equal to the specified increment
plus the current position. This command is useful when trying to synchronize the position of two motors
while they are moving.
Note that the controller operates as a closed-loop position controller while in the jog mode. The
LEGEND-MC converts the velocity profile into a position trajectory and a new position target is
generated every sample period. This method of control results in precise speed regulation with phase lock
accuracy.
Command Description
AC x,y Specifies acceleration rate
BG XY Begins motion
ST XY Stops motion
Parameters can be set with individual axis specifiers such as JGY=2000 (set jog speed for Y axis to 2000)
or AC 400000, 400000 (set acceleration for X and Y axes to 400000).
263
LEGEND-MC User’s Manual
Additional Commands
The commands VS n, VA n, and VD n are used to specify the vector speed, acceleration, and deceleration.
The LEGEND-MC computes the vector speed based on the axes specified in the LM mode. For example,
VT is used to set the S-curve smoothing constant for coordinated moves. The command AV n is the ‘After
Vector’ trippoint, which halts program execution until the vector distance of n has been reached.
264
LEGEND-MC User’s Manual
Instruction Interpretation
LI 4000 <4000 >1000 Specify first linear segment with a vector speed of 4000 and
end speed 1000
LI 1000 < 4000 >1000 Specify second linear segment with a vector speed of 4000
and end speed 1000
LI 0 < 4000 >1000 Specify third linear segment with a vector speed of 4000 and
end speed 1000
EN Program end
Changing Feedrate:
The command VR n allows the feedrate, VS, to be scaled between 0 and 10 with a resolution of .0001.
This command takes effect immediately and causes VS to be scaled. VR also applies when the vector
speed is specified with the ‘<’ operator. This is a useful feature for feedrate override. VR does not ratio
265
LEGEND-MC User’s Manual
the accelerations. For example, VR .5 results in the specification VS 2000 to be divided in half.
Command Description
LMX Specify axes for linear interpolation
LI x < n Specify incremental distances relative to current position, and assign vector
speed n.
CS Clear sequence
To illustrate the ability to interrogate the motion status, consider the first motion segment of our example,
#LMOVE, where the X axis moves toward the point X=5000. Suppose that when X=3000, the controller
is interrogated using the command ‘MG _AV’. The returned value will be 3000. The value of _CS and
_VPX will be zero.
266
LEGEND-MC User’s Manual
NOTE: This ‘internal’ definition of zero does not affect the absolute coordinate system or subsequent coor-
dinated motion sequences.
The command, VP x specifies the coordinates of the end points of the vector movement with respect to
the starting point.
Up to 511 VP segments may be specified in a single sequence and must be ended with the command VE.
The motion can be initiated with a Begin Sequence (BGS) command. Once motion starts, additional
segments may be added.
The Clear Sequence (CS) command can be used to remove previous VP commands which were stored in
the buffer prior to the start of the motion. To stop the motion, use the instructions STS or AB1. ST stops
motion at the specified deceleration. AB1 aborts the motion instantaneously.
The Vector End (VE) command must be used to specify the end of the coordinated motion. This
command tells the controller to decelerate to a stop following the last motion in the sequence. If a VE
command is not given, an Abort (AB1) must be used to abort the coordinated motion sequence.
The user must keep enough motion segments in the LEGEND-MC sequence buffer to ensure continuous
motion. If the controller receives no additional motion segments and no VE command, the controller will
stop motion instantly at the last vector. There will be no controlled deceleration. LM? or _LM returns the
available spaces for motion segments that can be sent to the buffer. 511 returned means the buffer is
empty and 511 segments can be sent. A zero means the buffer is full and no additional segments can be
sent. As long as the buffer is not full, additional segments can be sent at the PCI bus speed.
The operand _CS can be used to determine the value of the segment counter.
Additional Commands
The commands VS n, VA n and VD n are used for specifying the vector speed, acceleration, and
deceleration. VT is the motion smoothing constant used for coordinated motion.
267
LEGEND-MC User’s Manual
VP x < n >m
The first parameter, <n, is equivalent to commanding VSn at the start of the given segment and will cause
an acceleration toward the new commanded speeds, subjects to the other constraints.
The second parameter, > m, requires the vector speed to reach the value m at the end of the segment. Note
that the function > m may start the deceleration within the given segment or during previous segments, as
needed to meet the final speed requirement, under the given values of VA and VD.
Note, however, that the controller works with one > m command at a time. As a consequence, one
function may be masked by another. For example, if the function >100000 is followed by >5000, and the
distance for deceleration is not sufficient, the second condition will not be met. The controller will attempt
to lower the speed to 5000, but will reach that at a different point.
Changing Feedrate:
The command VR n allows the feedrate, VS, to be scaled from 0 and 10 times with a resolution of .0001.
This command takes effect immediately and causes VS scaled. VR also applies when the vector speed is
specified with the ‘<’ operator. This is a useful feature for feedrate override. VR does not ratio the
accelerations. For example, VR .5 results in the specification VS 2000 act as VS 1000.
Trippoints:
The AV n command is the After Vector trippoint, which waits for the vector relative distance of n to occur
before executing the next command in a program.
Command Description
VM m,n Specifies the axes for planar motion where m and n represent the planar axes
and p is the tangent axis.
CS Clear sequence.
LM? Return number of available spaces for linear and circular segments in
LEGEND-MC sequence buffer. Zero means buffer is full. 512 means buffer is
empty.
268
LEGEND-MC User’s Manual
Operand Description
_vpm The absolute coordinate of the axes at the last intersection along the sequence.
_LM Number of available spaces for linear and circular segments in the LEGEND-
MC sequence buffer. Zero means buffer is full. 512 means buffer is empty.
_CS Segment counter - Number of the segment in the sequence, starting at zero.
When AV is used as an operand, _AV returns the distance traveled along the sequence.
The operands _VPX and _VPY can be used to return the coordinates of the last point specified along the
path.
269
LEGEND-MC User’s Manual
Electronic Gearing
With the LEGEND-MC, the master is always the auxiliary encoder. The master may rotate in both
directions and the geared axis will follow at the specified gear ratio.
The GA command is unnecessary for the LEGEND-MC, as the auxiliary encoder is automatically used.
GR x,y specifies the gear ratios for the slaves where the ratio may be a number between +/-127.9999 with
a fractional resolution of .0001. GR 0,0 turns off gearing in both modes. A limit switch or ST command
disables gearing.
GR causes the specified axes to be geared to the actual position of the master.
Electronic gearing allows the geared motor to perform a second independent or coordinated move in
addition to the gearing. For example, when a geared motor follows a master at a ratio of 1:1, it may be
advanced an additional distance with PR, JG, VP, or LI commands.
Command Description
GA n Specifies master axes for gearing where n=DX for auxiliary encoder.
270
LEGEND-MC User’s Manual
Electronic Cam
The electronic cam is a motion control mode which enables the periodic synchronization of the servo
motor with an external device. The LEGEND-MC uses the auxiliary encoder as the master axis.
The electronic cam is a more detailed type of electronic gearing which allows a table-based relationship
between the axes. To illustrate the procedure of setting the cam mode, consider the cam relationship for
the slave axis X. Such a graphic relationship is shown in the following illustration - Electronic Cam
Example.
Step 2. Specify the master cycle and the change in the slave axis.
In the electronic cam mode, the position of the master is always expressed within one cycle. In this
example, the position of x is always expressed in the range between 0 and 6000. Similarly, the slave
position is also redefined such that it starts at zero and ends at 1500. At the end of a cycle when the
master is 6000 and the slave is 1500, the positions of both x and y are redefined as zero. To specify the
master cycle and the slave cycle change, we use the instruction EM and MM.
EM x; MMx
where EMx specifies the cycle of the slave over one cycle and MMx specifies the cycle of the master.
The cycle of the master is limited to 8,388,607 whereas the slave change per cycle is limited to
2,147,483,647. If the change is a negative number, the absolute value is specified. For the given example,
the cycle of the master is 6000 counts and the change in the slave is 1500. Therefore, we use the
instructions:
EM 1500; MM 6000
Step 3. Specify the master interval and starting point.
Next we need to construct the ECAM table. The table is specified at uniform intervals of master
positions. Up to 256 intervals are allowed. The size of the master interval and the starting point are
specified by the instruction:
EP m,n
where m is the interval width in counts, and n is the starting point.
For the given example, we can specify the table by specifying the position at the master points of 0, 2000,
4000 and 6000. We can specify that by
EP 2000,0
271
LEGEND-MC User’s Manual
The value, n, starts at zero and may go up to 256. The parameter x indicates the corresponding slave
position. For this example, the table may be specified by
ET[0]=0
ET[1]=3000
ET[2]=2250
ET[3]=1500
This specifies the ECAM table.
3000
2250
1500
272
LEGEND-MC User’s Manual
This disengages the slave axis at a specified master position. If the parameter is outside the master cycle,
the stopping is instantaneous.
To illustrate the complete process, consider the cam relationship described by
the equation:
The cam table can be constructed manually, point by point, or automatically by a program. The following
program includes the set-up.
The instruction EAX defines X as the master axis. The cycle of the master is
2000. Over that cycle, X varies by 1000. This leads to the instruction EM 2000,1000.
Suppose we want to define a table with 100 segments. This implies increments of 20 counts each. If the
master points are to start at zero, the required instruction is EP 20,0.
The following routine computes the table points. As the phase equals 0.18X and X varies in increments
of 20, the phase varies by increments of 3.6°. The program then computes the values of SLAVE
according to the equation and assigns the values to the table with the instruction ET[N] = SLAVE.
Instruction Interpretation
#SETUP Label
N=0 Index
N = N+1
EN
Now suppose that the slave axis is engaged with a start signal, input 1, but that both the engagement and
disengagement points must be done at the center of the cycle: X = 1000 and Y = 500. This implies that Y
must be driven to that point to avoid a jump.
273
LEGEND-MC User’s Manual
Instruction Interpretation
#RUN Label
SP,5000 Y speed
AM After Y moved
EN End
274
LEGEND-MC User’s Manual
Contour Mode
The LEGEND-MC also provides a contouring mode. This mode allows any arbitrary position curve to be
prescribed for any motion axes. This is ideal for following computer generated paths such as parabolic,
spherical or user-defined profiles. The path is not limited to straight line and arc segments and the path
length may be infinite.
When the controller receives the command to generate a trajectory along these points, it interpolates
linearly between the points. The resulting interpolated points include the position 12 at 1 msec, position
24 at 2 msec, etc.
The programmed commands to specify the above example are:
Instruction Description
#A Label
EN
275
LEGEND-MC User’s Manual
POSITION
(COUNTS)
336
288
240
192
96
48 TIME (ms)
0 4 8 12 16 20 24 28
SEGMENT 1 SEGMENT 2 SEGMENT 3
Additional Commands
The command, WC, is used as a trippoint "When Complete" or “Wait for Contour Data”. This allows the
LEGEND-MC to use the next increment only when it is finished with the previous one. Zero parameters
for DT followed by zero parameters for CD exit the contour mode.
If no new data record is found and the controller is still in the contour mode, the controller waits for new
data. No new motion commands are generated while waiting. If bad data is received, the controller
responds with a ?.
Command Description
CM X Specifies the X-axis for contouring mode. In a distributed control system, any
non-contouring axes may be operated in other modes.
CD x Specifies position increment over time interval. Range is +/-32,000. Zero ends
contour mode.
WC Waits for previous time interval to be complete before next data record is
processed.
276
LEGEND-MC User’s Manual
Motion Smoothing
The LEGEND-MC controller allows the smoothing of the velocity profile to reduce mechanical
vibrations in the system.
Trapezoidal velocity profiles have acceleration rates which change abruptly from zero to maximum
value. The discontinuous acceleration results in jerk which causes vibration. The smoothing of the
acceleration profile leads to a continuous acceleration profile and reduces the mechanical shock and
vibration.
Command Description
IT x,y Independent time constant
The command IT is used for smoothing independent moves of the type JG, PR, PA and the command VT
is used to smooth vector moves of the type VM and LM.
The smoothing parameters x,y and n are numbers between 0 and 1 and determine the degree of filtering.
The maximum value of 1 implies no filtering, resulting in trapezoidal velocity profiles. Smaller values of
the smoothing parameters imply heavier filtering and smoother moves.
Note that the smoothing process results in longer motion time.
277
LEGEND-MC User’s Manual
Homing
The Find Edge (FE) and Home (HM) instructions are used to home the motor to a mechanical reference.
This reference is connected to the Home input line. The HM command initializes the motor to the encoder
index pulse in addition to the Home input. The configure command (CN) defines polarity of the home
input.
The Find Edge (FE) instruction is useful for initializing the motor to a home switch. The home switch is
connected to the Home input. When the Find Edge command and Begin are used, the motor will
accelerate up to the slew speed and slew until a transition is detected on the homing line. The motor will
then decelerate to a stop. A high deceleration value must be input before the find edge command is issued
for the motor to decelerate rapidly after sensing the home switch. The velocity profile generated is shown
in the following illustration - Motion intervals in the Home sequence.
The Home (HM) command can be used to position the motor on the index pulse after the home switch is
detected. This allows for finer positioning on initialization. The command sequence HM and BG causes
the following sequence of events to occur.
1. Upon beginning, the motor accelerates to the slew speed. The direction of its motion is deter-
mined by the homing input. A zero (GND) will cause the motor to start in the forward direction;
+24V will cause it to start in the reverse direction. The CN command defines the polarity of the
home input.
2. Upon detecting a change in state on the home input, the motor begins decelerating to a stop.
3. The motor then traverses very slowly back until the home switch toggles again.
4. The motor then traverses forward until the encoder index pulse is detected.
5. The LEGEND-MC defines the home position as the position at which the index was detected and
sets the encoder reading at this position to zero.
MOTION BEGINS
TOWARD HOME
DIRECTION
POSITION
MOTION REVERSE
TOWARD HOME
DIRECTION
POSITION
POSITION
INDEX PULSES
POSITION
HOME SWITCH
POSITION
278
LEGEND-MC User’s Manual
NOTE: To insure a position capture within 25 microseconds, the input signal must be a transition from
high to low.
The LEGEND-MC software commands AL and RL are used to arm the latch and report the latched
position. The steps to use the latch are as follows:
1. Give the AL X command to arm the latch for the main (LEGEND) encoder.
2. Test to see if the latch has occurred by using the _ALX command. Example, V1=_ALX returns
the state of the X latch to the variable V1. V1 is 1 if the latch has not occurred.
3. After the latch has occurred, read the captured position with the RLX command or _RLX.
To capture the position of the auxiliary encoder, use the command ALSX. The input must be wired to
general input 2. _QL holds the captured position.
279
LEGEND-MC User’s Manual
NOTES:
280
LEGEND-MC User’s Manual
7 Application Programming
Introduction
The LEGEND-MC programming language is a powerful language that allows users to customize a
program to handle their application. Complex programs can be downloaded into the LEGEND-MC
memory for later execution. Utilizing the LEGEND-MC to execute sophisticated programs frees the host
computer for other tasks. The host computer can still send commands to the controller any time, even
while a program is being executed.
In addition to standard motion commands, the LEGEND-MC provides commands that allow the
LEGEND-MC to make its own decisions. These commands include conditional jumps, event triggers,
and subroutines. For example, the command JP#LOOP, N<10 causes a jump to the label #LOOP if the
variable N is less than 10.
For flexibility, the LEGEND-MC provides 254 user-defined variables, arrays and arithmetic functions,
i.e.; length in a cut-to-length operation can be specified as a variable in a program and assigned by an
operator.
The following sections in this chapter discuss all aspects of creating applications programs.
Program Format
A LEGEND-MC program consists of several LEGEND-MC instructions combined to solve a machine
control application. Action instructions, such as starting and stopping motion, are combined with
Program Flow instructions to form the complete program. Program Flow instructions evaluate real-time
conditions, such as elapsed time or motion complete, and alter program flow accordingly.
A delimiter must separate each LEGEND-MC instruction in a program. Valid delimiters are the
semicolon (;) or carriage return. The semicolon is used to separate multiple instructions on a single
program line. A carriage return enters the final command on a program line.
All LEGEND-MC programs must begin with a label and end with an End (EN) statement. Labels start
with the pound (#) sign followed by a maximum of seven characters. The first character must be a letter;
after that, numbers are permitted. Spaces are not permitted.
#BEGIN
#SQUARE
#X1
#BEGIN1
Invalid labels
#1Square
#123
281
LEGEND-MC User’s Manual
Special Labels
There are also some special labels, which are used to define input interrupt subroutines, limit switch
subroutines, error handling subroutines, and command error subroutines. Special labels provide the
application program a method of handling situations that would otherwise be difficult to program.
Example Program:
EN End of Program
The above program will execute automatically at power up and move X and Y 10000 and 20000 units.
After the motion is complete, the motors rest for 2 seconds. The cycle repeats indefinitely until the stop
command is issued. Automatic execution assumes that the program has been burned in using the BP
command.
282
LEGEND-MC User’s Manual
1. Only the main thread may use the input command, IN.
2. In a case of interrupts, due to inputs, limit switches, position errors or command errors, it is thread 0
which jumps to those subroutines.
The execution of the various programs is done with the instruction:
XQ #A, n
Where n indicates the thread number. To halt the execution of any thread, use the instruction
HX n
where n is the thread number.
Note that both the XQ and HX functions can be performed by an executing program.
Multitasking is useful for executing independent operations such as PLC functions that occur
independently of motion. The example below produces a waveform on Output 1 independent of a move.
The program above is executed with the instruction XQ #TASK2,0 which designates TASK2 as the main
thread. #TASK1 is executed within TASK2.
283
LEGEND-MC User’s Manual
Debugging Programs
The LEGEND-MC provides trace and error code commands which are used for debugging programs. The
trace command may be activated using the command, TR1. This command causes each line in a program
to be sent out to the communications port immediately prior to execution. The TR1 command is useful for
debugging programs. TR0 disables the trace function. The TR command may also be included as part of a
program.
If there is a program error, the LEGEND-MC will halt program execution at the line number at which an
error occurs and display the line. The user can obtain information about the type of error condition that
occurred by using the command, TC1. Check the TC (Tell Code) command reference page for a complete
listing of the codes.
JP Conditional Jump
JS Conditional Jump to Subroutine
MC Trigger "In position" trigger (TW x,y,z,w sets timeout for in-position)
MF Trigger Forward motion
MR Trigger Reverse motion
WC Wait for Contour Data
WT Wait for time to elapse
284
LEGEND-MC User’s Manual
When an event trigger instruction is decoded, however, the actual program sequence is halted. The
program sequence does not continue until the event trigger is "tripped". For example, the motion
complete trigger can be used to separate two move sequences in a program. The commands for the
second move sequence will not be executed until the motion is complete on the first motion sequence. In
this way, the LEGEND-MC can make decisions based on its own status or external events without
intervention from a host computer.
Command Function
AM X Y Z W or S Halts program execution until motion is complete on the
(A B C D E F G H) specified axes or motion sequence(s). AM with no
parameter tests for motion complete on all axes. This
command is for separating motion sequences in a
program.
285
LEGEND-MC User’s Manual
#TWOMOVE Label
PR 2000 Position Command
EN End program
In the above example, the AM trippoint is used to separate the two PR moves. If AM is not used, the
controller returns a ? for the second PR command because a new PR cannot be given until motion is
complete.
286
LEGEND-MC User’s Manual
#SETBIT Label
SP 10000 Speed is 10000
EN End program
The above example sets output bit 1 after a distance of 1000 counts from the start of the move. The
accuracy of the trippoint is the speed multiplied by the sample period.
#TRIP Label
JG 50000 Specify Jog Speed
STX Stop
EN End
287
LEGEND-MC User’s Manual
#VECTOR Label
VMXY;VS 5000 Coordinated path
VP 10000,20000 Vector position
VP 20000,30000 Vector position
VE End vector
BGS Begin sequence
AV 5000 After vector distance
VS 1000 Reduce speed
EN End
288
LEGEND-MC User’s Manual
#MOVES Label
PR 12000 Distance
SP 20000 Speed
AC 100000 Acceleration
EN End
#LOOP Loop
JP #LOOP Loop
EN
Conditional Jumps
The LEGEND-MC provides Conditional Jump (JP) and Conditional Jump to Subroutine (JS) instructions
for branching to a new program location based on a specified condition. Unlike event triggers, the
conditional jump instruction does not halt the program sequence. Instead, it tests to see if a condition is
satisfied and then branches to a new location or subroutine. (A subroutine is a group of commands
289
LEGEND-MC User’s Manual
defined by a label and EN command. After all the commands in the subroutine are executed, a return is
made to the main program). If the condition is not satisfied, the program sequence continues to the next
program line.
The JP and JS instructions have the following format:
Format: Meaning
JS destination, logical condition Jump to subroutine if logical condition is satisfied
JP destination, logical condition Jump to location if logical condition is satisfied
The destination is a program line number or label. The destination is where the program sequencer jumps
to if the specified condition is satisfied. The comma designates "IF". The logical condition tests two
operands with logical operators. The operands can be any valid LEGEND-MC numeric operand, including
variables, array elements, numeric values, functions, keywords, and arithmetic expressions.
Logical operators:
Operands:
Type Examples
Number V1=6
Numeric Expression V1=V7*6
@ABS[V1]>10
I/O V1>@AN[2]
@IN[1]=0
290
LEGEND-MC User’s Manual
Conditional Meaning
JP #LOOP,COUNT<10 Jump to #LOOP if the variable, COUNT, is less than 10
JP#A Jump to #A
Conditional jumps are useful for testing events in real-time. They allow the LEGEND-MC to make
decisions without a host computer. For example, the LEGEND-MC can decide between two motion
profiles based on the state of an input line. Or, the LEGEND-MC can keep track of how many times a
motion profile is executed.
Example:
Move the X motor to absolute position 1000 counts and back to zero ten times. Wait 100 msec between
moves.
291
LEGEND-MC User’s Manual
NOTE: Each condition must be placed in parentheses for proper evaluation by the controller. In addition,
the LEGEND-MC executes operations from left to right.
Examples
If the condition for the JP command is satisfied, the controller branches to the specified label or line
number and continues executing commands from this point. If the condition is not satisfied, the controller
continues to execute the next commands in sequence.
Format Meaning
Jump to #Loop if the variable, COUNT, is
JP #Loop, COUNT<10
less than 10
Jump to #C if
the value of V1 times V7 is less than or equal
JP #C,V1*V7<=V8*V2 to the
value of V8*V2
JP#A Jump to #A
292
LEGEND-MC User’s Manual
Example:
Move the A motor to absolute position 1000 counts and back to zero ten times. Wait 100 msec between
moves.
PA 0 Position absolute 0
EN End Program
NOTE: Do not jump (JP) out of an IF block. If this occurs, the ENDIF instruction will never be
executed.
command only when the argument of the IF command evaluates False. The ELSE command must occur
after an IF command and has no arguments. If the argument of the IF command evaluates false, the
controller will skip commands until the ELSE command. If the argument for the IF command evaluates
true, the controller will execute the commands between the IF and ELSE command.
Format: Meaning
IF <condition> Execute commands proceeding IF command (up to ELSE command) if con-
ditional statement(s) is true, otherwise continue executing at ENDIF com-
mand or optional ELSE command.
ELSE Optional command. Allows for commands to be executed when argument of
IF command evaluates not true. Can only be used with IF command.
ENDIF Command to end IF conditional statement. Program must have an ENDIF
command for every IF command.
294
LEGEND-MC User’s Manual
Example:
Subroutines
A subroutine is a group of instructions beginning with a label and ending with an END (EN). Subroutines
are called from the main program with the jump subroutine instruction JS, followed by a label or line
number, and conditional statement. Up to 16 subroutines can be nested. After the subroutine is executed,
the program sequencer returns to the program location where the subroutine was called unless the
subroutine stack is manipulated as described in the following section.
Example:
An example of a subroutine to draw a square 500 counts per side is given below. The square is drawn at
vector position 1000,1000.
295
LEGEND-MC User’s Manual
EN End subroutine
EN End subroutine
Stack Manipulation
It is possible to manipulate the subroutine stack by using the ZS command. Every time a JS instruction,
interrupt or automatic routine (such as #POSERR or #LIMSWI) is executed, the subroutine stack is
incremented by 1. Normally the stack is restored with an EN instruction. Occasionally it is desirable not to
return back to the program line where the subroutine or interrupt was called. The ZS1 command clears 1
level of the stack. This allows the program sequencer to continue to the next line. The ZS0 command
resets the stack to its initial value. For example, if a limit occurs and the #LIMSWI routine is executed, it
is often desirable to restart the program sequence instead of returning to the location where the limit
occurred. To do this, give a ZS command at the end of the #LIMSWI routine.
If the #AUTO label is included in a Burned Program (BP command), the controller will start executing the
program starting at the location of the #AUTO label when power is applied.
296
LEGEND-MC User’s Manual
For example, the #POSERR subroutine will automatically be executed when any axis exceeds its position
error limit. The commands in the #POSERR subroutine could decode which axis is in error and take the
appropriate action. In another example, the #ININT label could be used to designate an input interrupt
subroutine. When the specified input occurs, the program will be executed automatically.
Now, when a forward limit switch occurs on the X axis, the #LIMSWI subroutine will be executed.
NOTE: The #LIMSWI will continue to be executed until the limit switch is cleared (goes high).
297
LEGEND-MC User’s Manual
If the position error on the X axis exceeds that specified by the ER command, the #POSERR routine will
execute.
NOTE: The #POSERR routine will continue to be executed until the position error is cleared (is less than the
ER limit).
#A Label
II1 Input Interrupt on 1
JG 30000,,,60000 Jog
#LOOP;JP#LOOP;EN Loop
EN
298
LEGEND-MC User’s Manual
JP #BEGIN Repeat
EN End program
The above program prompts the operator to enter a jog speed. If a number is entered out of range (greater
than 12 million), the #CMDERR routine will be executed prompting the operator to enter a new number.
299
LEGEND-MC User’s Manual
Operator Function
+ Addition
- Subtraction
* Multiplication
/ Division
| Logical Or (On some computers, a solid vertical line appears as a broken line)
() Parenthesis
The numeric range for addition, subtraction and multiplication operations is +/-2,147,483,647.9999. The
precision for division is 1/65,000.
Mathematical operations are executed from left to right. Parentheses can be used and nested four deep.
Calculations within a parentheses have precedence.
Examples:
300
LEGEND-MC User’s Manual
@COS[n] Cosine
@FRAC[n] Fraction
@INT[n] Integer
@SIN[n] Sine
@TAN[n] Tangent
Functions may be combined with mathematical expressions. The order of execution is from left to right.
The units of the SIN and COS functions are in degrees with resolution of 1/128 degrees. The values can
be up to +/-2 billion degrees.
Example:
V1=@ABS[V7] The variable, V1, is equal to the absolute value of variable V7.
V2=5*@SIN[POS] The variable, V2, is equal to five times the sine of the variable,
POS.
V4=@AN[5] The variable, V4, is equal to the digital value of analog input 5.
301
LEGEND-MC User’s Manual
Variables
Many motion applications include parameters that are variable. For example, a cut-to-length application
often requires that the cut length be variable. The motion process is the same, however the length is
changing.
To accommodate these applications, the LEGEND-MC provides for the use of both numeric and string
variables. A program can be written in which certain parameters, such as position or speed, are defined as
variables. The variables can later be assigned by the operator or determined by the program calculations.
All variables created in the SMC are 48 bit fixed decimal point data. 32 bits are integer (+/- 2147483647)
and 16 bits are fraction (1/65535)
Example:
Programmable Variables
The LEGEND-MC allows the user to create up to 254 variables. Each variable is defined by a name which
can be up to eight characters. The name must start with an alphabetic character, however, numbers are
permitted in the rest of the name. Spaces are not permitted. Examples of valid and invalid variable names
are:
Valid Variable Names
POSX
POS1
SPEEDZ
Invalid Variable Names
1POS
123
SPEED Z
It is recommended that variable names not be the same as LEGEND-MC instructions. For example, PR is
not a good choice for a variable name.
The range for numeric variable values is 4 bytes of integer followed by two bytes of fraction (+/-
2,147,483,647.9999).
String variables can contain up to six characters which must be in quotation. Example: VAR="STRING".
Numeric values can be assigned to programmable variables using the equal sign. Assigned values can be
numbers, internal variables and keywords, and functions. String values can be assigned to variables using
quotations.
Any valid LEGEND-MC function can be used to return a value such as V1=@ABS[V2] or V2=@IN[1].
Arithmetic operations are also permitted.
302
LEGEND-MC User’s Manual
Example:
Variable values may be assigned to controller parameters such as GN or PR. Here, an equal is not used.
For example:
PR V1 Assign V1 to PR command
#JOYSTICK Label
JG 0,0 Set in Jog mode
#LOOP Loop
JP#LOOP Repeat
EN End
303
LEGEND-MC User’s Manual
Examples:
Internal variables can be used in an expression and assigned to a programmable variable, but they cannot
be assigned a value. For example: _KDX=2 is invalid.
The LEGEND-MC also provides a few keywords which give access to internal variables that are not
accessible by standard LEGEND-MC commands.
Keyword Function
_BGX or _BGY or _BGW Motion Done if 1. Moving if 0.
_LFX or _LFY or _LFZ or_LFW Forward Limit (equals 0 or 1)
_LRX or _LRY or _LRZ or LRW Reverse Limit (equals 0 or 1)
TIME Free-Running Real Time Clock* (off by 2.4% - Reset
on power-on). NOTE: TIME does not use _.
_HMX or _HMY or _HMZ or HMW Home Switch (equals 0 or 1)
Examples:
V1=_LFX Assign V1 the logical state of the Forward Limit Switch on the X-axis
V3=TIME Assign V3 the current value of the time clock
V4=_HMW Assign V4 the logical state of the Home input on the W-axis
304
LEGEND-MC User’s Manual
Example Program:
#TIMER Timer
INITIME=TIME Initialize time variable
PR50000;BGX Begin move
AMX After move
ELAPSED=TIME-INTIME Compute elapsed time
EN End program
#LIMSWI Limit Switch Routine
JP #FORWARD,_LFX=0 Jump if Forward Limit
AMX Wait for Motion Done
PR 1000;BGX;AMX Move Away from Reverse Limit
JP #END Exit
#FORWARD Forward Label
PR -1000;BGX;AMX Move Away from Forward Limit
#END Exit
RE Return to Main Program
305
LEGEND-MC User’s Manual
Arrays
For storing and collecting numerical data, the LEGEND-MC provides array space for 8000 elements in up
to 14 arrays. Arrays can be used to capture real-time data, such as position, torque and analog input values.
In the contouring mode, arrays are convenient for learning a position trajectory and later playing it back.
Defining Arrays
An array is defined by a name and number of entries using the DM command. The name can contain up to
eight characters, starting with an uppercase alphabetic character.
The number of entries in the defined array is enclosed in [ ].
Up to 14 different arrays may be defined. The arrays are one dimensional.
All array elements have the same structure as variables, 48 bit decimal point.
Example:
Each array element has a numeric range of 4 bytes of integer (231)followed by two bytes of fraction (+/-
2,147,483,647.9999).
Array space may be de-allocated using the DA command followed by the array name. DA*[0] de-
allocates all the arrays.
NOTE: Remember to define arrays using the DM command before assigning entry values.
Example:
SPEED[1]=7650.2 Assigns the first element of the array, SPEED the value
7650.2
POSX[10]=_TPX Assigns the 10th element of the array POSX the returned
value from the tell position command.
CON[2]=@COS[POS]*2 Assigns the second element of the array CON the cosine of
the variable POS multiplied by 2.
TIMER[1]=TIME Assigns the first element of the array timer the returned
value of the TIME keyword.
306
LEGEND-MC User’s Manual
An array element number can also be a variable. This allows array entries to be assigned sequentially
using a counter.
Example:
#A Begin Program
COUNT=0;DM POS[10] Initialize counter and define array
WT 10 Wait 10 msec
EN End Program
The above example records 10 position values at a rate of one value per 10 msec. The values are stored in
an array named POS. The variable, COUNT, is used to increment the array element counter. The above
example can also be executed with the automatic data capture feature described as follows.
Arrays may be uploaded and downloaded using the QU and QD commands.
QU array[ ],start,end,comma
QD array[ ],start,end
where array is an array name such as A[ ].
Start is the first element of array (default=0)
End is the last element of array (default=last element)
Comma -- if comma is a 1, then the array elements are separated by a comma. If not a 1, then the
elements are separated by a carriage return.
The file is terminated using <control>Z, <control>Q, <control>D or \.
RA n[ ],m[ ],o[ ],p[ ] Selects up to four arrays for data capture. The arrays must be
defined with the DM command.
RD_TI,_TPX,_SCZ,_TSY Selects the type of data to be recorded. See the table below for
the various types of data. The order of data type is important
and corresponds with the order of n,m,o,p arrays in the RA
command. In this example, the _TI input data is stored in the
first array selected by the RA command.
307
LEGEND-MC User’s Manual
_TI Inputs
_OP Output
NOTE: X may be replaced by Y,Z or W for capturing data on other axes, or A,B,C,D,E,F,G,H for LEG-
END-MC.
308
LEGEND-MC User’s Manual
309
LEGEND-MC User’s Manual
NOTES:
310
LEGEND-MC User’s Manual
MG STR {S3}
The above statement returns 3 characters of the string variable named STR.
Numeric data may be formatted using the {Fn.m} expression following the completed MG statement.
{$n.m} formats data in HEX instead of decimal. Example:
Example:
#A Label
JG 50000;BGX;ASX Jog, Begin, After Speed
MG "counts/sec" Message
EN End Program
When #A is executed, the above example will appear on the screen as: The speed is 50000 counts/sec
The MG command can also be used to configure terminals. Here, any character can be sent by using {^n}
where n is any integer between 1 and 255.
Example:
MG {^07} {^255} sends the ASCII characters represented by 7 and 255 to the bus.
311
LEGEND-MC User’s Manual
MG Message command
"" Surrounds text string
Variables may also be sent to the screen using the variable= format. Variable Name= returns the variable
value. For example, V1= , returns the value of the variable V1.
#DISPLAY Label
PR 1000 Position Command
BGX Begin
V1= Print V1
Input of Data
The IN command is used to prompt the user to input numeric or string data. The input data is assigned to
the specified variable or array element.
A message prompt may be sent to the user by specifying the message characters in quotes.
Example:
#A
IN "Enter Length", LENX
EN
This program sends the message:
Enter Length
to the PC screen or dumb terminal and waits for the operator to enter a value. The operator enters the
numeric value which is assigned to the variable, LENX. String variables with up to six characters may
also be input using the {S} specifier. For example, IN "Enter X,Y or Z", V{S} specifies a string variable
312
LEGEND-MC User’s Manual
to be input.
Formatting Data
Returned numeric values may be formatted in decimal or hexadecimal* with a specified number of digits
to the right and left of the decimal point using the PF command.
The Position Format (PF) command formats motion values such as those returned by the Tell Position
(TP), Speed? (SP?) and Tell Error (TE) commands.
Position Format is specified by:
PF m.n
where m is the number of digits to the left of the decimal point (0 through 10) and n is the number of
digits to the right of the decimal point (0 through 4) A negative sign for m specifies hexadecimal format.
Hex values are returned preceded by a $ and in 2's complement. Hex values should be input as signed 2's
complement, where negative numbers have a negative sign. The default format is PF 10.0.
Examples:
313
LEGEND-MC User’s Manual
DP
ER
PA
PR
TE
TP
If the number of decimal places specified by PF is less than the actual value, a nine appears in all the
decimal places.
Example:
The Variable Format (VF) command is used to format variables and array elements. The VF command is
specified by:
VF m.n
where m is the number of digits to the left of the decimal point (0 through 10) and n is the number of digits
to the right of the decimal point (0 through 4).
A negative sign for m specifies hexadecimal format. The default format for VF is VF 10.4
Hex values are returned preceded by a $ and in 2's complement.
:V1=10 Assign V1
:V1= Return V1
:V1= Return V1
:V1= Return V1
9 Overflow
The variable format also affects returned values from internal variables such as _GNX.
314
LEGEND-MC User’s Manual
PF and VF commands are global format commands. Parameters may also be formatted locally by using
the {Fn.m} or {$n.m} specification following the variable = . For example:
F specifies decimal and $ specifies hexadecimal. n is the number of digits to the left of the decimal, and
m is the number of digits to the right of the decimal. The local format is used with the MG* command.
Examples:
:V1=10 Assign V1
:V1= Return V1
User Units
Variables and arithmetic operations make it easy to input data in desired user units i.e.; inches or RPM.
For example, an operator can be prompted to input a number in revolutions. The input number is
converted into counts by multiplying it by the number of counts/revolution.
The LEGEND-MC position parameters such as PR, PA and VP have units of quadrature counts. Speed
parameters such as SP, JG and VS have units of counts/sec. Acceleration parameters such as AC, DC,
VA and VD have units of counts/sec2. All input parameters must be converted into these units.
Example:
#RUN Label
IN "ENTER # OF REVOLUTIONS",N1 Prompt for revs
BG Begin motion
EN End program
315
LEGEND-MC User’s Manual
NOTES:
316
LEGEND-MC User’s Manual
9 Programmable I/O
Digital Outputs
Each bit on the output port may be set and cleared with the software instructions SB (Set Bit) and
CB(Clear Bit), or OB (define output bit).
Example:
Instruction Function
SB3 Sets bit 3 of output port
CB4 Clears bit 4 of output port
The Output Bit (OB) instruction is useful for setting or clearing outputs depending on the value of a
variable, array, input or expression. Any non-zero value results in a set bit.
Instruction Function
OB1, POS Set Output 1 if the variable POS is non-zero. Clear Output 1 if
POS equals 0.
OB 2, @IN [1] Set Output 2 if Input 1 is high. If Input 1 is low, clear Output 2.
OB 3, @IN [1]&@IN [2] Set Output 3 only if Input 1 and Input 2 are high.
OB 4, COUNT [1] Set Output 4 if element 1 in the array COUNT is non-zero.
The output port may also be written to as an 8-bit word using the instruction
OP (Output Port). This instruction allows a single command to define the state of the entire 8-bit output
port, where 20 is output 1, 21 is output 2 and so on. A 1 designates that output is on.
Example:
Instruction Function
OP6 Sets outputs 2 and 3 of output port to high. All other bits are 0.
(21 + 22 = 6) (1100 binary)
The output port is useful for firing relays or controlling external switches and events during a motion
sequence.
317
LEGEND-MC User’s Manual
#OUTPUT Label
PR 2000 Position Command
BG Begin
AM After move
EN End
Digital Inputs
The LEGEND-MC has eight digital inputs for controlling motion by local switches. The @IN[n] function
returns the logic level of the specified input 1 through 8. For example, a Jump on Condition instruction
can be used to execute a sequence if a high condition is noted on an input 3. To halt program execution,
the After Input (AI) instruction waits until the specified input has occurred.
Example:
318
LEGEND-MC User’s Manual
10 Example Applications
Instruction Set Examples
Below are some examples of simple instructions. It is assumed your system is hooked-up and the motors
are under stable servo control.
319
LEGEND-MC User’s Manual
Instruction Interpretation
#A Label
BG X Begin X motion
BG Z Begin Z motion
EN
Instruction Interpretation
#HOME Label
AC 1000000 Acceleration Rate
DC 1000000 Deceleration Rate
SP 5000 Speed for Home Search
HM X Home X
BG X Begin Motion
AM X After Complete
MG "AT HOME" Send Message
EN End
#EDGE Label
AC 2000000 Acceleration rate
DC 2000000 Deceleration rate
SP 8000 Speed
FE Y Find edge command
BG Y Begin motion
AM Y After complete
MG "FOUND HOME" Send message
DP,0 Define position as 0
EN End
320
LEGEND-MC User’s Manual
MOTION BEGINS
TOWARD HOME
DIRECTION
POSITION
MOTION REVERSE
TOWARD HOME
DIRECTION
POSITION
POSITION
INDEX PULSES
POSITION
HOME SWITCH
POSITION
321
LEGEND-MC User’s Manual
Instruction Interpretation
#TEST
SPX=10000
ACX=1000000
DCX=1000000
CN,1
TRUE=1
FALSE=0
HOMING=FALSE
SHX; WT 2000
#HOMING
MG “Attempting to find
home” {N}
MG “(normal direction)”
FLX
BLX
HOMING=TRUE
JGX=8192;
FEX;BGX;AMX
HOMING=FALSE
JG*=500; FIX; BGX; (MCX because the controller will automatically define the position
MCX as zero when the index is found)
MG “Homed O.K!” EN
#BACKUP
MG “home input..”
CN,-1
322
LEGEND-MC User’s Manual
CN,1
JP #HOMING
EN
#REALPRB
MG “Limit Hit”
RE1
AB1; ZS
MG “Error”{N};TCI{N}
MG”on line”,_ED{F3.0}
MG”Program halted!”
AB
EN
323
LEGEND-MC User’s Manual
Instruction Interpretation
#A Label #A
II 1 Enable input 1 for interrupt function
JG 30000,-20000 Set speeds on A and B axes
BG AB Begin motion on A and B axes
#B Label #B
TP AB Report A and B axes positions
WI 1000 Wait 1000 milliseconds
JP #B Jump to #B
EN End of program
#INNT Interrupt subroutine
MG “Interrupt has occured” Displays the message
ST AB Stops motion on A and B axes
#LOOP;JP#LOOP,@IN[1]=0 Loop until Interrupt cleared
JG 15000,10000 Specify new speeds
WT300 Wait 300 milliseconds
BG AB Begin motion on A and B axes
RI Return from Interrupt subroutine
324
LEGEND-MC User’s Manual
Instruction Interpretation
#POINTS Label
SP 7000 Speed
#LOOP Label
JP #LOOP Repeat
EN End
Instruction Interpretation
#CONT Label
AC 80000;DC 80000 Acceleration rate
JG 0 Start job mode
BGX Start motion
#LOOP
325
LEGEND-MC User’s Manual
BG XY Begin motion
Instruction Interpretation
PR 20000 Position
AC 100000 Acceleration
DC 100000 Deceleration
SP 5000 Speed
BG X Begin
ACCELERATION
VELOCITY
ACCELERATION
VELOCITY
326
LEGEND-MC User’s Manual
Cut-to-Length Example
In this example, a length of material is to be advanced a specified distance. When the motion is complete,
a cutting head is activated to cut the material. The length is variable, and the operator is prompted to input
it in inches. Motion starts with a start button which is connected to input 1.
The load is coupled with a 2 pitch lead screw. A 2000 count/rev encoder is on the motor, resulting in a
resolution of 4000 counts/inch. The program below uses the variable LEN, to length. The IN command is
used to prompt the operator to enter the length, and the entered value is assigned to the variable LEN.
#BEGIN Label
AC 800000 Acceleration
DC 800000 Deceleration
SP 5000 Speed
LEN=3.4 Initial length in inches
#CUT Cut routine
AI1 Wait for start signal
IN "enter Length(IN)", LEN Prompt operator for length in inches
PR LEN *4000 Specify position in counts
BGX Begin motion to move material
AMX Wait for motion done
SB1 Set output to cut
WT100;CB1 Wait 100 msec, then turn off cutter
JP #CUT Repeat process
EN End program
Instruction Interpretation
Result=_RLX Set value of variable ‘Result’ equal to the report position of X axis
EN End
327
LEGEND-MC User’s Manual
Now suppose the gear ratio of the X-axis is to change on-the-fly to 2. This can be achieved by
commanding:
Instruction Interpretation
DM DIF[15]
T=0 T is time in ms
#A
V1=50*T
T=T+8
C=C+1
JP #A,C<16
C=0
328
LEGEND-MC User’s Manual
#C
D=C+1
C=C+1
JP #C,C<15
C=0
#E
C=C+1
JP #E, C<15
DT0
329
LEGEND-MC User’s Manual
Instruction Interpretation
#LMOVE Label
DP 0,0 Define position of X and Y axes to be 0
LMX Define linear mode between X and Y axes.
LI 5000 Specify first linear segment
LI 0 Specify second linear segment
LE End linear segments
VS 4000 Specify vector speed
BGS Begin motion sequence
AV 4000 Set trippoint to wait until vector distance of 4000 is reached
VS 1000 Change vector speed
AV 5000 Set trippoint to wait until vector distance of 5000 is reached
VS 4000 Change vector speed
EN Program end
Generating an Array
Consider the velocity and position profiles shown in the following illustration - Velocity Profile with
Sinusoidal Acceleration. The objective is to rotate a motor a distance of 6000 counts in 120 ms. The velocity
profile is sinusoidal to reduce the jerk and the system vibration. If we describe the position displacement
in terms of A counts in B milliseconds, we can describe the motion in the following manner:
NOTE: ω is the angular velocity; X is the position; and T is the variable, time, in milliseconds.
In the given example, A=6000 and B=120, the position and velocity profiles are:
ω = 50 [1 - cos 2π T/120]
330
LEGEND-MC User’s Manual
The 300 can compute trigonometric functions. However, the argument must be expressed in degrees.
Using our example, the equation for X is written as:
331
LEGEND-MC User’s Manual
Instruction Interpretation
#RECORD Begin Program
DM XPOS[501] Dimension array with 501 elements
RA XPOS[] Specify automatic record
RD _TPX Specify X position to be captured
MOX Turn X motor off
RC2 Begin recording; 4 msec interval
#A;JP#A,_RC=1 Continue until done recording
#COMPUTE Compute DX
DM DX[500] Dimension Array for DX
C=0 Initialize counter
#L Label
D=C+1
332
LEGEND-MC User’s Manual
This specifies relative position movement on the X axis. The movement is separated by 40 msec.
The following illustration - Velocity Profiles of XY shows the velocity profiles for the X and Y axis.
Instruction Interpretation
#A Begin Program
PR 2000,100 Specify relative position movement of 2000 and 100 counts for the X
and Y axes.
SP 15000,5000 Specify speed of 15000 and 5000 counts / sec
AC 500000,500000 Specify acceleration of 500000 counts / sec2 for all axes
DC 500000,500000 Specify deceleration of 500000 counts / sec2 for all axes
BG X Begin motion on the X axis
WT 40 Wait 40 msec
BG Y Begin motion on the Y axis
EN End Program
VELOCITY
(COUNTS/SEC)
15000
Y axis velocity profile
10000
5000
TIME (ms)
0 20 40 60 80 100
Velocity Profiles of XY
Notes on Velocity Profiles of XY illustration: The X axis has a ‘trapezoidal’ velocity profile, while the Y axis has a
‘triangular’ velocity profile. The X axis accelerates to the specified speed, moves at this constant speed, and then
decelerates such that the final position agrees with the commanded position, PR. The Y axis accelerates, but before
the specified speed is achieved, must begin deceleration such that the axis will stop at the commanded position.
333
LEGEND-MC User’s Manual
Instruction Interpretation
#S;JG 4000 Set speed
EN;
#A Label #A
II 1 Enable input 1 for interrupt function
#B Label #B
JP #B Jump to #B
EN End of program
Special Labels
This program demonstrates five of the SPECIAL LABELS as part of a LEGEND-MC application
program. #AUTO is usually the first line of a program. When this program is burned into the LEGEND-
MC using the BP command, the program will begin executing when the power is turned ON or after the
334
LEGEND-MC User’s Manual
Instruction
#AUTO
ERX=150; OEX=1, II3
SHX WT 500
#BUSY
JGX=@AN[1]*10000
BGX
MG “BUSY...”
WT500
JP#BUSY
EN
#POSERR-- This special label is used to handle a situation in which a servo is not able to remain in
position. The special label works with the ER command. When the value of the ER command is
exceeded, thread zero automatically jumps to the #POSERR label. In this program example, ERX=150
counts. If there are low gains or if using a small motor, it is possible to cause more than 150 counts of
error by hand, causing the #POSERR label to execute. In the following example, the program displays a
message and waits for input #1 to go low (falling edge). The servo is then re-energized.
There are three ways to return from a special label like this. The example below uses RE1; i.e., to return
from the error routine to the line in thread zero that was being executed when the #POSERR occurred.
The “1” means to restore a trip point if one was in progress, such as WT, AI, AM, AT, etc.
The second method is to do an RE, meaning that any trip points that were in progress are cleared. If
thread zero was waiting for an AM command, it would continue as if the profiler had completed the path.
The third method is to use the ZS command, which clears the subroutine stack, and the LEGEND forgets
it is in the middle of an error routine. After the ZS is given, it is possible to do a JP anywhere in the
program. Typically, there would be a jump back to a main loop where manual jogging can take place.
Instruction
#POSERR
SB1
AI1; AI-1
335
LEGEND-MC User’s Manual
The following is the special label that is automatically executed when there is a programming error, a
command given where it cannot be used, or a number out of range for a command. The example below
includes a jump to the #LIMSWI label if the _TC code is 22, which is “Begin not valid due to limit
switch.” This is considered a command error, but is easier to treat as a limit switch error. Similar
conditions could be handled by checking other _TC codes and reacting accordingly. If the error is
anything other than 22, motion is aborted without aborting the program (AB1), then a message is
prompted indicating the type of error and the line number on which it occurred. _ED reports the last line
that had an error. The #CMDERR routine can be finished just like the #POSERR special label, but it is not
recommended because usually there is very little reason to continue execution of the program if there are
serious errors in it. This routine is very useful in two ways:
First, during program design when there will be many programming mistakes, it is convenient to have the
program display the error and line number automatically.
Second, it is safer to abort motion if there is a program fault. Without the AB1command, the motors will
continue doing whatever they were doing before the fault. For example, if they were jogging, they will
continue jogging.
Instruction
#CMDERR
JP#LIMSWI,_TC=22
AB1
MG “Error”{N};TCI{N}
MG “on line”,_ED{F3.0}
MG “Program halted!”
AB
EN
336
LEGEND-MC User’s Manual
The following is the #LIMSWI special label for handling situations where limit switches ar hit during
motion. This label automatically executes if an axis is in motion and a limit switch in the direction of
motion is hit, or a software limit is exceeded. Without this special label, if a limit switch is hit during
motion, such as a position absolute move, the motor will decelerate to a stop with NO ERROR. if an AM
command is used, it will be cleared. The example as shown does not recover from the limit switch error,
but a recovery method that woks well is the use of a status flag variable. For example if the machine was
in a manual jog operation, a variable could be used to indicate that it was in jog mode (JOGMODE=1).
The first line in the #LIMSWI could jump to #PROBLEM if JOGMODE <>1, otherwise return from the
error. The two commented lines below demonstrate this. (The JOGMODE variable can be set to “1” in
the jog routine and set back to “0” at the end of the jog routine.)
Instruction
Limit= “+”
Limit=“-”
ZS
EN
337
LEGEND-MC User’s Manual
The following is the special label to handle input interrupts. Inputs 1 - 8 can be used as interrupts. this
example uses the input to tell the LEGEND that the system is under an E-STOP condition. This input may
come from a contact that also removes power from the amplifiers. Notice that the interrupt command II is
used at the beginning of the program to designate input #3 as an interrupt. When this input goes low,
thread zero automatically jumps to #ININT if it is included in the program. Notice that if the example
assumes that if an E-STOP occurs, the current operation has been scrapped. The ZS (Zero Subroutine
Stack) command is used which allows the program to jump anywhere. Usually it is easiest to jump back to
a main loop which handles the different modes of operation of the machine. Also note that if ZS is used,
the interrupt must be enabled for next time.
Instruction Interpretation
#ININT
SB3
MG “ESTOPPED”
MG “RE-ENABLED..”
SHX
WT2000
ZS
EN
Wire Cutter
Activate the start switch. The motor will advance the wire a distance of 10". When motion stops, the
controller generates an output signal activating the cutter. Allow 100 ms for cutting to complete the cycle.
Suppose the motor drives the wire by a roller with a 2" diameter and the encoder resolution is 1000 lines
per revolution. Since the circumference of the roller equals 2π inches, and it corresponds to 4000
quadrature, one inch of travel equals: 4000/2π = 637 count/inch
A distance of 10 inches equals 6370 counts, and a slew speed of 5 inches / second equals 3185 count/sec.
The input signal may be applied to I1, and the output signal as output 1. Motor velocity profile and related
input and output signals are in the following illustration - Motor Velocity and Associated Input/Output signals.
The program starts at a state that we define as #A. Here the controller waits for the input pulse on I1. As
soon as the pulse is given, the controller starts the forward motion.
Upon completion of the forward move, the controller outputs a pulse for 20 ms and then waits an
additional 80 ms before returning to #A for a new cycle.
338
LEGEND-MC User’s Manual
Instruction Function
#A Label
AI1 Wait for input 1
PR 6370 Distance
SP 3185 Speed
BGX Start Motion
AMX After motion is complete
SB1 Set output bit 1
WT 20 Wait 20 ms
CB1 Clear output bit 1
WT 80 Wait 80 ms
JP #A Repeat the process
START PULSE I1
MOTOR VELOCITY
OUTPUT PULSE
output
TIME INTERVALS
move wait ready move
339
LEGEND-MC User’s Manual
Instruction Function
#A Label
#B Label
EN End
Instruction Function
#A Label
BGX Start
#B
EN End
340
LEGEND-MC User’s Manual
341
LEGEND-MC User’s Manual
Instruction Function
#A Label
LINPOS=0
#B
WT 50 Wait 50 msec
PR ER Command correction
BGX
#C
EN
342
LEGEND-MC User’s Manual
11 Troubleshooting
Overview
The following discussion may help you get your system running if a problem is encountered.
Potential problems have been divided into groups as follows:
1. Installation
2. Stability and Compensation
3. Operation
The various symptoms along with the cause and the remedy are described in the following tables.
Installation
Symptom Cause Remedy
Motor runs away when connected to amplifier Amplifier offset Adjust amplifier offset
with no additional inputs. too large.
Same as above, but offset adjustment does not Damaged Replace amplifier.
stop motor. amplifier.
Controller does not read changes in encoder Wrong encoder Check encoder wiring.
position. connections.
Stability
Symptom Cause Remedy
Motor runs away when the Wrong feedback polarity. Invert the polarity of the loop by
loop is closed. (Positive Feedback) inverting the motor leads (brush
type) or the encoder (channel A+,
B+ if single ended; channel A+, A-
and B+, B- if differential)
Motor oscillates. Too high gain or too little Decrease KI and KP. Increase KD.
damping.
343
Operation
Symptom Cause Remedy
Controller rejects command. Anything. Interrogate the cause with TC
Responded with a ? or TC1.
Motor does not start or Noise on limit switches stops To check the cause,
complete a move. the motor. Noise on the abort interrogate the stop code
line aborts the motion. (SC). If caused by limit
switch or abort line noise,
reduce noise.
12 Index
A Code122134162
Abort252264267 Command Summary261263266268
Off-On-Error53 Communication87282296
Stop Motion264267 Baud Rate38
Absolute Position261293 Handshake38
Absolute Value271292 Compensation
Absolute value257291301 Backlash259
Acceleration252256288315325327 Configure249252311
Address Configure Encoder255
Jumpers37 Contour Data252284
After Absolute Position254284 Contour Mode77259
After Distance254284287 Contour mode252
After Input254284318 Control Filter
After Move305318 Damping343
After Relative Distance254 Coordinated Motion234239259267
After Vector Distance254284288 Contour Mode259
Analog feedback255 Ecam103271
Analog Output63 Electronic Cam97259271272
Arm Latch255327 Electronic Gearing259270
Array259276 Gearing259270
Arrays88255281306 Linear Interpolation259264267275
Automatic Record194 Coordinated motion250253
Dimension255306 Cosine257259300306
Download255 Cycle Time
Record255307 Clock223
At Speed254288
Automatic Record194 D
Automatic Subroutine Damping2496256343
MCTIME162 Data Capture193
Automatic Record194
B Data capture307
Backlash259 Arrays255281306
Backlash Compensation Debugging227284
Dual Loop259 Deceleration53252327
Backlash compensation341 Default Setting
Baud Rate38 Master Reset223
Begin Motion 70 252 282 286 297 303 Define Position255313319
308315319327334 Derivative Constant256
Burn Differential Encoder344
Program 21 252 254 255 281 305 Digital Filter
315338339342 Damping96
Variables255 Feedforward55
Integrator144
C Stability96
Cam Cycles252 Digital filter31249
Capture Data Damping24256
Record259276277 Feedforward256
Clear Bit255317 Gain2430311
Clear Sequence264266267268 Integrator2427256
Clock223304 PID242732
Update Rate223 Stability2429341
Velocity feedforward256
345
LEGEND–MC User’s Manual
F
Feedforward55256
Feedforward Acceleration112
Feedrate265268
Filter Parameter
Damping343
Stability343
Find Edge252278
Find Index252
Formatting252311313
Hexadecimal182237312313
346
LEGEND–MC User’s Manual
347
LEGEND–MC User’s Manual
348
LEGEND–MC User’s Manual
U
Update Rate223
Upload92255
V
Variable251254281290300311314
317339
Format256314
Vector
Acceleration253
Deceleration253
Position253288295
Sequence end253
Speed253288319
Vector mode319
Vector Acceleration266268
Vector Deceleration266268
Vector Mode
Clear Sequence264266267268
Feedrate265268
Vector Speed264268
Velocity feedforward256
W
Wait for Contour Data254284
349
YASKAWA ELECTRIC AMERICA, INC.
Chicago-Corporate Headquarters 2121 Norman Drive South, Waukegan, IL 60085, U.S.A.
Phone: (847) 887-7000 Fax: (847) 887-7310 Internet: http://www.yaskawa.com
MOTOMAN INC.
805 Liberty Lane, West Carrollton, OH 45449, U.S.A.
Phone: (937) 847-6200 Fax: (937) 847-6277 Internet: http://www.motoman.com
YASKAWA ELECTRIC CORPORATION
New Pier Takeshiba South Tower, 1-16-1, Kaigan, Minatoku, Tokyo, 105-0022, Japan
Phone: 81-3-5402-4511 Fax: 81-3-5402-4580 Internet: http://www.yaskawa.co.jp
YASKAWA ELETRICO DO BRASIL COMERCIO LTDA.
Avenida Fagundes Filho, 620 Bairro Saude Sao Paolo-SP, Brasil CEP: 04304-000
Phone: 55-11-5071-2552 Fax: 55-11-5581-8795 Internet: http://www.yaskawa.com.br
YASKAWA ELECTRIC EUROPE GmbH
Am Kronberger Hang 2, 65824 Schwalbach, Germany
Phone: 49-6196-569-300 Fax: 49-6196-888-301 Internet: http://www.yaskawa.de
MOTOMAN ROBOTICS AB
Box 504 S38525, Torsas, Sweden
Phone: 46-486-48800 Fax: 46-486-41410
MOTOMAN ROBOTEC GmbH
Kammerfeldstrabe 1, 85391 Allershausen, Germany
Phone: 49-8166-900 Fax: 49-8166-9039
YASKAWA ELECTRIC UK LTD.
1 Hunt Hill Orchardton Woods Cumbernauld, G68 9LF, Scotland, United Kingdom
Phone: 44-12-3673-5000 Fax: 44-12-3645-8182
YASKAWA ELECTRIC KOREA CORPORATION
Paik Nam Bldg. 901 188-3, 1-Ga Euljiro, Joong-Gu, Seoul, Korea
Phone: 82-2-776-7844 Fax: 82-2-753-2639
YASKAWA ELECTRIC (SINGAPORE) PTE. LTD.
Head Office: 151 Lorong Chuan, #04-01, New Tech Park Singapore 556741, SINGAPORE
Phone: 65-282-3003 Fax: 65-289-3003
TAIPEI OFFICE (AND YATEC ENGINEERING CORPORATION)
10F 146 Sung Chiang Road, Taipei, Taiwan
Phone: 886-2-2563-0010 Fax: 886-2-2567-4677
YASKAWA JASON (HK) COMPANY LIMITED
Rm. 2909-10, Hong Kong Plaza, 186-191 Connaught Road West, Hong Kong
Phone: 852-2803-2385 Fax: 852-2547-5773
BEIJING OFFICE
Room No. 301 Office Building of Beijing International Club,
21 Jianguomanwai Avenue, Beijing 100020, China
Phone: 86-10-6532-1850 Fax: 86-10-6532-1851
SHANGHAI OFFICE
27 Hui He Road Shanghai 200437 China
Phone: 86-21-6553-6600 Fax: 86-21-6531-4242
SHANGHAI YASKAWA-TONJI M & E CO., LTD.
27 Hui He Road Shanghai 200437 China
Phone: 86-21-6533-2828 Fax: 86-21-6553-6677
BEIJING YASKAWA BEIKE AUTOMATION ENGINEERING CO., LTD.
30 Xue Yuan Road, Haidian, Beijing 100083 China
Phone: 86-10-6232-9943 Fax: 86-10-6234-5002
SHOUGANG MOTOMAN ROBOT CO., LTD.
7, Yongchang-North Street, Beijing Economic & Technological Development Area,
Beijing 100076 China
Phone: 86-10-6788-0551 Fax: 86-10-6788-2878
YEA, TAICHUNG OFFICE IN TAIWAN
B1, 6F, No. 51, Section 2, Kung-Yi Road, Taichung City, Taiwan, R.O.C.
Phone: 886-4-2320-2227 Fax: 886-4-2320-2239
Phone: 55-11-5071-2552 Fax: 55-11-5581-8795 Internet: http://www.yaskawa.com.br