ioDeviceEnable (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All devices with RS485

Firmware version:

1.50 / 1.00.00


This function is used to enable or disable an I/O Extension device.

When a device is disabled, the firmware will no longer communicate with the device and the inputs and/or outputs on the device are no longer updated.

While a device is disabled, its status will not change and no new exceptions are raised.

 

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.

 

dev_addr : INT

The address of the device.

 

enable : BOOL

TRUE:

The I/O on the device is updated.

FALSE:

The I/O on the device is no longer updated.

 

Returns: INT

0

- Success.

1

- The I/O net is not found.

2

- The I/O device is not found.

 

Declaration:

FUNCTION ioDeviceEnable : INT;
VAR_INPUT
  net_id   : SINT;
  dev_addr : INT;
  enable   : BOOL;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM ModbusExample;
 
BEGIN
  ...
  IF cmd = 5 THEN
    // Disable device
    ioDeviceEnable(net_id := 1, dev_addr := device, enable := FALSE);
  END_IF;
  ...
END;
END_PROGRAM;