FB_Dpv1WritePNET
The function block FB_Dpv1WritePNET writes one or more parameters of a Sinamics Profidrive via DPV1 (Profidrive Specification 3.1) via Profinet. The DPV1 write telegram must be created with F_CreateDpv1WriteReqPkgPNET before a rising edge is present at bExecute. The DPV1 answer telegram must be evaluated with F_SplitDpv1WriteResPkgPNET after bBusy indicates a falling edge.
The execution of this function block requires some time, depending on the number of parameters to be read. The function block sends the DPV1 telegram and polls for an answer telegram.
Inputs
VAR_INPUT
bExecute : BOOL;(* drive access info *)
aNetId : T_AmsNetId; (* NetID of Profibus Master EL6631 *)
iProfinetPort : UINT; (* Port of ProfiDrive *)
iDriveId : USINT; (* 0..255 possible *)
pDpv1ReqData : POINTER TO ARRAY [1..iMAX_DPV1_SIZE_PNET_REQ] OF BYTE;
iDpv1ReqDataLen : UDINT;
pDpv1ResData : POINTER TO ARRAY [1..iMAX_DPV1_SIZE_PNET_RES] OF BYTE;
iDpv1ResDataLen : UDINT;
tTmOut : TIME;
END_VAR
Name | Type | Description |
---|---|---|
bExecute | BOOL | The function block is enabled by a positive edge at this input. |
aNetId | T_AmsNetID | The network address of the Profibus master device (see ADS tab of the Profibus master device in the I/O configuration in the TwinCAT system) |
iProfinetPort | UINT | The Profinet port number of the drive. This is an address for several axes, specified in the TwinCAT system in the I/O configuration. |
iDriveID | USINT | The ID is 1 for the ControllerUnit, 2 for the drive object A, 3 for the drive object B of a double/triple drive. The drive ID is set in the starter software. 1..16 is possible. |
pDpv1ReqData | POINTER TO ARRAY | Pointer to an array of 240 bytes containing the DPV1 write telegram. This telegram must be created by the function F_CreateDpv1WriteReqPkg before the DPV1 Read is activated via bExecute. |
iDv1ReqDataLen | UDINT | Maximum length of the DPV1 data buffer (240 bytes). |
pDpv1ResData | POINTER TO ARRAY | Pointer to an array of 240 bytes containing the DPV1 write answer telegram. This telegram must be evaluated by the function F_SplitDpv1WriteResPkg after a negative edge appears on bBusy. |
iDpv1ResDataLen | UDINT | Maximum length of the DPV1 response data buffer (240 bytes). |
tTmOut | TIME | Maximum time allowed for the execution of the command. |
Inputs/outputs
VAR_OUTPUT
iRequestRef : USINT; (* 1..127; 0: reserved *)
END_VAR
Name | Type | Description |
---|---|---|
iRefRequest | USINT | Reference that is automatically incremented with each telegram. The reference is required for the allocation of the responses to the write/read requests. |
Outputs
VAR_OUTPUT
bBusy : BOOL;
bError : BOOL;
bErrorValues : BOOL;
iErrId : UDINT;
iErrorClass : BYTE;
iErrorCode : BYTE;
END_VAR
Name | Type | Description |
---|---|---|
bBusy | BOOL | This output goes TRUE as soon as the function block is activated via bExecute and remains TRUE as long as the function block has not received a response. |
bError | BOOL | In case of errors this output goes TRUE and bBusy goes FALSE. |
bErrorValues | BOOL | TRUE if the DPV1 Write was unsuccessful or only partly successful. The error causes are returned via the error ID (as well as Class and Code). |
iErrId | UDINT | Returns the ADS error number or function-block-specific error numbers if bError = TRUE. |
iErrClass | BYTE | Profidrive error class |
iErrCode | BYTE | Profidrive error code |
Function-block-specific error codes | Description |
---|---|
0x2 | Incorrect response reference |
0x3 | DPV1 Read faulty or partially faulty |
0x4 | Incorrect response ID |
other error IDs | See ADS error codes |
Error classes | Description | Error code |
---|---|---|
0x0 - 0x9 | Reserved | - |
0xA | Application errors | 0x0: read error |
0xB | Access errors | 0x0: invalid index (no data block DB47, parameter access is not supported) |
0xC | Resource errors | 0x0: read conflict |
0xD - 0xF | User-defined errors | - |
Requirements
Development environment |
Target platform |
IO hardware |
PLC libraries to be integrated (category group) |
---|---|---|---|
TwinCAT v3.1.0 |
PC or CX (x86) |
Beckhoff EL6632 |
Tc2_IoFunctions (IO) |