LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

External clock to control data acquisition timing

Hi All,

 

I am relatively new to Labview and wish to synchronise my data aquisition with a high speed camera. I apologise in advance if this question has been asked before, but I could not find any threads that could help me.

 

The equipment I am using is a NI cDAQ 9172 Chassis with an NI 9215 and NI cRIO-9233 modules, and Labview 2010.

 

I have an application where I use several devices as inputs to my NI system. Included in that system is the output of a high speed camera, which produces a voltage pulse for every frame taken. I wish my labview program to sample the data from all the instruments using the camera as an external clock. More specifically, I will have my camera set at 4000 fps, and I wish to sample at approximately 40,000 Hz, so that 1 in every 10 data points will be acquired at the same moment the pulse occurs (and thus when the camera takes an image).

 

I have combined two programs from the NI Examples explorer. The first is a TDMS streaming example to continuously log data. The second is a program to continuously acquire and graph voltage, with
an external clock (Cont Acq&Graph Voltage-Ext Clk). I have attached an image of my block diagram. I have set the clock source in this program to "Sample Clock" under the Module I am using, and 

have collected data. However I do not know if the data is being acquired at exactly when the pulse is being fired.

 

I was wondering about the following:

 

1. Will/can this program (Ext Clk example mentioned earlier) acquire the data at the correct moment using the camera as a clock? If not, how can I get this to work?

2. Under the Clock Source setting, I can specify the module I am inputting for my clock, but not the exact channel. How does it know which channel I want to use as my clock?
3. Why do I get errors when I try to use the NI 9215 module, but not when I use the NI cRIO-9233 module?

4. Are there any hardware/software considerations I should be aware of for the timing of the data acquisition?


Thanks in advance for all your help. Please let me know if I was not clear in anything.

0 Kudos
Message 1 of 11
(7,345 Views)

Hello Current English, hope you are doing great!

 

If I understood your application correctly what you would like to do is to use your camera as the clock for your system, which is not the same as having your camera triggering the acquisition.
If the case is the first one you will need to connect the signal comming from the camera to any PFI line of your system taht is doing the acquisition and configure this as the external clock you are going to use in the timing Vi Source.

What are the errors you get when using the 9215 module, can you post screenshots?

Part of the hardware considerations you need to be aware is that the module you are using has the ability to sample as fast as you trigger otherwise the measurment wont keep up.

 

Regards, 

 

Luis A.

0 Kudos
Message 2 of 11
(7,295 Views)

Hi Luis,

 

Thanks for the reply!

 

You are correct, I wish to use the camera as the clock for my system. I was previously unaware of needing PFI lines. I've done some reading, and have found that the cDAQ-9172 chassis allows for PFI connectivity in the 5th and 6th slots. However, I cannot find any documentation that shows whether or not the NI 9215 and/or 9233 modules have that functionality as well. Would I be able to use them in those slots for my external clock, or would I need another module, like the NI 9401?

 

Also, will my Labview program need to be changed with the use of the PFI? Is there any documentation to introduce this topic?

 

I can provide some screenshots for my errors as soon as I can. I may not have access to the equipment straight away. If I need to connect the clock to a PFI channel, then most likely the error has something to do with that.


Thanks again, and I apologise if some of my questions have been brought up before or seem naive.

0 Kudos
Message 3 of 11
(7,285 Views)

Hello again, 

 

I just want to confirm, would you like to use the camera as a Trigger in order to take the acquisitions or definitely you would like to use the camera pulse as a sample clock?

Neither of the modules have a PFI line in order to export/import a sample clock however the PFI line available in the Chassis will let you use it as a clock reference input you can import from the camera.

 

Refer to page 40 of the manual for the PFI line. 
http://www.ni.com/pdf/manuals/371747f.pdf 

 

Code wise what you will need to do is to select the PFI line of your chassis as the clock for your tasks in the timing VI you are using.

 

Also if triggering your 9233 is what you want you can check this KB

How Can I Trigger a NI 9233 or 9234?

 

I could´nt find a  specific PFI line document however this are  Programmable Function Interface (PFI) terminals that will give you the ability to configure each PFI individually as the following:

 Static digital input, Static digital output, Timing input signal for AI, AO, DI, DO, or counter/timer functions, Timing output signal from AI, AO, DI, DO, or counter/timer functions: In our case we will use an external clock connected to the PFI lline to time the AI of your sytem.

 

Regards, 

 

Luis Martinez.
Applications Engineer.

National Instruments. 


 

 

0 Kudos
Message 4 of 11
(7,271 Views)

Hi Luis,


Thanks again for your reply. 

 

It is possible I am confusing the terminology and difference between "trigger" and "clock". I'll try to explain exactly what I want from my system without using either word....

 

I've attached an image with a representation of the system. The blue square wave represents the analog pulse signal from the camera, the red "x" is the desired sampled digital signal, and the green "+" signal is the potential signal if the data acquisition is not related to the camera's pulse. As you can see, the "x" sampling occurs right as the camera pulses (and thus takes an image), recording data from all my equipment (not just the camera) at the exact time an image is taken. In the second case, the "+" may sample has a phase shift from the pulse, the data is not synchronous with the images, and would most likely also experience a further phase shift over time.

 

I assumed for this case that the camera would be the "clock" of the system, but I could also have confused the terminology. In any case, what I have described above is what I wish to do. Hopefully that helps you understand what I am trying to do. Let me know if any of that was unclear.

 

I will also go through the manuals and play around with the PFI slots to try what you have suggested. Thanks again.

0 Kudos
Message 5 of 11
(7,256 Views)

Hi again,

 

I do not see any PFI options available when I attach my modules to slot 5 and 6 of the cDAQ-9172 module. It seems that the only options available are (screenshot attached):

 

SampleClock
SampleClockTimebase
SyncPulse

 

FYI, cDAQ3Mod5 is the NI cRIO-9233 and cDAQ3Mod6 is the NI 9215. What do the above options do, and what are they used for? From what I understand, the SampleClock is the internal clock of each module. However, I'm unsure what the other two options (SampeClockTimebase and SyncPulse) are used for.

 

From the thread "How Can I Trigger a NI 9233 or 9234?", it seems that a module that supports triggering/synchronisation (such as the NI 9401) is necessary. Would I need to obtain such a module in order to synchronise my cRIO-9233 or 9215?

 

Thanks,
currentenglish

0 Kudos
Message 6 of 11
(7,227 Views)

Hi there, 

 

I think this will clarify what the Sample Clock is.

 

Check this link for information of the SyncPulse signal 

 

When it comes to the synchronization part definitely you will need a module that supports synchonization as the 9401.

 

Regards, 

 

Luis A

0 Kudos
Message 7 of 11
(7,190 Views)

Hi Luis,

 

Thanks for your help and the links. I'll try to see if I can get a NI 9401 card. If I can, I may come back with some more questions on how to get it to synchronise.


Thanks!

 

Currentenglish

0 Kudos
Message 8 of 11
(7,178 Views)

I am looking at possible options on purchasing a module to aid in my synchronization.

 

Are both the NI 9401 and 9402 appropriate for my needs? The specifications show that the they both support digital triggering, but the 9401 also triggeres the cDAQ chassis.

 

Are there any other modules that would be able to give me access to the PFI lines for synchronization?

0 Kudos
Message 9 of 11
(7,157 Views)

Hello Currentenglish,  

 

I noticed you called our support service and spoke with one of our team members regarding the synchronization issue,

 

Please let us know if there is more information needed from your behalf so we can help you out,

 

Regards,

 

Luis A.

National Instruments

 

0 Kudos
Message 10 of 11
(7,135 Views)