Read current position with MC_ReadActualPosition
MC_ReadActualPosition is used to read 32-bit and 64-bit actual position values of an axis. While Enable input is On, the current position is continuously output to Value32 and Value64.
-
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 output of the function block is 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 | Output of the 32-bit value of the position as a REAL. |
Value64 | Output | Output of the 64-bit value of the position as a LREAL. |

//Set Axis Reference
Axis1 := 1;
IF (_AX01_RDY) THEN
//Example of MC_ReadActualPosition
INST_READACTUALPOSITION(Enable:=Enable_ReadActualPosition, Axis:=Axis1,
ErrorID=>INST_READACTUALPOSITION.ErrorID);
END_IF;
LM505