Specifications
Comedi
3 / 148
• Analog signals are a bit more complicated. Typically, an analog acquisition channel can be programmed to generate or read a
voltage between a lower and an upper threshold (e.g., -10V and +10V). The card’s electronics may also allow automatically
sampling of a set of channels in a prescribed order.
• Pulse-based signals (counters, timers, encoders, etc.) are conceptually only a bit more complex than digital inputs and outputs,
in that they only add some timing specifications to the signal. Comedi has still only a limited number of drivers for this kind of
signals, although most of the necessary API and support functionality is available.
In addition to these ‘real’ DAQ functions, Comedi also offers basic timer access.
1.5 Device hierarchy
Comedi organizes all hardware according to the following hierarchy:
• Channel: the lowest-level hardware component, that represents the properties of one single data channel; for example, an
analog input, or a digital output.
• Subdevice: a set of functionally identical channels. For example, a set of 16 identical analog inputs.
• Device: a set of subdevices that are physically implemented on the same interface card; in other words, the interface card
itself. For example, the National Instruments 6024E device has a subdevice with 16 analog input channels, another
subdevice with two analog output channels, and a third subdevice with eight digital inputs/outputs.
Some interface cards have extra components that don’t fit in the above-mentioned classification, such as an EEPROM to store
configuration and board parameters, or calibration inputs. These special components are also classified as ‘sub-devices’ in
Comedi.
1.6 Acquisition terminology
This Section introduces the terminology that this document uses when talking about Comedi ‘commands’, which are streaming
asyncronous acquisitions. Figure 1 depicts a typical acquisition sequence when running a command:
• The sequence has a start and an end. At both sides, the software and the hardware need some finite initialization or settling
time.
• The sequence consists of a number of identically repeated scans. This is where the actual data acquisitions are taking place:
data is read from the card, or written to it. Each scan also has a begin, an end, and a finite setup time. Possibly, there is also a
settling time (‘scan delay’) at the end of a scan.
So, the hardware puts a lower boundary (the scan interval) on the minimum time needed to complete a full scan.
• Each scan contains one or more conversions on particular channels, i.e., the AD/DA converter is activated on each of the
programmed channels, and produces a sample, again in a finite conversion time, starting from the moment in time called the
sample time in Figure 1 (sometimes also called the ‘timestamp’), and caused by a triggering event, called convert.
In addition, some hardware has limits on the minimum conversion interval it can achieve, i.e., the minimum time it needs be-
tween subsequent conversions. For example, some A/D hardware must multiplex the conversions from different input channels
onto one single A/D converter. Thus the conversions are done serially in time (as shown in Figure 1). Other cards have the
hardware to do two or more acquisitions in parallel, and can perform all the conversions in a scan simultaneously. The begin
of each conversion is ‘triggered’ by some internally or externally generated pulse, e.g., a timer.
In general, not only the start of a conversion is triggered, but also the start of a scan and of a sequence. Comedi provides the API
to configure what triggering source one wants to use in each case. The API also allows you to specify the channel list, i.e., the
sequence of channels that needs to be acquired during each scan.