comOpen

C Scripting Language
Reference Manual
Version 4.4.0

<< Back  End  Next >>
 
 
INDEX
Introduction
Installation
Using the CSL executive
Language
Directives
System library
String library
Math library
Regular expression lib.
File library
Database library
Async Communication
   comBits
   comBps
   comClose
   comFlow
   comInputChars
   comOpen
   comParity
   comPurgeInput
   comRead
   comReadChar
   comReadTimeout
   comStops
   comWaitForOutput
   comWrite
Registry/Profile handling
Windows control
C API
C++ Class Interface
CSL links
  
comOpen(
  const devname,     // name of async device
  [const logfile])   // optional communication logfile

Opens a communication line and returns a handle. The handle returned by comOpen is needed in subsequent calls to other COM functions.

devname is usually something like com1, com2 etc. Please note that Win32 requires a special notation for device names other than com1...com9. You will have to write \\.\ in front of all non-standard device names. For example you might have to write \\.\com10 instead of com10.

Devices are always initialized to these settings by comOpen:

  • 9600 Bits per second
  • 8 databits per word
  • no parity
  • 1 stopbit
  • no flow control
  • read timeout 1000 milliseconds

These settings may be altered by calling comBps, comBits, comParity, comStops and comReadTimeout after opening the device.

Optionally all communications can be traced into a logfile. The logfile is plain ASCII and may be inspected by any text editor.

Example:

var hdl = comOpen('com1','com1.log');
comBps(hdl,9600);
comWrite(hdl, 'hello world');
comWaitForOutput(hdl);
comClose(hdl);
  Copyright © IBK Landquart Last revision: 27.05.2002 << Back  Top  Next >>