Setting the Transceiver Control Mode
© National Instruments Corporation
Windows 2000/NT 4.0
To set the transceiver control mode, use the NI Ports serial configuration
utility. For instructions on how to use the utility, refer to Chapter 4,
Port
Configuration. The mode you select in the configuration utility is
automatically configured when you open a port on a serial interface. You
can also set the mode programmatically using
Setting the Transceiver Mode with DeviceIoControl()
The serial server software extends the
function for programming the transceiver control mode. To program the
transceiver control mode using
following steps:
1.
Add the following lines to your source code:
#include <winioctl.h>
#define IOCTL_SERIAL_SET_TRANSCEIVER_MODE \
CTL_CODE(FILE_DEVICE_SERIAL_PORT,37, \
METHOD_BUFFERED,FILE_ANY_ACCESS)
2.
Use the Win32 function
a.
Use the defined control code value listed in step 1 to set the
transceiver mode.
b.
Use the input buffer values (unsigned long) listed in Table 6-2 for
programming different transceiver modes.
Table 6-2. DeviceIoControl() Function Input Values
Transceiver Mode
Four-wire mode
Two-wire mode: DTR with echo
Two-wire mode: DTR controlled
Two-wire mode: Auto Control
For example, to set two-wire Auto Control mode, use the following code:
ULONG TranceiverMode = 131;
ULONG dummy;
DeviceIoControl(hDevice,
IOCTL_SERIAL_SET_TRANSCEIVER_MODE,(PVOID)
&TransceiverMode,sizeof(ULONG),NULL,0,&dummy,NULL);
Chapter 6
DeviceIoControl()
DeviceIoControl()
DeviceIoControl()
6-9
ENET-232 and ENET-485 Series User Manual
Using Your Serial Device Server
Serial
DeviceIoControl()
Windows
, complete the
, as follows:
DeviceIoControl()
Function Input Value
128
129
130
131
.