Read commanded position with MC_ReadCommandedPosition
MC_ReadCommandedPosition is used to read the commanded position of an axis. It outputs a 32-bit and 64-bit position value continuously while the Enable is true.
-
LS_Connect must be executed before this function block can be used.
-
The examples in this topic can be found in the XMC_SingleAxis_FBs.zip downloadable from Example Applications.
| Element Name | Element Type | Description |
|---|---|---|
| Enable | Input | Level detected request to execute the function block. |
| Axis | Input/Output | Axis reference variable. This can not be a constant. |
| Valid | Output | Indicates the position outputs are valid. |
| Busy | Output | Indicates the function block is currently being executed. |
| Error | Output | Indicates whether an error occurs or not. |
| ErrorID | Output | Error Identification number. |
| Value32 | Output | 32-bit commanded position value as a REAL. |
| Value64 | Output | 64-bit commanded position value as a LREAL. |
//Set Axis Reference
Axis1 := 1;
IF (_AX01_RDY) THEN
//Example of MC_ReadCommandedPosition
INST_READCOMMANDEDPOSITION(Enable:=Enable_ReadCommandedPosition,
Axis:=Axis1,ErrorID=>INST_READCOMMANDEDPOSITION.ErrorID);
END_IF;
LM523