FB_MBUS_Scan

FB_MBUS_Scan 1:

The function block FB_MBUS_Scan can be used to scan the M-Bus. All primary addresses (0..250) are queried successively. The array arrDevice is used to show certain device information.

Only the primary address is used for scanning.

The primary address of all devices must be set.

The function block can only be executed together with the function block FB_MBUSKL6781().

FB_MBUS_Scan 2: Inputs

VAR_INPUT
  bStart       : BOOL;
  bStop        : BOOL;
  eBaudrate    : E_MBUS_Baudrate := eMBUS_Baud2400;
  bStart       : BOOL;
  bDisabled    : BOOL := FALSE;
END_VAR

Name

Type

Description

bStart

BOOL

The search is started with a positive edge at this input.

bStop

BOOL

The search is stopped with a positive edge at this input.

eBaudrate

E_MBUS_Baudrate

300, 600, 1200, 2400, 4800, 9600 baud

bDisabled

BOOL

TRUE = deselection of the function block

FB_MBUS_Scan 3: Inputs/outputs

VAR_IN_OUT
  stCom : ST_MBUS_Communication;
END_VAR

Name

Type

Description

stCom

ST_MBUS_Communication

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

FB_MBUS_Scan 4: Outputs

VAR_OUTPUT
  bBusy           : BOOL;
  bReady          : BOOL;
  bError          : BOOL;
  eError          : E_MBUS_ERROR;
  usiAddress      : USINT;
  usiCount        : USINT;
  arrDevice       : ARRAY [0..250] OF ST_MBus_Scan;
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

This output outputs an error code in the event of an error. bError goes TRUE at the same time.

usiAddress

USINT

Primary address of the meter to be read with this function block.

usiCount

USINT

Number of detected valid devices

arrDevice

ARRAY OF ST_MBus_Scan

Information about the detected devices

Requirements

Development Environment

PLC library to include

TwinCAT from v3.1.4020.14

Tc2_MBus from 3.3.5.0