FB_MBUS_General_Param
This block is used for reading any M-Bus devices. The variable arrData supplies cMBUS_MaxDataParam values.
These values can be parameterised in the input array arrConfigData. String values and manufacturer-specific information are not shown correctly.
![]() | This function block is not suitable for BC/BX. The function block can only be executed together with the function block FB_MBUSKL6781(). |
VAR_INPUT
usiAddress : USINT;
stSecAdr : ST_MBUS_SecAdr;
eBaudrate : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart : BOOL;
bSND_NKE : BOOL := TRUE;
bReadInit : BOOL := TRUE;
tMinSendTime : TIME := t#2s;
usiUnit : USINT;
bDisabled : BOOL := FALSE;
arrConfigData : ARRAY [1..cMBUS_MaxDataParam] OF WORD;
usiAddress: Primary address of the counter, that shall be readout with this module.
stSecAdr: Secondary address of the counter, that shall be readout with this module.
eBaudrate: 300, 600, 1200, 2400, 4800, 9600 baud.
bStart: Positive edge on this input, the meter is read out once.
bSND_NKE: TRUE to initialize the meter at each reading, and sets the meter on the first telegram (SND_NKE).
bReadInit: After restarting the PLC, the meter is read out once.
tMinSendTime: Standard t#2s. When this time exceeds, the counter is rereadout. At t#0s the counter is not readout and can be readout with bStart manually.
usiUnit: Unit of the energy values. 0=W/J(h) / 1=KW/KJ(h) / 2=MW/MJ(h) / 3=GW/GJ(h).
bDisabled: TRUE = disable the function block.
arrConfigData: maximum of cMBUS_MaxDataParam input parameters for specifying which values are to be displayed in the output array arrData. See example below.
VAR_OUTPUT
bBusy : BOOL;
bReady : BOOL;
bError : BOOL;
eError : E_MBUS_ERROR;
dwIdNumber : DWORD;
byStatus : BYTE;
byGEN : BYTE;
byCounter : BYTE;
usiRecivedAdr : USINT;
eMedium : E_MBUS_Medium;
sMan : STRING(3);
arrData : ARRAY [1..cMBUS_MaxDataParam] OF ST_MBus_Data;
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).
dwIdNumber: Serial number of the meter (secondary address).
byStatus: Status of the meter. Please refer to device description for meanings.
byGEN: Meter software version.
byCounter: Transmission counter (number of transmitted RSP_UD).
usiRecivedAdr: Received primary address (0-250).
eMedium: Medium (see E_MBUS_Medium).
sMan: Manufacturer code.
arrData: Maximum cMBUS_MaxDataParam values. The values can be configured via the input variable arrConfigData. The meaning of the values is explained in the M-Bus protocol for the device.
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).
Sample VAR_INPUT arrConfigData
arrConfigData[x]:=T T V V; T T= telegram 2 digits (<=99), V V = value 2 digits (maximum cMBUS_MaxData <=99)
Sample arrConfigData:
MBUS.arrConfigData[1]:=0101; (telegram 1, value 1)
MBUS.arrConfigData[2]:=0102; (telegram 1, value 2)
MBUS.arrConfigData[3]:=0309; (telegram 3, value 9)
MBUS.arrConfigData[3]:=1510; (telegram 15, value 10)
MBUS.arrConfigData[4]:=511; (telegram 5, value 11)
MBUS.arrConfigData[x]:=10; false, too few digits (minimum 3)
MBUS.arrConfigData[x]:=12345; false, too many digits (maximum 4)
Incorrect assignment results in the corresponding field in the output array (arrData) remaining empty (no error message).