COMM_Open

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Modules > COMM >

COMM_Open

 

Description

 

Opens a serial port to begin communications.

 

Syntax

 

Status = COMM_Open(sComPort, hComm)

 

Returns

 

Zero if no error.

Any value different from zero means an error

 

Parameters

 

Name

Type

Optional

Meaning

sCommPort

String

No

Identifies the serial port number, for example, "COM1", "COM4", etc.

hComm

Number

No

A number containing a free file number, typically provided by the COMM_FreeFile function.

 

Remarks

 

If the port was not opened successfully, the return value is not zero.

Before actual communications through the port can commence, you must configure the communication parameters by using a COMM_Set statement for each parameter.

 

Restrictions

 

When opening ports above "COM9", Windows requires the port name to be specified using the following syntax:

 

COMM_Open("\\.\COM15", hComm)

 

See also

 

Examples