DrvModbusRead (FB)

FUNCTION_BLOCK DrvModbusRead EXTENDS AbbLConCA

The Function block DrvModbusRead reads one or more parameters of the drive. The number of parameters to be read is specified at the input Nvar. The first parameter number is specified at the input PrmNum.

All parameters must be accessible from consecutive Modbus registers in the drive. The values of the parameters are stored in the PLC memory area, defined at the input Data. The values in the PLC memory area are updated when the read job was performed without error. This is indicated by output JobDone = TRUE and output ModMastErrorAct = FALSE.

As long as the Enable = TRUE a new read job is requested each time the further read job is terminated. The Modbus job is started from the communication block which is connected to the same inout variable DriveData. It uses the Modbus function code 03 (Read n words). The drive (Modbus slave) from which the parameter is read is specified at this communication block. The communication blocks are available from the library e.g. DrvModbusTcp, DrvModbusRtu.

This function block is activated (Enable = TRUE) or deactivated (Enable = FALSE) via input Enable. If the block is active, the current values are available at the outputs. To start a new read job the input Enable has to be set from FALSE to TRUE.

If the input values are valid, a request to perform a Modbus job is sent to the communication block via the inout variable DriveData . If at least 1 input is invalid, no job is generated and the error is displayed at the outputs Error and ErrorID instead

InOut:

Scope

Name

Type

Initial

Comment

Inherited from

Input

Enable

BOOL

FALSE

A rising edge (Enable = TRUE) starts the operation, the output Busy goes to TRUE. All other inputs are read and considered continuously. A falling edge (Enable = FALSE) aborts the operation. During Aborting the Busy is still TRUE. Afterward all outputs are reset.

AbbLConCA

Output

Busy

BOOL

FALSE

Operation is running (while output Error is FALSE)

AbbLConCA

Error

BOOL

FALSE

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

AbbLConCA

Input

Prio

BOOL

FALSE

2: Reserved - not used

Nvar

UINT

1

3: Number of variables to be read. 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, to which data read by the slave should be stored

Inout

DriveData

DrvDataType

6: Drive reference variable to connect to all function blocks of this drive

Output

ErrorID

ERROR_ID

3: Error codes

ModMastErrorAct

BOOL

FALSE

4: Active error in ModMast. Operation is running with error . This output is TRUE for at least one cycle or until input Enable is set to FALSE. The output ModMastErrorIDLast gives more details about the last error.

ModMastErrorIDLast

WORD

0

5: 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

6: Active warning. Operation is running with warning . This output is TRUE for at least one cycle or until input Enable is set to FALSE. The output WarnIDLast gives more details about the warning.

WarnIDLast

WARNING_ID

7: Warning code of last active warning

JobDone

BOOL

FALSE

8: Read job done

JobBusy

BOOL

FALSE

9: Read job busy