CAN Sync Start Multiple with NI-DAQ.vi

NI-CAN

CAN Sync Start Multiple with NI-DAQ.vi

Purpose

Synchronize and start the specified list of multiple CAN tasks and a single NI-DAQ task. This is a more complex implementation of CAN Sync Start with NI-DAQ.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.

NI-DAQ task ID list is a task ID originally returned from an NI-DAQ configuration VI, such as AI Config or AO Config.

When this VI returns, do not call an NI-DAQ start VI. The LabVIEW diagram of this VI starts NI-DAQ task ID list for you, so you can immediately call NI-DAQ 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.
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-DAQ 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-DAQ 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-DAQ.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-DAQ hardware products. Refer to NI-DAQ for examples of synchronizing the timebase and trigger of multiple DAQ cards.

The diagram of this VI assumes that all NI-DAQ products are E Series MIO devices. 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.