FB_Dpv1ReadPNET
The “FB_Dpv1ReadPNET” function block reads one or more parameters of a Sinamics Profidrive via DPV1 (Profidrive Specification 3.1) via Profinet. The DPV1 read telegram must be created with F_CreateDpv1ReadReqPkgPNET before a rising edge is present at bExecute. The DPV1 response telegram must be evaluated with F_SplitDpv1ReadResPkgPNET 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.
VAR_INPUT
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
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 read telegram. This telegram must be created by the F_CreateDpv1ReadReqPkg function before the DPV1 read 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 read response telegram. This telegram must be evaluated by the F_SplitDpv1ReadResPkg 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.
VAR_OUTPUT
VAR_OUTPUT
bBusy : BOOL;
bError : BOOL;
bErrorValues : BOOL;
iErrId : UDINT;
iErrorClass : BYTE;
iErrorCode : BYTE;
END_VAR
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 read 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 |
Description |
---|---|
0x2 |
incorrect response reference |
0x3 |
DPV1 read was erroneous or partly erroneous |
0x4 |
incorrect response ID |
other error IDs |
see ADS error code |
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 not supported) |
0xC |
Resource errors |
0x0: read conflict |
0xD - 0xF |
User-defined errors |
- |
VAR_IN_OUT
VAR_OUTPUT
iRequestRef : USINT; (* 1..127; 0: reserved *)
END_VAR
iRefRequest: Reference that is automatically incremented with each telegram. The reference is required for the allocation of the responses to the write/read requests.
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) |