05-12-2009 04:53 PM
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?
05-13-2009 01:33 AM
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.
05-13-2009 08:56 AM
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
05-13-2009 09:53 AM
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.
05-13-2009 10:33 AM
05-13-2009 11:13 AM
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 ?