CAN Sync Start with NI-DAQmx.vi
Purpose
Synchronize and start the specified CAN task and NI-DAQmx 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-DAQmx task in is the task ID 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 for the task. 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.
|
Outputs
task reference out is the same as task reference in. Wire the task reference to subsequent NI-CAN VIs for this task. | |||||||||
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.
|
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.
|
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 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-DAQmx.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-DAQmx.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.
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.