1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
12
HREF="index.html"><LINK
16
HREF="index.html"><LINK
18
TITLE="Writing Comedi programs"
19
HREF="x403.html"></HEAD
30
SUMMARY="Header navigation table"
43
>Control and Measurement Device Interface</I
87
>This section assumes that you have successfully compiled and installed
91
> software, that your hardware device is in your computer,
92
and that you know the relevant details about it, i.e., what kind of
93
card it is, the I/O base, the IRQ, jumper settings related to input
100
NAME="CARDCONFIGURATION"
101
>2.1. Configuration</A
104
>Before being able to get information from a DAQ card, you first have
108
> core kernel module which device you have, which
109
driver you want to attach to the card, and which run-time options
110
you want to give to the driver. This configuration is done by running
114
> command. (As root of course.)
115
Here is an example of how to use the command (perhaps you should read
122
>PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH
123
comedi_config /dev/comedi0 labpc-1200 0x260,3</PRE
125
This command says that the <SPAN
132
> can be used to access the <ACRONYM
136
device that uses the <VAR
140
you give it two run-time parameters (<VAR
147
>). More parameters are possible, for example to
148
discriminate between two or more identical cards in your system.</P
150
>If you want to have the board configured in this way every time you
151
boot, put the lines above into a start-up script file of your Linux
152
system (for example, the
155
>/etc/rc.d/rc.local</TT
156
> file), or for PCMCIA
157
boards the appropriate place is the /etc/pcmcia/comedi script.
158
For non-PCMCIA boards, you can also arrange to have your driver
159
loaded and comedi_config run with by adding a few lines
160
to /etc/modules.conf (see the INSTALL file for the comedi
161
kernel modules). You can, of course, also run comedi_config
162
at a command prompt.</P
164
>This tutorial goes through the process of configuring <ACRONYM
171
>National Instruments AT-MIO-16E-10</VAR
175
>Data Translation DT2821-F-8DI</VAR
178
>The NI board is plug-and-play. The current ni_atmio driver
179
has kernel-level ISAPNP support, which is used by default
180
if you do not specify a base address. So you could simply
184
>comedi_config /dev/comedi0 ni_atmio</PRE
189
>Data Translation</VAR
190
> board, you need to have a
191
list of the jumper settings; these are given in the <ACRONYM
195
section about this card. (Check first to see whether they are still
197
The card discussed her is a <VAR
208
you that you need to know the I/O base, IRQ, DMA 1, DMA 2. However,
212
> driver also recognizes the
213
differential/single-ended and unipolar/bipolar jumpers. As always,
214
the source is the final authority, and looking in
219
tells us that the options list is interpreted as:</P
221
>(... TO BE FILLED IN ...)</P
223
>So, the appropriate options list is:
228
and the full configuration command is:
231
>comedi_config /dev/comedi1 dt2821-f-8di 0x200,4,,1,1,1</PRE
233
The differential/single-ended number is left blank, since the
234
driver already knowns (from the board name), that it is
235
differential. Also the DMA numbers are left blank, since we
236
don't want the driver to use DMA. (Which could interfere
237
with the sound card...)
238
Keep in mind that things commented in the source, but not in
239
the documentation are about as likely to change as the weather,
240
so put good comments next to the following line when you put
241
it in a start-up file.</P
243
>So now you have your boards configured correctly.
244
Since data acquisition boards are not typically well-engineered,
248
> sometimes can't figure out if the board is actually there.
249
If it can't, it assumes you are right. Both of these boards
250
are well-made, so <ACRONYM
253
> will give an error message if it
254
can't find them. The <ACRONYM
257
> kernel module, since it is a part
258
of the kernel, prints messages to the kernel logs, which you
259
can access through the command <B
265
>/var/log/messages</TT
267
Here is a configuration failure (from <B
273
>comedi0: ni_atmio: 0x0200 can't find board</PRE
275
>When it does work, you get:</P
278
>comedi0: ni_atmio: 0x0260 at-mio-16e-10 ( irq = 3 )</PRE
280
>Note that it also correctly identified the board.</P
287
NAME="GETTINGINFORMATION"
288
>2.2. Getting information about a card</A
291
>So now that you have <ACRONYM
294
> talking to the hardware, try to
298
>. Here's some pretty low-level information, which can
299
sometimes be useful for debugging:</P
302
>cat /proc/comedi</PRE
304
>On the particular system this demonstration was carried out, this
308
>comedi version 0.6.4
310
0: ni_atmio at-mio-16e-10 7
311
1: dt282x dt2821-f-8di 4</PRE
313
>This documentation feature is not well-developed yet. Basically, it
314
currently returns the driver name, the device name, and the number of
320
> directory, there is a
324
>, which provides information
325
about each subdevice on the board. Its output can be rather long,
326
if the board has several subdevices.
327
Here's part of the output of the <VAR
329
>National Instruments</VAR
331
board (which is on <TT
337
>demo/info /dev/comedi0</B
342
version code: 0x000604
343
driver name: ni_atmio
344
board name: at-mio-16e-10
345
number of subdevices: 7
347
type: 1 (analog input)
348
number of channels: 16
352
>The overall info gives information about the device; basically
353
the same information as <TT
358
>This board has seven subdevices. Devices are separated into
359
subdevices that each have a distinct purpose; e.g., analog
360
input, analog output, digital input/output. This board also
361
has an EEPROM and calibration DACs that are also subdevices.</P
366
> has more information about the device than what is displayed
370
> doesn't currently display
379
SUMMARY="Footer navigation table"
b'\\ No newline at end of file'