From wiki
Revision as of 20:54, 29 August 2017 by SMcNeill (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page is maintained for historic purposes. The functionality described below has not been implemented in QB64.

The COM(n) statement is used in an OPEN COM statement to open "COM1" or "COM2", it can also be used to enable/disable/stop event trapping of the serial port or to setup the event handler using ON COM (n).

Syntax: OPEN "COM1:" + options$ FOR mode AS #1

Syntax 2: COM(n) {ON|OFF|STOP}

Syntax 3: ON COM(n) GOSUB {linenumber|label}


  • COM is used as part of the OPEN string parameter.
  • COM number with a colon is used in the OPEN COM statement in quotation marks or a STRING variable.
  • Other parameters such as the baud rate(speed) are also required in the string parameter.
  • COM(n) ON, OFF or STOP can be used to enable, disable or temporarily stop event trapping respectively.

Example: OPEN "COM1: 9600, N, 8, 1," FOR RANDOM AS #1 LEN = 2048 ' random can transmit and receive data

See also:


Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page