FB_GENIbusGetMValue

This function block reads a measured value from a GENIbus device. The operation is thereby exclusively restricted to values of class 2. Only the ID code of the high byte and the length of the measured value need to be specified; the type of scaling and the unit of the measured value are determined by an internal INFO query. A structure at the stMValue output provides all important information about the value.

VAR_INPUT

bStart            : BOOL;
byAddr            : BYTE := 0;
byIDCode          : BYTE := 0;
eDataSize         : E_GENIBusMDataSize;
eCommandPriority  : E_GENIbusCommandPriority := eGENIbusCommandPriorityMiddle;

bStart: A rising edge at this input starts the reading process.

byAddr : Address of the GENIbus device to be addressed: valid entries: 1 - 200. This corresponds to the setting as is made directly on the GENIbus device. Conversion to the actual address range 32 – 231 (see GENIbus standard), takes place internally in the function block. A broadcast command via address 255 is naturally not permitted.

byIDCode: ID code of the value to be read. In the case of 16, 24 and 32-bit values, the ID of the high byte must be specified here, and the following order is always assumed: ID = hi, ID+1 = lo1, ID+2 = lo2, ID+3 = lo3.

eDataSize: Data size of the measured value: 8, 16, 24 or 32 bytes.

eCommandPriority: Priority (high, medium or low) with which the command is processed by the PLC library.

Example: Read-out of the total pumped volume of water. For this case is:

Source: Grundfos documentation "Operating the MAGNA3 and MGE model H/I via the GENIpro interface - Edition 01.00.35 - April 2015".

VAR_OUTPUT

bBusy         : BOOL;
bError        : BOOL;
udiErrorId    : UDINT;
udiErrorArg   : UDINT;
stMValue      : ST_GENIbusMValue;

bBusy: Starting with the edge at bStart, this output remains TRUE until the command has been processed.

bError: This output is switched to TRUE as soon as an error occurs during the execution of a command. The command-specific error code is contained in udiErrorId.

udiErrorId: Contains the command-specific error code of the most recently executed command. It is set back to 0 by the reactivation of the function block via the bStart input. See Error codes.

udiErrorArg: If applicable, contains an extended description of the error code.

stMValue : Output of the read value.

VAR_IN_OUT

stCommandBuffer   : ST_GENIbusCommandBuffer;

stCommandBuffer: Reference to the structure for communication (buffer) with the FB_GENIbusCommunication() function block.

Requirements

Development environment

Target platform

Required libraries

TwinCAT v2.11 R3/x64 from Build 2253

PC / CX

TcGENIbus library from V1.0.0