FC_ReadDriveEncoder - General Information
Type: |
Function |
Available as of: |
V1.0.3.0 |
Versions: |
Current version |
NOTE: The elements FB_WriteDriveEncoder und FC_ReadDriveEncoder are obsolete.
Use instead the elements FB_HomeAbs and FB_HomeSetPos with the mode PDL.ET_HomeSetPosMode.RestoreFromAxisEncoder.
The position of the motor sensor should be read.
The function reads the encoder position of the axis and reconstructs the position dependent on i_lrHomePos, i_lrAbsEncOffset, i_lrUserPeriod and the rotating direction of the axis. In doing so, the same parameter has to be used as when setting the position with the function block FB_WriteDriveEncoder. A SetPos is called up in the function.
The function must be called up once in the initialization part op the program for referencing the axes!
Input |
Data type |
Description |
---|---|---|
i_ifDrive |
IF_Drive |
Input for the axis that shall be controlled. |
i_lrHomePos |
LREAL |
Value as when setting the position with the function block FB_WriteDriveEncoder. |
i_lrAbsEncOffset |
LREAL |
Value as when setting the position with the function block FB_WriteDriveEncoder. |
i_lrUserPeriod |
LREAL |
Value as when setting the position with the function block FB_WriteDriveEncoder. |
Output |
Data type |
Description |
---|---|---|
q_etDiag |
General library-independent statement on the diagnostic. A value not equal to ET_Diag.Ok corresponds to an diagnostic message. |
|
q_etDiagExt |
POU-specific output on the diagnostic. q_etDiag = ET_Diag.Ok -> Status message q_etDiag <> ET_Diag.Ok -> Diagnostic message |
|
q_sMsg |
STRING[80] |
Event-triggered message which gives more detailed information on the diagnostic state. |
q_etDiag |
q_etDiagExt |
Enumeration value |
Description |
---|---|---|---|
OK |
0 |
Ok |
|
DriveConditionInvalid |
175 |
The drive encoder is invalid. |
|
InputParameterInvalid |
178 |
AbsEncOffset is outside the valid range. |
|
InputParameterInvalid |
3 |
The connected drive is invalid. |
|
InputParameterInvalid |
177 |
UserPeriod is outside the valid range. |
|
UnexpectedProgramBehavior |
1 |
An unintended detected error occurred during execution. |
Enumeration name: |
AbsEncOffsetRange |
Enumeration value: |
178 |
Description: |
AbsEncOffset is outside the valid range. |
Issue |
Cause |
Solution |
---|---|---|
- |
At the input i_lrAbsEncOffset, a number <= 0 or greater than the encoder period has been transferred. |
For i_lrAbsEncOffset, the following must hold: 0 < i_lrAbsEncOffset < maximum possible value of Drive.EncoderPosition. For the valid value range for i_lrAbsEncOffset, see output q_sMsg of FC_ReadDriveEncoder |
Enumeration name: |
DriveEncoderInvalid |
Enumeration value: |
175 |
Description: |
The drive encoder is invalid. |
Issue |
Cause |
Solution |
---|---|---|
- |
The axis encoder is not supported. |
Use an axis with a different encoder. |
Enumeration name: |
DriveInvalid |
Enumeration value: |
3 |
Description: |
The connected drive is invalid. |
Issue |
Cause |
Solution |
---|---|---|
- |
At the input i_ifDrive, no drive was applied. |
At the input i_ifDrive, a valid drive must be transferred. |
- |
The connected drive does not support all required functionalities. |
Establish which functionalities are not supported by the drive by means of output q_sMsg. Use a drive which supports all required functionalities. |
Enumeration name: |
Ok |
Enumeration value: |
0 |
Description: |
Ok |
The position has been read successfully.
Enumeration name: |
UnexpectedFeedback |
Enumeration value: |
1 |
Description: |
An unintended detected error occurred during execution. |
Issue |
Cause |
Solution |
---|---|---|
- |
An error occurred in the internal execution. |
Please inform the support team about this error. |
Enumeration name: |
UserPeriodRange |
Enumeration value: |
177 |
Description: |
UserPeriod is outside the valid range. |
Issue |
Cause |
Solution |
---|---|---|
- |
The input i_lrUserPeriod is negative. |
For the input i_lrUserPeriod, a positive value or zero must be specified. |
- |
The input i_lrUserPeriod does not fit into the encoder period. |
Assign the i_lrUserPeriod with zero to not consider any offset. The input i_lrUserPeriod must be chosen such that the following formula is fulfilled: ABS(lrEncoderPeriode/i_lrUserPeriod - TRUNC_INT(lrEncoderPeriode / i_lrUserPeriod)) = 0 with lrEncoderPeriode := EncoderRange * FeedConstant * DINT_TO_LREAL(GearIn) / DINT_TO_LREAL(GearOut) EncoderRange, FeedConstant, GearIn and GearOut are parameters of the i_ifDrive axis. |