MC_ReadParameter
This function block reads a numeric (LREAL) parameter value from the axis.
The command is typically processed synchronously.
Syntax
Definition:
FUNCTION_BLOCK MC_ReadParameter
VAR_INPUT
Axis : Type_PtpReadWriteParameter;
Enable : BOOL;
ParameterId : EAxisParameterId;
Mode : EReadMode;
END_VAR
VAR_OUTPUT
Valid : BOOL;
Busy : BOOL;
Error : BOOL;
ErrorId : UDINT;
Value : LREAL;
END_VAR
Inputs
|
Name |
Type |
Default |
Description |
|---|---|---|---|
|
Axis |
|
Reference to the axis | |
|
Enable |
BOOL |
|
Triggers a read on rising edge (EReadMode.Once) or every cycle while TRUE (EReadMode.Cyclic). |
|
ParameterId |
Invalid |
Identifier of the parameter to read. | |
|
Mode |
Once |
Once: read once at rising edge of Enable. Cyclic: read every cycle while Enable is TRUE. |
Outputs
|
Name |
Type |
Description |
|---|---|---|
|
Valid |
BOOL |
Valid output available at function block. |
|
Busy |
BOOL |
Function block is not finished. Always FALSE with ReadMode Once. |
|
Error |
BOOL |
Error occurred within function block. |
|
ErrorId |
UDINT |
Error identifier |
|
Value |
LREAL |
Last successfully read value of the parameter. |
Further information
Alternatively, the axis status can be read from the PLC using the AXIS_REF structure.
myAxis.McToPlc.Std.AxisStateInformation about the individual states is summarized in the section State diagram.
Possible error codes
For this function block, the following values, among others, are possible for the ErrorId output:
Error(Hex) | Error(Dec) | Error type | Description |
|---|---|---|---|
0x8145 | 33093 | Function Block | Mapping of cyclic interface between NC and PLC is missing (e.g., AXIS_REF, AXES_GROUP_REF, ...). A reference used by the function block (e.g., to an axis, group, mover or other motion object) is not linked to the corresponding NC object, or its cyclic mapping is incomplete. |
An overview of all NC error codes can be found here:
Version information
- TwinCAT Standard >= v3.1.4026.23.1
- TF5500 MC3 Base >= v4.0.6