BrokenArrow Posted March 28, 2007 Report Share Posted March 28, 2007 For several years, I've been using variations of the Boolean Trigger.vi (OpenG boolean tool) and a similar type of thing from Bloomy called boolean_transition.vi (attached for those unfamiliar with it). Then there's Data Changed.vi, and many variations of that one. I've been wondering if, by over using these tools, I may be slowing down my apps, or wasting large amounts of resident memory. The VI has to open, run a little loop, and close, and do this over and over (asuming it's in another master loop). In a given application, I may use these one-time loop things 20 or 50 times. They are just SO much more convenient than shift registers (the Data Changed.vi comes to mind), and while the Event Structure was a huge plus back n 7.1, there's just no way I can convert my old code - with so many little mini-events nested deep down in sub-vi's. One example of where I think I'm overusing [a variation of Boolean Trigger.vi] is when a Push-On, Push-Off button is used to trigger a one-shot event, such as sending a command to a port. The alternatives are a LOT more work. Some of our old code, done back in the mid 90's, uses TWO buttons (one transparent) and two local variables to achieve the same thing. Any thoughts on these VI's, and the proper use thereof? Any warnings? Pitfals? Thanks! Richard Quote Link to comment
Mikkel Posted March 28, 2007 Report Share Posted March 28, 2007 QUOTE(BrokenArrow @ Mar 27 2007, 03:57 AM) One example of where I think I'm overusing [a variation of Boolean Trigger.vi] is when a Push-On, Push-Off button is used to trigger a one-shot event, such as sending a command to a port. The alternatives are a LOT more work. Some of our old code, done back in the mid 90's, uses TWO buttons (one transparent) and two local variables to achieve the same thing. Why are you not using the button with 'Mechanical Action' set to 'Latch When Pressed', as far as I can tell, this would provide the same functionallity (if I understood the above correctly)? -Mikkel Quote Link to comment
BrokenArrow Posted March 28, 2007 Author Report Share Posted March 28, 2007 QUOTE(Mikkel @ Mar 27 2007, 03:41 AM) Why are you not using the button with 'Mechanical Action' set to 'Latch When Pressed', as far as I can tell, this would provide the same functionallity (if I understood the above correctly)?-Mikkel 'Latch When Pressed' doesn't leave the button 'pressed in', showing the user that that thing has happened. Quote Link to comment
Grampa_of_Oliva_n_Eden Posted March 28, 2007 Report Share Posted March 28, 2007 QUOTE(BrokenArrow @ Mar 27 2007, 08:29 AM) 'Latch When Pressed' doesn't leave the button 'pressed in', showing the user that that thing has happened. A "First Call" node would make sure the first call of this sub-VI would work correctly. I generally use the event structure value change and then read the control to determine which type of change occurred. Your version seems to be intended for a "polling" type architecture which requres my CPU but you know that already. Just my thoghts, Ben Quote Link to comment
BrokenArrow Posted March 28, 2007 Author Report Share Posted March 28, 2007 QUOTE(Ben @ Mar 27 2007, 08:45 AM) A "First Call" node would make sure the first call of this sub-VI would work correctly. Very astute.. I am getting some flaky behavior with boolean_transition.vi upon startup, but until now, I haven't cared because my INIT routine takes care of a few seconds of startup anomalies. I think I'll add that, though. Thanks Ben! Richard Quote Link to comment
ned Posted March 28, 2007 Report Share Posted March 28, 2007 QUOTE(BrokenArrow @ Mar 26 2007, 08:57 PM) Any thoughts on these VI's, and the proper use thereof? Any warnings? Pitfals? Thanks!Richard I doubt you'll see any problems using these VIs, but if you're really concerned about a speed impact you might want to set them to "subroutine" priority. Quote Link to comment
BrokenArrow Posted March 29, 2007 Author Report Share Posted March 29, 2007 Yesterday, as a test, I put about 50 or so of these types of VIs in a loop. They were "working" in a true statement. CPU usage in false statement was 0 to 1%. In the true, 1 to 3%. Clicking buttons willy-nilly didn't seem to impact CPU much. As far as speed, I need to research that further, but I noticed no appreciable difference by the naked eye (looking at a loop counter). In 5+ years, I have never used the priority settings, aside from playing with them. I'll give that a try, thanks. -Richard Quote Link to comment
Grampa_of_Oliva_n_Eden Posted March 29, 2007 Report Share Posted March 29, 2007 QUOTE(BrokenArrow @ Mar 28 2007, 08:02 AM) In 5+ years, I have never used the priority settings, aside from playing with them. I'll give that a try, thanks.-Richard To the best of my understanding "subroutine" priority is a pseudo-priority. It just tells LV "pull out all of the stops and run like he#$ !" Ben Quote Link to comment
Aristos Queue Posted March 30, 2007 Report Share Posted March 30, 2007 With a VI this small, performance probably isn't a concern. But if you do anything 20 billion times, it does tend to add up. ;-) With that in mind, I offer a modification to your VI. Correct me if I'm wrong, but this should be the same functionality in less time. http://forums.lavag.org/index.php?act=attach&type=post&id=5341 Quote Link to comment
BrokenArrow Posted March 30, 2007 Author Report Share Posted March 30, 2007 QUOTE(Aristos Queue @ Mar 29 2007, 10:36 AM) ...........Correct me if I'm wrong, but this should be the same functionality in less time. Good point! Why update front panel indicators that aren't used? That's LabVIEW 101... And I'm on LabVIEW 102. Been there for 5 years.... Quote Link to comment
Grampa_of_Oliva_n_Eden Posted March 30, 2007 Report Share Posted March 30, 2007 QUOTE(BrokenArrow @ Mar 29 2007, 10:10 AM) ... And I'm on LabVIEW 102. Been there for 5 years.... Small world! I studied French for five years in high school, never did pass French 2. Since no other classes would fit into my schedule, they decided that art class would satisfy the forign language requirement. I used to think that was funny before I found out about LV. Now my "other language" requires I draw picures! "God work in mysterious ways" Ben Quote Link to comment
BrokenArrow Posted March 31, 2007 Author Report Share Posted March 31, 2007 QUOTE(Ben @ Mar 29 2007, 04:00 PM) Small world!I studied French for five years...... Ben I took 4 semesters of German in college, and all I can say is "where is the drug store? I've been horribly mangled in a train wreck". Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.