Scan Lists
A scan list is a string composed of device names, channel names, and characters that define connections, disconnections, triggering, and timing of the scan.
Switch Modules in NI-DAQmx
MAX supplies the default device name (or resource name) you use in a scan list. To find the default name, open MAX, and go to Devices and Interfaces»NI-DAQmx Devices. An example name is SCXI-1130:"SC1Mod1". The part of the name in quotes—for instance, SC1Mod1 or Dev1—is what you use in the scan list.
Scan List Characters
The following characters can be used in a scan list.
Character | Definition |
---|---|
-> | Used in a connect action (/Dev1/channel1->channel2). For example, the string /SC1Mod1/ch0->com0 connects CH0 to COM0. |
~ | Used with '->' in a disconnect action (~/Dev1/channel1->channel2). Valid only in No Action mode. For example, ~/Dev1/ch0->com0 means disconnect CH0 and COM0. |
; | Wait for debounce, send scan advanced output signal, then wait for trigger input. |
& | Separates connect and/or disconnect actions. For example, the string /Dev1/ch0->com0 & /Dev1/ch9->com1 means connect CH0 to COM0 and CH9 to COM1 (in no particular order). |
&& | Wait for debounce. For example, /Dev1/ch0->com0 && /Dev1/ch9->com1 means connect CH0 to COM0, wait for the relays to settle, then connect CH9 to COM1. |
: | Used in a channel range (channelX:Y, where X and Y are integers). Text containing a channel range represents multiple scan list entries. For example, the string /SC1Mod4/ch0:7->com0; represents 8 scan list entries. A semicolon must appear after the connect action using a channel range. |
Tip NI-DAQmx ignores white space and line returns. Use these to format the appearance of lengthy scan lists. |
Scan List Entries
A scan list entry is the text delimited by semicolons (;). Scan lists are composed of one or more scan list entries. For example, the following scan list contains two scan list entries:
/Dev1/ch0->com0; /Dev1/ch1->com0;
Scan Modes
The scan mode affects how NI-DAQmx interprets the scan list string. Typical scanning applications use the Break Before Make scan mode.
Mode | Description |
---|---|
Break Before Make (default) | Connections from the previous scan list entry are automatically disconnected before executing the current scan list entry. Disconnect actions (~/Dev1/channel1->channel2) are not valid in this mode. |
No Action | Connections remain connected until they are explicitly disconnected by a disconnect action. |
Break After Make | Currently unsupported. |
Scan List Examples
Example 1
Scan Mode: No Action
Scan List: /Dev1/ch0->com0; ~/Dev1/ch0->com0 && /Dev1/ch1->com0; ~/Dev1/ch1->com0 &&
Meaning:
- Connect ch0 to com0.
- Wait for debounce, send scan advanced signal, then wait for trigger input.
- Disconnect ch0 from com0, and wait for debounce.
- Connect ch1 to com0.
- Wait for debounce, send scan advanced signal, then wait for trigger input.
- Disconnect ch1 from com0, and wait for debounce.
- If the scan is set to continuous, return to step 1; else, stop.
Example 2
Scan Mode: Break Before Make
Scan List: /Dev1/ch0->com0; /Dev1/ch1->com0;
Meaning:
This scan list is equivalent to Example 1. Notice that the disconnect actions in Example 1 are no longer required.
Example 3
Scan Mode: Break Before Make
Scan List: /Dev1/ch0:1->/Dev1/com0;
Meaning:
This scan list is equivalent to Example 1 and Example 2. This scan list uses a channel range to reduce typing.