Use this function to modify the encoder position of the physical encoder (SinCos encoder). The function only sends one job. This job is processed by a system task. This task communicates with the physical encoder via a serial interface.
The position that is transferred with the parameter i_lrPosition of the function, is transmitted via the serial interface of the encoder and stored in the encoder non-volatile memory. Then the encoder rereads the position and the parameters InitPosition and EncoderPosition are updated.
Use the function FC_PhyEncGetCmdState() to determine if the job was completed.
WARNING | |
---|---|
Input |
Data type |
Description |
---|---|---|
i_stEncId |
ST_LogicalAddress |
Logical address of the encoder |
i_lrPosition |
LREAL |
Absolute encoder position that has to be set in the encoder |
Data type |
Description |
---|---|
BOOL |
TRUE: job started FALSE: job interface busy (try again) or error |
Set the encoder position to 25 units.
FeedConstant = 360 units/rotation
EncoderType = 16#7; that is, SinCos Multiturn with 4096 rotations
Position 0 ... 1,474,560 units
CASE lState OF
1:
FC_PhyEncSetPosition(_PMEnc, 25.0);
lState:=2;
2:
IF FC_PhyEncGetCmdState() = TRUE THEN
lState:=3;
END_IF;
3:
;
END_CASE;
Result
The encoder position of the physical encoder is set to 25 units. This value is also displayed in the EncoderPosition parameter of the physical master encoder.