01-10-2017 11:20 AM
Hey! I'm a Labview student, new to this software.
I've made a program that continously acquires data from a waveform generator for a set time interval (which can be adjusted as required) and then writes the data to a spreadsheet if needed (new data in new columns).
I was somehow able to run the program and achieve the desired outcome, but I'm sure that there are a lot of silly things that I did 😄
Would someone please help me optimize the program, it would be very helpful for me to learn more 🙂
(I'm attaching the VI here)
Thanks in advance,
Akash 🙂
01-10-2017 03:39 PM
Here are things to either never do or very rarely do:
On the other side, a good practice is to use sub-VIs to "hide the details", making your code "fit on a single screen" (so it can be visually grasped without needing 12 monitors or lots of mouse scrolling).
Bob Schor
01-10-2017 03:45 PM
Hey Bob,
Thanks a lot for your suggestions 🙂
But if you say that Frame sequences and local variables are not to be used often (or at all), then in this case, how do I write my program in such a way that I get the code to execute in a particular sequence and get the desired outcome? Do you have any suggestions for that?
01-12-2017 03:11 AM
Is using "Queues" a solution to avoid Local variables in my exmaple??
01-12-2017 10:45 AM
@akash90 wrote:
Hey Bob,
Thanks a lot for your suggestions 🙂
But if you say that Frame sequences and local variables are not to be used often (or at all), then in this case, how do I write my program in such a way that I get the code to execute in a particular sequence and get the desired outcome? Do you have any suggestions for that?
State Machine.
And for single loops, keep your data in Shift Registers.
01-12-2017 11:24 AM
I'll explore more about State Machines and try to implement it in my program (and bug you guys again if I have some problem with that 😄 ).
Thanks for the suggestion 🙂
01-16-2017 08:34 AM
Hey guys,
I'm attaching the VI that I've made using State machine structure (the sub VI for the folder and file name is also attached along with the state machine diagram to explain what exactly I am trying to do)
In this VI, I'm having a couple of problems:
Firstly, the Timer is running in a multiple of 100 ms (on defining a buffer of 0.1 seconds), as a result of which I'm not getting the exact number of values everytime. For example, if I set the Timer at 2000 ms, the recording ON time runs anywhere from 2000 to 2099 ms not giving me the exact number of data points that I desire. For a period of 2000 ms, I should be getting 5120 values of Y, but sometimes I get only 4864 instead. How can I solve that issue?
Secondly, I am getting the column headings of "Time" and "Samples" for the first iteration in the logged file, but not for the next iterations. I'm sure that the solution for that would be simple enough, but I'm not able to figure it out. Any ideas about that?
Thanks in advance 🙂