OPEN COM

From QB64 Phoenix Edition Wiki
Revision as of 15:55, 19 April 2022 by BigRon55 (talk | contribs) (Created page with "The OPEN COM statement is used to access a computer's serial port COM. {{PageSyntax}} : '''OPEN''' "COMn: ''Speed'', ''Parity'', ''Bits'', ''Stopbit'', [''Options'']" [FOR {RANDOM|BINARY|OUTPUT|INPUT}] AS #''P'' [LEN = {{Parameter|byteSize}}] {{Parameters}} * ''Speed'' (baud rate): 50, 150, 300, 600, 1200, 1800, 2400, '''9600''' (QBasic's maximum), 19200 or '''115200''' ('''QB64''''s maximum). * ''Parity'': '''N''' (none), E (eve...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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]


Template:Parameters

  • 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):
  • ASC : ASCII byte mode. End of line = CHR$(13). End of file = CHR$(26)
  • BIN : Binary byte mode. Default mode if ASC is not used(option not required).
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.


Description