Manual USB-DIO-48
14
Chapter 5: Programming
The driver software provided with the board uses a 32-bit .dll front end compatible with any
Windows programming language. Samples provided in Borland C++Builder, Borland Delphi,
Microsoft Visual Basic, and Microsoft Visual C++ demonstrate the use of the driver.
The following is a list of the most common function calls provided by the driver in Windows.
For a complete list of available functions and details on how to use them refer to the USB
Software Reference Manual located in the installation path for this board.
unsigned long DIO_Configure(DeviceIndex, bTristate, pOutMask, pData)
unsigned long
DIO_Configure
(
unsigned long DeviceIndex - number from 0-31 of the device you want to configure
unsigned char bTristate - boolean value. TRUE causes all bits on the device to enter tristate
(high-impedance) mode. FALSE removes the tristate. The tristate is changed
after
the
remainder of the configuration has occurred. All devices with this feature power-on in the
"tristate" mode at this time.
void *pOutMask - a pointer to the first element of an array of bytes; one byte per 8 ports or
fraction. Each "1" bit in the array indicates that the corresponding byte of the device is
Output.
void *pData - a pointer to the first element of an array of bytes. Each byte is copied to the
digital output ports on the device before the ports are taken out of tristate. Any bytes in the
array associated with ports configured as input are ignored.
)
The size of the out mask and data is as follows:
Out Mask
2 bytes
Data 12
bytes
unsigned long DIO_WriteAll(DeviceIndex,pData)
unsigned long DeviceIndex - number from 0-31 of the device to which you wish to write all
output bits
void *pData - pointer to the first element of an array of bytes. Each byte is copied to the
corresponding output byte. Bytes written to ports configured as inputs are ignored
)
Note that the size of "all" is the same as the size of the data given under DIO_Configure.
unsigned long DIO_ReadAll(DeviceIndex,Buffer)
unsigned long DeviceIndex - number from 0-31 of the device from which you wish to read all
digital bits
void *Buffer - pointer to the first element of an array of bytes. Each port will be read, and the
reading stored in the corresponding byte in the array.
)
Note that the size of "all" is the same as the size of the data given under DIO_Configure.