Character: -
Decimal: 45
Hexadecimal: 0x2D
Command Value: Destination Address (80-2303)
Note: This command is supported in RMC100 CPU firmware dated 20010402 or newer.
Note: This command should only be used in the Event Step table. It is usually not useful to issue this command directly from the PLC.
This command allows the user to subtract a constant value from a memory location in the RMC and store the result in another memory location in the RMC. The memory locations available for the source of this operation include any Status, Command, Parameter, or Event Step register. The memory locations available for the destination of this operation include any Command, Parameter, or Event Step register.
The addresses of the source and destination registers match the addresses shown in the RMC Register Map (PROFIBUS-DP Message Mode) topic, except that only addresses 0-2303 are usable by this command.
Tip: Use the Address Tool to greatly simplify entering addresses for this and other commands that use addresses. See Address Tool for details.
This command uses the command fields as follows:
Mode: The Mode field controls how the 16-bit source, destination, and constant values are sign-extended. Its bits are defined as follows:
Bits 7-15
Reserved. Must be 0.
Bits 4-6
Position Range Axis. These bits are used only if bit 1 (Register Sign Extension) is set. They then determine which axis's position range is used for the source and destination registers.
Bits 2-3
Reserved. Must be 0.
Bit 1
Register Sign Extension. If this bit is 1, then the source and destination registers are sign extended to fit the position range for the axis selected by Mode bits 4-6.
If this bit is 0, then the source and destination registers are sign extended the same way as the constant.
Bit 0
Constant Sign Extension. If this bit is 0, then the constant in the Speed field is signed. Otherwise, this constant is unsigned.
Tip: To simplify computing and entering the Mode value, use the pop-up editor. First enter the command so that RMCWin knows which Mode dialog box to display. Then either double-click the mode value or press ENTER when the cursor is in the Mode field. You will then be able to select the options you want, and the Mode will be computed for you.
Acceleration:
Reserved (must be 0)
Deceleration:
Source Address. This is an address (see above) of the register to start with. The register's value can be signed, unsigned, or a position value depending on Mode bits 0-1.
Speed:
This is a constant value that is subtracted from the register specified by the Deceleration field. This constant can be signed or unsigned as determined by Mode bit 0.
Command Value:
Destination Address. This is an address (see above) of the register to store the result in. Before the result is stored, it is checked if it falls in the range selected by Mode bits 0-1 (signed, unsigned, or a position value). If the result does not fall within this range, then an internal error bit is set, which can be tested with the MathOK (0x12) and MathERR (0x13) link types.
Command:
- (45 decimal, 0x2D hexadecimal)
Although this command is limited to subtracting a constant from an RMC register, it is possible to subtract one register from another using two of these commands in a row. The first event step would use either an Add or Subtract command with a 0 in the Speed command field to essentially move a field from the original RMC register into the Speed command field of the next event step. The next event step would then perform a "constant" Subtract command, but because this constant had just been set to another register value, the Subtract effectively subtracts one register from another.
See also: Add Command, MulDiv Command
Copyright (c) 1997-2015 by Delta Computer Systems, Inc.