Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

SPORT_CONNECT_EX

Serial Port I/O Function: Establishes the connection to a serial port, defines certain usage parameters, and defines the size of the internal buffer for data reception. This routine is only available for Windows.

Module

USE IFPORT

result = SPORT_CONNECT_EX (port [,options] [,BufferSize])

port

(Input) Integer. The port number of connection. The routine will open COM n, where n is the port number specified.

options

(Input; optional) Integer. Defines the connection options. These options define how the nnn_LINE routines will work and also effect the data that is passed to the user. If more than one option is specified, the operator .OR. should be used between each option. Options are as follows:

Option

Description

DL_TOSS_CR

Removes carriage return (CR) characters on input.

DL_TOSS_LF

Removes linefeed (LF) characters on input.

DL_OUT_CR

Causes SPORT_WRITE_LINE to add a CR to each record written.

DL_OUT_LF

Causes SPORT_WRITE_LINE to add a LF to each record written.

DL_TERM_CR

Causes SPORT_READ_LINE to terminate READ when a CR is encountered.

DL_TERM_LF

Causes SPORT_READ_LINE to terminate READ when a LF is encountered.

DL_TERM_CRLF

Causes SPORT_READ_LINE to terminate READ when CR+LF is encountered.

If options is not specified, the following occurs by default:

(DL_OUT_CR .OR. DL_TERM_CR .OR. DL_TOSS_CR .OR. DL_TOSS_LF)

This specifies to remove carriage returns and linefeeds on input, to follow output lines with a carriage return, and to return input lines when a carriage return is encountered.

BufferSize

(Input; optional) Integer. Size of the internal buffer for data reception. If BufferSize is not specified, the size of the buffer is 16384 bytes (the default).

The size of the buffer must be 4096 bytes or larger. If you try to specify a size smaller than 4096 bytes, your specification will be ignored and the buffer size will be set to 4096 bytes.

Results

The result type is INTEGER(4). The result is zero if successful; otherwise, a Windows* error value.

Example

USE IFPORT
INTEGER(4) iresult
iresult =  SPORT_CONNECT_EX( 2, BufferSize = 8196 )
END

See Also