DrvModbusWrite (FB)
FUNCTION_BLOCK DrvModbusWrite EXTENDS AbbETrig
Function block DrvModbusWrite writes ‘n’ parameter to the drive. The number of parameters to be written is specified and must be available in the PLC memory area, defined at the input Data. The write job has been performed without error if output JobDone = TRUE and output Error = FALSE.
To start a new write job the input Execute has to be set from FALSE to TRUE (edge sensitive). The Modbus job is started from the communication block which is connected to the same DriveData variable. It uses the Modbus function code 16 (Write n words). The Modubs job is started in the moment, the token for this block is free. Then the parameters, which were stored at the risinge edge of Execute input, are transfered to the Modbus communication block. The write data at the DATA input has to be kept stable until the job is finished.
The drive (Modbus Slave) to which the parameter is written is specified at the communication block.
Note
Drive parameters are only saved temporarily, if changed via fieldbus. To make these changes permanent in the drive the special parameter “PARAMETER SAVE” has to be set. Please see drive manuals for the parameter details
- InOut:
Scope
Name
Type
Initial
Comment
Inherited from
Input
ExecuteBOOLFALSE
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
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
AbbETrig
BusyBOOLFALSE
Operation is running (while outputs Done and Error are FALSE)
AbbETrig
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.
AbbETrig
Input
PrioBOOLFALSE
2: Reserved - not used
NvarUINT1
3: Number of variables to be written. Valid range: 1..125
PrmNumUINT1
4: Parameter number = 100 x Group + Index. e.g. Par 20.06 -> PrmNum = 20 * 100 + 06 = 2006. Valid range: 1..65535. For 32 bit parameters see function DrvModPara32Bit
DataDWORD0
5: First operand address of an operand area in the AC500, from which data should be written to the slave
Inout
DriveData6: drive reference variable to connect to all FBs of this drive
Output
ErrorID4: Error codes
ModMastErrorActBOOLFALSE
5: Active error in ModMast. Operation is running with error . This output is TRUE for at least one cycle or until Execute is set to FALSE. The output ModMastErrorIDLast gives more details about the last error.
ModMastErrorIDLastWORD0
- 6: Error code of last active error in ModMast. For error code description when used with DrvModbusTcp block, refer to error codes in Modbus TCP library, “AC500_ModbusTcp.ERROR_ID”,
For error code description when used with DrvModbusRtu block, refer to error codes in Modbus RTU library, “AC500_ModbusRtu.ERROR_ID”.
WarnActBOOLFALSE
7: Operation is running with warning . This output is TRUE for at least one cycle or until Execute is set to FALSE. The output WarnIDLast gives more details about the warning.
WarnIDLast8: Warning code of last active warning
JobDoneBOOLFALSE
9: Write job done
JobBusyBOOLFALSE
10: Write job busy
Methods:
B_CyclicAction
C_CleaningAction
D_ResetAction
A_StartAction
Structure: