
The function block 'DrvModbusRead' reads one or more parameters / values of the drive. The number of data 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 JobDone = TRUE and ModMastErrorAct = FALSE.
If the Modbus job was finished with an error, the output ModMastErrorAct is set for one cycle. The Error ID returned by the Modbus job is shown at the output ModMastErrorIDLast. The output ModMastErrorIDLast will show that last Error ID until the input Enable is set from TRUE to FALSE.
As long as the Enable = TRUE a new read job is requested automatically one cycle after the further read job was terminated. The Modbus job is started from the Communication Block which is connected to the same 'DriveData' variable. It uses the Modbus function code 03 (read n words). The drive (Modbus device) from which the parameter is read is specified at this Communication Block. The Communication Blocks are available from the library e.g. DrvModbusTcp or DrvModbusRtu.
The 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 must be set to TRUE. If the input values are valid, a request to perform a Modbus job is send to the Communication Block via the 'DriveData' variable. If at least 1 input is invalid, no job is generated, and the error is displayed at the outputs Error and ErrorID instead.