beckhoff — 11.2.11.1 Serial COM Ports

Reference | I/O Devices Bits 4-12: nIn Number of data present in buffer Ctrl Bit 0: TR: Transmit Request Bit 1: RA: Receive Accepted Bit 2: IR: Init Request Bit 3: Unused Bits 4-12: nOut Number of data to be sent TA / TR A status change from TR has the effect of loading the nOut data number (maximum 4096 bytes) from Data0- DataN into the send buffer. The interface signals the execution of this command via TA. RA / RR Via a status change from RR the controller interface indicates that the displayed nIn data number is in Data0-DataN. The reception of data is acknowledged in the control word using RA. Only then is new data transmitted from the interface to the controller.

IA / IR If IR is high, the interface carries out an initialization. The send and receive functions are disabled, the FIFO indicators are reset. The execution of initialization is acknowledged by the interface with IA. BUF_F The receive buffer is full. Data received now will be lost. Extended Ctrl/Status: From TwinCAT v2.10 Build >= 1313 (CE image v2.16(x86), v2.17(ARM) and higher). This option is only supported by the standard PC interfaces COMx. If this option is selected, an additional word of process output data (ExtCtrl) and process input data (ExtStatus) is displayed to the existing data. Via these process data the following RS232 control lines can be set or requested. ExtCtrl Bits:

0x0001 = DTR 0x0002 = RTS If the according bit is set/reset the concerning RS232 control line is set/reset. All other bits are reserved. ExtStatus Bits: 0x0001 = CTS 0x0002 = DSR 0x0004 = RI 0x0008 = DCD 0x8000 = TX buffer empty (this bit is set if all send buffer are empty (inclusive hardware Fifo). The state of the rs232 control lines can be requested by masking the bits. All other bits are reserved. Sync Mode In Sync mode , communication with the interface hardware is synchronized with the communication task. This setting usually offers benefits at high baud rates, as long the cycle time of the communication task is short enough.

At 115 kBaud, for example, 12 characters are received each millisecond. The interface therefore has to be operated with a maximum cycle time of 1 ms, in order to avoid overflow of the 16-byte hardware FIFO. If the cycle times are too long, there is a risk of buffer overflow. If Sync mode is switched off, the interface is served via the Windows timer interrupt every millisecond, irrespective of the task cycle time. This mode is not real-time capable, and with high computer utilisation longer operating intervals may be experienced. In this case, with very high baud rates there is also a risk of buffer overflow.

It is recommended to activate Sync mode and to adjust the cycle time of the communication task to the baud rate in such a way that overflow of the 16-byte hardware buffer is avoided. For smaller baud rates and with a slower communication task, Sync mode may perhaps be deactivated. TwinCAT 2 262 Version: 1.7