added get_subdevice_flags()
[comedilib.git] / doc / comedilib-5.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 <HTML>
3 <HEAD>
4  <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
5  <TITLE>Comedi Documentation: Application-specific functions</TITLE>
6  <LINK HREF="comedilib-6.html" REL=next>
7  <LINK HREF="comedilib-4.html" REL=previous>
8  <LINK HREF="comedilib.html#toc5" REL=contents>
9 </HEAD>
10 <BODY>
11 <A HREF="comedilib-6.html">Next</A>
12 <A HREF="comedilib-4.html">Previous</A>
13 <A HREF="comedilib.html#toc5">Contents</A>
14 <HR>
15 <H2><A NAME="s5">5. Application-specific functions</A></H2>
16
17 <P>
18 <P>
19 <H2><A NAME="ss5.1">5.1 Digital Input/Output</A>
20 </H2>
21
22 <P>
23 <P>Many boards supported by comedi have digital input and output
24 channels.  Some boards allow the direction of a channel to be
25 specified in software.
26 <P>Comedi groups digital channels into subdevice, which is a group
27 of digital channels that have the same characteristics.  For
28 example, digital output lines will be grouped into a digital
29 output subdevice, bidirectional digital lines will be grouped
30 into a digital I/O subdevice.  Thus, there can be multiple
31 digital subdevices on a particular board.
32 <P>
33 <P>
34 <H2><A NAME="ss5.2">5.2 Timed Input/Output</A>
35 </H2>
36
37 <P>
38 <P>
39 <P>
40 <H2><A NAME="ss5.3">5.3 Slowly-varying inputs</A>
41 </H2>
42
43 <P>
44 <P>
45 <P>Sometimes, your input channels change slowly enough that
46 you are able to average many sucessive input values to get a
47 more accurate measurement of the actual value.  In general,
48 the more samples you average, the better your estimate
49 gets, roughly by a factor of sqrt(number_of_samples).
50 Obviously, there are limitations to this:
51 <P>
52 <P>
53 <UL>
54 <LI>you are ultimately limited by "spurious free dynamic range"
55 </LI>
56 <LI>you need to have _some_ noise on the input channel,
57 otherwise you will be averaging the same number N times.
58 </LI>
59 <LI>the more noise you have, the greater your SFDR, but it
60 takes many more samples to compensate for the increased
61 noise
62 </LI>
63 <LI>if you feel the need to average samples for 2 seconds,
64 your signal will need to be _very_ slowly-varying, i.e.,
65 not varying more than your target uncertainty for the
66 entire 2 seconds.
67 </LI>
68 </UL>
69 <P>As you might have guessed, the comedi library has functions
70 to help you in your quest to accurately measure slowly varying
71 inputs.  I use these functions to measure thermocouple voltages
72 -- actually, the library functions came from a section of code
73 that was previously part of the thermocouple reading program.
74 <P>The comedi self-calibration utility also uses these functions.
75 On some hardware, it is possible to tell it to measure an
76 internal stable voltage reference, which is typically going
77 to be very slowly varying -- on the kilosecond time scale
78 or more.  So it is reasonable to measure millions of samples,
79 to get a very accurate measurement of the A/D converter output
80 value that corresponds to the voltage reference.  Sometimes,
81 however, this is overkill, since there is no need to
82 perform a part-per-million calibration to a standard that
83 is only accurate to part-per-thousand.
84 <P>
85 <P>
86 <P>
87 <P>
88 <P>
89 <HR>
90 <A HREF="comedilib-6.html">Next</A>
91 <A HREF="comedilib-4.html">Previous</A>
92 <A HREF="comedilib.html#toc5">Contents</A>
93 </BODY>
94 </HTML>