Chapter6 UsingYour Serial Hardware
©NationalInstruments Corporation 6-5 SerialHardware and Software for Windows
Forexample, to set TXRDY two-wire auto control mode, use the
followingcode:
Windows 2000
ULONG TranceiverMode = 131;
ULONG dummy;
DeviceIoControl(hDevice,
IOCTL_SERIAL_SET_TRANSCEIVER_MODE,(PVOID)
&TransceiverMode,sizeof(ULONG),NULL,0,&dummy,NULL);
Windows NT/Me/9x
ULONG TranceiverMode = 131;
DeviceIoControl(hDevice,
IOCTL_SERIAL_SET_TRANSCEIVER_MODE,(PVOID)
&TransceiverMode,sizeof(ULONG),lpOutBuffer,
nOutBufferSize,lpBytesReturned,lpOverlapped);
Table6-3. DeviceIoControlFunction Input Values
TransceiverMode
DeviceIoControl
FunctionInput Value
Four-wiremode 128
Two-wiremode: DTR with echo 129
Two-wiremode: DTR controlled 130
Two-wiremode: TXRDY auto control 131