Scan Lists

NI Switches

Scan Lists

A scan list is a string composed of channel names and characters that define connections, disconnections, triggering, and timing of the scan.

Scan List Characters

The following table shows characters that can be used in a scan list when programming with NI-SWITCH.

Character(s) Definition
-> Used in a connect action (channel1->channel2). For example, the string ch0->com0 connects CH0 to COM0.
~Used with '->' in a disconnect action (~channel1->channel2). Valid only in No Action mode. For example, ~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 ch0->com0 & ch9->com1 means connect CH0 to COM0 and CH9 to COM1 (in no particular order and with minimal delay).
&&Wait for debounce. For example, ch0->com0 && 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 ch0:7->com0; represents eight scan list entries. A semicolon must appear after the connect action using a channel range.

Tip  NI-SWITCH ignores whitespace 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:

ch0->com0; ch1->com0;

Scan Modes

The scan mode affects how the driver interprets the scan list. Typical scanning applications use the Break Before Make scan mode.

ModeDescription
Break Before Make (default)Connections from the previous scan list entry are automatically disconnected before executing the current scan list entry. Disconnect actions, such as ~channel1->channel2, are not valid in this mode.
No ActionConnections remain connected until they are explicitly disconnected by a disconnect action.
Break After MakeCurrently not supported.

Scan List Examples

Example 1

Scan Mode: No Action
Scan List: ch0->com0; ~ch0->com0 && ch1->com0; ~ch1->com0 &&

Meaning:

  1. Connect ch0 to com0.
  2. Wait for debounce, send scan advanced signal, then wait for trigger input.
  3. Disconnect ch0 from com0 and wait for debounce.
  4. Connect ch1 to com0.
  5. Wait for debounce, send scan advanced signal, then wait for trigger input.
  6. Disconnect ch1 from com0 and wait for debounce.
  7. If the scan is set to continuous, return to step 1; otherwise, end the scan.

Example 2

Scan Mode: Break Before Make
Scan List: ch0->com0; ch1->com0;

Meaning:

The scan list in this example is equivalent to the scan list in Example 1. Notice that the disconnect actions in Example 1 are no longer required.

Example 3

Scan Mode: Break Before Make
Scan List: ch0:1->com0;

Meaning:

This scan list is equivalent to Example 1 and Example 2. This scan list uses a channel range to reduce keystrokes.