FB_UnlockTrafoParam
The Function Block FB_UnlockTrafoParam unlocks the transformation parameters so that they can be written.
After the Unlock the Kinematic Parameters can be written from the PLC with ADSWRITE. The required Index Group is the Object Id and the Index Offset is the Parameter Id. The written parameters are not persistent.
Notice | |
Changing parameters may lead to discontinuities Beware this is to be used with extreme caution. Redefining kinematic parameters can introduce discontinuities in the Kinematic chain. |
VAR_INPUT
VAR_INPUT
bExecute : BOOL;
oidTrafo : UDINT;
END_VAR
bExecute: The command is triggered by a rising edge at this input.
oidTrafo: Object-ID of the kinematic transformation object. See example below.
VAR_OUTPUT
VAR_OUTPUT
bBusy : BOOL;
bDone : BOOL;
bError : BOOL;
nErrorId : UDINT;
END_VAR
bBusy: The output becomes TRUE when the command is started with bExecute as long as the function block is executing the command. While bBusy is TRUE, no new instructions will be accepted at the inputs. When bBusy becomes FALSE again, the function block is ready for a new command. At the same time one of the outputs bDone or bError is set.
bDone: The output becomes true if the command succeeded.
bError: The output bError becomes true if an error occurs as the command is executed.
nErrorId: Contains the command-specific error code of the most recently executed command. The error code can be found in the ADS error documentation or in the NC error documentation (error codes above 0x4000).
Example
The Object Id and Parameter Id needed to unlock and write a new value to a transformation parameter can be read from the Transformation Object in System Manager.


VAR
bUserExecuteUnlock : BOOL;
fbFB_UnlockTrafoParam : FB_UnlockTrafoParam;
bUserExecuteWriteParam : BOOL;
fbADSWRITE : ADSWRITE;
oidTrafo : UDINT := 16#010100B0; (*Trafo object id*)
pidTrafo : UDINT := 16#05010020; (*parameter id*)
fParamValue : LREAL;
END_VAR
fbFB_UnlockTrafoParam(
bExecute := bUserExecuteUnlock,
oidTrafo := oidTrafo,
bBusy=>,
bDone=>,
bError=>,
nErrorId=> );
(*After unlocking new parameter value can be written*)
fbADSWRITE(
NETID:='' ,
PORT:= AMSPORT_R0_NCSAF,
IDXGRP:=oidTrafo ,
IDXOFFS:= pidTrafo,
LEN:=SIZEOF(fParamValue) ,
SRCADDR:= ADR(fParamValue),
WRITE:=bUserExecuteWriteParam ,
TMOUT:= ,
BUSY=> ,
ERR=> ,
ERRID=> );