SEND_CMD (axis, cmd, param0, …)
Sends a command to the specified axis.
Parameters
axis(DINT)
The axis to send the command to. May be any constant, variable, or expression that evaluates to a DINT.
The axis parameter is validated only at runtime. If the specified axis does not exist, the command will not be issued, with no notice provided. If axis is outside the following ranges during runtime, the task will fault:
RMC75/RMC150: 0-15
RMC200 with 32 or fewer axes defined: 0-31
RMC200 with more than 32 axes defined: any value is accepted
cmd(DINT)
The command to send. Must be a literal value (such as 20) or a constant. May not be a variable, an expression, or a floating point value (entering 20.0 is not accepted).
Named constants are available to use for the cmd parameter. For example, the constant CMD.MOVE_ABS is a value of 20 for the Move Absolute (20) command. To access the constants, in the Expression Editor, on the Tags tab, expand Expression Constants.
param0(REAL or DINT)
The parameters of the command, from param0 to param8. All parameters for the specified command must be entered. For example, the Move Absolute (20) command has 6 parameters, so all 6 parameters must be entered. The Clear Faults (4) command does not have any parameters, so no parameters should be entered.
The data type is internally converted to a REAL. Some parameters require a whole number, which may be entered as a REAL or a DINT. Expressions, literals, and variables are also supported. In addition, for the Set Discrete Output, Clear Discrete Output, and Toggle Discrete Output commands, the I/O Point command parameter may be the I/O point tag name.
Address parameters:
For command parameters that require an address, such as the Master Register parameter for gearing and curve commands, the address must be entered in the command parameter as a numerical address. Passing the tag itself, such as “_Time” or “_Axis[5].TarPos”, will cause the value held in the register to be interpreted as the address. Instead, the numerical address (N) of the register must be used:
N = file * 4096 + element,
where file and element are from the IEC address format of the RMC register, given as %MDfile.element.
Example:
Use SEND_CMD to start curve 10 for 1 cycle, geared to the _Time register. First, we must calculate the address of the _Time register, which is different for each controller family:
Controller |
IEC Address |
Numerical Address |
---|---|---|
RMC75 |
%MD20.10 |
20 * 4096 + 10 = 81930 |
RMC150 |
%MD44.10 |
44 * 4096 + 10 = 180234 |
RMC200 |
%MD18.10 |
18 * 4096 + 10 = 73738 |
For the RMC200, the following command will start the desired curve based on time:
SEND_CMD(0, CMD.CURVE_START, 10, 18*4096+10, 1);
Notice that the following would be incorrect:
SEND_CMD(0, CMD.CURVE_START, 10, _Time, 1);
Return Value
The SEND_CMD function does not return a value.
Remarks
The SEND_CMD function may only be used in the Expression (113) command. It may not be used in other expressions, such as in Link Types, Program Triggers, etc.
The SEND_CMD function sends one command to one axis. To send commands to multiple axes, use multiple instances of the function. To send identical commands to multiple axes, use the SEND_CMD_MULTI function.
Some commands are not necessary to send within an expression. For example, the Set Discrete Output, Clear Discrete Output, and Toggle Discrete Output commands are unnecessary because the discrete output tag can be directly written to via an expression.
The RUN Mode (98), Expression (113) and No-op (0) commands are not allowed to be used in the SEND_CMD function.
Examples
SEND_CMD(10, CMD.MOVE_ABS, 24, 30, 60, 20, 0);
Sends the Move Absolute (20) command to axis 10, with a position of 24, velocity of 30, acceleration of 60, deceleration of 20, and direction of 0.
SEND_CMD(0, CMD.CLEAR_FAULTS);
Sends the Clear Faults (4) command to axis 0.
See Also
CMD Constants | SEND_CMD_MULTI | Standard Functions
Copyright © 2024 Delta Computer Systems, Inc. dba Delta Motion