COM(n)

From QB64.org wiki
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}

Description:

  • 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:

OPEN COM, ON COM(n)




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