CAN Sync Start with NI-DAQ.vi

NI-CAN

CAN Sync Start with NI-DAQ.vi

Purpose

Synchronize and start the specified CAN task and NI-DAQ task.

Format

Inputs

task reference in is the task reference from the previous NI-CAN VI. The task reference is originally returned from VIs such as CAN Initialize.vi or CAN Create Message.vi.

NI-DAQ task ID is the task ID 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 for the task. The LabVIEW diagram of this VI starts the NI-DAQ task ID 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

task reference out is the same as task reference in. Wire the task reference to subsequent NI-CAN VIs for this task.
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 task 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 both 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 with NI-DAQ.vi to clear the tasks.

This VI synchronizes a single CAN hardware product to a single NI-DAQ hardware product. To synchronize multiple CAN cards and/or multiple NI-DAQ cards, refer to CAN Sync Start Multiple with NI-DAQ.vi.

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.

The diagram of this VI assumes that the NI-DAQ product is an E Series MIO device. 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.