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>
Globale_Variablen (GVL) ¶ InOut: Scope Name Type Initial Constant INVALID_HANDLE DWORD 16#FFFFFFFF
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>
POUs ¶ SysComClose (Function) SysComGetVersion2300 (Function) SysComOpen (Function) SysComRead (Function) SysComSetSettings (Function) SysComSetSettingsEx (Function) SysComWrite (Function)
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>
SysComClose (FUN) ¶ FUNCTION SysComClose : BOOL InOut: Scope Name Type Return SysComClose BOOL Input dwHandle DWORD
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>