FB_MBUSKL6781
This function block is used for reading M-Bus devices via a serial KL6781 - M-Bus master terminal.
The block can only be used in conjunction with at least one meter block.
An instance of this block is required for each serial KL6781 terminal.
The minimum cycle time for reading the serial interface depends on the baud rate. Guide value for 2400 baud: 10 ms max. For programs with a higher cycle time, the blocks be called in a faster task (see also here).
VAR_INPUT
usiRetries : USINT;
bStart : BOOL;
bDisabled : BOOL := FALSE;
usiRetries: Number of retries on error. If usiRetries is not assigned or set to 0, the value is set to 3 internally.
bStart: Positive edge on this input, all meters is read out once.
bDisabled: TRUE = disable the function block
VAR_OUTPUT
bBusy : BOOL;
bReady : BOOL;
bError : BOOL;
eError : E_MBUS_ERROR;
bBusy: The bBusy output is TRUE while the meter is being read.
bReady: The bReady output is TRUE for one cycle, once meter reading is completed.
bError: The bError output becomes TRUE as soon as an error occurs. The error is described via the variable eError.
eError: The eError output issues an error code when an error occurs (see E_MBUS_ERROR).
VAR_IN_OUT
stComIn : ST_KL6781inData22B;
stComOut : ST_KL6781outData22B;
stCom : ST_MBUS_Communication;
stComIn: Is linked to the terminal in the System Manager.
stComOut: Is linked to the terminal in the System Manager.
stCom: About this structure, the block is connected to the meter function blocks.