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

Document Type: Tutorial
NI Supported: Yes
Publish Date: Dec 21, 2006


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

Synchronizing CompactDAQ and CAN Measurements for In-Vehicle Data Logging

2 ratings | 5.00 out of 5
Print

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 CompactDAQ measurements can be synchronized with CAN I/O using NI PCMCIA-CAN interfaces.

Required Hardware

In addition to a CompactDAQ chassis and the I/O modules of your preference, the following equipment is required for CAN and CompactDAQ synchronization:
  • NI 9401 - 8 Channel, 5 V/TTL High-Speed Bi-directional 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
See Also:
NI 9401 Model Page
NI PCMCIA-CAN Interfaces (Syncronization cable is an accessory)

Hardware Setup


To achieve true hardware synchronization between CompactDAQ measurements and CAN data, the NI PCMCIA-CAN card will utilize the onboard CompactDAQ clock. To export this clock from CompactDAQ, an NI 9401 digital I/O module needs to be placed in either slot 5 or 6 of the CompactDAQ chassis. These 2 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 7 slots.

To connect the PCMCIA-CAN card to the 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 CompactDAQ and a PCMCIA-CAN card

Programming

The NI-CAN driver installs numerous example programs for creating applications with CAN and 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 CompactDAQ and CAN measurements, the vast majority of the program will remain the same as the examples listed above. The only difference, however, is that 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 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. This control will allow you to specify what digital line the clock will be exported on.

Related Links:
NI CAN Software and Hardware Products
NI CompactDAQ Homepage
Synchronizing CAN and Analog Signals for Device Validation
2 ratings | 5.00 out of 5
Print

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/).