DrvPnWrite (FB)

FUNCTION_BLOCK DrvPnWrite EXTENDS AbbETrig

Function block DrvPnWrite writes maximum 37 parameters to the drive in a single DPV1 query. The number of parameters to be written is specified at the input Nvar.

Another limit while using the DrvPnWrite function block is, it can process only up to 240 byte data in one request or 37 drive parameters whichever is lower. If the write data length is more than 240 byte, the function block generates an error code “WRITE_PACKAGE_SIZE_TOO_LONG” (16#0004). At the output “PackageSize” the precalculated size of the request is shown.

Parameters to write to the drive are specified at the DATA input. DrvPbPnPrmDpv1DataType structure must be declared to a variable and connected to DATA input using ADR, which is to be entered with Group, Index. This structure contains the Group, Index, Parameter type and the value to be written, which must be given to the variable.

Read parameter type and values are stored in the same variable.

DrvPdPrmDpv1DataType structure has the following array elements

  • abyPrmGroup: Array of 37 WORD for specifying parameter Group.

  • abyPrmIndex: Array of 37 WORD for specifying parameter Index.

  • abyPrmType: Array of 37 DRV_PDRIVE_PRM_TYPE for specifying parameter type, please refer the respective Drives manual for parameter data type and enter the respective ENUM. For details about ENUM please refer DRV_PDRIVE_PRM_TYPE ⇘ “DRV_PDRIVE_PRM_TYPE”

  • adwPrmValue: Array of 37 DWORD for specifying parameter value that should be written

The values in the structure area are updated, when the WRITE job was performed without error. This is indicated by Done = True.

Mode input

  • Mode = 16#00 => Write direct variables and parameters via an Fxxx module, e.g. FENA-21 or FPNO-21. Group and Index have to be used as in the Data.awPrmGroup and Data.awPrmIndex array. (Number of Elements in the PN Datablock is set to 16#01)

  • Mode = 16#01 => Write direct variables and parameters via an Rxxx module, e.g. RETA-02 for ACS800 or DCS500. Group and Index have to be used as in the Data.awPrmGroup and Data.awPrmIndex array. (Number of Elements in the PN Datablock is set to 16#01)

  • Mode = 16#1x => to be used to access PROFIDrive parameters with Attribute = 16#10 (Value) and Number of Elements = x.

  • Mode = 16#2x => to be used to access PROFIDrive parameters with Attribute = 16#20 (Description) and Number of Elements = x. (Not supported with Fxxx or Rxxx modules)

  • Mode = 16#3x => to be used to access PROFIDrive parameters with Attribute = 16#30 (Text) and Number of Elements = x. (Not supported with Fxxx or Rxxx modules)

For PROFIDrive parameters using Mode = 16#1x, 16#2x or 16#3x the Number of Elements = x is used for all the parameters in the Data array.

Note

If multiple DrvPnRead and /or multiple DrvPnWrite Functions Blocks for the same device are enabled at the same time, it may cause a read/write error.

Note

Values changed over the fieldbus are not saved permanently in the drive! To save changes permanent in the drive write the “PARAMETER SAVE” parameter to 1. E.g. 96.07 for ACSx80 or 16.07 for ACS800

InOut:

Scope

Name

Type

Initial

Comment

Inherited from

Input

Execute

BOOL

FALSE

A rising edge starts the operation, the output Busy goes to TRUE. In the first cycle all other inputs are read and stored, afterwards they are ignored. A falling edge does not stop the operation. After Done = TRUE or Error = TRUE and Execute = FALSE all outputs will be reset.

AbbETrig

Output

Done

BOOL

FALSE

Operation is completed without error (while outputs Busy and Error are FALSE). This output is TRUE for at least one cycle or until Execute is set to FALSE

AbbETrig

Busy

BOOL

FALSE

Operation is running (while outputs Done and Error are FALSE)

AbbETrig

Error

BOOL

FALSE

Operation is stopped with error (while outputs Busy and Done are FALSE). This output is TRUE for at least one cycle or until Execute is set to FALSE. The output ErrorID gives more details about the error.

AbbETrig

Input

Slot

BYTE

1

2: Slot in which Profinet is configured

DevApi

DWORD

0

3: Profinet device API command

DevName

STRING(INT#240)

‘’

4: Profinet Name of the device, Ex: ‘abbdrive-38’

Mode

BYTE

0

5: Mode = 0: Fxxx- modules e.g. FENA-21 or FPNO-21. Mode = 1: Rxxx modules used e.g. RETA-02 (ACS800, ACS500); Other modes for Profidrive parameters see description.

MaxRetries

BYTE

4

6: Maximum numbers of retries of internal read / write telegrams if device replies with “state conflict”. Maximum = 10

WaitTimeRetry

WORD

200

7: Waiting time [ms] before a new retry is started after response with “state confict”. 0 = Automatic calculation regarding data size; Min: 40ms; Max: 2000ms

Nvar

BYTE

1

8: Number of parameters to write

Data

DWORD

9: Address of variable of “DrvPdPrmDpv1DataType”. Connect via ADR operator. For Parameter Group, Index, Type and Value

Output

ErrorID

ERROR_ID

ERROR_ID.NO_ERROR

4: Error codes

AddErrorID1

AC500_PnioCntrl.ERROR_ID

AC500_PnioCntrl.ERROR_ID.NO_ERROR

5: ErrorID output from internal called PnioCtrlWrite block. See enum ERROR_ID library AC500_PnioCtrl.

AddErrorID2

UDINT

0

6: AddErrNo output number from internal called PnioCtrlWrite block. See library AC500_PnioCtrl.

Status

DWORD

0

7: Status output from internal called PnioCtrlWrite block - see Profidrive description in fieldbus module manual or AC500-V2 docu “Profinet Status” in Profinet IO library.

AddVal1

WORD

0

8: Additional Value 1 - AddVal1 output from internal called PnioCtrlWrite block see library AC500_PnioCtrl

AddVal2

WORD

0

9: Additional Value 2 - AddVal2 output from internal called PnioCtrlWrite block see library AC500_PnioCtrl

PackageSize

INT

0

10: Precalculated data size of profinet request telegram. Must not exceed 240, otherwise function block exits with Error. Can be reduced by less parameters or using more parameters with WORD type instead of DWORD.