CAN Sync Start Multiple with NI-DAQmx.vi

NI-CAN

CAN Sync Start Multiple with NI-DAQmx.vi

Purpose

Synchronize and start the specified list of multiple CAN tasks and a single NI-DAQmx task. This is a more complex implementation of CAN Sync Start with NI-DAQmx.vi that supports multiple CAN hardware products.

Format

Inputs

CAN task reference list in is an array of NI-CAN task references. Each task reference is originally returned from VIs such as CAN Initialize.vi or CAN Create Message.vi. You can build the task references into an array using the LabVIEW Build Array VI.

DAQmx task in is the task from an NI-DAQmx configuration VI, such as DAQmx Create Virtual Channel.

When this VI returns, do not call an NI-DAQmx Start Task VI. The LabVIEW diagram of this VI starts the NI-DAQmx task for you, so you can immediately call NI-DAQmx read or write VIs.

RTSI terminal specifies the RTSI terminal number to use for the shared start trigger. This input uses a ring typedef to select terminals from RTSI0 to RTSI6.
Error in describes error conditions occurring before the VI executes. If an error has already occurred, the VI returns the value of the Error in cluster in Error out.
status is True if an error occurred. If status is True, the VI does not perform any operations.
code is the error code number identifying an error. A value of 0 means success. A negative value means error: VI did not execute the intended operation. A positive value means warning: VI executed intended operation, but an informational warning is returned. For a description of the code, wire the error cluster to a LabVIEW error-handling VI, such as the Simple Error Handler.
source identifies the VI where the error occurred.

Outputs

CAN task reference list out is the same as CAN task reference list in.
Synchronization out defines a cluster with information about the signals that have been routed between the cards and about additional DAQmx tasks that may have been created for synchronization.
Counter task out is the task from an NI-DAQmx Create Virtual Channel VI. This additional NI-DAQmx task is created under certain circumstances to generate a common timebase clock for cards that do not support sharing of timebases through RTSI (like DAQ cards or NI-CAN Series 1 cards).
Routes out is a 1-dimensional array of terminal names of signals that have been routed between the cards.
Source terminal is the name of the terminal where the route starts.
Destination terminal is the name of the terminal where the route ends.
Error out describes error conditions. If the Error in cluster indicated an error, the Error out cluster contains the same information. Otherwise, Error out describes the error status of this VI.
status is True if an error occurred.
code is the error code number identifying an error. A value of 0 means success. A negative value means error: VI did not execute the intended operation. A positive value means warning: VI executed intended operation, but an informational warning is returned. For a description of the code, wire the error cluster to a LabVIEW error-handling VI, such as the Simple Error Handler.
source identifies the VI where the error occurred.

Description

The CAN and NI-DAQmx tasks execute on different NI hardware products. To use the input/output samples of these tasks together in the application, the NI hardware products must be synchronized with RTSI terminal connections. Both NI hardware products must use a common timebase to avoid clock drift, and a common start trigger to start input/output at the same time.

This VI uses NI-CAN and NI-DAQmx RTSI functions to synchronize the NI hardware products to a common timebase and start trigger, and then it starts sampling on all tasks. The function used to connect RTSI terminals on the CAN card is CAN Connect Terminals.vi.

When you use this VI to start the tasks, you must use CAN Clear Multiple with NI-DAQmx.vi to clear the tasks.

This VI is intended to serve as an example. You can use the VI as is, but the LabVIEW diagram is commented so that you can use the VI as a starting point for more complex synchronization scenarios. Before you customize the LabVIEW diagram, save a copy of the VI for editing.

This VI does not demonstrate synchronization of multiple NI-DAQmx hardware products. Refer to NI-DAQ for examples of synchronizing the timebase and trigger of multiple DAQ cards.

This VI is designed to support most E Series MIO devices and M Series MIO devices through NI-DAQmx. If you are using a different NI hardware product, refer to the diagram as a starting point.

The diagram of this VI issues the start trigger immediately. To implement more complex triggering, such as using an AI trigger to start, refer to the diagram as a starting point.