02-04-2014 02:06 PM
Hello,
I have a vi with which I would like to collect data. It is set to start collecting when the start-trigger is sensed, which works perfectly, but I would also like to have the user be able to start the data collection process by pressing a button instead of applying the trigger. I'm at a loss on how to do this. I thought the event structure would work well; however the trigger has no boolean value with which I can associate it. If it did, I could then perform a logical comparison between the trigger and button to determine whether data collection ought to start.
So, how can I represent an activated trigger as a boolean? Or is there a better way to accomplish my goal?
I think I can make things clearer by expressing in linear programming what it is I'm trying to acheive:
if (trigger == true || button == true){
start data collection
}
I've attached my vi in case anyone feels it would be useful.
Solved! Go to Solution.
02-04-2014 02:19 PM
Hello, curious
If this was my application, I would just start continuous scan, and then do a "software" trigger, rather than a hardware. It would look something like this (in "plain text" code)
start acquisiton, but don't save all of it (either in memory or disk)
while (input < trigger and button isn't pressed)
{acquire data and dump it in to a circular buffer, the size of which is your "prescan"}
dump your circular buffer in to file (memory) and start acquiring new data until stop condition
I hope this helps.
-M
02-04-2014 03:19 PM
Hello, M
Thanks for your reply.
My system relies on the hardware digital trigger -- out of my control, I'm afraid. Is it possible to somehow synchronize a software trigger to my hardware trigger so that when the former is triggered, the latter is too -- then apply your method? I'm not sure if I'm making much sense here, but I still feel as if somehow generating a boolean from my hardware trigger may be an easier solution, at least from my beginner's perspective.
02-04-2014 03:50 PM
Have you searched the LabVIEW Help file for "User event"? There's nothing that says that two different events can't result in the same action.
What do you mean by your "hardware trigger is activated"? There must be some kind of signal generated somewhere when that happens.
Cameron
02-05-2014 07:49 AM
I am aware that different events can result in the same action; however I'm trying to find a way to represent the trigger as a boolean so that I can compare its occurence to the button's occurence.
What I mean when I say my "hardware trigger is activated" is the trigger is triggered. I understand there is a signal generated when my trigger is triggered, but I do not know how to represent this occurence as a boolean. I know that it is triggered because the signal appears on my chart, but I'm looking for a way to programmatically determine whether or not my trigger was triggered.
02-06-2014 05:32 PM
Hey curious,
What DAQ hardware are you using?
02-07-2014 01:41 PM
Hi, hnesmith
I'm using the USB 6229 OEM.
02-17-2014 03:50 PM
Hey,
I noticed that no one has commented on this post for the past 10 days. What is the status of your work? Do you still need assistance? Let me know.
Rob W
Applications Engineering
National Instruments
02-27-2014 02:00 PM
Hi, Rob
I still haven't figured out a solution.
I have modified my approach by eliminating the option to start data collection via front panel button, and instead start collecting data when the program opens. The same issue remains, though: how can I collect data without writing to a file (so the user can use this time to zero out measurements) then, when a trigger is applied (by user), send the data to a file?
At this point I realized that a trigger may not be necessary, and that I could just read the state of the pin (PFI15) that the trigger is now physically connected to and link the result to a case structure. I discovered the niSync vi's and utilized the PFI Line State trigger property node thinking I could link it to the case structure, but I cannot assign any of the PFI lines as references for the property node. And even if I could, I am not entirely convinced this solution would work as documentation from NI indicates NI-Sync is compatible with devices I am not using (see: http://www.ni.com/download/ni-sync-3.4.1/4476/en/).
Attached is a simple vi demonstrating my attempts.
03-02-2014 10:32 PM
Hi,
You are correct, USB 6229 is definitely not compatible with NI-Sync. However, you should be able to do this with the DAQmx driver functions.
If I understand correctly, you would like to generate a graph from your Analog Input, and have this write to file based on a triggered event. Using a PFI line won't work for this particular function, however you can create a Digital Input Task instead and route the wire to a D I/O line instead of a PFI line. You can then use that to write/not-write the Analog Input to file using a case structure depending on the state of the Digital Line.
Hope this helps! Let me know if you have any other questions.