Chapter 4 Using Your Serial Hardware
Serial for Windows NT
4-4
©
National Instruments Corporation
buffer values (unsigned long) listed in Table 4-3 for programming
different transceiver modes.
Table 4-3.
DeviceIoControl Function Input Values
Transceiver Mode
DeviceIoControl
Function Input
Value
Four-wire mode
128
Two-wire mode:
DTR
with echo
129
Two-wire mode:
DTR
controlled
130
Two-wire mode:
TXR DY
auto control
131
For example, to set two-wire
TXR DY
auto control mode, use the
following call:
ULONG TranceiverMode = 131;
DeviceIoControl(
hDevice,
IOCTL_SERIAL_SET_TRANSCEIVER_MODE,(PVOID)
&TransceiverMode,sizeof(ULONG),
lpOutBuffer,
nOutBufferSize,lpBytesReturned,lpOverlapped);
General Programming Requirements
Once installed, the NI Serial software is integrated into the standard
Windows NT communications software. NI serial ports are used like any
other Windows NT communications (COM) port. Windows NT has
standard communication functions for use within either 16-bit (Win16)
applications or 32-bit (Win32) applications.
Setting the Maximum Baud Rate for a 16-Bit Application
To select 115,200 baud from a 16-bit (Win16) application written in C,
you should define the following constant in your program as follows:
#define CBR_115200 0xff20
You can then use this constant as you would any other baud rate value in
your Windows communication calls. For example, you can place it into a
DCB structure and pass it to
SetCommState
. For a Win32 application,
do not use the constant shown here for 115,200 baud. Use the constant
defined in the Win32 communications header file provided with your
compiler.