Specifications
Comedi
26 / 148
4.7.6 Bitfield Pattern Matching Extended Trigger
(Status: design. No driver implements this feature yet.)
The insn field of the instruction data structure has not been assigned yet.
The chanspec field of the instruction data structure is ignored.
The data field of the instruction data structure is used as follows:
data[1] trigger flags.
data[2] mask.
data[3] pattern.
The pattern matching trigger issues a trigger when all of a specifed set of input lines match a specified pattern. If the device
allows, the input lines should correspond to the input lines of a digital input subdevice, however, this will necessarily be device
dependent. Each possible digital line that can be matched is assigned a bit in the mask and pattern. A bit set in the mask indicates
that the input line must match the corresponding bit in the pattern. A bit cleared in the mask indicates that the input line is
ignored.
Notes: This only allows 32 bits in the pattern/mask, which may be too few. Devices may support selecting different sets of lines
from which to match a pattern.
Discovery: The number of bits can be discovered by setting the mask to all 1’s. The driver must modify this value and return
-EAGAIN.
4.7.7 Counter configuration
(Status: design. No driver implements this feature yet.)
The insn field of the instruction data structure has not been assigned yet.
The chanspec field of the instruction data structure is used to specify which counter to use. (I.e., the counter is a Comedi
channel.)
The data field of the instruction data structure is used as follows:
data[1] trigger configuration.
data[2] primary input chanspec.
data[3] primary combining machine configuration.
data[4] secondary input chanspec.
data[5] secondary combining machine configuration.
data[6] latch configuration.
Note that this configuration is only useful if the counting has to be done in software. Many cards offer configurable counters in
hardware; e.g., general purpose timer cards can be configured to act as pulse generators, frequency counters, timers, encoders,
etc.
Counters can be operated either in synchronous mode (using INSN_READ) or asynchronous mode (using commands), similar to
analog input subdevices. The input signal for both modes is the accumulator. Commands on counter subdevices are almost always
specified using scan_begin_src = TRIG_OTHER, with the counter configuration also serving as the extended configuration
for the ‘scan begin’ source.
Counters are made up of an accumulator and a combining machine that determines when the accumulator should be incremented
or decremented based on the values of the input signals. The combining machine optionally determines when the accumulator
should be latched and put into a buffer. This feature is used in asynchronous mode.
Note: How to access multiple pieces of data acquired at each event?