SysComOpen3 (FUN) ¶ FUNCTION SysComOpen3 : RTS_IEC_HANDLE <description>Opens a serial communication device specified by settings</description> <result><p>RESULT: Handle to the opened com port or RTS_INVALID_HANDLE if failed</p></result> InOut: Scope Name Type Comment Return SysComOpen3 RTS_IEC_HANDLE Input pSettings POINTER TO SysComSettings <param name=”pSettings” type=”IN”>Settings for the communication device. See category “Com port settings” for detailed information</param> pSettingsEx2 POINTER TO SysComSettingsEx2 <param name=”pSettingsEx2” type=”IN”>Optional extended settings for the serial device. Can be 0.</param> pResult POINTER TO RTS_IEC_RESULT <param name=”pResult” type=”OUT”>Pointer to runtime system error code (see CmpErrors.library)</param>
SysComPurge (FUN) ¶ FUNCTION SysComPurge : RTS_IEC_RESULT <description>Clear the fifo buffer of the serial interface</description> <result><p>RESULT: Returns the runtime system error code (see CmpErrors.library).</p></result> InOut: Scope Name Type Comment Return SysComPurge RTS_IEC_RESULT Input hCom RTS_IEC_HANDLE <param name=”hCom” type=”IN”>Handle to com port</param>
SysComRead (FUN) ¶ FUNCTION SysComRead : UDINT <description>Reads the number of bytes from the receive buffer of the specified device. <p>IMPLEMENTATION NOTE: If the timeout elapsed until the requested number of bytes are received, the function returns the number of bytes already received! This must be considered in the caller and the implementation!</p></description> <result><p>RESULT: Number of actual read bytes</p></result> InOut: Scope Name Type Comment Return SysComRead UDINT Input hCom RTS_IEC_HANDLE <param name=”hCom” type=”IN”>Handle to com port</param> pbyBuffer POINTER TO BYTE <param name=”pbyBuffer” type=”IN”>Pointer to data buffer for received data</param> ulSize UDINT <param name=”uiSize” type=”IN”>Requested number of bytes to read. Must be less or equal the size of the receive buffer!</param> ulTimeout SYS_COM_TIMEOUT <param name=”ulTimeout” type=”IN”>Timeout in milliseconds to read data from the device. [0]=Immediate return. If the timeout elapsed, the function returns with the still received data (could be less then the requested number of bytes!)</param> pResult POINTER TO RTS_IEC_RESULT <param name=”pResult” type=”OUT”>Pointer to return the runtime system error code (see CmpErrors.library).</param>
SysComSetSettings (FUN) ¶ FUNCTION SysComSetSettings : RTS_IEC_RESULT <description>Set the parameter of the interface specified by handle. Use SysComSetSettings2()! This function should only be used for backward compatibility! </description> <result><p>RESULT: Returns the runtime system error code (see CmpErrors.library).</p></result> InOut: Scope Name Type Comment Return SysComSetSettings RTS_IEC_RESULT Input hCom RTS_IEC_HANDLE <param name=”hCom” type=”IN”>Handle to com port</param> pSettings POINTER TO SysComSettings <param name=”pSettings” type=”IN”>Pointer to new settings</param> pSettingsEx POINTER TO SysComSettingsEx <param name=”pSettingsEx” type=”IN”>OPTIONAL: Pointer to extended settings or 0</param>
SysComSetSettings2 (FUN) ¶ FUNCTION SysComSetSettings2 : RTS_IEC_RESULT <description>Set the parameter of the interface specified by handle.</description> <result><p>RESULT: Returns the runtime system error code (see CmpErrors.library).</p></result> InOut: Scope Name Type Comment Return SysComSetSettings2 RTS_IEC_RESULT Input hCom RTS_IEC_HANDLE <param name=”hCom” type=”IN”>Handle to com port</param> pSettings POINTER TO SysComSettings <param name=”pSettings” type=”IN”>Pointer to new settings</param> pSettingsEx2 POINTER TO SysComSettingsEx2 <param name=”pSettingsEx2” type=”IN”>OPTIONAL: Pointer to extended settings or 0</param>
SysComSetTimeout (FUN) ¶ FUNCTION SysComSetTimeout : RTS_IEC_RESULT <description>Set the timeout of the specified serial interface (hardware timeout). The Timeout is the time between two received or sent characters until the read or write operation will return. Typically this value should be 0 (returns immediately)</description> <result><p>RESULT: Returns the runtime system error code (see CmpErrors.library).</p></result> InOut: Scope Name Type Comment Return SysComSetTimeout RTS_IEC_RESULT Input hCom RTS_IEC_HANDLE <param name=”hCom” type=”IN”>Handle to com port</param> ulTimeout SYS_COM_TIMEOUT <param name=”ulTimeout” type=”IN”>Timeout in milliseconds for the read and write operation to set</param>
SysComSettings (STRUCT) ¶ TYPE SysComSettings : STRUCT <category>Com port settings</category> <description>: Settings to open and to configure a COM interface</description> InOut: Name Type Comment sPort SYS_COM_PORTS <element name=”sPort” type=”IN”>Port number: 0=disabled, 1=COM1, 2=COM2, …. See SYS_COM_PORTS for predefined values.</element> byStopBits SYS_COM_STOPBITS <element name=”byStopBits” type=”IN”>Stop bits. See SYS_COM_STOPBITS for details.</element> byParity SYS_COM_PARITY <element name=”byParity” type=”IN”>Parity. See SYS_COM_PARITY for details.</element> ulBaudrate SYS_COM_BAUDRATE <element name=”ulBaudRate” type=”IN”>Baudrate. See SYS_COM_BAUDRATE for details.</element> ulTimeout SYS_COM_TIMEOUT <element name=”ulTimeout” TYPE=”IN”>Hardware timeout. The Timeout is the TIME between two received OR sent characters until the read or write operation will return. Typically this value should be 0 (returns immediately) See SYS_COM_TIMEOUT for predefined values. </element> ulBufferSize UDINT <element name=”ulBufferSize” type=”IN”>Buffersize of FIFO buffer</element>
SysComSettingsEx (STRUCT) ¶ TYPE SysComSettingsEx : STRUCT <category>Com port extended settings</category> <description>: This structure can be used to get and set the settings of a COM port. NOTE: The difference of this structure to SysComSettingsEx2 are the 2 members bDtrControl and bRtsControl! Here you can specify only BOOL instead of BYTE values in SysComSettingsEx2! </description> InOut: Name Type Comment byByteSize BYTE <element name=”byByteSize” TYPE=”IN”>Number of bits/BYTE, 4-8</element> bBinary BOOL <element name=”bBinary” TYPE=”IN”>Binary mode, no EOF check</element> bOutxCtsFlow BOOL <element name=”bOutxCtsFlow” TYPE=”IN”>CTS handshaking on output</element> bOutxDsrFlow BOOL <element name=”bOutxDsrFlow” TYPE=”IN”>DSR handshaking on output</element> bDtrControl BOOL <element name=”bDtrControl” TYPE=”IN”>DTR flow control</element> bDsrSensitivity BOOL <element name=”bDsrSensitivity” TYPE=”IN”>DSR Sensitivity</element> bRtsControl BOOL <element name=”bRtsControl” TYPE=”IN”>Rts flow control</element> bTXContinueOnXoff BOOL <element name=”bTXContinueOnXoff” TYPE=”IN”>XOFF continues Tx</element> bOutX BOOL <element name=”bOutX” TYPE=”IN”>XON/XOFF out flow control</element> bInX BOOL <element name=”bInX” TYPE=”IN”>XON/XOFF in flow control</element> byXonChar BYTE <element name=”XonChar” TYPE=”IN”>Tx AND Rx XON character</element> byXoffChar BYTE <element name=”XoffChar” TYPE=”IN”>Tx AND Rx XOFF character</element> wXonLim WORD <element name=”XonLim” TYPE=”IN”>transmit XON threshold</element> wXoffLim WORD <element name=”XoffLim” TYPE=”IN”>transmit XOFF threshold</element>
SysComWrite (FUN) ¶ FUNCTION SysComWrite : UDINT <description><p>Writes the number of bytes to the send buffer of the specified device.</p> <p>IMPLEMENTATION NOTE: If the timeout elapsed until the requested number of bytes are sent, the function returns the number of bytes already sent! This must be considered in the caller and the implementation!</p></description> <result><p>RESULT: Number of actual written bytes</p></result> InOut: Scope Name Type Comment Return SysComWrite UDINT Input hCom RTS_IEC_HANDLE <param name=”hCom” type=”IN”>Handle to com port</param> pbyBuffer POINTER TO BYTE <param name=”pbyBuffer” type=”IN”>Pointer to data buffer for sent data</param> ulSize UDINT <param name=”uiSize” type=”IN”>Requested number of bytes to sent. Must be less or equal the size of the sent buffer!</param> ulTimeout SYS_COM_TIMEOUT <param name=”ulTimeout” type=”IN”>Timeout in milliseconds to sent data to the device. [0]=Immediate return. If the timeout elapsed, the function returns with the still sent data (could be less then the requested number of bytes!)</param> pResult POINTER TO RTS_IEC_RESULT <param name=”pResult” type=”OUT”>Pointer to return the runtime system error code (see CmpErrors.library).</param>
SysComSettingsEx2 (STRUCT) ¶ TYPE SysComSettingsEx2 : STRUCT <category>Com port extended settings</category> <description>: This structure can be used to get and set the settings of a COM port. NOTE: The difference of this structure to SysComSettingsEx are the 2 members byDtrControl and byRtsControl! Here you can specify BYTE instead of BOOL values in SysComSettingsEx! </description> InOut: Name Type Comment byByteSize BYTE <element name=”byByteSize” TYPE=”IN”>Number of bits/BYTE, 4-8</element> bBinary BOOL <element name=”bBinary” TYPE=”IN”>Binary mode, no EOF check</element> bOutxCtsFlow BOOL <element name=”bOutxCtsFlow” TYPE=”IN”>CTS handshaking on output</element> bOutxDsrFlow BOOL <element name=”bOutxDsrFlow” TYPE=”IN”>DSR handshaking on output</element> byDtrControl BYTE <element name=”byDtrControl” TYPE=”IN”>DTR (data-terminal- ready) flow control. See SYS_COM_DTR_CONTROL for possible values.</element> bDsrSensitivity BOOL <element name=”bDsrSensitivity” TYPE=”IN”>DSR Sensitivity</element> byRtsControl BYTE <element name=”byRtsControl” TYPE=”IN”>Rts (request-to-send) flow control. See SYS_COM_RTS_CONTROL for possible values.</element> bTXContinueOnXoff BOOL <element name=”bTXContinueOnXoff” TYPE=”IN”>XOFF continues Tx</element> bOutX BOOL <element name=”bOutX” TYPE=”IN”>XON/XOFF out flow control</element> bInX BOOL <element name=”bInX” TYPE=”IN”>XON/XOFF in flow control</element> byXonChar BYTE <element name=”XonChar” TYPE=”IN”>Tx AND Rx XON character</element> byXoffChar BYTE <element name=”XoffChar” TYPE=”IN”>Tx AND Rx XOFF character</element> wXonLim WORD <element name=”XonLim” TYPE=”IN”>transmit XON threshold</element> wXoffLim WORD <element name=”XoffLim” TYPE=”IN”>transmit XOFF threshold</element>