'KCMLOpenPort(sPort$)
Opens a serial or parallel port on the client
Arguments
| STR() | sPort$ | [in] | Format string describing the port to be opened. |
Returns
A handle with which to reference the port, or 0 if the call failed.
Syntax
The following definition is built into KCML. You do not have to include it in your own code.
$DECLARE 'KCMLOpenPort(STR())
Remarks
KCMLOpenPort opens a serial or parallel port on the client. The returned handle can be passed to KCMLWritePort and KCMLClosePort. The handle should be closed after use.
To open a parallel port sPort$ should be "LPT1:" for the first port, "LPT2:" for the second and so on. Opening a serial port is more complicated as there are more options to set.
For a serial port the format is "COMn:baud,bits,parity,stop bits,flow control". For example, the string "COM1:57600,8,O,1,H" would open COM1 at 57600 baud using 8 bits per character with odd parity, one stop bit and hardware flow control.
Valid options
| Option | Possible Values |
|---|---|
| COMn | Any valid port number. |
| baud | Any valid baud rate |
| bits | 7 or 8 |
| parity | [E]ven [O]dd [M]ark or [N]one |
| stop bits | 1, 1.5 or 2 |
| flow control | [N]one [X]on/Xoff [H]ardware or [B]oth |
Further Information
| Introduced | KCML 6.20 |
| Compatibility | KClient |
See Also
KCMLClosePort, KCMLDebugBackProcess, KCMLGetClientIP_TOS, KCMLReadPort, KCMLSetClientIP_TOS, KCMLWritePort, KCMLWritePortName