Switch Scanning
Another method to operate relays in a switch module is through scanning. Scanning is typically used when timing of connections needs to be synchronized with an event of another device such as a measurement instrument.
Unlike the immediate operations, where the relay actuates immediately after calling DAQmx Switch Connect (or Disconnect) function/VI, scanning consists of setting up a list of connections to be made after an event.
Connection operations are entered in a scan list that is downloaded to the memory of the switch module. The first entry in the scan list is executed when the switch module is initiated using the DAQmx Start Task function/VI. The triggering settings determine how the switch advances through subsequent entries in the list. The scan list can be executed continuously or for a finite number of times.
After each connection, switch modules can generate a digital pulse called Advance Complete. This pulse is typically used to trigger another device, such as a DMM to take a measurement.
There are three scanning options—Software Trigger Scanning, Synchronous Scanning, and Handshaking—which ultimately determine the triggering scheme.
Software Trigger Scanning
In Software Trigger Scanning, the scan list starts when the DAQmx Start Task function/VI is called. Each subsequent entry is executed after each call of the DAQmx Send Software Trigger function/VI.
To write a software trigger scanning program, complete the following steps:
- Set Topology Name of the switch module using DAQmx Switch Set Topology and Reset.
- Set up the list of connections using the DAQmx Switch Create Scan List function/VI.
- Set the Trigger Type attribute/property in the DAQmx Trigger class to Software.
- Select number of times the scan list executes by setting the Repeat Mode attribute/property in DAQmx Switch Scan Class to Continuous or Finite.
- Initialize the switch module using the DAQmx Start Task function/VI. The first entry in the scan list is executed and the switch waits for software triggers to execute the following entries in the list.
- Execute each set of connections in the scan list by calling the DAQmx Send Software Trigger function/VI and specifying the Advance Trigger.
- Terminate the scanning operation using the DAQmx Stop Task function/VI.
- Release resources using the DAQmx Clear Task function/VI.
Refer to the Switch Scanning—Software Trigger VI for an example of software trigger scanning in LabVIEW.
Synchronous Scanning
In synchronous scanning, each entry in the scan list is executed after the switch receives a digital pulse. This digital pulse is the Advance Trigger. A common use of synchronous scanning is with a measurement device like a digital multimeter (DMM). The DMM is programmed to take measurements at regular intervals and generate a digital pulse. When the switch receives this digital pulse, it advances to the next entry in its scan list. You must program the DMM interval time to account for the time required by the switch to actuate and settle.
To write a synchronous scanning program, complete the following steps:
- Set Topology Name of the switch module using the DAQmx Switch Set Topology and Reset function/VI.
- Set up the list of connections using the DAQmx Switch Create Scan List function/VI.
- Set the Trigger Type attribute/property to Digital Edge and source appropriately in the DAQmx Trigger function/VI. The source should coincide with the destination of the digital pulse sent by the measurement device.
- Select number of times the scan list executes by setting the Repeat Mode attribute/property in DAQmx Switch Scan Class to continuous or finite.
- Configure the digital pulse generated after each connection. In synchronous scanning, this digital pulse is not used. Set the Advance Complete Event:Output Terminal in DAQmx Export Signal class to an empty string.
- Initialize the switch module using the DAQmx Start Task function/VI. The first entry in the scan list is executed and the switch waits for digital pulses to execute the following entries in the list. Each time the switch module receives a digital pulse, it executes an entry in its scan list.
- Terminate the scanning operation using the DAQmx Stop Task function/VI.
- Release resources using the DAQmx Clear Task function/VI.
Refer to the Switch Scanning with DMM—Synchronous VI for an example of synchronous scanning in LabVIEW.
Handshaking
Handshaking is very similar to synchronous scanning except the switch sends a digital pulse back to the measurement device after each set of connections. In this case, the measurement device accepts a pulse as a trigger for its measurements instead of taking measurements at regular intervals. If you use a DMM, it needs to be initialized and ready to accept a trigger for its first measurement. The switch is then initiated, executes its first entry in the scan list, waits for a digital pulse to execute its next entry, and generates a digital pulse (Advance Complete). When the DMM receives this digital pulse, it takes the first measurement and generates a digital pulse. When the switch receives this pulse, it executes the next entry in the scan list, generates another digital pulse, and so on.
To write a handshaking program, complete the following steps:
- Set Topology Name of the switch module using the DAQmx Switch Set Topology and Reset function/VI.
- Set up the list of connections using the DAQmx Switch Create Scan List function/VI.
- Set the Trigger Type to Digital Edge and the source appropriately in the DAQmx Trigger function/VI. The source should coincide with the destination of the digital pulse sent by the measurement device.
- Configure the digital pulse generated after each set of connections. Set the Advance Complete Event:Output Terminal in DAQmx Export Signal class appropriately. This output terminal should coincide with the source of the DMM input trigger.
- Select number of times the scan list executes by setting the Repeat Mode attribute/property in DAQmx Switch Scan Class to continuous or finite.
- Initialize the switch module using the DAQmx Start Task function/VI. The first entry in the scan list is executed, and the switch waits for digital pulses to execute the following entries in the list. Each time the switch module receives a digital pulse, it executes an entry in its scan list and generates a digital pulse.
- Terminate the scanning operation using the DAQmx Stop Task function/VI.
- Release resources using the DAQmx Clear Task function/VI.
Refer to Switch Scanning with DMM—Handshaking VI for an example of handshaking in LabVIEW.