ioNetConfig (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All devices with RS485

Firmware version:

4.56 / 1.00.00


This function is used to change the configuration of an I/O Extension net.

The changes will be applied when the I/O Extension net is enabled with the ioNetEnable function.

 

The network ID is for the I/O Extension net that is found in the RTCU IDE, not the MODBUS connection ID returned by modbusOpen.

 

 

Input:

net_id : SINT

The network ID of the I/O Extension network.

 

port : SINT (-1,0..2) (default -1)

Selects which serial port to use (see serial port enumeration).

This parameter is ignored if set to -1.

 

baud : DINT (-1,9600,19200,38400,57600) (default -1)

Selects the desired baud rate.

This parameter is ignored if set to -1.

 

bit : SINT (-1,7/8) (default -1)

Selects the number of bits per character.

Note: 7 bit only works when parity is used (even or odd).

This parameter is ignored if set to -1.

 

parity : SINT (-1,0..2) (default -1)

Selects the desired parity, 0 is none, 1 is even, and 2 is odd.

This parameter is ignored if set to -1.

 

stop : SINT (-1,1/2) (default -1)

Selects number of stop bits.

This parameter is ignored if set to -1.

 

 

Returns: INT

0

- Success.

1

- The I/O net is not found.

2

- No changes to the configuration.

3

- Illegal parameter.

 

Declaration:

FUNCTION ioNetConfig : INT;
VAR_INPUT
  net_id   : SINT;
  port     : DINT := -1;
  baud     : DINT := -1;
  bit     : SINT := -1;
  parity   : SINT := -1;
  stop     : SINT := -1;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM ModbusExample;
 
  // Move I/O Extension net 1 to serial port 2
  ioNetEnable(net_id := 1, enable := OFF);
  ioNetConfig(net_id := 1, port := 2);
  ioNetEnable(net_id := 1, enable := ON);
 
  ...
 
BEGIN
  ...
END;
END_PROGRAM;