Set Variable
SET_VAR · V4.23Assign, add to or subtract from V0 to V18; system_count adds system counts.
Hexadecimal notation is used for IDs, indexes, modes and sentinel values where applicable. Physical quantities (such as pulses, milliseconds and pulse/s) remain in their native units. Macro names are shown only when defined by the firmware.
Input parameters
| Parameter | Initial value | Meaning |
|---|---|---|
Variable IDvariable_index | 0x00U | Tasks can write V0 to V18 or select system_count to add system counts. V19 is task-read-only motion mode and cannot be written by SET_VAR. MTGM_OP_VARIABLE_MOTION_MODE = 0x13U; MTGM_OP_VARIABLE_SYSTEM_COUNT = 0xFFU. |
Assignment modeassign_mode | = | For ordinary variables, = assigns, + adds and - subtracts. system_count always adds; it does not assign or subtract. |
Valuevalue | 0 | Numeric assignment/comparison value within the current validation range. |
Initial values are editor defaults for a newly inserted instruction; configure them for the actual machine.
Firmware macro definitions
Hexadecimal equivalents of the firmware definitions; numeric values are unchanged.
#define MTGM_OP_VARIABLE_MOTION_MODE 0x13U
#define MTGM_OP_VARIABLE_SYSTEM_COUNT 0xFFUExecution and usage
- Tasks cannot write V19. Define ownership/order for shared variables; system_count is not an ordinary variable.