Configuration in TwinCAT 3

Activate Virtual Com Port

TwinCAT 3 provides the EL60xx configuration tab for bus terminals of type EL60xx. For EL60xx terminals with checked "Virtual Com Port" check box TwinCAT creates on configuration activation a virtual serial COM port.

Configuration in TwinCAT 3 1:

The number of the COM port is defined in edit field "Com Port". Note, that a com port number must be unique within a computer. The computer on which the virtual com port should be created must not have a com port with this number. TwinCAT starts with com port number 6. The com port number must be less than 65536.

Local or Remote

Edit field "Host Ams NetId" determines the computer on which the virtual com port should be created. By default the local computer is used, which is the one where the configuration is activated and with which the bus terminal is connected. It is also possible to create the virtual com port on a remote computer just by changing the "Host Ams NetId" respectively. Note, that the TwinCAT-Virtual-Serial-COM-Driver has to be installed on this computer.

 

COM Port Settings

Within "Com Port Settings" panel one can change the common parameters of a com port, i.e. baud rate, parity, data bits, stop bits, and also flow control settings as RTS/CTS, Tx XON/XOFF, and Rx XON/XOFF. The bus terminal is initialized with the configured parameters on TwinCAT activation. However, usually applications that open a com port will also reconfigure it with their own particular default settings overriding the settings from system manager.

Not all possible combinations of parity, data bit count and stop bit count are valid. The following table lists the allowed combinations:

7 data bits, even parity, 1 stop bit

7 data bits, even parity, 2 stop bits

7 data bits, odd parity, 1 stop bit

7 data bits, odd parity, 2 stop bits

8 data bits, no parity, 1 stop bit

8 data bits, no parity, 2 stop bits

8 data bits, even parity, 1 stop bit

8 data bits, even parity, 2 stop bits

8 data bits, odd parity, 1 stop bit

8 data bits, odd parity, 2 stop bits

 

In addition to common parameters there are some proprietary settings for an EL60xx bus terminal, i.e. "Transfer Rate Optimization" and "Fifo threshold". With enabled "Transfer Rate Optimization" the bus terminal first collects enough data to fill the available space in the process image before it is sent to the TcIo driver. With disabled "Transfer Rate Optimization" the data is sent as soon as possible to the TcIo driver. The "Fifo Threshold" setting determines when the bus terminal indicates "Fifo Full" state.

Parameters of the EL6021 bus terminal are somewhat different. Therefore the configuration dialog differs:

Configuration in TwinCAT 3 2:

The EL6021 does not support RTS/CTS handshake. It does support a half duplex mode and it can be configured for point to point connections.

For more details on the special settings refer to bus terminal documentation of EL6001 and EL6021.

Add IO-Task

The TwinCAT IO driver only processes data from bus terminals, if at least one input variable is linked to a Task variable. Otherwise, the data is ignored. Therefore, a dummy Task with one variable for each bus terminal that is used as virtual com port is needed. Create a Dummy Task with IO-Image.

Configuration in TwinCAT 3 3:

Insert a Input Variable of UINT-Typ and link the input status word of the bus terminal to a respective Task variable as shown in the screen shot below.

Make sure to configure the task with "Auto start" enabled. The "Cycle Ticks" settings controls the update frequency for the variables. In order to get the full data transfer rate through a virtual COM port, the cycle time should be about 1ms.

Configuration in TwinCAT 3 4:

 

Requirements

Development environment

Target system type

TwinCAT v3.0.0

PC or CX (x86)