OPENCOMMDEVICE@

Platform

x64, Win32

Purpose

To open a serial port for I/O.

Syntax

INTEGER (KIND=7) 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.

PORTNUM must be in the range 0 to 256.

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

RSIZE and TSIZE were provided for Windows 3.1 and are now redundant.

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.

OPENCOMMDEVICE@ returns a file HANDLE that can be used in a direct calls to�Microsoft library functions such as WaitCommEvent. A suitable interface for WaitCommEvent is:
 STDCALL WaitCommEvent 'WaitCommEvent' (VAL,REF,VAL):INTEGER*4
where the first argument is the HANDLE returned by OPENCOMMDEVICE@. The second argument receives the event mask and is an INTEGER*4 variable. The third argument must be set to zero and represents a NULL pointer passed as a value.

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited