Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

DI-194 driver Documentation

0.1.5

Introduction

Dataq Instruments (http://www.dataq.com/) offers an inexpensive but useful device called the DI-194. available through their online store

There are two variants currently supported - the older DI-194, with eight bit resolution, and the newer DI-194RS, with 10 bit resolution. Both have four analog input channels and three digital inputs, which can be read at up to 240Hz on a single channel. As of 4/2003, cost is about $25USD. The analog ports fixed range, reading from -10VDC to +10VDC.

The device is self-powered off of the serial port, making for a very compact and self contained tool.

However, the included Windows software is limited and platform-specific. I wanted to write a program for Unix (specifically, Linux) to use this device for my own needs.

Credits

The Dataq page for the DI-194 code links you to a vendor of a COM-based Windows library, plus the information noted below. Via Google, I found the "Linux Home Automation II" page at http://meltingpot.fortunecity.com/lightsey/52/index2.html that has links to these two files:

http://www.tcrobots.org/software/dataq/dataq.c

http://www.tcrobots.org/software/dataq/makefile

This almost worked. I used their code as a basis for this project, and am in their debt. The authors are listed as

Author: Anthony Hanson and Mike Hage Date: April 1st, 2001

Device details

The DI-194 runs at 4800 baud always, with an eight-byte result buffer. You setup the mode and rate you want, and then the 194 streams data out until you stop it or reset it. Since it runs at 4800 baud, a bit of math shows that the max 240Hz sample rate limits you to one analog input channel. Similarly, 120Hz is two channels, and 60Hz is all four. By the Nyquist theorem, you are limited to input data of less than 30Hz if all four channels are running. (Less, almost certainly, since this does not include the required lowpass filter!)

The data format the device returns is annoyingly scrambled; see the dataform.html file in the doc subdirectory for the information as provided by Dataq.

Command and response protocol

As seen in dataform.html, the command are zero-prefixed, and have a single byte argument. For all except reset, the command and argument are echod back as sent, with 0xFF returned if a bad command.

Read the di_open function if you want to learn the details.

Note:
Undocumented Command
The Dataq docs skip one command. By running portmon on an NT machine, I captured their software programming a DI-194 and DI-194RS. The first thing their software does is send a 0x00, 'B', '1'. This is not in the docs. I don't know what this is for, but I emulate it.

If you have an old DI-194, then you have to send an 'enable code', which I cribbed from the original source. The software does this automatically based on the serial number - the RS's return ten ASCII zeros, the 194's return an ASCII number.

Current capabilites

Compiling the code nets you a program that opens and programs the unit for 240Hz sampling. If you supply it a filename, it will save the data to disk in ASCII format. I suggest SciGraphica http://scigraphica.sourceforge.net/ for plotting the data; its much better than Gnuplot.

Grace http://plasma-gate.weizmann.ac.il/Grace/ is also pretty spiffy.

What You Get and What it Does

di_test

This is an interactive test program, with online help, to exercise and test your DI-194 and its connection. Read, reset, etc, etc.

di_source

Built on the library, this sets up a TCP port and, upon connection, streams data from the DI-194 to the TCP port. For example, you can telnet to the port and watch the data go by. This is the start of a networked DAQ app.

di_tempd

Special-purpose version of di_source, for reading a LM35CAZ temp sensor and telling the temp to whomever connects.

di_simplest

Hello, world type of code. Open, program, print one set of readings per second. A good place to start.

gtkdaq

Built on the library, this throws up an oscilloscope-style screen to plot data in realtime. Relies on the GTKDatabox library.

Note:
The pause button does not resume; unknown reason.

To do yet

Code cleanup (renaming, etc)

Determine other modes. WinDAQ can run at other rates; how?

Post to the net.

Using the code

Need to write this!
Generated on Thu May 1 11:31:45 2003 for DI-194 driver by doxygen1.3