Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

synchronizing DAQ

Hi,
 
I'm currently building a VI that will acquire voltage measurements using a 6221-37 pin and images using a 1411 card linked to a CCD camera. I've managed to acquire my voltage measurements and write them to file. I would now like to know how I can synchronize the voltage measurement acquisition with image acquisition. The camera can feed up to 30 frames/sec, so that would be the ideal acquisition rate to set for both channels. Here are my questions:
 
1. I have several frames to acquire (30 frames/sec x 10-15 sec = 300 to 450 frames). Should I save these frames individually in seperate files as jpeg pictures or would it be best to sequence them into an avi? I will have frame-by-frame measurements to take later on and the possibilty to convert the avi back into single frames. I'm looking for the best way to acquire as many frames as possible while keeping up to speed with the voltage measurements.
 
2. Do I have to make any kind of physical connection between the CF-37 pin and the 1411 BNC trigger? If so, a BNC cable has two wires, so where should I plug the ground wire? Is there an option I can choose to get the 1411 to synchronize with an internal clock and get the voltage measurment to be synchronized with the same clock?
 
3. I basically need to produce two files. One will contain time and voltage measurements. The second will contain time meaurements and the file name of each frame. Can you suggest a better way of knowing at what moment each frame was taken? If I could synchronize both acquisitions, I could use the time stamps in the voltage measurement file.
 
Thanks for all your help.
 
PhilL
0 Kudos
Message 1 of 9
(3,923 Views)

Hi PhilL,

1.  I would suggest using an AVI to save your sequential frames.  This will reduce the amount of time your function spends opening and closing files because you can keep an AVI open and append to the file.

2.  I have come across two methods for synchronizing a DAQmx and IMAQ board.  One method uses the DAQmx board to trigger the IMAQ capture using a RTSI cable.  You can set your DAQmx trigger frequency to 30Hz for your desired frame rate.  An example file has been included with this post.

The second method uses the external trigger on the camera to trigger the DAQmx acquisition.  A discussion on the synchronization of the two can be found here.  You just need to use the IMAQ Trigger Drive2 vi being driven by the Vertical Syncronization signal of the IMAQ.  Then connect that signal through BNC, neglecting the grounding line, to a DAQmx PFI line.  I believe that both boards use the same ground since they are connected in your computer.  

 3.  Hopefully this advice helps you synchronize the two acquisitions.  If this is the case, I would definately recommend saving a timestamp with the voltage measurements as you suggested.

Let me know if this works or you have further questions.

Regards,

Ryan

0 Kudos
Message 2 of 9
(3,895 Views)

Hello Ryan,

first of all, thaks a lot for your help. After examining everything, I had also decided to use the sequence to save to avi.

As for the synchronization, I have to admit I'm still having problems. First of all, I checked my board and there isn't a RTSI socket, so I can eliminate that possibility. This means I need to use the BNC trigger (I/O) on the 1411 and a PF line on the 6221 (alos I/O) and to be honest, I don't really know how... I know how to change the trigger input for the voltage measurements, but I don't know how to program the BNC trigger on the 1411 to output a trigger signal or to accept an incoming signal.

I saw the Trigger Drive2.vi, but don't know where to insert it into my "Sequence to avi" vi. I have included the two VIs I want to put together. If you could take a look at them and give me a few pointers, I would be really appreciate it. The first is where I acquire the voltage measurements. I suppose I have to insert the Sequenc to avi VI in the same While loop, but am not sure of which parts need to be included inside the loop.

What exactly is the 'Trigger Number' feild in the Trigger Drive 2.vi ? Could you give me an example?

As you can see, I'm a little lost. I think it would be simpler to output a trigger signal on one of the PFI lines and use it as a trigger source for the imaq board. When I create such a task in MAX, should I use an analog ouput, a digital output or a counter output?

Thanks again for your help.

The VIs will be easier to visualize if you have NI-IMAQ. If nout, you cal always just see the names of the missing suvVis in the Context Help window. Thanks again
 
Phil
Download All
0 Kudos
Message 3 of 9
(3,871 Views)

Hey Phil,

I would still suggest using the IMAQ card to drive the DAQmx acquisition.  It will be easier this way because you won't have to set up a periodic signal and drive the camera acquisitions.  The card is automatically set up (through MAX) to acquire at 30 frames/sec.  All that is required then is to use the video signal to drive the DAQmx acquisitions.  Since you said you know how to change the DAQmx trigger, I will focus on explaining the Trigger Drive2 setup.

After looking at your application I would suggest inserting the Trigger Drive2 after the IMAQ Init and before your IMAQ Sequence.  The triggers will not start until you begin acquisition (call IMAQ Sequence) and will stop when you are done with your sequence.  As a result you should get exactly one trigger per frame with no extra measurements.  

Set the Trigger Type to "External", the Trigger Number to "0", the Trigger Polarity to "High True", and the Trigger Drive to "Frame Start" or "Vertical Synchronization Signal".  This will send a trigger out of the trigger port on the 1411 which you can wire to a PFI or trigger line on the 6221.  This trigger signal will be true at the beginning of each acquisition and will allow you to match one voltage measurement to each frame. 

I would suggest not skipping any frames during the IMAQ Sequence. 

I hope this helps get you started.  Let me know if you have any further questions.

Regards,

Ryan F.

0 Kudos
Message 4 of 9
(3,864 Views)
Hi Ryan,
 
thanks again for your help. I think the trigger is now working on the 1411, but I can't manage to find the right settings for the DAQmx. I've set my Trigger on the PFI7 line. What should the following options be set to???:
1. Acquisition mode (I get en error any time it is different from a finite number of samples, but I don't know how long each acquisition will last...)
2. Advanced clock (Internal or External)
3. Start Trigger
4. Reference Trigger
5. Should I set the number of samples to 1 the Rate at 30 Hz?
 
I read somewhere that the DAQmx should always be placed in a while loop. I can understand this if it is running in continuous mode, but is this true even if it is triggered by an external signal?
 
Thanks again for your help. I f anyone else reads this, your comments and suggestions are welcome.
 
Phil
0 Kudos
Message 5 of 9
(3,847 Views)

Hey Phil,

Please refer to the Acq&Graph Voltage-Int Clk-HW Trig Restarts.vi example file.  This file can be found in Help->Find Examples.  Browse according to Task and follow Hardware Input and Output->DAQmx->Analog Measurements->Voltage.  This setup provides one sample per incoming trigger and should work well for your application.

You will need to modify the example in the following ways: 

DAQmx Timing needs: Sample Clock, Finite Samples, Samples > 1, and any rate you choose (try 1000).  DAQmx  Start Trigger should be set to Start Digital Edge.  DAQmx Read should be set to Analog->Single Channel->Single Sample->DBL.

You can use the number of images in the sequence to end the DAQmx Read loop.  Either append to a file each loop or enable indexing and save all your data out after the sequence is complete. You won't need a reference trigger.

Hopefully this gets you on the way.
 
Regards,
Ryan F.
0 Kudos
Message 6 of 9
(3,842 Views)
this thread has been very helpful to me already. I am trying to synchronize a DAQmx signal (PCI 6221 grabbing two voltage signals) an a IMAQ signal ( PCI 1405) with labview 7.1.

I would like to have to IMAQ trigger the DAQ to aquire 20 datapoints with a frequency of, say, 50 Hz every time one image started to be grabbed!
Does that mean I have to set the Sample Clock : sample mode= finite, samples per channel = 20 and sampling rate= 50 ? I am rather asking for confirmation!

I also want to know the exact time of the triggering! How do I get the system time at the trigger events of the IMAQ ?

thanks,
Miethe

Message Edited by miethe on 04-18-2007 05:31 PM

0 Kudos
Message 7 of 9
(3,542 Views)
Hi

please use the correct forum for your question
in this case    multifunction daq
greetings from the Netherlands
0 Kudos
Message 8 of 9
(3,532 Views)
Hi,

thanks for pointing me in the direction of the right forum1

Miethe
0 Kudos
Message 9 of 9
(3,519 Views)