DrvPnWrite (FB)
FUNCTION_BLOCK DrvPnWrite EXTENDS AbbETrig3
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
ExecuteBOOLFALSE
A rising edge starts a single 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. For executing another operation the Execute input needs to be retriggered by another rising edge!
AbbETrig3
Output
DoneBOOLFALSE
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
AbbETrig3
BusyBOOLFALSE
Operation is running (while outputs Done and Error are FALSE)
AbbETrig3
ErrorBOOLFALSE
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.
AbbETrig3
Input
CmDeviceAc500_DeviceBase.IRoleProfinetController2: Name of the Communication Module Device connected, Example: CM579_PNIO or Profinet_IO_Controller
DevNameSTRING(INT#240)3: Profinet Name of the device, Example: ‘abbdrive-38’
DevSlotUINT1
4: Device Slot to which the data object is to be written to - For all ACS/DCS Drives “1” should be used.
DevSubSlotUINT1
5: Device SubSlot to which the data object is to be written to - For all ACS/DCS Drives “1” should be used.
ModeBYTE0
6: 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.
MaxRetriesBYTE4
7: Maximum numbers of retries of internal read / write telegrams if device replies with “state conflict”. Maximum = 10
WaitTimeRetryWORD200
8: Waiting time [ms] before a new retry is started after response with “state confict”. 0 = Automatic calculation regarding data size; Min: 40ms; Max: 2000ms
NvarBYTE9: Number of parameters to write
DataDWORD10: Address of variable of “DrvPdPrmDpv1DataType”. Connect via ADR operator. For Parameter Group, Index, Type and Value
Output
ErrorIDERROR_ID.NO_ERROR
4: Error codes
AddErrorID1AC500_CM579Profinet.ERROR_IDAC500_CM579Profinet.ERROR_ID.NO_ERROR
5: Error ID from internal called ProfinetCommonRead or ProfinetCommonWrite block.
AddErrorID2UDINT0
6: AddErrNo output number from internal called PnioCtrlWrite block. See library AC500_CM579Profinet.
StatusDWORD0
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. (E.g. 16#DF80B500 = Write Response State conflict. –> Try to increase MaxRetries or WaitTimeRetry)
AddVal1WORD0
8: Additional Value 1 - AddVal1 output from internal called PnioCtrlWrite block see library AC500_CM579Profinet
AddVal2WORD0
9: Additional Value 2 - AddVal2 output from internal called PnioCtrlWrite block see library AC500_CM579Profinet
PackageSizeUINT0
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.
Methods:
A_StartAction
B_CyclicAction
C_CleaningAction
D_ResetAction
Structure: