comedilib/demo
2003-08-16 23:18:07 +00:00
..
perl perl demo 2002-03-18 21:52:13 +00:00
python add #! line 2003-06-04 02:54:41 +00:00
antialias.c fixing includes for exit(), memset() for gcc 2.96 compiler warnings 2003-01-01 23:07:02 +00:00
ao_waveform.c fixing includes for exit(), memset() for gcc 2.96 compiler warnings 2003-01-01 23:07:02 +00:00
apply_cal.c added apply_cal demo 2003-04-22 00:04:14 +00:00
cmd.c Changes to make it a little more robust 2002-03-18 21:50:40 +00:00
common.c Changed main.c to common.c 2001-07-14 00:53:30 +00:00
dio.c fixing includes for exit(), memset() for gcc 2.96 compiler warnings 2003-01-01 23:07:02 +00:00
eeprom_dump.c fixed error checking that tested for unsigned variables being negative 2002-04-02 19:55:33 +00:00
examples.h Changed the name of verbose_flag; Added a few more flags in main.c 2001-07-14 00:50:52 +00:00
info.c fixing includes for exit(), memset() for gcc 2.96 compiler warnings 2003-01-01 23:07:02 +00:00
inp.c fixing includes for exit(), memset() for gcc 2.96 compiler warnings 2003-01-01 23:07:02 +00:00
inpn.c fixing includes for exit(), memset() for gcc 2.96 compiler warnings 2003-01-01 23:07:02 +00:00
insn.c set default n_scan value to 10 for insn demo, added check that it is 2003-03-05 17:01:34 +00:00
ledclock.c fixing includes for exit(), memset() for gcc 2.96 compiler warnings 2003-01-01 23:07:02 +00:00
Makefile.am demos should be nodist 2003-05-02 07:52:24 +00:00
mmap.c include string.h for memset() 2003-01-01 23:08:07 +00:00
outp.c fixing includes for exit(), memset() for gcc 2.96 compiler warnings 2003-01-01 23:07:02 +00:00
poll.c fixing includes for exit(), memset() for gcc 2.96 compiler warnings 2003-01-01 23:07:02 +00:00
README Add a few comments about recent changes in demos 2001-07-15 23:52:13 +00:00
receiver.c use CR_EDGE and CR_INVERT constants instead of magic numbers 2003-05-24 21:15:06 +00:00
select.c fixing includes for exit(), memset() for gcc 2.96 compiler warnings 2003-01-01 23:07:02 +00:00
sender.c fixing includes for exit(), memset() for gcc 2.96 compiler warnings 2003-01-01 23:07:02 +00:00
sigio.c fixing includes for exit(), memset() for gcc 2.96 compiler warnings 2003-01-01 23:07:02 +00:00
sv.c fix warnings 2003-08-16 23:18:07 +00:00
tut1.c Cleanup of example programs 2000-10-19 06:28:27 +00:00
tut2.c random cleanup 2000-11-30 01:29:10 +00:00

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, use here and in the following the command-line
option -f <device>.

Continue with ./inp -s <subdevice> -c <channel> to read individual samples,
and with ./outp -s <subdevice> -c <channel> <integer value> to set an
output value.  Other beginning demos are: cmd, dio, inpn, tut1, tut2.
You should understand how these work before trying to understand the
other demos.

The perl subdirectory contains a few examples for the perl wrapper.



DEMO PROGRAMS:

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.

common:
	This is not an example.  The file common.c just contains some code
	that is common to many of the examples.

cmd: 
	An example for directly using Comedi commands.  Comedi commands
	are used for asynchronous acquisition, with the timing controlled
	by on-board timers or external events.  If this demo doesn't work
	with your hardware, read the comments in the source.  Hint: data
	is written to stdout, comments to stderr.
 
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:
	This demo requires a Fantazein clock modified to be directly
	controlled by the parallel port on a computer.  The original
	demo used a real-time task and controlled the parallel port
	directly.  This version is not complete.

mmap:
	This example shows how to map the internal Comedi buffer
	and directly access samples instead of using read() and
	write().  This is very similar to cmd.c, so look there for
	comments on most of the code.

outp <value>:
	Write one <value> to one channel of one subdevice.  Requires
	a digital or analog output subdevice.

receiver:
	This demo is meant to be used in conjunction with the sender
	demo.  Receiver requires a digital input subdevice, and sender
	requires a digital output subdevice.  When the clock and data
	pins are connected between the sending and receiving devices,
	one should be able to send bits over the link.
 
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:
	See receiver.

sigio:
	Similar to the cmd demo.  This demo sets up a signal handler
	for SIGIO, which is called whenever data is ready to be read
	from the device.

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.  See the Comedilib documentation.


COMMAND-LINE OPTIONS:

Many of these demos are linked with the file common.c, which parses
command line options.  Some options don't make sense with all programs.
The options are:

  -a <aref>	use analog reference <aref> (default: 0 == ground)
  -c <chan>	use channel <chan> (default: 0)
  -s <subd>	use subdevice <subd> (default: 0)
  -r <index>	use voltage range <index> (default: 0)
  -f <file>	use device file <file> (default: /dev/comedi0)
  -n <value>	use <value> for the number of channels in a scan
  -N <value>	use <value> for the number of scans
  -F <freq>	use <freq> as the scan frequency
  -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