IOS_CONTROLCHANNEL: Enable or Disable a Communication Channel

Function Description

This function allows you to enable or disable a communication channel.

A channel managed by this function is reinitialized to its default value (enable) after a reset (cold/warm).

After a stop or after a start command, the channel remains disabled if it was disabled before. After a reset, the channel is enabled (default) even if it was disabled before.

NOTE: When you attempt to disable a channel communicating with a TM3BCEIP bus coupler, the system will try to re-enable the connection and send the bus coupler configuration to it, as the bus coupler uses more than one channel, and the IOS_CONTROLCHANNEL function only disables or enables one channel at a time. This is therefore seen as an error by the system. To effectively disable the channels connected to a TM3 bus coupler, you must disable the associated bus coupler. Refer to ControlChannels: Enable or Disable all Communication Channels with TM3BCEIP. To enable the channels of the bus coupler, you must also use this method.

Graphical Representation

IL and ST Representation

To see the general representation in IL or ST language, refer to Function and Function Block Representation.

I/O Variable Description

This table describes the input variables:

Input

Type

Comment

ChannelID

UINT

The channel number (visible in the first column of the configuration page).

Enable

BOOL

Enables or disables command.

This table describes the output variable:

Output

Type

Comment

IOS_CONTROLCHANNEL

INT

Returns 0 on success, a negative value on error.

Example

This is an example of a call of this function:

// Disable Modbus TCP channel 3

IOS_CONTROLCHANNEL (3, FALSE);