I am new to labview, having recently taken the Core I and II courses.
I am programming a test rig to acquire the linear position of a hydraulic cylinder and plot it over time. In programming this code, I elected to use an event structure so that when a front panel button is pressed, a certain part of the test is run.
In one particular part of the test, called the Snub Test, I need to measure the position of the cylinder over time and plot it to a graph. The data acquisition needs to be continuous, however the event structure only allows the loop to run once.
I have attached a portion of my code for reference.
Can someone please advise how I can get this data acquisition to run continuously until the user (or a reference trigger) stops the test?
A single loop with an event structure is not the best way to go about this. I was unable to open your code as there were some subVI's missing so I cannot appreciate how you have approached this although I will assume you have a vi with a single while loops with an event struct in it!
You should study the "Producer/Consumer Design Pattern (Events)" template that ships with LabVIEW. In case you are unfamiliar, select File>>New. Then expand the Frameworks section and within Design Patterns you will see the template I mentioned.
This template will show you how to use an event structure in its own loop to issue commands to a parallel loop which could contain your DAQ code. Typically when an event is called in a producer loop, a command is queued to the consumer loop which allows some form of control over its function (start DAQ, Stop DAQ, Quit for example).
As a general rule (which I do break on the odd occasion as feature creep sets in) I never put any code in an event structure other than the code required to call some other code in a parallel loop...that is to say I only use 'Enque Element.vi' within an event structure. Study that template I mentioned, 9 out of 10 programs I write starts with that kind of framework.
If you are not familiar with Queues, they are your best friend, get to know them well and soon you will be a strong and powerfull programmer 🙂
A few comments to your VI in general: