**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 handshaking.
First, the DMM is initiated and waits for a digital pulse from the switch before taking any measurements. When the switch scanning task is started, it connects the first channel in its scan list, waits for the channel to settle and generates a digital pulse-Scan Advanced. When the DMM receives this digital pulse, it takes the first 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 and this continues.
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.
4. Select a valid Advance Trigger source and Advance Complete destination.
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.
4. Select a valid Measurement Complete destination and Trigger Source.
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. Then the switch task is committed, which sets the scan list and trigger settings on the hardware.
2. The DMM is configured. Functions, range, resolution, triggers and number of points to take are set. When the DMM initiates, it configures its hardware according to the settings and waits for a trigger.
3. When the switch initiates it connects the first channels in its scan list, waits for the relays to settle and send its Scan Advanced signal to trigger the DMM for its first measurement. Once the DMM has taken a measurement, the DMM sends its MC signal to the switch to advance to the next entry in the scan list.
4. The DMM returns to the user the number of measurements specified in "Sample to Fetch at a Time". When the stop button is pushed the acquisition stops.
5. Terminates the scanning operation, closes the session to the switch, and display 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.