LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to always read from the first signal of a regenerated DAQmx output in a for loop?

Solved!
Go to solution

See.  Now that you've acquired all the signals, you can see which trigger is aligned with the red light and which is aligned with the blue light.   Use that information within your analysis.

0 Kudos
Message 11 of 12
(354 Views)
Solution
Accepted by topic author Ellie90

I will try to elaborate on RavensFan's post. He is exactly right.

 

If all of your signals are sampling synchronously, that means they are all being sampled at the same time and the same rate, so they should all have the same order. Once we can make these assumptions, then we don't care at what absolute time the sampling occurred. We can use the sample ordering to separate them. Here is what I mean by that:

 

1. Retrieve ith sample from camera and blue light control.

2. Is the blue light control high during this sample? If so, then the picture is blue. Otherwise, it is red.

 

Here are some links you need to read if you are not already familiar with these features of DAQmx (and how to implement them):

Timing and Synchronization with DAQmx

More Synchronization with DAQmx

Triggering with DAQmx

 

One important thing to remember is that you cannot achieve fine-tuned synchronization at the software level. Now, this is a gross generalization, but what I mean is that you cannot simply put two DAQmx Reads next to each other in a for loop and hope they are synchronized. They won't be. (In fact, the DAQmx Read function actually has nothing to do with synchronization! This is because of the way data is buffered on its way from your camera to LabVIEW. At the moment, I'm unable to find a suitable explanation of this outside of NI's DAQ course, but here might be a good place to start finding some answers.)

 

I hope this explanation makes sense. I would highly encourage you to check out the resources I have linked as you debug your system further. It is hard to say without seeing your code, but I suspect you are not properly synchronizing your signals. The issue you have described should be simple to resolve once your camera trigger and lighting triggers are properly synchronized. Just use the method I have described above.

 

Good luck!

 

Duncan

Message 12 of 12
(351 Views)