Skip to content
12 changes: 7 additions & 5 deletions docs/source/examples/config_daqmx_example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ product = "NI 9217"

[modules.cDAQ1Mod3]
product = "NI 9205"
frequency = 1000
clock = "/cDAQ1/PFI1"

[modules.cDAQ1Mod3.trigger]
type = "digital edge"
terminal = "/cDAQ1/PFI0"
edge = "rising"

[modules.cDAQ1Mod3.ai.ai0]
type = "voltage"
Expand All @@ -46,8 +53,3 @@ info = "Example of AI voltage channel"

[modules.cDAQ1Mod4]
product = "NI 9203"

[trigger]
type = "digital edge"
terminal = "/cDAQ1/PFI0"
edge = "rising"
16 changes: 9 additions & 7 deletions docs/source/user_guide/config_files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ Format
its module and its key: ``[modules.cDAQ1Mod3.ai.ai0]`` is the channel ``cDAQ1Mod3/ai0``, so the module of a channel
is the device its name starts with. ``product`` is the product
type of the module, informative. ``frequency`` is optional: the sampling frequency of the module in Hz, a positive
integer. The generic viewer acquires each module with its own task, so each has its own frequency.

``[trigger]``
Optional: what starts the tasks. A digital trigger starts the task of every module; an analog one watches a channel of
the file and starts only the task of its module. ``type`` is ``digital edge`` (``terminal``, such as
``/cDAQ1/PFI0``, and ``edge``) or ``analog edge`` (``channel``, a channel of the file such as ``cDAQ1Mod3/ai0`` or a dedicated analog trigger
terminal such as ``/Dev1/APFI0``, ``level`` in volts, inside the range of the channel, and ``edge``). ``edge`` is ``rising`` (the default) or ``falling``. Without this table the tasks start at once.
integer. The generic viewer acquires each module with its own task, so each has its own frequency (with an external
clock, the highest frequency of that clock). ``clock`` is optional: a terminal such as ``/cDAQ1/PFI1`` or
``/cDAQ1Mod1/ai/SampleClock`` (the clock of another module); without it the module uses its own clock.

``[modules.<name>.trigger]``
Optional: what starts the task of the module; without it the task starts at once. ``type`` is ``digital edge``
(``terminal``, such as ``/cDAQ1/PFI0``, and ``edge``) or ``analog edge`` (``channel``, a channel of the module such
as ``cDAQ1Mod3/ai0`` or a dedicated analog trigger terminal such as ``/Dev1/APFI0``, ``level`` in volts, inside the
range of the channel, and ``edge``). ``edge`` is ``rising`` (the default) or ``falling``.

``[modules.<name>.ai.<key>]``
One table for each analog input channel. The channel is ``<module>/<key>`` (``cDAQ1Mod3/ai0``) and the order of
Expand Down
54 changes: 36 additions & 18 deletions docs/source/user_guide/nidaqmx_viewer_use.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@ How to use it
its device can measure (``voltage``, then ``current``, ``thermocouple`` and ``rtd``) and its default parameters; a
voltage channel gets the widest voltage range of the device.
3. **Choose the type of each channel** (``voltage``, ``current``, ``thermocouple``, ``rtd``). The group is rebuilt with
only the parameters of the new type; the values that the two types share, such as the range, are kept.
Remove a channel with the remove button of its group.
only the parameters of the new type. The range is kept only between types that measure the same quantity
(thermocouple and RTD): changing from a voltage to a current or a temperature gives the default range of the new
type, as a range in volts means nothing in amperes. Remove a channel with the remove button of its group.
4. **Set the acquisition**: the display, the frequency and, for the traces, the number of samples (see below).
5. **Grab or start the live mode.** The task is built from the channels when the first one is available, and rebuilt
at the next grab when the channels changed (in live mode, at the next start).

The channels are acquired by one task for each module (the device their name starts with, ``cDAQ1Mod1`` for
``cDAQ1Mod1/ai0``), because the modules of a chassis cannot always share a clock (the delta-sigma modules such as the
NI 9211 and NI 9217 cannot be timed with others). Each task gives its own data, named ``NI AI <module>`` (``NI AI cDAQ1Mod1``), and the tasks
start one after the other, without any alignment of their samples. A start trigger shared by the tasks (see below) is
start one after the other, without any alignment of their samples. A common clock or start trigger (see below) is
the way to align them when the hardware allows it. The driver refuses to put in one task modules that cannot share a clock
(error -201425, which the plugin turns into a message naming the devices): the generic viewer avoids it, as each
module has its own task.
Expand All @@ -44,23 +45,40 @@ Settings
* **Display type**: ``0D`` gives the mean of the samples of each channel (with its standard error), ``1D`` gives the
trace as a function of time.
* **Frequency Acq.**: the sampling rate that a module starts with.
* **Module frequencies**: one frequency for each module of the channels (they appear and disappear with the
channels), as a module can need a rate of its own. Each module is acquired at its frequency.
* **Start trigger**: ``none`` (the tasks start at once), ``digital edge`` (a *Terminal* such as ``/Dev1/PFI0`` and
an *Edge*) or ``analog edge`` (a *Channel*, a *Level* in volts and an *Edge*). A digital trigger starts the task of
every module. An analog trigger watches one of the channels of the tree, which the driver requires to be a channel of
the task, so it starts only the task of that channel's module (the others start at once); the channel is acquired
like the others. The list also offers the dedicated analog trigger terminals (``/Dev1/APFI0``) of the devices of the
channels, for the devices that have some: such a terminal is not acquired, and starts the task of its device.
* **Modules**: one group for each module of the channels (they appear and disappear with the channels), as a module
can need a rate, a clock and a start of its own. Each module is acquired by its own task, with:

* **Frequency**: the sampling rate of the module. With an external clock it is the highest frequency that clock
can have (the driver needs it to size its buffer), not the real one.
* **Clock**: ``internal`` (the module times itself) or a clock source, which makes the modules share one clock.
Any module may follow an external clock. The list offers only real clock sources: the terminals wired to the
device (``/Dev1/PFI1``, RTSI, PXI), the sample clocks and timebases of the subsystems of the device
(``/Dev1/ao/SampleClock``) and the sample clock that another module exports (``/Dev1/ai/SampleClock``). A module
is never offered its own sample clock.
* **Reach of the sources**: a clock source or a digital trigger terminal has to be reachable by the module. The
lists offer the terminals of the device of the module and, for a module of a cDAQ chassis, the terminals of the
chassis (``/cDAQ1/PFI0``) and of the other modules of the same chassis. A card or a USB device only has its own
terminals, as a device cannot be wired to another one by software.
* **Start trigger**: ``none`` (the task starts at once), ``digital edge`` (a *Terminal* such as ``/Dev1/PFI0``, or
the start trigger exported by another module of the same chassis, and an *Edge*) or ``analog edge`` (a *Channel*, a *Level* in volts
and an *Edge*). An analog trigger watches one of the channels of the module, which the driver requires to be a
channel of the task (set its ``read`` box off if you do not want its samples); the list also offers the dedicated
analog trigger terminals (``/Dev1/APFI0``) of the module, if it has some: such a terminal is not acquired.

The tasks start in the order that their sources require: a module that waits for the clock or the trigger of another
one starts first and the one that provides the signal starts last. Two modules that wait for each other cannot be
started: the plugin says so, and one of them has to use its own clock.
With an external clock the time between samples is not known, so the 1D axis is the sample index (no unit) and not
the time in seconds.
* **Nsamples** (``1D`` only): the length of the trace. In ``0D`` the number of points averaged is the *Naverage* of the
viewer, and in ``1D`` *Naverage* is the number of traces averaged. The driver needs at least two samples for a
clocked acquisition: *Nsamples* cannot be below 2, and with *Naverage* = 1 two samples are acquired and the first
one is kept.
* **Channels**: the group described above. Each channel has a ``read`` box (checked by default): unchecked, the
channel stays in the task but its samples are not in the data, which is what an analog trigger on that channel needs.
A module whose channels are all unchecked gives no data. The parameters of a channel are the fields of its channel class of the
API (``AIVoltage``, ``AICurrent``, ``AIThermocouple``, ``AIRtd``), with the same names; see :doc:`config_files`
for the list.
API (``AIVoltage``, ``AICurrent``, ``AIThermocouple``, ``AIRtd``), with the same names; the range (``min_val`` and ``max_val``) is shown in the unit of its quantity: V, A, or the
temperature units of the channel. See :doc:`config_files` for the list.

Loading and saving a configuration
----------------------------------
Expand All @@ -77,16 +95,16 @@ The parameters below are in the ``NIDAQmx config`` group of the settings.
the state manager of the Dashboard, which sets the menu again, and so loads the same file. The list is read
when the plugin starts, and again after a save.
* **Configuration** also loads the channels: choosing a file replaces the channels of the tree by the ones of the
file, in the order of the file (which is the order of the data), the frequency of each module and the start trigger
(none if the file has none). You can then add, remove or change channels as
file, in the order of the file (which is the order of the data), the frequency, the clock and the start trigger of each module
(internal clock and no trigger if the file has none). You can then add, remove or change channels as
usual, also from several devices: the file is only read, never changed, unless you save. One file is one
configuration: to work with another set of channels, save it under another suffix.
* As soon as the tree is not what the file describes any more (a channel added, removed or changed, a frequency or
the trigger modified), the menu goes back to ``(manual)``, so that it never shows a configuration that is not in the tree. To get the
* As soon as the tree is not what the file describes any more (a channel added, removed or changed, a frequency, a clock or
a trigger modified), the menu goes back to ``(manual)``, so that it never shows a configuration that is not in the tree. To get the
file back, choose it again in the menu.
* **Save as...**: a button with a LED. A click opens a small dialog asking the *Suffix* of the file
(``config_daqmx_<suffix>.toml``; ``default`` is the file without suffix), proposed with the configuration loaded.
The file then describes exactly the channels of the tree, the frequency of each module and the start trigger
The file then describes exactly the channels of the tree, the frequency, the clock and the start trigger of each module
(those of an existing file that are not in the tree are
removed). The format of the file groups the channels by module, so each channel is written in the module its name
starts with (``Dev1`` for ``Dev1/ai1``, ``cDAQ1Mod3`` for ``cDAQ1Mod3/ai0``): channels of several devices can be
Expand Down
Loading
Loading