IOF_SER_IDN_Write
The function block "IOF_SER_IDN_Write" allows to WRITE a value to an S- or P-Parameter of a SERCOS drive. The data type and size are determined automatically from the drive.
Internally, an instance of the ADSREAD function block and an instance of the ADSWRITE function block are called.
VAR_INPUT
VAR_INPUT
sNetId : T_AmsNetId;
nIDN : UINT; (* S: 0******* ********, P: 1******* ******** *)
bExecute : BOOL;
nPort : UINT;
nAttrib : DWORD;
cbLen : UDINT;
dwSrcAddr : DWORD;
tTimeout : TIME;
END_VAR
sNetId: It is possible here to provide the AmsNetId of the TwinCAT computer on which the ADS command is to be executed. If it is to be run on the local computer, an empty string can be entered.
nIDN: The nIDN is used to specify the SERCOS parameter which has to be written. For standard S-Parameters nIDN has to be between 0 and 32767, for manufacturer specific P-Parameters nIDN has to be between 32768 and 65535.
bExecute: The function block is activated by a positive edge at this input.
nPort: The port number nPort is specified by the TwinCAT System Manager during the hardware configuration.
nAttrib: Attribute of the parameter, if known. If nAttrib = 0 then IOF_SER_IDN_Write reads the parameter attribute from the drive, before it writes the parameter value to the drive.
cbLen: Length of data buffer, that contains the value.
dwSrcAddr: Address of data buffer, that contains the value.
tTimeout: States the length of the timeout that may not be exceeded by execution of the ADS command.
VAR_OUTPUT
VAR_OUTPUT
nAttribRd : DWORD;
sAttrib : ST_SercosParamAttrib;
bBusy : BOOL;
bError : BOOL;
nErrId : UDINT;
END_VAR
nAttribRd: contains the attribute of the parameter and can be used if saved as attribute (nAttrib) for the next parameter access with read or write
sAttrib: contains the actual attribute of the parameter split to separate bits in to the structure ST_SercosParamAttrib
bBusy: When the function block is activated this output is set. It remains set until and acknowledgement is received.
bError: If an ADS error should occur during the transfer of the command, then this output is set once the bBusy output is reset.
nErrId: Supplies the ADS error number when the bError output is set.
Requirements
Development environment | Target system type | IO hardware | PLC libraries to include |
---|---|---|---|
TwinCAT v2.8.0 Build > 735 | PC (i386) | Sercans SCS-P ISA; Sercans SCS-P PCI; | TcIoFunctions.Lib ( Standard.Lib; TcBase.Lib; TcSystem.Lib; TcUtilities.Lib are included automatically ) |