OpenCom
Com port management function. Function not available anymore since Windows XP.
The OpenCom function opens the specified Com port. Not available in WinTask Lite.
Syntax
ret=OpenCom(<port_num>,<speed>,<parity$>,<databits>,<stopbits>,<flowctl$>)
Parameters
<port_numt>: Com port number to open (from 1 to 8, Com1 to Com8).
<speed>: port speed, integer with the following possible values:
75, 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 56000, 57600<parity$>: one character for the parity ; possible values are :
N
none (no parity)
E
even (even parity)
O
odd (odd parity)
M
mark
S
space
<databits>: data bits, integer with the following possible values:
4, 5, 6, 7, 8.<stopbits>: stop bits, integer with the following possible values:
1, 2 or 3 (3 is the code for a stopbit with a value of 1.5) .<flowctl$>: one character for the flow control ; possible values are:
N
none
R
RTS/CTS
X
Xon/Xoff
Return value
Ret, numeric return code. If the specified Com port has been opened correctly, the function returns 0, otherwise use this return code for Error Handling.
Remarks
Parameters can be in uppercase or lowercase.
WinTask allocates a 1024-byte buffer for receiving characters from the com port. This buffer can be read by the ReadCom function.
See also
Example
ret=OpenCom(1,9600,"n",8,1,"n")
Opens the serial port Com1 for 9600 bits per second, no parity, 8 databits, 1 stop bit and no flow control.