112 lines
3.4 KiB
Text
112 lines
3.4 KiB
Text
|
|
GETTING STARTED:
|
|
|
|
After installing comedi and comedilib, cd to this directory (comedilib*/demo).
|
|
|
|
Use ./info for a very first test. If hardware and software are correctly
|
|
installed, the program prints a list of subdevices it recognises. If the
|
|
device is not /dev/comedi0, you can use the command-line option
|
|
'-f <device file>'.
|
|
|
|
Continue with ./inp -s <subdevice> -c <channel> to read individual samples,
|
|
or with ./outp -s <subdevice> -c <channel> <integer value> to set an
|
|
output value.
|
|
|
|
|
|
Examples
|
|
|
|
|
|
ao_waveform:
|
|
You need a device (and driver) capable of streaming analog output,
|
|
which currently is some of the members of the NI AT-MIO and PCI-MIO
|
|
E series. Creates a sine wave on an analog output channel.
|
|
|
|
cmd:
|
|
An example for using Comedi commands. Comedi commands
|
|
are used for asynchronous acquisition, with the timing controlled
|
|
by on-board timers or external events.
|
|
|
|
dio:
|
|
Requirements: A board with a digital I/O subdevice. Not just
|
|
a 'digital input' or 'digital output' subdevice, but one in
|
|
which the channels can be configured between input and output.
|
|
|
|
eeprom_dump:
|
|
Dumps the EEPROM of a card, if it has one. Useful for debugging
|
|
devices/drivers.
|
|
|
|
info:
|
|
Displays some information that Comedi knows about a device.
|
|
|
|
inp:
|
|
Simple input: Reads one sample from one channel on one subdevice.
|
|
|
|
inpn:
|
|
Slightly more complicated input demo. (It has a for() loop.)
|
|
Reads each channel on a subdevice, at every possible input
|
|
range, and converts the data to a voltage.
|
|
|
|
insn:
|
|
Example showing how to use instructions directly. Not
|
|
recommended for beginners: use higher-level functions such
|
|
as comedi_data_read(), comedi_data_write(), etc., as demonstrated
|
|
in the inp, outp, and dio examples.
|
|
|
|
ledclock:
|
|
Requirements: A board with a digital I/O subdevice. Not just
|
|
a 'digital input' or 'digital output' subdevice, but one in
|
|
which the channels can be configured between input and output.
|
|
|
|
main:
|
|
This is not a demo. The file main.c contains just an auxiliary
|
|
function. See below.
|
|
|
|
mmap:
|
|
Similar to the cmd demo, except the data is obtained through
|
|
a memory mapping instead of doing read() on /dev/comediX.
|
|
|
|
outp:
|
|
Write one <value> to one channel of one subdevice.
|
|
|
|
receiver:
|
|
Requirements: A board with a digital I/O subdevice. Not just
|
|
a 'digital input' or 'digital output' subdevice, but one in
|
|
which the channels can be configured between input and output.
|
|
|
|
select:
|
|
An example for using select() with asynchronous input. This
|
|
example requires an asynchronous input subdevice that can
|
|
handle TRIG_TIMER as a scan_begin_src.
|
|
|
|
sender:
|
|
Requirements: A board with a digital I/O subdevice. Not just
|
|
a 'digital input' or 'digital output' subdevice, but one in
|
|
which the channels can be configured between input and output.
|
|
|
|
sv:
|
|
Similar to inp, but measures the input using the comedi_sv_*()
|
|
functions, which average many samples to try to get a more accurate
|
|
estimate of the actual input.
|
|
|
|
tut1:
|
|
tut2:
|
|
Tutorial examples.
|
|
|
|
|
|
Many of these demos are linked with the file main.c, which parses
|
|
command line options. Some options don't make sense with all programs.
|
|
The options are:
|
|
|
|
|
|
-a <aref> uses analog reference <aref> (default: 0)
|
|
-c <chan> uses channel <chan>
|
|
-s <subd> uses subdevice <subd>
|
|
-r <range> uses voltage range <range>
|
|
-f <file> uses device file <file> (default: /dev/comedi0)
|
|
-v verbose
|
|
-d set analog reference to differential
|
|
-g set analog reference to ground
|
|
-o set analog reference to other
|
|
-m set analog reference to common
|
|
|
|
|