Silverfrost Logo About Us | Contact Us
 

OPENCOMMDEVICE@

Platform

Win32

Purpose

To open a serial port for I/O.

Syntax

INTEGER (KIND=3) OPENCOMMDEVICE@(PORTNUM,COMSPEC,RSIZE,TSIZE)
INTEGER (KIND=3) PORTNUM, RSIZE,TSIZE
CHARACTER (LEN=*) COMSPEC

Description

To initiate serial communications between the computer and external devices a communications port must be selected and opened. On a standard PC there is a maximum of four serial ports, although it is common for only two to be installed. PORTNUM can therefore be either 1, 2, 3 or 4. Port 1 is commonly used to connect the mouse and so may not be available.

COMSPEC is a string that specifies the baud rate, parity, data and stop bit information (e.g. '9600, n, 8, 1'). Possible values are:

baud rate: 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200

parity: n (none), o (odd), e (even)

data bits: 7 or 8

stop bits: 0 or 1

Under Windows 3.1(1) it is necessary to specify a size for input and output buffers. The size of the input buffer RSIZE and the size of the output buffer TSIZE should be set at about 1024. On slower systems with high data rates it may be advisable to specify larger values.

Return value

OPENCOMMDEVICE@ returns a positive value when successful otherwise it returns -1.

Notes

To access this routine you need to provide a definition by, for example, including the file clearwin.ins or by using the MSWIN module.

 

 

Copyright © 1999-2017 Silverfrost Limited