Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I synchronise the encoder ouput to the analog data

Hello,

   I am using PXI 1042Q, Mseries PXI 6289. I am using M- PXI 6289 for analog input and another M-PXI 6289 for encoder data. My question is how can I synchronise both the analog input and encoder data. I would like to synchronise the recording of both analog data and encoder data. Can I get a sample VI?

0 Kudos
Message 1 of 6
(3,694 Views)

This can easily be done by using the ai/SampleClock (one pulse for every AI sample) as the sample clock source of the counter task. Please read this document (in particular the Multi-Device Synchronization section) and post back if you need further help.

0 Kudos
Message 2 of 6
(3,682 Views)

Hello JB,

       Thanks for the information. I tried to make a labview code from the information you have provided but I am getting an error while executing the code. I have attached the error and also the code. Let me know where I went wrong. 

 

Thanks,

kartik 

Download All
0 Kudos
Message 3 of 6
(3,673 Views)

There would be several improvements for your code. But let's focus on the timeout. Below extract from the help for the DAQmx Read VI should share some light :

 

number of samples per channel specifies the number of samples to read. If you leave this input unwired or set it to -1, NI-DAQmx determines how many samples to read based on if the task acquires samples continuously or acquires a finite number of samples.

If the task acquires samples continuously and you set this input to -1, this VI reads all the samples currently available in the buffer.

If the task acquires a finite number of samples and you set this input to -1, the VI waits for the task to acquire all requested samples, then reads those samples.

 

Therefore, in your case, the counter read waits for 1000 samples but with a timeout of 0.

 

There are several possible solutions but what I recommend is to use an Array Size function to compute the number of values of the analog read. By wiring this number to the number of samples per channel input of the counter read you will read the exact same number of samples for both tasks in each iteration of the loop.

 

Don't hesitate to post again if you should need further help.

0 Kudos
Message 4 of 6
(3,653 Views)
I tried to make the changes as indicated in your reply but still I am not able to get the results. I have changed the "timeout" as 10 and also routed the "number of samples" acordingly. I still get the same error message. Is there any other way that I can solve this problem.
0 Kudos
Message 5 of 6
(3,649 Views)

Unfortunately I have never used PXI cards and therefore I'm not shure about this point. With PCI boards it would be necessary to wire the ai/SampleClock signal from one card to the other (RTSI connector). Please ensure that this signal is routed from one PXI board to the other without any additional hardware (or software configuration).

 

Are there any PXI users who were willing to share their experience on this point ?

 

Does the AI task behaves as expected ? (data is not an empty array)

Do you get some values from the CI task or is the array always empty ?

0 Kudos
Message 6 of 6
(3,642 Views)