mbusOpen (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

LX4, NX-400

Firmware version:

1.94.00


This function is used to open a connection to an M-Bus or Wireless M-Bus interface.

 

 

Input:

type : SINT default 1

The type of connection to create:

1

- On-board M-Bus interface (Only supported on the RTCU LX4)

2

- Wireless M-Bus

 

baud : DINT (300,600,1200,2400,4800,9600,19200,38400) (default 2400)

The baud rate to use for Wired M-Bus.

Note that not all baud rates are supported on all interfaces.

 

mode : SINT default _MBUS_MODE_T1

The operation mode to use for Wireless M-Bus:

_MBUS_MODE_T1

- T1

_MBUS_MODE_T2

- T2

_MBUS_MODE_S1

- S1

_MBUS_MODE_S2

- S2

_MBUS_MODE_R

- R

_MBUS_MODE_T1_C

- Reception of both T1 and C

_MBUS_MODE_T2_C

- Reception of both T2 and C

 

 

Output:

handle : SYSHANDLE

A handle to the connection

 

Returns: INT

1

- Success

0

- Not supported

-1

- Invalid handle(handle is in use)

-2

- No more connections available

-3

- Interface is already in use

-4

- Invalid baud rate

-5

- Invalid interface type.

-8

- Failed to open connection

 

Declaration:

FUNCTION mbusOpen : INT;
VAR_INPUT
  type     : SINT := 1;
  baud     : DINT := 2400;
  mode     : SINT := _MBUS_MODE_T1;
  handle   : ACCESS SYSHANDLE;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  mb : SYSHANDLE;
  rc : INT;
END_VAR;
 
BEGIN
  ...
  // Open wired M-Bus interface
  rc := mbusOpen(handle := mb);
  ...
END;
END_PROGRAM;