comedilib/doc/html/comedilib-5.html
2000-02-02 05:14:23 +00:00

94 lines
3.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>Comedi Documentation: Application-specific functions</TITLE>
<LINK HREF="comedilib-6.html" REL=next>
<LINK HREF="comedilib-4.html" REL=previous>
<LINK HREF="comedilib.html#toc5" REL=contents>
</HEAD>
<BODY>
<A HREF="comedilib-6.html">Next</A>
<A HREF="comedilib-4.html">Previous</A>
<A HREF="comedilib.html#toc5">Contents</A>
<HR>
<H2><A NAME="s5">5. Application-specific functions</A></H2>
<P>
<P>
<H2><A NAME="ss5.1">5.1 Digital Input/Output</A>
</H2>
<P>
<P>Many boards supported by comedi have digital input and output
channels. Some boards allow the direction of a channel to be
specified in software.
<P>Comedi groups digital channels into subdevice, which is a group
of digital channels that have the same characteristics. For
example, digital output lines will be grouped into a digital
output subdevice, bidirectional digital lines will be grouped
into a digital I/O subdevice. Thus, there can be multiple
digital subdevices on a particular board.
<P>
<P>
<H2><A NAME="ss5.2">5.2 Timed Input/Output</A>
</H2>
<P>
<P>
<P>
<H2><A NAME="ss5.3">5.3 Slowly-varying inputs</A>
</H2>
<P>
<P>
<P>Sometimes, your input channels change slowly enough that
you are able to average many sucessive input values to get a
more accurate measurement of the actual value. In general,
the more samples you average, the better your estimate
gets, roughly by a factor of sqrt(number_of_samples).
Obviously, there are limitations to this:
<P>
<P>
<UL>
<LI>you are ultimately limited by "spurious free dynamic range"
</LI>
<LI>you need to have _some_ noise on the input channel,
otherwise you will be averaging the same number N times.
</LI>
<LI>the more noise you have, the greater your SFDR, but it
takes many more samples to compensate for the increased
noise
</LI>
<LI>if you feel the need to average samples for 2 seconds,
your signal will need to be _very_ slowly-varying, i.e.,
not varying more than your target uncertainty for the
entire 2 seconds.
</LI>
</UL>
<P>As you might have guessed, the comedi library has functions
to help you in your quest to accurately measure slowly varying
inputs. I use these functions to measure thermocouple voltages
-- actually, the library functions came from a section of code
that was previously part of the thermocouple reading program.
<P>The comedi self-calibration utility also uses these functions.
On some hardware, it is possible to tell it to measure an
internal stable voltage reference, which is typically going
to be very slowly varying -- on the kilosecond time scale
or more. So it is reasonable to measure millions of samples,
to get a very accurate measurement of the A/D converter output
value that corresponds to the voltage reference. Sometimes,
however, this is overkill, since there is no need to
perform a part-per-million calibration to a standard that
is only accurate to part-per-thousand.
<P>
<P>
<P>
<P>
<P>
<HR>
<A HREF="comedilib-6.html">Next</A>
<A HREF="comedilib-4.html">Previous</A>
<A HREF="comedilib.html#toc5">Contents</A>
</BODY>
</HTML>