Specifications
Comedi
4 / 148
Figure courtesy of Kurt Müller.
Figure 1: Asynchronous Acquisition Sequence
1.7 DAQ functions
The basic data acquisition functionalities that Comedi offers work on channels, or sets of channels:
• Single acquisition: Comedi has function calls to synchronously perform one single data acquisition on a specified channel:
comedi_data_read(), comedi_data_read_delayed(), comedi_data_write(), comedi_dio_read(), com-
edi_dio_write(). In addition, the lower-level comedi_do_insn() function can be used to perform an acquisition.
‘Synchronous’ means that the calling process blocks until the data acquisition has finished.
• Mutiple synchronous acquisition: The comedi_data_read_n() function performs (possibly multiple) data acquisitions
on a specified channel, in a synchronous way. So, the function call blocks until the whole acquisition has finished. The precise
timing between the acquisitions is not hardware controlled.
In addition, comedi_do_insnlist()() executes a list of instructions in one single (blocking, synchronous) call, such that
the overhead involved in configuring each individual acquisition is reduced.
• Command: a command is sequence of scans, for which conditions have been specified that determine when the acquisition
will start and stop, and when each conversion in each scan should occur. A comedi_command() function call sets up the
aynchronous data acquisition: as soon as the command information has been filled in, the comedi_command() function call
returns. The hardware of the card takes care of the sequencing and timing of the data acquisition as it proceeds.
1.8 Supporting functionality
The command functionality cannot be offered by DAQ cards that lack the hardware to autonomously sequence a series of scans.
For these cards, the command functionality may be provided in software. And because of the quite strict real-time requirements
for a command acquisition, a real-time operating system should be used to translate the command specification into a correctly
timed sequence of instructions. Comedi provides the comedi_rt_timer() kernel module to support such a virtual command
execution under RTAI or RTLinux/Free.
Comedi not only offers the API to access the functionality of the cards, but also to query the capabilities of the installed devices.
That is, a user process can find out what channels are available, and what their physical parameters are (range, direction of
input/output, etc.).