FB_MBUS_Scan

FB_MBUS_Scan 1:

This function block can be used to scan the M-Bus 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:

This function block is not compatible with BC / BX devices.

VAR_INPUT

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

bStart: Positive edge on this input starts the scanning process.

bStop: Positive edge on this input stops the scanning process.

eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.

bDisabled: TRUE = disable the function block.

VAR_OUTPUT

bBusy       : BOOL;
bReady      : BOOL;
bError      : BOOL;
eError      : E_MBUS_ERROR;
usiAddress  : USINT;
usiCount    : USINT;
arrDevice   : ARRAY [0..250] OF ST_MBus_Scan;

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).

usiAddress: Primary address of the meter.

usiCount: Amount of devices recognized as valid.

arrDevice: Information about the scanned devices.

VAR_IN_OUT

stCom       : ST_MBUS_Communication;

stCom: About this structure, the block FB_MBUSKL6781() is connected to the meter function blocks (see ST_MBUS_Communication).

Download sample program for PC/CX systems: FB_MBUS_Scan 3:

Download sample program for BX systems: FB_MBUS_Scan 4:

Controller configuration setting: "BCxx50 or BX serial"

Download sample program for BC systems: FB_MBUS_Scan 5:

BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".

Controller configuration setting: "BC serial"