Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronizing Analog Inputs, CAN Input Messages and CAN Output Messages

Hi All,

 

I am trying to develop a system that will allow me to read Analog Inputs, CAN inputs and also output CAN messages.  I have looked at several examples to be able to sync up Analog Inputs with CAN inputs as well as Analog with Can outputs, and I am also currently able to do all three simultaneously.  The problem I am running into is synchronizing all the data so that everything is organized and saved at the correct timestamp so that I can effectivly do frequency response. 

 

I have tried using a waveform for my CAN write, and then aligning the waveform with my CAN read waveform and Analog In waveform but when my write and reads are in different loops the waveforms do not match up and the values are still off.  When I have had my read and write happen in the same loop the difference in my analog and CAN input sampling rate, currently at 1kHz is slowed down by my CAN output speed of 100 hZ and the waveforms are still off.

 

Has anyone seen an example or done something along these lines that would be close to what I am trying to accomplish?

 

Thanks.

 

0 Kudos
Message 1 of 4
(3,091 Views)

Hey Steve,

 

What hardware are you using?

 

-Doug B

Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,079 Views)

Currently I am using a PCI-6036E that is connected to a SCXI-1000 chassis and also connected to a series 2 NI-CAN pci card.

 

I have followed some of the examples and am using the CAN Sync Start with NI-DAQmx VI and have modified that to also start my CAN output task as well, the default is just an input task.  I have it running now where I can generate a waveform using the signal generator, set my sample numbers and rate and output the signal on my CAN bus, as well as read in Analog signals and CAN Inputs.

 

Using another CAN bus monitor I am able to see my output message, I am commanding current to a coil, and also see the input message, my coil current feedback.

 

I would like to be able to either log the messages the CAN write sends and then sync it with the Inputs, analogs, frequencies, and whatever else people ask me to record, or I would even be satisfied to read the output message during my read CAN Inputs routine, although I am not sure if that is possible.

 

Any ideas or examples are appreciated!

0 Kudos
Message 3 of 4
(3,076 Views)

Hey Steve,

 

So your card is using our NI-CAN driver, not the NI-XNET driver? If so, take a look at these articles:

 

http://digital.ni.com/public.nsf/allkb/95EB3CB8E92D30FB86256F2C00672C44

http://www.ni.com/white-paper/4204/en

 

I think that the second article linked above will be especially helpful.

 

 

Hope This Helps,

 

Doug B

Applications Engineer
National Instruments
0 Kudos
Message 4 of 4
(3,068 Views)