OPEN COM
Jump to navigation
Jump to search
The OPEN COM statement is used to access a computer's serial port COM.
Syntax
- OPEN "COMn: Speed, Parity, Bits, Stopbit, [Options]" [FOR {RANDOM|BINARY|OUTPUT|INPUT}] AS #P [LEN = byteSize]
- Speed (baud rate): 50, 150, 300, 600, 1200, 1800, 2400, 9600 (QBasic's maximum), 19200 or 115200 (QB64's maximum).
- Parity: N (none), E (even), O (odd), S (space) or M (mark). Note: If 8 bits, use parity N for numerical data.
- Bits = number of bits/byte: Valid numbers: 5, 6, 7 or 8
- Stopbit = number of stop bits: Valid numbers: 1, 1.5 or 2
- Optional COM port Options (separated by commas):
- Below ms is the timeout in milliseconds 1 to 65535. Zero ignores a timeout. Default without ms = 1000 :
- CD[ms] : Time until timeout of DCD (Carrier Detect) line in. CD0 ignores timeouts.
- CS[ms] : Time until timeout of CTS (Clear to Send) line in. CS0 ignores timeouts.
- DS[ms] : Time until timeout of DSR (Data Set Ready) line in. DS0 ignores timeouts.
- OP[ms] : Time until data lines become active. If timeout then OPEN fails, OP0 ignores timeouts.
- RB[b] : Size of receive buffer in bytes when used. Default when not used = 512 bytes
- TB[b] : Size of transmit buffer in bytes when used. Default when not used = 512 bytes
- RS : Supress detection of Request to Send (RTS) line.