CP_BI: C++ DAQ Board Interface.

Introduction.

CP_BI is a C++ library that allows to do data acquisition (DAQ) in a hardware-independent way.

Unfortunately there is no standard API for DAQ meaning that the software becomes hardware-dependent. CP_BI adds an abstraction layer that allows to avoid this dependency. CP_BI does not substitute manufacturer's drivers, it uses them and hides proprietary API from the programmer. CP_BI is implemented in a DLL, but it is also possible to make it a part of the source code (not recommended). CP_BI was designed for streaming multi-channel data, so its API and performance were optimized accordingly.

Note: current implementation of CP_BI supports DAQ samples represented as 16-bit signed integers, but it should not be hard to add other sample sizes.

Supported Platforms

CP_BI can be compiled and used with Borland C++ Builder and with Visual C++. The library has been tested on Windows 2000 and Windows 98, but it should also work on Windows NT 4.0 and Windows XP. Obviously platform support is subject to availability of the drivers for the particular board and the platform.

Supported Hardware.

For now the list of supported hardware is rather short, but to a add new board from NI or DT should not be very hard since the already existing code can be used as a prototype. More than that - it might be that adding a new board would require only changes in the XML configuration, without actually changing C++ code.

Manufacturer Board Name Board ID
National Instruments AT-MIO-16E-2 1001
National Instruments DAQPad-6020E for USB 1002
National Instruments DAQPad-1200 1003
-- Board Simulator 2001
Data Translation DT9801 3001

Board Simulator is a software simulator of AT-MIO16E-2, but unlike the real board it reads data from a file. Quite helpful in debugging.

Complete list of the supported boards along with their capabilities can be found in the configuration file (XML).

Usage

To use CB_BI you have to call CreateInterfaceByDeviceID() first. It will return a pointer to the object of class IBoardInterface. Next step is to call IBoardInterface::DaqBoardInit. Then DAQ can be configured using IBoardInterface::DaqSetParameters and IBoardInterface::DaqSetNotification methods. Use IBoardInterface::DaqStart to begin acquiring data.

CP_BI notifies the caller of new data via a callback (prototyped in CallbackPtr()) or a message, or both. On notification the user should lock the received block by calling IBoardInterface::DaqLockBlock and retrieve the data using provided API calls, e.g. IBoardInterface::DaqGetBlockData after that the block should be unlocked: IBoardInterface::DaqUnlockBlock. Note that if a continuous stream of data is required, user must check that the blocks are consecutive: locking a block for too long can lead to loss of data and missing blocks. Also if there was an error on block acquisition the error code is stored in the block header.

To stop DAQ use IBoardInterface::DaqStop(). When done - call IBoardInterface::DaqBoardRelease() and delete the instance of the IBoardInterface class.

Downloading

Before using CP_BI please make sure that you read and agree to the License . You can download complete package including the DLLs, test program, and the source code here.

If you want to download a compressed-html single-file help, you can get it here.

Author.

CP_BI was written by Sergei Rebrik rebrik@phy.ucsf.edu

Acknowledgements

Thanks to Lee Thomason and Yves Berquin for TinyXml.
Generated on Tue Oct 21 16:45:00 2003 for CP_BI: C++ DAQ Board Interface. by doxygen1.3-rc3