Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Jun 8, 2009


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

Synchronizing NI CompactDAQ and CAN Measurements for In-Vehicle Data Logging

2 ratings | 5.00 out of 5
Read in | Print | PDF

Overview

NI CompactDAQ is an ideal platform for in-vehicle data acquisition and logging. Often times, it is desirable to synchronize analog and digital measurements with CAN. This document discusses how NI CompactDAQ measurements can be synchronized with CAN I/O using NI PCMCIA-CAN interfaces.

Required Hardware

In addition to an NI CompactDAQ chassis and the I/O modules of your preference, the following equipment is required for CAN and NI CompactDAQ synchronization:

  • NI 9401 – 8-Channel, 5 V/TTL High-Speed Bidirectional Digital I/O Module
  • Any NI PCMCIA-CAN Series 2 Interface
  • NI PCMCIA-CAN Synchronization Cable


2-port, NI PCMCIA-CAN card with synchronization cable
NI 9401 – 8-channel digital I/O
Additional Resources:
NI 9401 Model Page
NI PCMCIA-CAN Interfaces (syncronization cable is an accessory)


Hardware Setup


To achieve true hardware synchronization between NI CompactDAQ measurements and CAN data, the NI PCMCIA-CAN card uses the onboard NI CompactDAQ clock. To export this clock from NI CompactDAQ, an NI 9401 digital I/O module needs to be placed in either slot five or six of the NI CompactDAQ chassis. These two slots allow the onboard clock to be routed to a RTSI line, which in turn, allows the clock to be exported on a digital line. All other I/O modules can be placed in any of the remaining seven slots.

To connect the PCMCIA-CAN card to the NI CompactDAQ chassis, follow the directions below:

  1. Connect the Trig7_CLK wire to Pin 17 of the NI 9401 digital I/O module.
  2. Connect the Trig 0 wire to Pin 14 of the NI 9401 digital I/O module.
  3. Connect one of the GND wires to Pin 13 of the NI 9401 digital I/O module.

[+] Enlarge Image
Figure 1. Wiring Diagram for NI CompactDAQ and a PCMCIA-CAN Card

Programming

The NI-CAN driver installs numerous example programs for creating applications with CAN and data acquisition (DAQ) hardware synchronization. These example programs are located in the example finder under the following section and include:

Hardware Input and Output >> CAN >> Channel API >> Synchronizing with DAQ >> DAQmx

  • CAN Waveform Input and DAQmx Waveform Input.vi
  • CAN Waveform Input and DAQmx Waveform Output.vi
  • CAN Waveform Output and DAQmx Waveform Input.vi
  • CAN Waveform Output and DAQmx Waveform Output.vi


To create an application with synchronized NI CompactDAQ and CAN measurements, the vast majority of the program remains the same as the examples listed above. The only difference is that NI CompactDAQ does not natively export a clock, such as with RTSI on PCI and with the timing and synchronization buses for PXI. To expose the NI CompactDAQ onboard clock and route it to a digital output line, simply replace the “CAN Sync with DAQmx.vi” with the “CAN Sync with CompactDAQ.vi” from the linked example program below.

The “CAN Sync with CompactDAQ.vi” has an additional input for clock frequency. When replacing the “CAN Sync with DAQmx.vi” with “CAN Sync with CompactDAQ.vi,” make sure to add a control for the “Freqout Input” parameter. With this control, you can specify what digital line the clock will be exported on.

Additional Resources:
NI CAN Software and Hardware Products
NI CompactDAQ Homepage
Synchronizing CAN and Analog Signals for Device Validation

2 ratings | 5.00 out of 5
Read in | Print | PDF

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).