FB_MBUSKL6781

FB_MBUSKL6781 1:

This function block is used to read M-Bus devices via the Bus Terminal KL6781.

The block can only be used in conjunction with at least one counter block.

An instance of this block required for each KL6781 terminal.

At 2400 baud the maximum task time for this block is 10 ms. If higher task times are required, this block must be processed in a separate fast task.

VAR_INPUT

usiRetries : USINT;
bStart     : BOOL;
bDisabled  : BOOL := FALSE;

usiRetries: Number of repetitions in the event of errors

bStart: A positive edge at this input triggers one reading of all meters.

bDisabled: TRUE = deselection of the 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: this output goes TRUE as soon as an error occurs. This error is described via the variable eError.

eError: In the event of an error the output issues an error code (see E_MBUS_ERROR). bError goes TRUE at the same time.

VAR_IN_OUT

stComIn  : ST_KL6781inData22B;
stComOut : ST_KL6781outData22B;
stCom    : ST_MBUS_Communication;

stComIn: Process image of the inputs (see ST_KL6781inData22B).

stComOut: Process image of the outputs (see ST_KL6781outData22B).

stCom: This structure is used to link the block with the meter blocks (see ST_MBUS_Communication).

Requirements

Development environment

required TC3 PLC library

TwinCAT from v3.1.4020.14

Tc2_MBus from 3.3.4.0