10-04-2016 03:29 PM - edited 10-04-2016 03:52 PM
Dear Labview community,
I am tasked with creating a DAQ-based (RPM, power,torque,temperature,pressure) program which is, among other things, supposed to log its measurements into excel. I have not had problems creating the actual log system, however, I do have a specific problem still: I am supposed to implement a function whose task is to record those values while a record button is pressed down, and stop recording once the user presses a stop button. The program is not supposed to stop running - it records data from a running engine, and the only time the program is supposed to be stopped is when we stop the engine.
Now, I have tried many ways to implement it, but have failed so far, getting error -2146827284 at undefined location (an error within the excel functions, it would seem). The ways I tried:
I have tried to include a maximally stripped-down version of the VI's so troubleshooting is easier for whoever is willing to help me. Saved in LV2012, I think that is the earliest version that supports the excel functions that I implemented.
Included are the VI's, and the very basic excel template that I am using for this test.
Thank you for your attention, and I hope I don't offend anyone with any ignorance that the VI's may feature. I am rather new to Labview.
Solved! Go to Solution.
10-04-2016 03:45 PM
Unfortunately the code was for LV 2016, and I do have LV 2012, so I could not open it.
One thing you might consider is writing your values to a CSV file during the test, or keeping them in a buffer of some sort (shift register, feedback node), then after you finished recording you can dump it to an XLS file.
I remember having a problem in the past of closing and opening an Excel file very quickly, but without seeing your code I don't know if that could be the issue.
10-04-2016 03:58 PM
Heya, thank you for the quick reply.
I have reuploaded the archive in LV2012 (my bad, compressed the wrong folder). Tried to comment as best I could.
The code (most preferably! for ease of interpretation and use) needs to be based on a template. I have included a picture of a formatting that I am working towards.
I am already using a buffer, a collector VI. I am not familiar with manually building a queue (yet), and so far, it seemed to work just fine (even if express VI's are frowned down upon.)
10-04-2016 04:11 PM
Hi, there is a lot of room for improvement. One thing that may fix your problem quickly is to change the mechanical action of "stop recording". Right now it is set to "switch when pressed". You want a latching mechanism, so it only dumps the data once. Try "latch when released". As it is right now, as soon as you click "stop recording" it tries to write and re-write and re-write your Excel sheet as quickly as the main while loop will allow it to. Change it to latching so it only writes once.
10-04-2016 04:15 PM
Are you trying to do your "record and write data" process multiple times while the VI is running? It does not look like it is set up to handle that, since you are not using the "reset" input on your collector VI.
I think you would be much better served by an event structure rather than polling (reading the value every loop) of your buttons, if you care to look into that.
10-04-2016 04:33 PM - edited 10-04-2016 04:35 PM
Dear gregoryj,
I can't believe that that was actually all I required. Yes. For this simple VI this has indeed worked - I am sad not to have seen this myself - but now I see the logic perfectly.
I will scale this to the actual program tomorrow ( it is rather late here right now (00:32) ), and if I manage to do it, I will mark your post as a solution - I am not closing this right now because I don't want to open another thread should I encounter any problems.
And yes, I didn't think about the reset on collector at all. As to an event structure - I didn't know of its existence, so I implemented as I could.
Thank you.
10-05-2016 01:33 PM
Hi gregoryj,
I have changed up the main program, and this solution seems to work. Thanks a lot! I have accepted your answer as the solution.
10-05-2016 02:13 PM
You are welcome. Please look into "state machines" and "event driven state machines", it will make your life much easier!
10-06-2016 04:53 AM
After this project is submitted to the company that requested it, I will pass labview core1+core2 to get a better theoretical base of how Labview works exactly - state machines seem to be included in core 2. The school mentioned the state machine/event driven state machine in brief, but didn't give any exercises, so I hope to get to know them that way.
Again, thanks.