Chapter 4
Using Your Serial Hardware
PCMCIA Serial for Windows 98/95
4-4
©
National Instruments Corporation
Setting the Transceiver Mode with DeviceIoControl
The NI Serial software extends the Windows function
DeviceIoControl
for programming the transceiver control mode. To program the transceiver
control mode using
DeviceIoControl
, complete the 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
DeviceIoControl
. Use the defined control
code value listed in Step 1 to set the transceiver mode, and the input
buffer values (unsigned long) listed in Table 4-3 for programming
different transceiver modes.
For example, to set TXRDY two-wire 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);
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: TXRDY auto control
131
Содержание PCMCIA Serias
Страница 1: ...PCMCIA 485 2...