Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
OPEN COM Statement
◄Summary► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Opens and initializes a communications channel for input or output (I/O);
must be executed before a device can be used for communication using an
RS232 interface.
OPEN "COMn: optlist" [FOR mode] AS [#]filenum% [LEN = reclen%]
■ n Communications port to open:
• 1 = COM1
• 2 = COM2
■ optlist Optional communication parameters; the most frequently
used options are:
[speed] [,[parity] [,[data] [,[stop]]]]
Option Description Range (Default in Bold)
═══════ ══════════════════════════════ ═══════════════════════════
speed Baud rate (bits per second) 75, 110, 150, 300, 600,
1200, 1800, 2400, 9600
parity Method of parity checking N, E, O, S, M, PE
(none, even, odd, space, mark,
error checking)
data Number of data bits per byte 5, 6, 7, or 8
stop Number of stop bits 1, 1.5, or 2(*)
──────────────────────────────────────────────────────────────────────
(*) The default value is 1 for baud rates > 110. For baud rates <= 110,
the default value is 1.5 when data is 5; otherwise, the value is 2.
■ mode Keyword specifying mode:
• OUTPUT Sequential output mode
• INPUT Sequential input mode
• RANDOM (default) Random-access mode
■ filenum% Any unused file number between 1 and 255, inclusive
■ reclen% Size of a random-access-mode buffer; default is 128 bytes
See Also
◄OPEN Statement (File I/O)► ◄Opening a COM port►