51 Chapter 3
3.5.5 DIO Modules
PCM-7130 has 8 DI(Digital Input), 8 DO(Digital Output). Users can
access these resources by writing windows programs with WIN32 API.
PCM-7130 is built-in the DIO driver to allow users accessing DI and DO
values. Users should use WIN32 APIs to access them. The driver name is
"DIO1:". The programmers must open this driver before using the
resources. Then programmers could use DeviceIOControl functions to
access DO and DI values. The function description of DeviceIOControl
is illustrated in section 3.5.3.
There are 3 control codes for the operation codes in the DIO driver:
1. IOCTL_GET_DI(0x1002):
lpInBuffer : the pointer to the DI index. Its range is from 0 to 5.
nInBufferSize: unused.
lpOutBuffer: the pointer to the current DI value. Its vlue should be 0 or 1.
nOutBufferSize: unused.
2. IOCTL_GET_DO(0x1003):
lpInBuffer : the pointer to the DO index. Its range is from 0 to 5.
nInBufferSize: unused.
lpOutBuffer: the pointer to the current DI value. Its value should be 0 or
1.
nOutBufferSize: unused.
3. IOCTL_SET_DO(0x1005):
lpInBuffer : the pointer to the DO index. Its range is from 0 to 5.
nInBufferSize: the setting value. It must be 0 or 1.
lpOutBuffer: unused.
nOutBufferSize: unused.
Examples:
#define IOCTL_GET_DI 0x1002
#define IOCTL_GET_DO 0x1003
#define IOCTL_SET_DO 0x1005
HANDLE g_hDIO=NULL;
TCHAR szClassName[60];
...
// assign the DIO driver name
wsprintf(szClassName, TEXT("DIO1:"));
// Open the DIO driver