Serial Control From Other Programs; The Example Programs - Halma Ocean Optics CUV-TLC-50F Installation And Operation Manual

Temperature-regulated cuvette holder
Table of Contents

Advertisement

A: Serial Control for the CUV-TLC-50F

Serial Control from Other Programs

It may be useful to have temperature control for the CUV-TLC-50F system from other programs (for
example data acquisition programs). The installation CD includes code for a simple C++ program that
illustrates how to use QnwSerial.DLL for serial communications with the TLC 50™ hardware.
QnwSerial.dll provides functions that simplify opening and closing serial ports, and sending and receiving
data over a serial connection. This DLL was developed with Borland C++ Builder 3. QnwSerial.dll can
only be used by 32-bit programs. The "Borland Example" and "Microsoft Example" directories contain
the code and project files required by Borland C++, version 5.02, and Microsoft Developer Studio Visual
C++, version 4.0, respectively, to generate the application. If you have either of these development
systems (or newer versions) installed on your computer, you should be able to open the projects
(QnwExample.ide or QnwExample.mdp files) and compile and link them to generate the example
programs. You will probably need to modify the project directories for Borland's header and library files
in the Borland project so that the system can find the standard Borland files.
The .C and .H files for the Microsoft Example differ from those for the Borland Example in minor ways
as described below. For the Microsoft Example, the QnwSerial DLL function prototypes and function
calls include an added underscore as the first character of the function names.
One of the standard include lines differs between the two examples, <DIR.H> for Borland and
<DIRECT.H> for Microsoft.
In several of the calls to SendDlgItemMessage() the parameter -1 for Borland was changed to
(WPARAM)(-1) for Microsoft to suppress a warning message during compilation in the latter
development system. The line "#pragma argsused" is included before two of the function definitions only
for Borland, again to suppress a warning message during compilation.

The Example Programs

Copies of the resulting executable files, QnwExample.exe and QnwExampleM.exe, are included if you
installed the example programming files ("typical" installation choice).
When the programming example is started, it obtains the information needed for connecting to and
configuring a serial port from a command list file, QnwExample.lst. If this list file does not exist in the
startup directory, default settings are used and a QnwExample.lst file will be created which includes those
settings when the program is closed. You can modify this information to change the serial port setup to be
used the next time the program is started. The setup line is in the form of a DOS "mode" command for
configuring a serial port — "COM1:19200,N,8,1" — and must be the only data on the first line of the file.
In the example line above, COM1 specifies the serial port to be used (typically COM1, COM2, etc., but
some computers may require different designations). The remaining parameters specify a baud rate of
19200, no parity, 8 data bits and no stop bits, respectively. The parameters "19200,N,8,1" are correct for
the CUV-TLC-50F, so you should only need to consider changing the port designation if COM1 does not
work.
18
000-30000-000-02-0205

Advertisement

Table of Contents
loading

Table of Contents