**Note: This page includes switch code written with the switching palette of the NI-DAQmx driver. In the past, you were able to program NI switches with either the NI-DAQmx or NI-SWITCH driver. As of 2015, the NI-DAQmx switching palette is not recommended for new designs and NI strongly recommends using the NI-SWITCH driver for new designs. For more information, please review the following document: What Drivers Can I Use to Program My NI Switch Modules?
This example demonstrates how to scan a series of channels on a switch module and take measurements with an NI digital multimeter using synchronous scanning.
The DMM takes a measurement and generates a digital pulse-Measurement Complete (MC). When the switch receives this digital pulse, it advances to the next entry in its scan list. The DMM takes the next measurement after a time interval. You must program the DMM interval time by configuring an Interval Sample Trigger. Set the Interval parameter to, at least, the time needed for the switch to activate and settle.
Instructions for Running:
Switch Setup: (refer to the NI Switches Help)
1) Select the DAQmx switch device.
2) Select the correct topology for your switch module.
3) Enter a valid scan list.
3) Select a valid Advance Trigger location.
DMM Setup: (refer to your NI DMM documentation)
1) Enter your NI-DMM instrument descriptor.
2) Select measurement type, range and resolution.
3) Enter number of samples and sample interval.
4) Select a valid MC destination.
Refer to the NI Switches Help to determine if your switch supports scanning, the scan list syntax, and the valid channel names for your switch module.
Block Diagram Steps:
1. The switch is configured first. Triggers and scan list are set.
2. The DMM is configured. Functions, range, resolution, triggers and number of points to take are set.
3. When the switch initiates, it connects the first channel in its scan list, enters the wait for trigger state, and allows the rest of the program to continue.
4. When the DMM initiates it configures its hardware according to the settings from step B) and takes a measurement. This measures the first connection in the switch scan list. The DMM sends its MC signal to the switch to advance to the next connection. Then the switch moves to the next entry in its scan list and waits for a new trigger. The DMM then takes a new measurement after the interval time set in Sample interval parameter has elapsed. This operation repeats until the number of measurements is equal to the Sample Count. When all the points have been acquired, they are returned to the user (fetch) and the DMM session is closed.
5. Terminates the scanning operation, closes the session to the switch, and displays errors if any.
I/O Connections Overview:
Refer to the NI Switches Getting Started Guide and NI Switches Help for information about connecting signals to your switch module.