~ubuntu-branches/ubuntu/intrepid/comedilib/intrepid

« back to all changes in this revision

Viewing changes to doc/doc_html/x333.html

  • Committer: Bazaar Package Importer
  • Author(s): David Schleef
  • Date: 2004-11-04 11:43:51 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041104114351-a50kaei5yamka8r6
Tags: 0.7.22-2
It helps if the shared library is actually in the package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
2
<HTML
 
3
><HEAD
 
4
><TITLE
 
5
>Configuration</TITLE
 
6
><META
 
7
NAME="GENERATOR"
 
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
 
9
REL="HOME"
 
10
TITLE="    Comedi 
 
11
  "
 
12
HREF="index.html"><LINK
 
13
REL="PREVIOUS"
 
14
TITLE="    Comedi 
 
15
  "
 
16
HREF="index.html"><LINK
 
17
REL="NEXT"
 
18
TITLE="Writing Comedi programs"
 
19
HREF="x403.html"></HEAD
 
20
><BODY
 
21
CLASS="SECTION"
 
22
BGCOLOR="#FFFFFF"
 
23
TEXT="#000000"
 
24
LINK="#0000FF"
 
25
VLINK="#840084"
 
26
ALINK="#0000FF"
 
27
><DIV
 
28
CLASS="NAVHEADER"
 
29
><TABLE
 
30
SUMMARY="Header navigation table"
 
31
WIDTH="100%"
 
32
BORDER="0"
 
33
CELLPADDING="0"
 
34
CELLSPACING="0"
 
35
><TR
 
36
><TH
 
37
COLSPAN="3"
 
38
ALIGN="center"
 
39
>Comedi: The <SPAN
 
40
CLASS="emphasis"
 
41
><I
 
42
CLASS="EMPHASIS"
 
43
>Control and Measurement Device Interface</I
 
44
></SPAN
 
45
>
 
46
handbook
 
47
  </TH
 
48
></TR
 
49
><TR
 
50
><TD
 
51
WIDTH="10%"
 
52
ALIGN="left"
 
53
VALIGN="bottom"
 
54
><A
 
55
HREF="index.html"
 
56
ACCESSKEY="P"
 
57
>Prev</A
 
58
></TD
 
59
><TD
 
60
WIDTH="80%"
 
61
ALIGN="center"
 
62
VALIGN="bottom"
 
63
></TD
 
64
><TD
 
65
WIDTH="10%"
 
66
ALIGN="right"
 
67
VALIGN="bottom"
 
68
><A
 
69
HREF="x403.html"
 
70
ACCESSKEY="N"
 
71
>Next</A
 
72
></TD
 
73
></TR
 
74
></TABLE
 
75
><HR
 
76
ALIGN="LEFT"
 
77
WIDTH="100%"></DIV
 
78
><DIV
 
79
CLASS="SECTION"
 
80
><H1
 
81
CLASS="SECTION"
 
82
><A
 
83
NAME="INSTALL"
 
84
>2. Configuration</A
 
85
></H1
 
86
><P
 
87
>This section assumes that you have successfully compiled and installed
 
88
the <ACRONYM
 
89
CLASS="ACRONYM"
 
90
>Comedi</ACRONYM
 
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
 
94
ranges, etc.</P
 
95
><DIV
 
96
CLASS="SECTION"
 
97
><H2
 
98
CLASS="SECTION"
 
99
><A
 
100
NAME="CARDCONFIGURATION"
 
101
>2.1. Configuration</A
 
102
></H2
 
103
><P
 
104
>Before being able to get information from a DAQ card, you first have
 
105
to tell the <ACRONYM
 
106
CLASS="ACRONYM"
 
107
>Comedi</ACRONYM
 
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
 
111
the <B
 
112
CLASS="COMMAND"
 
113
>comedi_config</B
 
114
> command. (As root of course.)
 
115
Here is an example of how to use the command (perhaps you should read
 
116
its <B
 
117
CLASS="COMMAND"
 
118
>man</B
 
119
> page now):
 
120
<PRE
 
121
CLASS="SCREEN"
 
122
>PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH
 
123
comedi_config /dev/comedi0 labpc-1200 0x260,3</PRE
 
124
>
 
125
This command says that the <SPAN
 
126
CLASS="QUOTE"
 
127
>"file"</SPAN
 
128
>
 
129
<TT
 
130
CLASS="FILENAME"
 
131
>/dev/comedi0</TT
 
132
> can be used to access the <ACRONYM
 
133
CLASS="ACRONYM"
 
134
>Comedi</ACRONYM
 
135
>
 
136
device that uses the <VAR
 
137
CLASS="PARAMETER"
 
138
>labpc-1200</VAR
 
139
> board, and that
 
140
you give it two run-time parameters (<VAR
 
141
CLASS="LITERAL"
 
142
>0x260</VAR
 
143
> and
 
144
<VAR
 
145
CLASS="LITERAL"
 
146
>3</VAR
 
147
>). More parameters are possible, for example to
 
148
discriminate between two or more identical cards in your system.</P
 
149
><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
 
153
<TT
 
154
CLASS="FILENAME"
 
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
 
163
><P
 
164
>This tutorial goes through the process of configuring <ACRONYM
 
165
CLASS="ACRONYM"
 
166
>Comedi</ACRONYM
 
167
>
 
168
for two devices, a
 
169
<VAR
 
170
CLASS="LITERAL"
 
171
>National Instruments AT-MIO-16E-10</VAR
 
172
>, and a
 
173
<VAR
 
174
CLASS="LITERAL"
 
175
>Data Translation DT2821-F-8DI</VAR
 
176
>.</P
 
177
><P
 
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
 
181
run comedi_config as
 
182
<PRE
 
183
CLASS="SCREEN"
 
184
>comedi_config /dev/comedi0 ni_atmio</PRE
 
185
></P
 
186
><P
 
187
>&#13;For the <VAR
 
188
CLASS="LITERAL"
 
189
>Data Translation</VAR
 
190
> board, you need to have a
 
191
list of the jumper settings; these are given in the <ACRONYM
 
192
CLASS="ACRONYM"
 
193
>Comedi</ACRONYM
 
194
> manual
 
195
section about this card. (Check first to see whether they are still
 
196
correct!)
 
197
The card discussed her is a <VAR
 
198
CLASS="LITERAL"
 
199
>DT2821-f-8di</VAR
 
200
>.  The
 
201
<B
 
202
CLASS="COMMAND"
 
203
>man</B
 
204
> page of <B
 
205
CLASS="COMMAND"
 
206
>comedi_config</B
 
207
> tells
 
208
you that you need to know the I/O base, IRQ, DMA 1, DMA 2.  However,
 
209
the <ACRONYM
 
210
CLASS="ACRONYM"
 
211
>Comedi</ACRONYM
 
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
 
215
<TT
 
216
CLASS="FILENAME"
 
217
>module/dt282x.c</TT
 
218
>
 
219
tells us that the options list is interpreted as:</P
 
220
><P
 
221
>(... TO BE FILLED IN ...)</P
 
222
><P
 
223
>So, the appropriate options list is:
 
224
<PRE
 
225
CLASS="SCREEN"
 
226
>0x200,4,,1,1,1</PRE
 
227
>
 
228
and the full configuration command is:
 
229
<PRE
 
230
CLASS="SCREEN"
 
231
>comedi_config /dev/comedi1 dt2821-f-8di 0x200,4,,1,1,1</PRE
 
232
>
 
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
 
242
><P
 
243
>So now you have your boards configured correctly.
 
244
Since data acquisition boards are not typically well-engineered,
 
245
<ACRONYM
 
246
CLASS="ACRONYM"
 
247
>Comedi</ACRONYM
 
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
 
251
CLASS="ACRONYM"
 
252
>Comedi</ACRONYM
 
253
> will give an error message if it
 
254
can't find them.  The <ACRONYM
 
255
CLASS="ACRONYM"
 
256
>Comedi</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
 
260
CLASS="COMMAND"
 
261
>dmesg</B
 
262
> or the file
 
263
<TT
 
264
CLASS="FILENAME"
 
265
>/var/log/messages</TT
 
266
>.
 
267
Here is a configuration failure (from <B
 
268
CLASS="COMMAND"
 
269
>dmesg</B
 
270
>):</P
 
271
><PRE
 
272
CLASS="SCREEN"
 
273
>comedi0: ni_atmio: 0x0200 can't find board</PRE
 
274
><P
 
275
>When it does work, you get:</P
 
276
><PRE
 
277
CLASS="SCREEN"
 
278
>comedi0: ni_atmio: 0x0260 at-mio-16e-10 ( irq = 3 )</PRE
 
279
><P
 
280
>Note that it also correctly identified the board.</P
 
281
></DIV
 
282
><DIV
 
283
CLASS="SECTION"
 
284
><H2
 
285
CLASS="SECTION"
 
286
><A
 
287
NAME="GETTINGINFORMATION"
 
288
>2.2. Getting information about a card</A
 
289
></H2
 
290
><P
 
291
>So now that you have <ACRONYM
 
292
CLASS="ACRONYM"
 
293
>Comedi</ACRONYM
 
294
> talking to the hardware, try to
 
295
talk to <ACRONYM
 
296
CLASS="ACRONYM"
 
297
>Comedi</ACRONYM
 
298
>.  Here's some pretty low-level information, which can
 
299
sometimes be useful for debugging:</P
 
300
><PRE
 
301
CLASS="SCREEN"
 
302
>cat /proc/comedi</PRE
 
303
><P
 
304
>On the particular system this demonstration was carried out, this
 
305
command gives:</P
 
306
><PRE
 
307
CLASS="SCREEN"
 
308
>comedi version 0.6.4
 
309
format string
 
310
 0: ni_atmio             at-mio-16e-10           7
 
311
 1: dt282x               dt2821-f-8di            4</PRE
 
312
><P
 
313
>This documentation feature is not well-developed yet.  Basically, it
 
314
currently returns the driver name, the device name, and the number of
 
315
subdevices.</P
 
316
><P
 
317
>In the <TT
 
318
CLASS="FILENAME"
 
319
>demo/</TT
 
320
> directory, there is a
 
321
command called <B
 
322
CLASS="COMMAND"
 
323
>info</B
 
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
 
328
CLASS="LITERAL"
 
329
>National Instruments</VAR
 
330
>
 
331
board (which is on <TT
 
332
CLASS="FILENAME"
 
333
>/dev/comedi0</TT
 
334
>), as a result of
 
335
the command <B
 
336
CLASS="COMMAND"
 
337
>demo/info /dev/comedi0</B
 
338
>:</P
 
339
><PRE
 
340
CLASS="SCREEN"
 
341
>overall info:
 
342
  version code: 0x000604
 
343
  driver name: ni_atmio
 
344
  board name: at-mio-16e-10
 
345
  number of subdevices: 7
 
346
subdevice 0:
 
347
  type: 1 (analog input)
 
348
  number of channels: 16
 
349
  max data value: 4095
 
350
...</PRE
 
351
><P
 
352
>The overall info gives information about the device; basically
 
353
the same information as <TT
 
354
CLASS="FILENAME"
 
355
>/proc/comedi</TT
 
356
>.</P
 
357
><P
 
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
 
362
><P
 
363
><ACRONYM
 
364
CLASS="ACRONYM"
 
365
>Comedi</ACRONYM
 
366
> has more information about the device than what is displayed
 
367
above, but <B
 
368
CLASS="COMMAND"
 
369
>demo/info</B
 
370
> doesn't currently display
 
371
this.</P
 
372
></DIV
 
373
></DIV
 
374
><DIV
 
375
CLASS="NAVFOOTER"
 
376
><HR
 
377
ALIGN="LEFT"
 
378
WIDTH="100%"><TABLE
 
379
SUMMARY="Footer navigation table"
 
380
WIDTH="100%"
 
381
BORDER="0"
 
382
CELLPADDING="0"
 
383
CELLSPACING="0"
 
384
><TR
 
385
><TD
 
386
WIDTH="33%"
 
387
ALIGN="left"
 
388
VALIGN="top"
 
389
><A
 
390
HREF="index.html"
 
391
ACCESSKEY="P"
 
392
>Prev</A
 
393
></TD
 
394
><TD
 
395
WIDTH="34%"
 
396
ALIGN="center"
 
397
VALIGN="top"
 
398
><A
 
399
HREF="index.html"
 
400
ACCESSKEY="H"
 
401
>Home</A
 
402
></TD
 
403
><TD
 
404
WIDTH="33%"
 
405
ALIGN="right"
 
406
VALIGN="top"
 
407
><A
 
408
HREF="x403.html"
 
409
ACCESSKEY="N"
 
410
>Next</A
 
411
></TD
 
412
></TR
 
413
><TR
 
414
><TD
 
415
WIDTH="33%"
 
416
ALIGN="left"
 
417
VALIGN="top"
 
418
>Comedi</TD
 
419
><TD
 
420
WIDTH="34%"
 
421
ALIGN="center"
 
422
VALIGN="top"
 
423
>&nbsp;</TD
 
424
><TD
 
425
WIDTH="33%"
 
426
ALIGN="right"
 
427
VALIGN="top"
 
428
>Writing <ACRONYM
 
429
CLASS="ACRONYM"
 
430
>Comedi</ACRONYM
 
431
> programs</TD
 
432
></TR
 
433
></TABLE
 
434
></DIV
 
435
></BODY
 
436
></HTML
 
437
>
 
 
b'\\ No newline at end of file'