mbusSlaveConfigBaud (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

LX4

Firmware version:

1.94.00


This function is used to change the baud rate of a wired M-Bus slave.

 

 

Input:

handle : SYSHANDLE

A handle to the connection

 

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

The new baud rate to use.

 

pri_addr : INT default -1

The primary address for the slave to configure. Use -1 to use the secondary address instead.

 

sec_addr : STRING

The secondary address for the slave to configure. Used if the primary address is  -1.

 

 

Returns: INT

1

- Success

0

- Not supported

-1

- Invalid handle

-4

- Invalid baud rate

-5

- Invalid interface type.

-6

- Invalid address

-9

- Communication error

-10

- Communication timeout

-11

- Invalid reply

 

Declaration:

FUNCTION mbusSlaveConfigBaud : INT;
VAR_INPUT
  handle   : SYSHANDLE;
  baud     : DINT;
  pri_addr : INT := -1;
  sec_addr : STRING;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  mb : SYSHANDLE;
  rc : INT;
END_VAR;
 
BEGIN
  ...
  // Open wired M-Bus interface @2400 baud
  rc := mbusOpen(handle := mb);
  ...
  // Change baud on device with primary address 11 to 9600 baud
  rc := mbusSlaveConfigBaud(handle:=mb, pri_addr:=11, baud:=9600);
  ...
  // Change speed to 9600 baud to be able to communicate with the device
  rc := mbusBaudSet(handle := mb, baud := 9600);
  ...
END;
END_PROGRAM;