Jump to content

I'm addicted to these VI's....


Recommended Posts

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

Link to comment

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 :)

Link to comment

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.

Link to comment

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

Link to comment

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

Link to comment

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.

Link to comment

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

Link to comment

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

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.