Fast (500 kHz) analog-to-digital conversion in OS/2 using the CIO-DAS16/M1

by Stefan Zollner 04/19/1996

For my work in ultrafast laser spectroscopy, I need to be able to read voltages (from a photodiode) into my computer. I do this using an analog-to-digital converter. Such A/D converter are available from many companies, such as National Instruments, Keithley, Computerboards, Microstar. The problem: Most of these companies (except Microstar) do not support OS/2 as a platform. Except for Microstar, they certainly do not have OS/2-specific drivers.

Solution: Computerboards, Inc, produces a low-cost (USD 999), high-speed (1 MHz) 12-bit A/D converter (CIO-DAS16/M1). Using documentation provided with the card, I wrote a series of assembly language routines for slow and fast (up to 400 kHz) analog-to-digital conversions. I also wrote some wrapper routines in C++ which hide the assembly language routines from the main program. The result of my programming is available here.

I should note that this routine works only by turning off the interrupts. In other words, you disable the operating system and take over complete control of your CPU just like you would in xx-DOS. After calling such a ring-2 routine (particularly if it is very time-consuming), it is a good idea to call DosSleep(0) and give up the time slice to give other OS/2 threads a chance to execute. (I am piping the data into GNUPLOT and plot the data after each call to ADSCAN.)

Most of the routines are pretty general and can be used for most A/D applications. The last routine (ADSCAN) is special. It is designed for fast-scan pump-probe spectroscopy using a linear shaker from General Scanning, see Dan Edelstein's paper in Rev. Sci. Instrum.

Source files:

 * Assembler source - ioad.mac
 * Include file for C++ main program - ioad.hpp
 * Include file for C main program - ioad.h
 * Object code - ioad.obj
 * Linker definition file for DLL (DEF) - ioad.def
 * Resulting DLL - ioad.dll
 * Resulting import library (LIB) - ioad.lib
 * The make file which builds it all - ioad.mak
 * C++ code to use the assembly language routines - ADC.CPP
 * Header file for adc.cpp - ADC.HPP
 * Main program to test some of the routines - adctest.cpp
 * A zip file containing all of the above, plus additional files you need. adctest.zip
 * Current version is 1.07 dated 04/19/96. (The version statement is only in the DLL, not in any of the source files.)

Note: The libraries IOAD.LIB contain the code in IO386.DLL and IO386.LIB. Use one or the other, but not both. The IOAD libraries and the zip file also contain code for digital/analog conversion (D/A) and parallel I/O.

DISCLAIMER: This server is an experimental offering.

DISCLAIMER: This sample code is for your information only. Do not attempt to use this code on your equipment without first inspecting the source code and making sure it does what you want. This code is supplied as is without warranty or liability of any kind. Most of the brand names on this page are registered trademarks. The authors have no connection with Computerboards, IBM, or other computer companies. The trademarks are included here for information only, not as an endorsement of a particular vendor or product.