02-12-2009 04:57 PM
I have been looking at all the examples involving triggers in
labview and quite a few ones in the forum, but I cannot figure out how
to do what I want.
I am using Labview 8.5 and the DAQ PCIe-6259.
I need to start and stop the acquisition of an analog input (voltage) with a digital trigger, several times.
It basically corresponds to an X-Y scan.
My raster scan is started and done till its end without me having to interact with it.
The scanning controller is just giving me some trigger times in between which I need to acquire some data.
A few lines would be looking like that (the x axis here being the time):
→ ---------trigger1+++++++++++++++++++++++++++++++++++++++++++++++++++++++++trigger2---------------
---------trigger4+++++++++++++++++++++++++++++++++++++++++++++++++++++++++trigger3--------------- ←
→ ---------trigger6+++++++++++++++++++++++++++++++++++++++++++++++++++++++++trigger5---------------
...
The ------ correspond to two zones were I do not need to scan (where the movement is not linear).
What I need to do is:
I do probably not fully understand the stop trigger concept, but I hope that someone would be able to help me.
Thanks
Solved! Go to Solution.
02-16-2009 03:34 AM
Good morning Zedude,
Please peruse the attached file. Its a fairly simple example vi, illastrating how to trigger (start and stop) a analogue acqusition from a digital PFI line. The block diagram is well documented, so it should be easy to follow and modify. I have not included any data logging or array creation - but from the tone of your forum post, you are happy to impliment this yourself.
I hope this was helpful to you.
Best wishes
02-16-2009 04:19 AM
Hi Rich,
your example is in Labview 8.6 and I am using Labview 8.5, so that I cannot open it.
could you post your example in an earlier version of Labview ?
Thanks
02-16-2009 04:23 AM
Sorry, but by mistake I pressed the button "solution ?" when I actually do not have my solution yet !
02-16-2009 04:27 AM
Ha Ha! That was pre-emptive solution acceptance. I feel that there is alot of pressure on my example code now 😉
I should have checked your LV version before posting. Sorry about that, myfriend.
Best wishes,
02-16-2009 06:23 AM
Rich,
I am not sure that your solution would allow me to do what I want, because I don't know exactly where the triggers are, so that I cannot really define the number of samples and the number of pretrigger samples.
But actually my problem has changed recently, because I discovered that I have more trigger points that I was expecting and that they are not defined as a "position tag" as I was expecting, but as timestamps.
So I actually now need to do a continuous acquisition during all my scan, which give rise to a new question - I don't know if it should be a new post.
My question is how to acquire two continuous signals (one AI, one DI) at a frequency around 10kHz for probably around 8M samples and store them in a file?
I don't think it is reasonable to try to fill an array every X samples, because anyway at the end it will be huge.
Any help would be greatly appreciated.
02-16-2009 08:36 AM - edited 02-16-2009 08:37 AM
A very efficient method of data logging is the tdms file format. The TDMS file format is designed to write and read measured data at a very high speed, while maintaining a hierarchical system of descriptive information.
Traditionally, TDMS was a National Instruments only file format – you could only read it using our products – LabVIEW/CVI/DIAdem. However, bolt-on’s are now available, which allows you to directly open the .tdms files with Excel (see link).
National Instruments Technical Data Management Overview
http://zone.ni.com/devzone/cda/tut/p/id/3676
Introduction to LabVIEW TDM Streaming Vis
http://zone.ni.com/devzone/cda/tut/p/id/3539
VI-Based API for Writing TDMS Files
http://zone.ni.com/devzone/cda/tut/p/id/6471
TDM Excel Add-In Tool for Microsoft Excel User Guide
http://zone.ni.com/devzone/cda/tut/p/id/4906
Examples of the use of the TDMS API ship with LabVIEW. You will find them in HELP > find examples > fundamentals > File Input and Output. For you application, I would recommend the “Cont Acq&Graph Voltage - Write Data to File (TDMS).vi”.
If you are not interested in the TDMS file format, then you just need to look at streaming data to disk. There is a lot of information to be found on the NI website, but example vis ship directly with LabVIEW.
HELP > find examples > fundamentals > File Input and Output > Write to Text File.vi
The fact that you are using the low level functions means that you can open and close references to the file on start up and end of your acquisition, and just stream the data to disk as it is being acquired. This minimizes the interactions you make with the OS and increases efficiency… and it also means that you do not need to build huge arrays of data, before saving it all to disk in one hit.
However, at the speeds you require, the TDMS format would likely be the best solution.
02-16-2009 08:49 AM
Thanks for your help Rich.
It is funny because before your answer I got a phone call from NI and, after asking me if I wanted to buy something, they transferred my call to an engineer who suggested me to try this TDMS file format.
I will give it a try.
Thank you again