Yaskawa LEGEND-MC User Manual
Legend-mc user’s manual
Table of contents
Document Outline
- LEGEND-MC
- User’s Manual
- TABLE OF CONTENTS
- 1 Introduction
- The LEGEND-MC is a single axis Ethernet motion controller designed for use exclusively 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 registration is also available as a standard feature.
- Additionally, point-to-point control and communications over the Ethernet connections are standard features. The Ethernet function allows multiple handles or devices to communicate with the controller.
- Part Numbers
- Start-up
- Front Panel Description
- Power/Connections Wiring - Single Phase
- Power/Connections Wiring - Three Phase
- Cable Shielding, Segregation and Noise Immunity
- I/O Connections (50-pin CN5)
- Analog I/O
- Digital I/O
- Emergency Stop Chain
- Serial Communication
- External Encoder Specifications
- Dedicated Inputs
- Physical Specifications
- Hardware Specifications
- Cable Diagram and Dimensional Drawings
- NOTES:
- 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:
- 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:
- The first level, the closing of the loop, assures that the motor follows the commanded position. Closing the position loop using...
- The motion profiling is the generation of the desired position function. This function, R(t), describes where the motor should b...
- The highest level of control is the motion program. This can be stored in the host computer or in the controller. This program describes the tasks in terms of the motors that need to be controlled, the distances and the speed.
- Level
- 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.
- 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.
- Operation of Closed-Loop Systems
- To understand the operation of a servo system, we may compare it to a familiar closed-loop operation, adjusting the water temper...
- The closing of the servo loop is very similar. Suppose that we want the motor position to be at 90 degrees. A position sensor, o...
- The analogy between adjusting the water temperature and closing the position loop carries further. We have all learned that the ...
- The results may be worse if we turn the faucet too fast. The overreaction results in temperature oscillations. When the response...
- What causes the oscillations? The basic cause for the instability is a combination of delayed reaction and high gain. In the cas...
- Servo systems also become unstable if their gain is too high. The delay in servo systems is between the application of the curre...
- This motion controller includes a special filter that is designed to help the stability and accuracy. Typically, such a filter p...
- The filter parameters are represented by the three constants KP, KI and KD, which correspond to the proportional, integral and derivative term respectively.
- The damping element of the filter acts as a predictor, thereby reducing the delay associated with the motor response.
- The integrator function, represented by the parameter KI, improves the system accuracy. With the KI parameter, the motor does not stop until it reaches the desired position exactly, regardless of the level of friction or opposing torque.
- The integrator also reduces the system stability. Therefore, it can be used only when the loop is stable and has a high gain.
- The output of the filter is applied to a digital-to-analog converter (DAC). The resulting output signal in the range between +10 and -10 Volts is then applied to the amplifier and the motor.
- The motor position, whether rotary or linear is measured by a sensor. The resulting signal, called position feedback, is returned to the controller for closing the loop.
- The following section describes the operation in a detailed mathematical form, including modeling, analysis and design.
- System Modeling
- 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
- Motor-Amplifier
- 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:
- For example, a current amplifier with Ka = 2 A/V with the motor described by the previous example will have the transfer function:
- 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:
- For example, a 1000 lines/rev encoder is modeled as:
- DAC
- 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:
- This filter includes a lead compensation and an integrator. It is equivalent to a continuous PID filter with a transfer function G(s).
- For example, if the filter parameters are KP = 4:
- the digital filter coefficients are:
- 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
- If the sampling period is T = 0.001, for example, H(s) becomes:
- 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:
- The transfer function of the system elements are:
- Motor:
- Amp:
- DAC:
- Encoder:
- ZOH:
- Digital Filter:
- Therefore,:
- Accordingly, the coefficients of the continuous filter are:
- The filter equation may be written in the continuous equivalent form:
- The system elements are shown in the following illustration:
- The open loop transfer function, A(s), is the product of all the elements in the loop:
- To analyze the system stability, determine the crossover frequency, wc at which A(j wc) equals one. This can be done by the Bode plot of A(j wc), as shown in the following illustration:
- Bode plot of the open loop transfer function
- 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:
- Finally, the phase margin, PM, equals:
- 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.
- System Design and Compensation
- The closed-loop control system can be stabilized by a digital filter, which is pre-programmed in the LEGEND-MC controller. The f...
- The Analytical Method
- The analytical design method is aimed at closing the loop at a crossover frequency, wc, with a phase margin PM. The system parameters are assumed known. The design procedure is illustrated by a design example.
- Consider a system with the following parameters:
- 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 wc = 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:
- Amp:
- DAC
- Encoder:
- ZOH:
- Compensation Filter:
- The next step is to combine all the system elements, with the exception of G(s), into one function, L(s):
- Then the open loop transfer function, A(s), is:
- Now, determine the magnitude and phase of L(s) at the frequency wc = 500:
- This function has a magnitude of:
- and a phase:
- G(s) is selected so that A(s) has a crossover frequency of 500 rad/s and a phase margin of 45 degrees. This requires that:
- However, since:
- then it follows that G(s) must have magnitude of:
- and a phase:
- In other words, we need to select a filter function G(s) of the form:
- so that at the frequency wc =500, the function would have a magnitude of 40 and a phase lead of 59 degrees.
- These requirements may be expressed as:
- and:
- The solution of these equations leads to:
- Therefore:
- and:
- The function G is equivalent to a digital filter of the form:
- where:
- and:
- Assuming a sampling period of T=1ms, the parameters of the digital filter are:
- The LEGEND-MC can be programmed with the instruction:
- 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.
- Notch Filter
- There are some applications in which the standard tuning procedure using the PID filter of the controller cannot completely elim...
- The notch filter is an advanced tuning technique that acts much like a “band-reject” filter in an electronic circuit. Certain fr...
- 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 ...
- 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:
- These graphs show how NF, NB, and NZ determine the characteristics of the filter. In particular, NB specifies the bandwidth that...
- A simple method for attaining your NF,NB, and NZ parameters is the following:
- Although the theory behind a notch filter is beyond the scope of this application note, a general overview may clarify how the n...
- Resonance shows up as a pair of complex poles with a real part. A notch filter attempts to cancel the unwanted poles by placing ...
- A notch filter can be extremely helpful when used properly, however it is not right for every system. Incorrect placement of the...
- Overview
- 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.
- Controller Response to Data
- Most LEGEND-MC instructions are represented by two characters followed by the appropriate parameters. Each instruction must be terminated by a carriage return or semicolon.
- Instructions are sent in ASCII, and the LEGEND-MC decodes each ASCII character (one byte) one at a time. It takes approximately .5 msec for the controller to decode each command.
- After the instruction is decoded, the LEGEND-MC returns a colon (:) if the instruction was valid or a question mark (?) if the instruction was not valid or was not recognized.
- For instructions requiring data, such at Tell Position (TP), the LEGEND-MC will return the data followed by a carriage return, line feed and : .
- It is good practice to check for : after each command is sent to prevent errors. An echo function is provided to enable associating the LEGEND-MC response with the data sent. The echo is enabled by sending the command EO 1 to the controller.
- 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
- 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
- SMC Protocol Guidelines
- Ethernet Configuration
- Communication Protocols
- The Ethernet is a local area network through which information is transferred in units known as packets. Communication protocols...
- 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...
- 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.
- Addressing
- There are three levels of addresses defining Ethernet devices. The first is the Ethernet or hardware address- a unique and perma...
- 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.
- 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...
- 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
- Global vs. Local Operation
- Each LEGEND-MC controls one axis of motion, referred to as A or X. The host computer can communicate directly with any LEGEND-MC...
- The LEGEND-MC supports Yaskawa’s control system. This allows up to four LEGEND-MC controllers to be connected together as a sing...
- Here is a simple way to view Local and Global Operation; when the host communicates with a slave controller, it considers the sl...
- The controllers may operate under both Local and Global Mode. In general, operating in Global Mode simplifies controlling the en...
- 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 assig...
- 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 ...
- IHh=ip0,ip1,ip2,ip3
2 h is the handle. ip is the slave IP address.
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 g...
- 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.
- The data contained in the record is as follows:
- . (RP) reference position
- . (TP) encoder position
- . (TE) position error
- . (TV) velocity
- . (TT) torque
- . (TS) limit and home switches
- . (TS) axis status (in motion, motor of, at speed, stopcode)
- . (TI) uncommitted inputs
- . (OP) uncommitted outputs
- Operation of Distributed Control
- For most commands it is unnecessary to be conscious of whether an axis is local or remote. For example, to set the KP value for the X and Z axes, the command for the master would be:
- KP 10,,20
- Similarly, the interrogation commands can also be issued. For example, the position error for all axes 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 respon...
- 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.
- Accessing the I/O of the slaves
- The I/O of the slaves are settable and readable from the master. The bit numbers are adjusted by the handle number of the data record. Each handle adds 100 to the bit number. Handle A is 100 and Handle F is 600.
- 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.
- Handling Communication Errors
- 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.
- When the Yaskawa controller acts as the master, the IH command is used to assign handles and connect to its slaves. The IP addre...
- An additional protocol layer is available for speaking to I/O devices. Modbus is an RS-485 protocol that packages information in...
- 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...
- Communicating with Multiple Devices
- The LEGEND-MC is capable of supporting multiple 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.
- An Ethernet handle is a communication resource within a device. The LEGEND-MC can have a maximum of 8 Ethernet handles open at a...
- Multicasting
- Using Third Party Software
- Yaskawa supports ARP, BOOT-P, and Ping, which are utilities for establishing Ethernet connections. ARP is an application that de...
- The LEGEND-MC can communicate with a host computer through any application that can send TCP/IP or UDP/IP packets. A good example of this is Telnet, a utility that comes with most Windows systems.
- NOTE: A command sent over an Ethernet Telnet session must reside in one packet. This means that a Telnet emulator must not send ...
- Communication Protocols
- NOTES:
- Introduction
- 4 Command Reference
- 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 comman...
- Where x, y, z and w are replaced by actual values.
- A ? returns the specified value for that axis. For example, AC ?,?,?,?, returns the acceleration of the X,Y,Z and W axes.
- Other commands require action on the X,Y,Z or W axis to be specified. These commands are followed by uppercase X,Y,Z or W. Actio...
- Where X,Y,Z and W specify axes.
- The usage “Description:” specifies the restrictions on allowable execution. “While Moving” states whether or not the command is ...
- “Can be Interrogated” states whether or not the command can be interrogated by using ? to return the specified value. “Used as a...
- The following table defines terms found in the usage chart for each command:
- AB (Abort)
- [Motion]
- AB (Abort) stops motion instantly without controlled deceleration by freezing the profiler. If there is a program executing, AB ...
- 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.
- [Motion]
- @ABS (Absolute Value)
- AC (Acceleration)
- @ACOS (Arc Cosine)
- AD (After Distance)
- [Trippoint]
- 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.
- x, y z, w, or a, b, c, d, e, f, g, h are unsigned integers
- [Trippoint]
- AF (Analog Feedback)
- [Configuration]
- The Analog Feedback (AF) command is used to set an axis with analog feedback instead of digital feedback (quadrature/pulse dir)....
- 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.
- _AFn returns the current feedback setting where n is an axis letter
- [Configuration]
- AI (After Input)
- AL (Arm Latch)
- AM (After Motion)
- @AN (Analog Input)
- AO (Analog Out)
- AP (After Absolute Position)
- [Trippoint]
- The After Position (AP) 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 absolute position.
- 2. The motion profiling on the axis is complete.
- 3. The commanded motion is moving 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.
- [Trippoint]
- AR (After Relative)
- [Trippoint]
- 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.
- x, y z, w, or a, b, c, d, e, f, g, h are unsigned integers
- [Trippoint]
- AS (At Speed)
- @ASIN (Arc Sine)
- AT (After Time)
- [Trippoint]
- The AT command is a trippoint which is used to hold up execution of the next command until after the specified time has elapsed....
- 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)
- The following commands are sent sequentially:
- [Trippoint]
- @ATAN (Arc Tangent)
- BG (Begin)
- BL (Backward Limit)
- [Setting]
- The BL command sets the reverse software limit. If this limit is exceeded during a commanded motion, the motion will decelerate ...
- 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.
- _BLn contains the value of the reverse software limit where n is an axis letter.
- [Setting]
- BN (Burn Parameters)
- BP (Burn Program)
- BV (Burn Variables)
- CB (Clear Bit)
- [I/O]
- 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 mas...
- 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.
- 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.
- [I/O]
- CD (Contour Data)
- CE (Configure Encoder)
- [Configuration]
- 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.
- Each integer is the sum of two integers r and s which configure the main and the auxiliary encoders according to the chart below.
- “?” returns the encoder inputs
- For example: CEX = 10 implies r = 2 and s = 8, both encoders are reversed quadrature.
- _CEn contains the value of encoder type for the main and auxiliary encoder where n is an axis letter.
- [Configuration]
- CF (Configure Messages)
- [Configuration]
- Sets the controller’s default port for unsolicited messages. By default, the LEGEND-MC controller will send unsolicited response...
- n is A through P for Ethernet handles 1 thru 16, S for serial port.
- _CF will return the current port selected for unsolicited responses from the controller. The _CF will return a decimal value of the ASCII code.
- [Configuration]
- CH (Connect Handle)
- [General]
- The CH command is used to associate master and slave controllers in a distributed control system. The master controller must ass...
- x is X, Y, Z, W or A, B, C, D, E, F, G, H.
- h1 is the handle (character) to be used to send commands to the slave controller.
- h2 is the handle (character) to be used for receiving status from the slave controller.
- An example subroutine demonstrating how to release handles:
- [General]
- CM (Contour Mode)
- [Setting]
- 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.
- CM? Returns a 1 if the contour buffer is full, and 0 if the contour buffer is empty.
- _CM contains a ‘0’ if the contour buffer is empty, otherwise contains a ‘1’ meaning the buffer is full.
- [Setting]
- CN (Configure Limit Switches)
- @COM (2’s Complement)
- @COS (Cosine)
- CS (Clear Sequence)
- [General]
- 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 .
- [General]
- CW (Copyright)
- [General]
- The CW command has a dual usage. The CW command will return the copyright information when the argument, n is 0. Otherwise, the ...
- 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.
- _CW contains the value of the data adjustment bit. 1 =on, 2 = off
- [General]
- DA (De-allocate Variables)
- [General]
- The DA command frees array and/or variable memory space. With this command, more than one array or variable can be specified for...
- 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.
- _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.
- ‘Cars’ and ‘Salesmen’ are arrays and ‘Total’ is a variable.
- [General]
- DB (Dynamic Brake)
- DC (Deceleration)
- [Motion]
- 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.
- x, y z, w, or a, b, c, d, e, f, g, h are unsigned integers
- _DCn contains the deceleration rate in counts/sec2 where n is an axis letter.
- [Motion]
- DE (Dual (Auxiliary) Encoder)
- DL (Download)
- [General]
- 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
Z, Q, D, or \. - If no parameter is specified, downloading a data file will clear any programs in the LEGEND-MC RAM. The data is entered beginnin...
- 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.
- When used as an operand, _DL gives the number of available labels. The total number of labels is 126.
- 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
- [General]
- DM (Dimension Array)
- [General]
- 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.
- 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.
- _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.
- [General]
- DP (Define Position)
- DT (Delta Time)
- [Motion]
- The DT command sets the time interval for Contouring Mode. Sending the DT command once will set the time interval for all follow...
- 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.
- _DT contains the value for the time interval for Contour Mode
- [Motion]
- DV (Dual Velocity (Dual Loop))
- EA (ECAM Master)
- EB (ECAM Enable)
- [Setting]
- 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.
- n = 1 starts cam mode and n = 0 stops cam mode.
- EB? Returns a 0 if ECAM is disabled and 1 if enabled.
- _EB contains the state of Ecam mode. 0 = disabled, 1 = enabled
- [Setting]
- EC (ECAM Counter)
- [Setting]
- 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.
- n is an integer between 0 and 256.
- n = ? Returns the current value of the index into the ECAM table.
- _EC contains the current value of the index into the ECAM table.
- [Setting]
- ED (Edit Mode)
- [General]
- 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:
D Deletes a line I Inserts a line before the current one P Displays the previous line Q Exits the Edit subsystem 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...
- n specifies the line number to begin editing. The default line number is the last line of program space with commands.
- _ED Contains the line number of the last line to have an error. Very useful in tracing field problems.
- [General]
- EG (ECAM Engage)
- [Motion]
- The EG command engages an ECAM operation at a specified position of the master encoder. If a value is specified outside of the m...
- n is the master position at which the slave axis must be engaged.
- “?” returns 1 if specified axis is engaged and 0 if disengaged
- _EGn contains ECAM status where n is an axis letter. 0 = axis is not engaged, 1 = axis is engaged.
- [Motion]
- ELSE
- EM (ECAM Cycle)
- EN (End)
- [Program Flow]
- 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
- [Program Flow]
- ENDIF
- EO (Echo)
- EP (ECam Table Intervals and Start Point)
- EQ (ECam Quit (Disengage))
- [Motion]
- The EQ command disengages an electronic cam slave axis at the specified master position. If a value is specified outside of the master’s range, the slave will disengage immediately.
- n is the master position at which the axis is to be disengaged.
- “?” contains a 1 if engage command issued and slave is waiting to engage, 2 if disengage command issued and slave is waiting to disengage, and 0 if ECAM engaged or disengaged.
- _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.
- [Motion]
- ER (Error Limit)
- ET (ECam Table)
- FA (Acceleration Feedforward)
- [Setting]
- The FA command sets the acceleration feedforward coefficient, or returns the previously set value. This coefficient, when scaled...
- Acceleration Feedforward Bias = FA × AC × 1.5 × 10-7
- Deceleration Feedforward Bias = FA × DC × 1.5 × 10-7
- The Feedforward Bias product is limited to 10 Volts. FA will only be operational during independent moves, not gearing, camming or interpolation.
- FA has a resolution of .25
- _FAn contains the value of the feedforward acceleration coefficient where n is an axis letter.
- [Setting]
- FE (Find Edge)
- FI (Find Index)
- FL (Forward Limit)
- [Setting]
- The FL command sets the forward software position limit. If this limit is exceeded during commanded motion, the motor will decel...
- 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.
- _FLn contains the value of the forward software limit where n is an axis letter.
- [Setting]
- @FRAC (Fraction)
- FV (Velocity Feedforward)
- [Setting]
- 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.
- Velocity feedforward bias = 1.22 × 10-6 × FV × Velocity [in ct/s].
- For example, if FV=10 and the velocity is 200,000 count/s, the velocity feedforward bias equals 2.44 volts.
- _FV contains the velocity feedforward coefficient where n is an axis letter.
- [Setting]
- GA (Master Axis for Gearing)
- GR (Gear Ratio)
- HC (Handle Configuration)
- [Configuration]
- The HC command performs all the operations of IH, NA and the QW command for a simplified connection method.
- _HC contains a 0 if the Handle Configuration failed or has not been issued.
- contains a 1 if the Handle Configuration is in progress.
- contains a 2 if the Handle Configuration has completed successfully.
- [Configuration]
- HM (Home)
- [Motion]
- The HM command performs a three-stage homing sequence.
- 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.
- _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.
- [Motion]
- HR (Handle Restore)
- [Configuration]
- The HR command is used to enable the automatic restoration of handles that have closed during distributed control communications...
- 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.
- ARGUMENTS: HRn where
- n = 0 to disable automatic Handle Restore.
- n = 1 to enable automatic Handle Restore.
- HR? returns the present setting of the HR command.
- [Configuration]
- HS (Handle Switch)
- [Configuration]
- The HS command is used to switch the handle assignments between two handles. Handles are assigned by the controller when the han...
- ARGUMENTS: HS a=b where
- a = the first handle of the switch (A - P)
- b = the second handle of the switch (A - P)
- This example demonstrates a master controller, M2, searching for other controllers on each handle and forcing them to communicat...
- 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.
- [Configuration]
- HW (Handle Wait)
- HX (Halt Execution)
- [Program Flow]
- 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.
- n is 0 to 3 to indicate the task number
- 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
- [Program Flow]
- IA (Internet Address)
- [Setting]
- 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.
- 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).
- >u specifies the multicast IP address where u is an integer between 0 and 63.
- IA? will return the IP address of the controller
- _IA0 contains the IP address representing a 32 bit signed number (Two’s complement)
- _IA1 contains 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.
- [Setting]
- IF
- IH (Internet Handle)
- [Setting]
- 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.
- _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.
- _IHh4 contains a 1 if the SA command is waiting for acknowledgement from a slave
- contains a 2 if the SA command received a colon
- contains a 3 if the SA command received a question mark
- contains a 4 if the SA command timed out
- [Setting]
- II (Input Interrupt)
- [Configuration]
- 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 prog...
- 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.
- [Configuration]
- IL (Integrator Limit)
- [Tuning]
- 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...
- _ILn contains the value of the integrator limit in volts where n is an axis letter.
- [Tuning]
- IN (Input Variable)
- [General]
- 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. I...
- "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
- [General]
- @IN (Input)
- [I/O]
- @IN returns the status of the digital input number or variable given in square brackets. Note that the @IN command is a function...
- When using this command to access I/O on a slave controller in distributed control mode, use it with the handle for outbound mas...
- 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.
- 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.
- [I/O]
- @INT (Integer)
- IP (Increment Position)
- [Motion]
- 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.
- 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.
- 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).
- An IP n command will cause the motor to instantly try to servo to a position n from the present instantaneous position. The SP a...
- [Motion]
- IT (Independent Time Constant)
- [Motion]
- The IT command filters the acceleration and deceleration functions in independent moves of JG, PR, PA type to produce a smooth v...
- The use of IT will not effect the trippoints AR and AD. The trippoints AR and AD monitor the profile prior to the IT filter and therefore can be satisfied before the actual distance has been reached if IT is NOT 1.
- An IT value less then 1 will make the move longer. This can be compensated for by increasing the acceleration and deceleration paraemters
- n is a positive number with a resolution of 1/256
- _ITn will return the value of the independent time constant where n is an axis letter.
- [Motion]
- JG (Jog)
- JP (Jump to Program Location)
- [Program Flow]
- The JP command causes a jump to a program location on a specified condition (optional). The program location may be any label. T...
- Multiple conditions can be used in a single jump statement. Conditional statements are combined in pairs using operands “&” and ...
- location is a program label
- condition is a conditional statement using a logical operator
- [Program Flow]
- JS (Jump to Subroutine)
- [Program Flow]
- The JS command will change the sequential order of execution of commands in a program. If the jump is executed, the program will...
- Multiple conditions can be used in a single jump subroutine statement. The conditional statements are combined in pairs using th...
- destination is a line number or label
- condition is a conditional statement using a logical operator
- The logical operators are:
- [Program Flow]
- KD (Derivative Constant)
- KI (Integrator)
- KP (Proportional Constant)
- LA (List Arrays)
- LC (Lock Controller)
- [Configuration]
- The (LC) Lock Controller command is used to prohibit the execution of certain commands from the serial port by setting a securit...
- 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.
- _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.
- [Configuration]
- LE (Linear Interpolation End)
- [Motion]
- Signifies the end of a linear interpolation sequence. It follow the last LI specification in a linear sequence. The LE command signifies the controller issues commands to decelerate the motor to a stop.
- n=? Returns the total vector move length in encoder counts for the coordinate system.
- _LE contains the total vector move length in encoder counts.
- [Motion]
- _LF* (Forward Limit)
- LI (Linear Interpolation)
- [Motion]
- The LI command specifies the incremental distance of travel for Linear Interpolation (LM) mode. LI parameter are relative distan...
- LM? returns the available spaces for LI segments that can be sent to the buffer. 511 returned means the buffer is empty and 511 ...
- Linear Interpolation is useful for making contoured or continuous move profiles.
- NOTE: Linear mode can NOT be used on multiple axes controlled via ethernet.
- [Motion]
- LL (List Labels)
- LM (Linear Mode)
- [Setting]
- The LM command specifies the linear interpolation mode and specifies the axes for linear interpolation. LI commands are used to ...
- Only one axis can be used in interpolation mode. Axes connected in a distributed control system cannot be coordinated over ether...
- _LMx contains the number of spaces available in the sequence buffer for the coordinate system.
- [Setting]
- LO (Lockout)
- [Configuration]
- 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.
- 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
- _LOh contains the state of the lockout for handle A - P or S.
- The list continues, each handle is offset by $600.
- [Configuration]
- _LR* (Reverse Limit)
- LS (List Program)
- [General]
- The LS command sends a listing of the program memory out of the port that issued the command. The listing will start with the li...
- 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.
- [General]
- LT (Latch Target)
- [Motion]
- The LT command is used for stopping an axis a defined distance after a registration mark (latch) input. The distance specified b...
- 1 Motors stopped at commanded independent position (Latch input not received)
- 40 Stopped at Latch Target.
- 41 Latch Target overrun due to limit switch or stop command.
- 42 Latch Target overrun due to insufficient distance.
- [Motion]
- LV (List Variables)
- LZ (Leading Zeros)
- MB (Modbus)
- [I/O]
- 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 Modb...
- 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 s...
- [I/O]
- MC (Motion Complete)
- MF (Motion Forward)
- MG (Message)
- [General]
- The MG command sends data out the specified port. This can be used to alert an operator, send instructions or return a variable value.
- "m" is a text message including letters, numbers, symbols or
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.
- 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.
- [General]
- MM (Master’s Modulus)
- MO (Motor Off)
- [Setting]
- The MO command shuts off the PID control algorithm and the servo enable signal. The controller will continue to monitor the moto...
- 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.
- _MOn will return the state of the motor where n is an axis letter, 0 = servo loop on and 1 = servo loop off.
- [Setting]
- MR (Motion Reverse)
- MT (Motor Type)
- [Configuration]
- 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.
- 1 Servo motor (rotary motor moves counterclockwise when viewing shaft end of motor)
- -1 Servo motor reversed polarity
- _MTn contains the value of the motor type where n is an axis letter.
- [Configuration]
- MW (Modbus Wait)
- NA (Number of Axes)
- [Configuration]
- 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.
- n is an integer. this number represents the number of axes in a distributed control system.
- [Configuration]
- NB (Notch Bandwidth)
- NF (Notch Filter)
- NO (No Operation)
- [General]
- 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.
- m is any group of letters, numbers, symbols or
G
- [General]
- NZ (Notch Zero)
- OB (Output Bit)
- [I/O]
- 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 mas...
- 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.
- 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.
- [I/O]
- OC (Output Compare)
- [I/O]
- 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.
- 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 th...
- _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.
- [I/O]
- OE (Off On Error)
- OF (Offset)
- [Tuning]
- 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.
- ARGUMENTS: OF x, y, z, w or OFX=x or OF a, b, c, d, e, f, g, h where
- _OFn contains the offset in volts where n is an axis letter.
- [Tuning]
- OP (Output Port)
- [I/O]
- 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.
- m is an integer
- _OP contains the status of the outputs.
- [I/O]
- @OUT (Output)
- [Function]
- @OUT returns the status of the digital output number or variable given in square brackets. Note that the @OUT command is a funct...
- 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.
- 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.
- [Function]
- PA (Position Absolute)
- PF (Position Format)
- [Setting]
- The PF command allows the user to format the position numbers such as those returned by TP. The number of digits of integers and...
- 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:
- m is an integer. The negative sign for m specifies hexadecimal representation.
- n is an integer
- _PF contains the value of position format parameter.
- [Setting]
- PN (Legend Parameter)
- [Configuration]
- The PN command sets or returns data residing in the Legend amplifier. The PN command causes the controller to communicate to the...
- p is the parameter number, typically entered as a hex value, this is amplifier standard.
- v is the value of the parameter, in the units required by the parameter.
- _PNp will return the value of the parameter where p is the parameter number.
- [Configuration]
- PR (Position Relative)
- PW (Password)
- QD (Download Array)
- QL (Query Latch - Auxiliary Encoder)
- QR (Data Record)
- [General]
- The QR command causes the controller to return a record of information regarding controller status. This status information incl...
- 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.
- [General]
- QU (Upload Array)
- [General]
- The QU command transfers array data from the LEGEND-MC to a host computer. QU requires that the array name be specified along wi...
- “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.
- [General]
- QW (Slave Record Update Rate)
- [Configuration]
- The QW command is given to the master controller of a distributed system. The value establishes the update rate for data records...
- h is the handle being used to send commands to the slave controller.
- n = an even integer between 4 and 16000. this sets the period at which the slave controller updates the master controller. the v...
- [Configuration]
- QZ (Return Data Record Information)
- [General]
- The QZ command is an interrogation command that returns information regarding the Data Record. The controller’s response to this command will be the return of 4 integers separated by commas. The four fields represent the following:
- First field returns the number of axes.
- Second field returns the number of bytes to be transferred for general status
- Third field returns the number bytes to be transferred for coordinated move status
- Fourth field returns the number of bytes to be transferred for axis specific information
- [General]
- RA (Record Array)
- [General]
- 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.
- n,m,o,p are dimensioned arrays as defined by DM command. The [ ] contain nothing.
- [General]
- RC (Record)
- [General]
- The RC command begins recording for the Automatic Record Array Mode (RA). RC 0 stops recording.
- n is an integer 1 thru 8 and specifies 2n samples between records. RC 0 stops recording.
- m is optional and specifies the number of records to be recorded. If m is not specified, the DM number will be used. A negative ...
- _RC contains status of recording '1' if recording, '0' if not recording.
- [General]
- RD (Record Data)
- [General]
- The RD command specifies the data type to be captured for the Record Array (RA) mode. The data types include:
- the arguments are the data type to be captured using the record array feature. The order is important. Each of the four data types corresponds with the array specified in the RA command.
- _RD contains the address for the next array element for recording.
- [General]
- RE (Return from Error)
- RI (Return from Interrupt)
- RL (Report Latch)
- @RND (Round)
- RP (Reference Position)
- RS (Reset)
R S (Master Reset) R V (Firmware Revision) - SA (Send Command)
- [General]
- SA sends a command from the master to the slave controller of a distributed control system. Any command can be sent to a slave c...
- When using this command to access I/O on a slave controller in distributed control mode, use it with the handle for outbound mas...
- 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 inte...
- 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.
- _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...
- Recommended Send Method
- Recommended Receive Method
- [General]
- SB (Set Bit)
- [I/O]
- 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 mas...
- n is an integer in the range 1 to 4 decimal or Modbus address. See chart below for setting outputs on slave controllers.
- 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.
- [I/O]
- SC (Stop Code)
- SH (Servo Here)
- [General]
- 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.
- [General]
- @SIN (Sine)
- SP (Speed)
- @SQR (Square Root)
- ST (Stop)
- TA (Tell Alarm)
- [Status]
- The TA command checks the alarm output of the amplifier on the side connector. If no alarm is present, the controller returns 15...
- 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.
- [Status]
- TB (Tell Status Byte)
- TC (Tell Code)
- TD (Tell Dual (Auxiliary) Encoder)
- TE (Tell Error)
- TH (Tell Handle)
- [Status]
- 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.
- [Status]
- TI (Tell Inputs)
- [I/O]
- 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 mas...
- _TI contains the status byte of the input block. This can be masked to return only specified bit information.
- [I/O]
- TIME (Time Keyword)
- TL (Torque Limit)
- TM (Time Base)
- TP (Tell Position)
- TR (Trace Mode)
- TS (Tell Switches)
- [Status]
- TS returns the state of the Home switch, Forward and Reverse Limit switch, error conditions, motion condition and motor state. T...
- Bit 7
- Axis in motion if high
- Bit 6
- Error limit exceeded if high
- Bit 5
- Motor off if high
- Bit 4
- Amplifier OK if high
- Bit 3
- Forward Limit inactive if high
- Bit 2
- Reverse Limit inactive if high
- Bit 1
- State of home switch
- Bit 0
- Latch not armed if high
- _TSX contains the current status of the switches.
- [Status]
- TT (Tell Torque)
- TV (Tell Velocity)
- TW (Time Wait)
- UL (Upload)
- VA (Vector Acceleration)
- VD (Vector Deceleration)
- VE (Vector End)
- VF (Variable Format)
- [General]
- The VF command allows the variables and arrays to be formatted for number of digits before and after the decimal point. When dis...
- 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).
- m and n are unsigned numbers. A negative m specifies hexadecimal format.
- _VF contains the value of the format for variables and arrays.
- [General]
- VR (Vector Speed Ratio)
- VS (Vector Speed)
- [Motion]
- 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.
- n is an unsigned even number. The units are counts per second.
- _VS contains the vector speed.
- [Motion]
- VT (Vector Time Constant)
- WC (Wait for Contour)
- WT (Wait)
- XQ (Execute Program)
- [General]
- The XQ command begins execution of a program residing in the program memory of the controller. Execution will start at the label...
- A is a program label of up to seven characters
- m is a line number
- n is the thread number 0 through 3
- _XQn contains the current line number of execution for thread n, and -1 if thread n is not running.
- [General]
- ZS (Zero Subroutine Stack)
- [Program Flow]
- The ZS command is only valid from within an application program and is used to avoid returning from an interrupt (either input o...
- 0 returns stack to original condition
- 1 eliminates one return on stack
- _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.
- [Program Flow]
- Command Description
- 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 download...
- 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
- Command Syntax
- LEGEND-MC instructions are represented by two ASCII upper case characters followed by applicable arguments. A space may be inser...
- For example, the command
- PR is the two character instruction for Position Relative. 4000 is the argument which represents the required position value in counts. The
terminates the instruction. The space between PR and 4000 is optional. - For specifying data for the X,Y,Z and W axes, commas are used to separate the axes and preserve axis order as X,Y,Z and W. If no...
- To view the current values for each command, specify the command followed by a ? for each axis requested. The LEGEND-MC provides an alternative method for specifying data.
- Here data is specified individually using a single axis specified such as X,Y,Z or W (or A,B,C,D,E,F,G or H for the LEGEND-MC). An equal sign is used to assign data to that axis. For example: PRZ=1000 Sets the Z axis data as 1000
- All axes data may be specified at once using the * symbol. This sets all axes to have the same data. For example:
- Example XYZW Syntax for Specifying Data
- Example XYZW syntax for Requesting Action
- Controller Response to Commands
- For each valid command entered, the LEGEND-MC returns a colon (:). If the LEGEND-MC decodes a command as invalid, it returns a question mark (?).
- For example, if the command bg is sent in lower case, the LEGEND-MC will return 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 lo...
- 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.
- 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 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
- Program Flow
- General Configuration
- Control Filter Settings
- Status
- Error And Limits
- Arithmetic Functions
- Introduction
- 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.
- Independent Axis Positioning
- In this mode, motion between the specified axes is independent, and each axis follows its own profile. The user specifies the de...
- 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 (...
- An incremental position movement (IP) may be specified during motion as long as the additional move is in the same direction. He...
- Command Summary - Independent Axis
- 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.
- The following illustration - Velocity Profiles of XY shows the velocity profiles for the X and Y axis.
- Notes on Velocity Profiles of XY illustration: The X axis has a ‘trapezoidal’ velocity profile, while the Y axis has a ‘triangul...
- Independent Jogging
- The jog mode of motion is very flexible because speed, direction and acceleration can be changed during motion. The user specifi...
- An instant change to the motor position can be made with the use of the IP command. Upon receiving this command, the controller ...
- Note that the controller operates as a closed-loop position controller while in the jog mode. The LEGEND-MC converts the velocit...
- Command Summary - Jogging
- Linear Interpolation Mode
- The LEGEND-MC provides a linear interpolation mode for 1 axis. In linear interpolation mode, motion is coordinated to maintain t...
- The LM command selects the Linear Interpolation mode and axes for interpolation. For example, LM X selects the X axis for linear interpolation.
- When using the linear interpolation mode, the LM command only needs to be specified once unless the axes for linear interpolation change.
- Specifying Linear Segments
- The command LI x specifies the incremental move distance for each axis. This means motion is prescribed with respect to the curr...
- The clear sequence (CS) command can be used to remove LI segments stored in the buffer prior to the start of the motion. To stop...
- The Linear End (LE) command must be used to specify the end of a linear move sequence. This command tells the controller to dece...
- It is the responsibility of the user to keep enough LI segments in the LEGEND-MC sequence buffer to ensure continuous motion. If...
- The instruction _CS returns the number of the segment being processed. As the segments are processed, _CS increases, starting at zero. This function allows the host computer to determine which segment is being completed.
- 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.
- Specifying Vector Speed for Each Segment
- The instruction VS has an immediate effect and, therefore, must be given at the required time. In some applications, such as CNC, it is necessary to attach various speeds to different motion segments. This can be done with two functions: < n and > m
- For example: LI x < n >m
- The first command, < n, is equivalent to commanding VSn at the start of the given segment and will cause an acceleration toward the new commanded speed, subject to the other constraints.
- The second function, > m, requires the vector speed to reach the value m at the end of the segment. Note that the function > m m...
- Note, however, that the controller works with one > m command at a time. As a consequence, one function may be masked by another...
- As an example, consider the following program.
- Changing Feedrate:
- Command Summary - Linear Interpolation
- Vector Mode: Linear Interpolation Motion
- Specifying Vector Segments
- The motion segment is described by the command; VP for linear segments. Once a set of linear segments have been specified, the s...
- 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 Vector End (VE) command must be used to specify the end of the coordinated motion. This command tells the controller to dece...
- The user must keep enough motion segments in the LEGEND-MC sequence buffer to ensure continuous motion. If the controller receiv...
- 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.
- Specifying Vector Speed for Each Segment:
- The vector speed may be specified by the immediate command VS. It can also be attached to a motion segment with the instructions
- VP x < n >m
- The first parameter,
- The second parameter, > m, requires the vector speed to reach the value m at the end of the segment. Note that the function > m ...
- Note, however, that the controller works with one > m command at a time. As a consequence, one function may be masked by another...
- Changing Feedrate:
- Trippoints:
- Command Summary - Coordinated Motion Sequence
- Operand Summary - Coordinated Motion Sequence
- Specifying Vector Segments
- 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 ratio...
- 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 e...
- Command Summary - Electronic Gearing
- 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 il...
- Step 1. Selecting the master axis
- The first step in the electronic cam mode is to select the master axis. This is done with the instruction
- EAD is the auxiliary encoder for the x-axis
- For the given example, since the master is x, we specify EADX
- 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 ...
- 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...
- 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:
- 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
- Step 4. Specify the slave positions.
- Next, we specify the slave positions with the instruction
- where n indicates the order of the point.
- 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
- This specifies the ECAM table.
- Step 5. Enable the ECAM
- To enable the ECAM mode, use the command
- where n=1 enables ECAM mode and n=0 disables ECAM mode.
- Step 6. Engage the slave motion
- To engage the slave motion, use the instruction
- where x is the master positions at which the corresponding slaves must be engaged.
- If the value of any parameter is outside the range of one cycle, the cam engages immediately. When the cam is engaged, the slave position is redefined, modulo one cycle.
- Step 7. Disengage the slave motion
- To disengage the cam, use the command
- where x is the master positions at which the corresponding slave axes are disengaged.
- 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:
- Y = 0.5 * X + 100 sin (0.18*X)
- where X is the master, with a cycle of 2000 counts.
- 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...
- Now suppose that the slave axis is engaged with a start signal, input 1, but that both the engagement and disengagement points m...
- This is done with the program:
- Contour Mode
- The LEGEND-MC also provides a contouring mode. This mode allows any arbitrary position curve to be prescribed for any motion axe...
- Specifying Contour Segments
- The Contour Mode is specified with the command, CM, i.e.; CMX specifies contouring on the X axis.
- A contour is described by position increments which are described with the command, CD x over a time interval, DT n. The paramet...
- Consider, for example, the illustration labelled The Required Trajectory on the following page. The position X may be described by the points:
- The same trajectory may be represented by the increments
- 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:
- 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 in...
- 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 Summary - Contour Mode
- General Velocity Profiles
- 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 accele...
- Using the IT and VT Commands (S curve profiling):
- When operating with servo motors, motion smoothing can be accomplished with the IT and VT commands. These commands filter the ac...
- The smoothing function is specified by the following commands:
- 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 imp...
- Note that the smoothing process results in longer motion time.
- Homing
- The Find Edge (FE) and Home (HM) instructions are used to home the motor to a mechanical reference. This reference is connected ...
- The Find Edge (FE) instruction is useful for initializing the motor to a home switch. The home switch is connected to the Home i...
- 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.
- High Speed Position Capture (Latch Function)
- Often it is desirable to capture the position precisely for registration applications. The LEGEND-MC provides a position latch f...
- 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:
- 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.
- Overview
- 7 Application Programming
- Introduction
- The LEGEND-MC programming language is a powerful language that allows users to customize a program to handle their application. ...
- In addition to standard motion commands, the LEGEND-MC provides commands that allow the LEGEND-MC to make its own decisions. The...
- 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 instructi...
- A delimiter must separate each LEGEND-MC instruction in a program. Valid delimiters are the semicolon (;) or carriage return. Th...
- All LEGEND-MC programs must begin with a label and end with an End (EN) statement. Labels start with the pound (#) sign followed...
- The maximum number of labels that may be defined is 126.
- Valid labels
- Invalid labels
- #1Square
- Special Labels
- Executing Programs - Multitasking
- Two programs can run independently. The programs (threads) are numbered 0 through 3. 0 is the main thread. The main thread differs from the others in the following points:
- The execution of the various programs is done with the instruction:
- Where n indicates the thread number. To halt the execution of any thread, use the instruction
- 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.
- Debugging Programs
- The LEGEND-MC provides trace and error code commands which are used for debugging programs. The trace command may be activated u...
- If there is a program error, the LEGEND-MC will halt program execution at the line number at which an error occurs and display t...
- Program Flow Commands
- Event Triggers & Trippoints
- LEGEND-MC Event Triggers
- Event Trigger Examples:
- Event Trigger - Multiple Move Sequence
- 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.
- 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.
- Event Trigger - Set Output after Distance
- Set 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.
- 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.
- Event Trigger - Repetitive Position Trigger
- Event Trigger - Start Motion on Input
- Event Trigger - Set Output when at Speed
- Event Trigger - Change Speed along Vector Path
- Event Trigger - Multiple Move with Wait
- Define Output Waveform Using AT
- Event Trigger - Multiple Move Sequence
- Conditional Jumps
- The LEGEND-MC provides Conditional Jump (JP) and Conditional Jump to Subroutine (JS) instructions for branching to a new program...
- The JP and JS instructions have the following format:
- The destination is a program line number or label. The destination is where the program sequencer jumps to if the specified cond...
- Logical operators:
- Operands:
- The jump statement may also be used without a condition.
- Example of conditional jump statements are given below:
- Conditional jumps are useful for testing events in real-time. They allow the LEGEND-MC to make decisions without a host computer...
- Example:
- Multiple Conditional Statements
- The LEGEND-MC will accept multiple conditions in a single jump statement. The conditional statements are combined in pairs using...
- Example using variables named V1, V2, V3 and V4:
- JP #TEST, (V1
- In this example, this statement will cause the program to jump to the label #TEST if V1 is less than V2 and V3 is less than V4. To illustrate this further, consider this same example with an additional condition:
- JP #TEST, ((V1
- This statement will cause the program to jump to the label #TEST under two conditions; 1. If V1 is less than V2 and V3 is less than V4. OR 2. If V5 is less than V6.
- JP #TEST, (V1
- Examples
- Example:
- Move the A motor to absolute position 1000 counts and back to zero ten times. Wait 100 msec between moves.
- If, Else, and Endif
- The LEGEND-MC provides a structured approach to conditional statements using IF, ELSE and ENDIF commands.
- Using the IF and ENDIF Commands
- An IF conditional statement is formed by the combination of an IF and ENDIF command. The IF command has as it's arguments one or...
- NOTE: An ENDIF command must always be executed for every IF command that has been executed. It is recommended that the user not ...
- NOTE: Do not jump (JP) out of an IF block. If this occurs, the ENDIF instruction will never be executed.
- Using the ELSE Command
- Nesting IF Conditional Statements
- Command Format - IF, ELSE and ENDIF
- Example:
- Subroutines
- Stack Manipulation
- Auto Start Routine
- Automatic Subroutines for Monitoring Conditions
- Often it is desirable to monitor certain conditions continuously without tying up the host or LEGEND-MC program sequences. The L...
- For example, the #POSERR subroutine will automatically be executed when any axis exceeds its position error limit. The commands ...
- Example - Limit Switch:
- Example - Position Error
- Input Interrupt Example:
- Bad Command Example
- Mathematical and Functional Expressions
- For manipulation of data, the LEGEND-MC provides the use of the following mathematical operators:
- 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:
- Example:
- 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 wri...
- 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 charact...
- Valid Variable Names
- Invalid Variable Names
- 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.
- Example:
- Example - Using Variables for Joystick
- Internal Variables & Keywords
- Arrays
- For storing and collecting numerical data, the LEGEND-MC provides array space for 8000 elements in up to 14 arrays. Arrays can b...
- 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:
- Assignment of Array Entries
- Like variables, each array element can be assigned a value. Assigned values can be numbers or returned values from instructions, functions and keywords.
- Values are assigned to array entries using the equal sign. Assignments are made one element at a time by specifying the element number with the associated array name.
- Example:
- Example:
- 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. Th...
- 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
Z, Q, D or \.
- Automatic Data Capture into Arrays
- NOTES:
- Introduction
- 8 Input and Output of Data
- Sending Messages
- Messages may be sent to the bus using the message command, MG. This command sends specified text and numerical or string data from variables or arrays to the screen.
- Text strings are specified in quotes and variable or array data is designated by the name of the variable or array. For formatting string variables, the {Sn} specifier is required where n is the number of characters, 1 through 6. Example:
- 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:
- The above statement sends the message:
- The actual numerical value for the variable, RESULT, is substituted with the format of 5 digits to the left of the decimal and 2 to the right.
- In addition to variables, functions and commands, responses can be used in the message command. For example:
- The message command normally sends a carriage return and line feed following the statement. The carriage return and the line fee...
- Example:
- Example:
- Summary of Message Functions:
- Example - Printing a Variable
- Input of Data
- 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:
- 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:
- 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.
- The variable format also affects returned values from internal variables such as _GNX.
- 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:
- 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 ...
- Example:
- Sending Messages
- 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:
- 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.
- 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:
- Example - Turn ON Output After Move
- Digital Inputs
- Digital Outputs
- 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.
- Example - Jog in X only
- Homing Example (HM method):
- Homing Example (FE and FI method)
- Example - Input Interrupt
- Example - Position Follower (Point-to-Point)
- Example - Position Follower (Continuous Move)
- Example - Absolute Position Movement
- Example - Motion Smoothing
- Cut-to-Length Example
- Latch Capture Example:
- Example - Electronic Gearing LEGEND-MC
- Objective: Run a geared motor at a speed of 1.132 times the speed of an external master. The master is driven at speeds between 0 and 1800 RPM (2000 counts/rev encoder), and is connected through the auxiliary encoder inputs.
- Solution: Use a LEGEND-MC controller, where the X-axis auxiliary is master and X-axis main is geared axis.
- Now suppose the gear ratio of the X-axis is to change on-the-fly to 2. This can be achieved by commanding:
- Contour Mode Example
- Example of Linear Interpolation Motion:
- Generating an Array
- Consider the velocity and position profiles shown in the following illustration - Velocity Profile with Sinusoidal Acceleration....
- w = (A/B) [1 - cos (2pT/B)]
- X = (AT/B) - (A/2p)sin (2pT/B)
- In the given example, A=6000 and B=120, the position and velocity profiles are:
- X = 50T - (6000/2p) sin (2p T/120)
- Note that the velocity, w, in count/ms, is
- w = 50 [1 - cos 2p T/120]
- The 300 can compute trigonometric functions. However, the argument must be expressed in degrees. Using our example, the equation for X is written as:
- X = 50T - 955 sin 3T
- Teach (Record and Play-Back)
- Record and Playback Example:
- Example - Multiple Move Sequence
- Required Motion Profiles:
- 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.
- Notes on Velocity Profiles of XY illustration: The X axis has a ‘trapezoidal’ velocity profile, while the Y axis has a ‘triangul...
- Example - Start Motion on Switch
- Examples - Input Interrupt
- Special Labels
- This program demonstrates five of the SPECIAL LABELS as part of a LEGEND-MC application program. #AUTO is usually the first line...
- #POSERR-- This special label is used to handle a situation in which a servo is not able to remain in position. The special label...
- There are three ways to return from a special label like this. The example below uses RE1; i.e., to return from the error routin...
- 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.
- The following is the special label that is automatically executed when there is a programming error, a command given where it ca...
- 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.
- The following is the #LIMSWI special label for handling situations where limit switches ar hit during motion. This label automat...
- The following is the special label to handle input interrupts. Inputs 1 - 8 can be used as interrupts. this example uses the inp...
- 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 ...
- 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.
- Speed Control by Joystick
- The speed of a motor is controlled by a joystick. The joystick produces a signal in the range between - 10V and +10V. The objective is to drive the motor at a speed proportional to the input voltage.
- Assume that a full voltage of 10 Volts must produce a motor speed of 3000 rpm with an encoder resolution of 1000 lines or 4000 count/rev. This speed equals:
- The program reads the input voltage periodically and assigns its value to the variable VIN. To get a speed of 200,000 ct/sec for 10 volts, we select the speed as
- The corresponding velocity for the motor is assigned to the VEL variable.
- Position Control by Joystick
- Backlash Compensation by Dual-Loop
- This design example addresses the basic problems of backlash in motion control systems. The objective is to control the position...
- The dilemma is where to mount the sensor. A rotary sensor, gives a 4-micron backlash error. If a linear encoder is used, the backlash in the feedback loop will cause oscillations due to instability.
- An alternative approach is the dual-loop, using two sensors, rotary and linear. The rotary sensor assures stability (because the...
- Since the required accuracy is 0.5 micron, the resolution of the linear sensor should preferably be twice finer. A linear sensor with a resolution of 0.25 micron allows a position error of +/-2 counts.
- The dual-loop approach requires the resolution of the rotary sensor to be equal or better than that of the linear system. Assumi...
- To illustrate the control method, assume that the rotary encoder is used as a feedback for the X-axis, and that the linear senso...
- The first step is to command the X motor to move to the rotary position of 1000. Once it arrives we check the position of the lo...
- The correction can be performed a few times until the error drops below +/-2 counts. Often, this is performed in one correction cycle.
- Example Motion Program:
- Instruction Set Examples
- 11 Troubleshooting
- 12 Index