Name :Set the current location command

Symbol :MC_SetPosition

Illustrate:

        Used to set the current position of the shaft, the rising edge is valid.
        This command can be called to set the current position of the axis only when the PLCOpen state of the axis is in the Disabled, Standstill, and Errorstop states.
        When MODE=0 (absolute mode), on the rising edge of EXECUTE, the command writes the POS to the current position of the axis.
        When MODE=1 (relative mode), on the rising edge of EXECUTE, the command adds the corresponding value of POS to the current position of the axis (this command can only be called on the premise that the current position is known, otherwise the command will be incorrect).

Image:

Parameter:

The name of the parameter | data type | IN/OUT | Parameter role | Illustrate | Default value
--- | --- | --- | --- | --- | ---
AXISNO | UDINT | IN | Pulse shaft number | 0-7 |
    not
EXECUTE | BOOL | IN | Function block triggering | The rising edge triggers the execution of the order |
    FALSE
POS | REAL | IN | Target location | Target location(Positive/Negative/0), unit: unit |
    0
MODE | REAL | USINT | Mode selection | 0 - Absolute mode, writes the value of the POS to the current position, 1 - Relative mode, adds the value of the POS on the basis of the current position (if the current position of the axis is known), unit: unit |
    0
DONE | BOOL | OUT | Completion flag | TRUE：The axis position is set |
    FALSE
BUSY | BOOL | OUT | Busy sign | TRUE：The axis position is being set |
    FALSE
ERROR | BOOL | OUT | Error flags | TRUE：There was an error with the function block call> |
    FALSE
ERRORID | UINT | OUT | Error codes | 0：Normal, Other: Error code value |
    0

Example:

LD:

ST:

MC_SetPosition_inst1(AXISNO := 0, EXECUTE := TRUE, POS := 0, MODE := 0, DONE => DoneOut, BUSY => BusyOut, ERROR => ErrorOut, ERRORID => ErrorIdOut);

Interpretation:

       AXISNO is 0, which means that the operating pulse axis is 0;
       EXECUTE by FALSE->TRUE, to start the axis position setting command;
       If the POS value is 0, the target location is 0unit;
       MODE is 0, which means absolute mode, and the value of POS is written to the current position, if it is 1, it means relative mode, and the corresponding value of POS is added on the basis of the current position of the axis;
       If DoneOut is TRUE, the execution of the axis position setting command is complete.
       BusyOut is TRUE, which means that the axis position is being set, and BusyOut is reset after completion.
       If ErrorOut is TURE, it means that there is an error and the command cannot be executed.
       If ErrorIdOut is 0, the execution is normal, and if it is not 0, there is an error and cannot be executed.