FB_MBUSKL6781

FB_MBUSKL6781 1:

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

The function block can only be executed together with at least one meter function block.

An instance of this function block required for each KL6781 terminal.

The function block requires a task time of maximum 10 ms at 2400 baud. If higher task times are required, this function block must be outsourced to a fast task.

FB_MBUSKL6781 2: Inputs

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

Name

Type

Description

usiRetries

USINT

Number of retries in the event of errors

bStart

BOOL

All meters are read once on the positive edge of this input.

bDisabled

BOOL

TRUE = deselection of the function block.

FB_MBUSKL6781 3: Inputs/outputs

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

Name

Type

Description

stComIn

ST_KL6781inData22B

Process image of the inputs

stComOut

ST_KL6781outData22B

Process image of the outputs

stCom

ST_MBUS_Communication

This structure is used to link the function block with the meter blocks.

FB_MBUSKL6781 4: Outputs

VAR_OUTPUT
  bBusy : BOOL;
  bReady : BOOL;
  bError : BOOL;
  eError : E_MBUS_ERROR;
END_VAR

Name

Type

Description

bBusy

BOOL

The bBusy output is TRUE as long as the meter is being read.

bReady

BOOL

The bReady output is TRUE for one cycle, once meter reading is completed.

bError

BOOL

This output goes TRUE as soon as an error occurs. This error is described via the eError variable.

eError

E_MBUS_ERROR

In the event of an error, the output issues an error code and bError becomes TRUE at the same time.

Requirements

Development Environment

PLC library to include

TwinCAT from v3.1.4020.14

Tc2_MBus from 3.3.5.0