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

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

Prio

BOOL

FALSE

2: Reserved - not used

Nvar

UINT

1

3: Number of variables to be written. Valid range: 1..125

PrmNum

UINT

1

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

Data

DWORD

0

5: First operand address of an operand area in the AC500, from which data should be written to the slave

Inout

DriveData

DrvDataType

6: drive reference variable to connect to all FBs of this drive

Output

ErrorID

ERROR_ID

4: Error codes

ModMastErrorAct

BOOL

FALSE

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.

ModMastErrorIDLast

WORD

0

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”.

WarnAct

BOOL

FALSE

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.

WarnIDLast

WARNING_ID

8: Warning code of last active warning

JobDone

BOOL

FALSE

9: Write job done

JobBusy

BOOL

FALSE

10: Write job busy