FB_Dpv1WritePNET 1:

The “FB_Dpv1WritePNET” function block 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 response telegram must be evaluated with F_SplitDpv1WriteResPkgPNET after a falling edge appears at bBusy.

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 a response telegram.


    bExecute        : BOOL;(* drive access info *)
    aNetId          : T_AmsNetId; (* NetID of Profinet Master EL6631 *)
    iProfinetPort   : UINT; (* Port of ProfiDrive *)
    iDriveId        : USINT; (* 0..255 possible *)
    iDpv1ReqDataLen : UDINT;
    iDpv1ResDataLen : UDINT;
    tTmOut          : TIME;

bExecute: the block is activated by a positive edge at this input.

aNetId: 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, type: T_AmsNetID).

iProfinetPort: 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: The ID is 1 for the controller unit, 2 for the drive object A and 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 an array of 240 bytes containing the DPV1 write telegram. This telegram must be created by the F_CreateDpv1WriteReqPkgPNET function before the DPV1 write is activated via bExecute.

iDv1ReqDataLen: Maximum length of the DPV1 data buffer (240 bytes).

pDpv1ResData: Pointer to an array of 240 bytes containing the DPV1 write response telegram. This telegram must be evaluated by the F_SplitDpv1WriteResPkgPNET function after a falling edge appears at bBusy.

iDv1ResDataLen: Maximum length of the DPV1 response data buffer (240 bytes).

tTmOut: Maximum time allowed for the execution of the command.


    bBusy        : BOOL;
    bError       : BOOL;
    bErrorValues : BOOL;
    iErrId       : UDINT;
    iErrorClass  : BYTE;
    iErrorCode   : BYTE;

bBusy: This output goes TRUE as soon as the function block is activated via bExecute and remains TRUE as long as the block has not received a response.

bError: In case of errors this output goes TRUE and bBusy goes FALSE.

bErrorValues: 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).

nErrId: Returns the ADS error number or function-block-specific error numbers if bError = TRUE.

nErrClass: Profidrive error class.

nErrCode: Profidrive error code.

Function-block-specific error codes



incorrect response reference


DPV1 write was erroneous or partly erroneous


incorrect response ID

other error IDs

see ADS error code

Error classes


Error code

0x0 - 0x9




Application errors

0x0: read error
 0x1: write error 0x2: module error
 0x3 - 0x7: reserved
0x8: version conflict
 0x9: not supported
0xA - 0xF: user-dependent


Access errors

0x0: invalid index (no data block DB47, parameter access not supported)
0x1: write length error
0x2: invalid slot
0x3: type conflict
0x4: invalid range
0x5: state conflict (access to DB47 temporarily not possible because of internal process states)
0x6: access denied
0x7: invalid range (write error in the DB47 header) 0x8: invalid parameter
0x9: invalid type
0xA - 0xF: user-dependent


Resource errors

0x0: read conflict
0x1: write conflict
0x2: resource busy
0x3: resource not attainable 0x4 - 0x7: reserved
0x8 - 0xF: user-dependent

0xD - 0xF

User-defined errors



    iRequestRef : USINT;(* 1..127; 0: reserved *)

iRefRequest: Reference that is automatically incremented with each telegram. The reference is required for the allocation of the responses to the write/read requests.


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)