National Instruments AT 用户手册

下载
页码 208
Chapter 6
Using Your Serial Hardware
© National Instruments Corporation
6-5
For example, to set TXRDY two-wire auto control mode, use the
following code:
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);
Table 6-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: TXRDY auto control
131