FB_MBUS_General_Send
This function block serves to send data to any M-Bus devices. (for example, the primary address of the meter can be changed with this function block)
The function block can only be executed together with the function block FB_MBUSKL6781().
Functionality of the function block
VAR_INPUT
usiAddress : USINT;
stSecAdr : ST_MBUS_SecAdr;
eBaudrate : E_MBUS_Baudrate := eMBUS_Baud2400;
bStart : BOOL;
bSND_NKE : BOOL := TRUE;
bDisabled : BOOL := FALSE;
byC_Field : USINT:=16#53;
byCI_Field : USINT:=16#51;
arrData : ARRAY [0..240] OF BYTE;
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).
bDisabled: TRUE = disable the function block.
byC_Field: C-Field / Control field.
byCI_Field: CI-Field / Control information field.
arrData: The data to be sent must be transferred to this variable.
VAR_OUTPUT
bBusy : BOOL;
bReady : BOOL;
bError : BOOL;
eError : E_MBUS_ERROR;
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).
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:
Download sample program for BX systems:
Controller configuration setting: "BCxx50 or BX serial"
Download sample program for BC systems:
BCxx00 must be set to "Large Model" in the PLC under "Project/Options/Controller Settings".
Controller configuration setting: "BC serial"