AIOUSB is a library of C and C++ functions and classes for controlling ACCES I/O USB devices. Its function API conforms to the USB Software Reference Manual. The prior version of AIOUSB did not conform to this specification, so any application code based on the prior version will have to be revised to use the current API function names and parameter lists. Every effort was made to ensure that the current API implementation is 100% compliant with the specification.
Assuming you’re starting from the root directory of the distribution, installing AIOUSB consists of performing these few simple steps (logged in as ‘root’, of course).
mkdir /usr/local/include/aiousb
cp -p lib/aiousb.h /usr/local/include/aiousb
cp -p lib/libaiousb*.a /usr/local/lib
export CPATH=/usr/local/include/libusb-1.0/:/usr/local/include/aiousb
You can, of course, place the AIOUSB files (aiousb.h, libaiousb*.a) elsewhere, such as in the local directory of the application program that will use AIOUSB. The above steps are suggested in order to conform to the usual Linux conventions and make the AIOUSB files available to all users and all application programs.
If you do locate the libraries and header files somewhere else, there are some environment variables you can set which are used by the sample program make files. These are:
export AIOUSBLIBDIR="path to the AIOUSB libraries"
export AIOUSBCLASSLIBDIR="path to the AIOUSB C++ class libraries"
There are several variations of the libraries. They all begin with "libaiousb" and have an extension of ".a". There are currently no shared versions of the AIOUSB libraries. The library files which contain the string "cpp" contain object modules that are compiled for use with C++. They are not C++ class libraries. The library files which contain the string "dbg" are compiled for source level debugging with the "-ggdb" compiler option. At present, there are four variations of the libraries: C or C++, and release or debug.
Residing one level above the AIOUSB library are two additional sister libraries: an object-oriented C++ class library, and a nearly identical Java class library. These libraries should be considered beta software and are still in development. However, testing so far shows that they are working reliably. There are a few sample programs in the "samples" directory demonstrating use of both of these class libraries. More such samples will be provided in the future.
You may install the C++ class library in the same manner as described for the base AIOUSB library above, using the commands:
cp -p classlib/*.hpp /usr/local/include/aiousb
cp -p classlib/libclassaiousb*.a /usr/local/lib
If you don't wish to copy all those files, then you can use the environment variables (CPATH and AIOUSBCLASSLIBDIR) instead.
The primary documentation for the C++ and Java class libraries is in AIOUSB Java Class Library Reference. While oriented toward the Java class library, it's also applicable to the C++ class library. As with the C and C++ libraries, there is an environment variable that may be useful for specifying the location of the AIOUSB Java class library (aiousb.jar):
export AIOUSBJAVALIBDIR="path to the AIOUSB java libraries"
Assuming you have installed AIOUSB according to the above instructions, compiling a program to use it is as simple as:
g++ sample.cpp -laiousb -lusb-1.0 -o sample (C++)
or
gcc sample.c -laiousb -lusb-1.0 -lm -o sample (C)
To compile Java programs to use the AIOUSB Java class library, use the command:
javac -cp /path/aiousb.jar Sample.java (where "path" is where you installed the Java class library)
To execute the compiled Java program, use the command:
java -cp /path/aiousb.jar:. Sample
The table below summarizes the AIOUSB API functions available in the library. For a detailed API reference, refer to AIOUSB API Reference.
AIOUSB API Functions | ||
---|---|---|
General Functions | ||
AIOUSB_ClearFIFO | AIOUSB_SetStreamingBlockSize | ClearDevices |
CustomEEPROMRead | CustomEEPROMWrite | GetDeviceBySerialNumber |
GetDevices | GetDeviceSerialNumber | QueryDeviceInfo |
ResolveDeviceIndex | ||
Extended General Functions | ||
AIOUSB_Exit | AIOUSB_GetCommTimeout | AIOUSB_GetDeviceByProductID |
AIOUSB_GetDeviceProperties | AIOUSB_GetResultCodeAsString | AIOUSB_GetVersion |
AIOUSB_GetVersionDate | AIOUSB_Init | AIOUSB_ListDevices |
AIOUSB_SetCommTimeout | AIOUSB_SetMiscClock | |
DIO Functions | ||
DIO_ConfigurationQuery | DIO_Configure | DIO_ConfigureEx |
DIO_Read1 | DIO_Read8 | DIO_ReadAll |
DIO_Write1 | DIO_Write8 | DIO_WriteAll |
DIO Streaming Functions (Advanced) | ||
DIO_StreamClose | DIO_StreamFrame | DIO_StreamOpen |
DIO_StreamSetClocks | ||
CTR Functions | ||
CTR_8254Load | CTR_8254Mode | CTR_8254ModeLoad |
CTR_8254Read | CTR_8254ReadAll | CTR_8254ReadLatched |
CTR_8254ReadModeLoad | CTR_8254ReadStatus | CTR_8254SelectGate |
CTR_StartOutputFreq | ||
ADC Functions | ||
ADC_ADMode | ADC_BulkAcquire | ADC_BulkPoll |
ADC_GetChannelV | ADC_GetConfig | ADC_GetScan |
ADC_GetScanV | ADC_Initialize | ADC_QueryCal |
ADC_Range1 | ADC_RangeAll | ADC_SetCal |
ADC_SetConfig | ADC_SetOversample | ADC_SetScanLimits |
Extended ADC Functions | ||
AIOUSB_ADC_ExternalCal | AIOUSB_ADC_InternalCal | AIOUSB_ADC_LoadCalTable |
AIOUSB_ADC_SetCalTable | AIOUSB_CountsToVolts | AIOUSB_GetCalMode |
AIOUSB_GetEndChannel | AIOUSB_GetGainCode | AIOUSB_GetOversample |
AIOUSB_GetStartChannel | AIOUSB_GetTriggerMode | AIOUSB_InitConfigBlock |
AIOUSB_IsDifferentialMode | AIOUSB_IsDiscardFirstSample | AIOUSB_MultipleCountsToVolts |
AIOUSB_MultipleVoltsToCounts | AIOUSB_SetAllGainCodeAndDiffMode | AIOUSB_SetCalMode |
AIOUSB_SetDifferentialMode | AIOUSB_SetDiscardFirstSample | AIOUSB_SetGainCode |
AIOUSB_SetOversample | AIOUSB_SetScanRange | AIOUSB_SetTriggerMode |
AIOUSB_VoltsToCounts | ||
DAC Functions | ||
DACDirect | DACMultiDirect | DACOutputClose1 |
DACOutputCloseNoEnd1 | DACOutputFrame1 | DACOutputFrameRaw1 |
DACOutputOpen1 | DACOutputSetCount1 | DACOutputSetInterlock1 |
DACOutputStart1 | DACSetBoardRange | |
Notes | ||
1 Not yet implemented |