FB_MBUS_Scan

FB_MBUS_Scan 1:

This 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 block can only be executed together with the block FB_MBUSKL6781().

VAR_INPUT

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

bStart: The search is initiated with a positive edge at this input.

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

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

bDisabled: TRUE = deselection of the 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: 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.

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

usiCount: Number of detected valid devices.

arrDevice: Information about the detected devices (see ST_MBus_scan).

VAR_IN_OUT

stCom : ST_MBUS_Communication; 

stCom: This structure is used to link the block FB_MBUSKL6781() 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