04-19-2014 02:04 AM
Hi, here is my problem:
As part of a bigger VI, i want to make a stopwatch to measure duration of changes in output voltage of an infrared sensor. I've already made the subVI to recognize changes and return a boolean value (works with level crossing).
I have problems with the stopwatch subVI. It's "get date/time in seconds"-based, it subtracts the starting time of the subVI from the current time (see attachment). It works perfectly for the first time, but once it's triggered, it continues to measure time from the first trigger point, and doesn't want to update the starting time, no matter how kindly I ask it to do so. From then on, the inbound boolean value only switches the display on and off. I tried modifications, but I can't figure out the solution. How could I reset the function, or what another way could I build a simple stopwatch? Thanks for your help!
04-19-2014 08:51 AM
04-19-2014 09:03 AM
can you post the snapshot of your vi to understand the problem i cannot open your vi because of version conflict.
04-19-2014 10:50 AM
@Grasshopper98 wrote:
..., no matter how kindly I ask it to do so.
Make sure the microphone is on. 😄
Seriously, as a cheap workaround simply use the "elapsed time" express VI. You can even open it and see how it does it.
In order to reset, you need to change the value held in the shift register or feedback node. This hint should be enough, try to fix it now. 😄
Under what conditions do you want to reset the start time? (whenever the boolean is off? Whenever it goes from off to on?, etc.)
(Also please don't maximize the front panel or diagram windows to the screen, especially for small VIs like this. Very annoying! A toplevel loop like this needs a small wait, there is absolutely no reason to spin the loop millions if times per second, consuming all available CPU. Overall, the VI is very poorly constructured and you should probably start with a few tutorials before you continue with more complex problems.)
04-19-2014 11:54 AM
I would recommend just using the Elasped Time function that is already in LabVIEW. Yes, it is an express VI, but it works really well for this kind of thing.
04-26-2014 05:05 AM
04-26-2014 01:12 PM - edited 04-26-2014 01:12 PM
Is there any reason why you would post a screenshot of your entire desktop, showing basically the VI you attached earlier and a lot of extra garbage? Keep the noise down, please! And please add some text to the post to tell us what the question is. Thanks.
04-26-2014 02:43 PM
Is building a stopwatch part of a homework assignment? I'm guessing because your screen shot is useful in that it shows you are using a student edition. 😉
04-27-2014 07:15 AM
No, it's not a homework. Unfortunately my high school doesn't teach us this kind of stuff, so I'm an autodidact. This project will be for a competition, and NI provides a myDAQ kit with the Student Edition.
So, my problem is still this stopwatch thing: I want to measure the time that my lab-rats test subjects schoolmates spend with obstructing the way of an infralight across a corridor. I've figured out that I should reset the value held in the feedback node, but I don't know how, so that's why I originally posted the question. I've also looked at the elapsed time VI after your suggestion, but I find it a bit strange, that I have to give the starting time, I thought that it would be much easier to assemble a simple boolean-triggerable stopwatch with this otherwise sophisticated, handy program, that does not fill half of my screen.
So any ideas on resetting the time value? It always should start when the boolean is TRUE, and when it becomes FALSE again, then it should should stop, spit out the measured time, and then when it gets triggered again, it should refresh the feedback node with the actual time, if possible, and do the same thing all over again. It would be just an extra stuff, I'm working on it as a side-task, so I didn't really have time to dig myself into big stopwatch-diagrams. If I cannot keep it simple, I might just drop it, but I'm gonna make a try with this elapsed time VI. So thanks for the help, and I'd be grateful for any other tip. And sorry for the snapshot, I knew it's not really good, but I was in hurry.
(Also, altenbach, at the end of your first response, I couldn't clearly understand the problem you wrote down. It might be my English or my insufficient programming knowledge, but could you be more detailed about what's wrong with the subVI's resource consumption?)
04-27-2014 09:22 AM
Well Welcome to the forums! and yes, few public high schools teach what you can learn here by accident.
Of course, fewer high school students are really interested in learning. You may be the exception. look here
a resetable, pausable, timer ins't exactly "Basic" but it is common.
Keep learning!