Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   How to toggle a relay with one button? (http://www.chiefdelphi.com/forums/showthread.php?t=112580)

Ether 02-07-2013 18:03

Re: How to toggle a relay with one button?
 
Quote:

Originally Posted by Racer26 (Post 1281118)
I prefer to use shift registers and while loops.

Are you saying this would look clearer to you using shift registers and while loops instead of feedback nodes?



Racer26 03-07-2013 10:37

Re: How to toggle a relay with one button?
 
Generally, yes.

I find that vi to be difficult to understand, as the loop that causes the feedback nodes to contain data is outside the scope of the vi. Tracking the flow of the program gets much harder that way.

Ether 03-07-2013 11:07

Re: How to toggle a relay with one button?
 
Quote:

Originally Posted by Racer26 (Post 1281164)
Generally, yes.

Can you post a PNG or GIF of how you would re-write that?



Racer26 03-07-2013 14:14

Re: How to toggle a relay with one button?
 
1 Attachment(s)
This would have identical function to the other one. Similar in compactness, and IMO easier to understand what is happening. Its a style thing though, I fully understand that other people may find feedback nodes easier to understand.

Attachment 15042

Joe Ross 03-07-2013 14:27

Re: How to toggle a relay with one button?
 
Quote:

Originally Posted by Racer26 (Post 1281173)
This would have identical function to the other one.

Don't you need to leave the shift registers uninitialized for this to work?

Racer26 03-07-2013 14:46

Re: How to toggle a relay with one button?
 
Quote:

Originally Posted by Joe Ross (Post 1281175)
Don't you need to leave the shift registers uninitialized for this to work?

D'oh. Yes, you do. Fixed.

Ether 03-07-2013 16:59

Re: How to toggle a relay with one button?
 
Quote:

Originally Posted by Racer26 (Post 1281173)
This would have identical function to the other one. Similar in compactness, and IMO easier to understand what is happening. Its a style thing though, I fully understand that other people may find feedback nodes easier to understand.

Attachment 15042

Yikes. Similar in compactness? Easier to understand? To each his own I guess :)



Ether 03-07-2013 17:00

Re: How to toggle a relay with one button?
 
Quote:

Originally Posted by Racer26 (Post 1281177)
D'oh. Yes, you do. Fixed.

My lip is bleeding.



Aren Siekmeier 05-07-2013 09:42

Re: How to toggle a relay with one button?
 
Quote:

Originally Posted by Racer26 (Post 1281118)
I understand them, but they break left to right data flow, which is considered a no-no in most of the LabVIEW world.

In the posted example, only one of the feedback nodes "breaks" this flow, the other is oriented left to right. And there is an arrow...

Racer26 05-07-2013 10:48

Re: How to toggle a relay with one button?
 
Quote:

Originally Posted by compwiztobe (Post 1281320)
In the posted example, only one of the feedback nodes "breaks" this flow, the other is oriented left to right. And there is an arrow...

Do you find it easy to understand that what goes into the left hand side of a a left-to-right oriented feedback node is different to what comes out of the right hand side?

Personally, I find it difficult. Especially without the loop there to show that the code you're looking at is actually being called in a looping fashion to populate the feedback nodes.

I'm pretty sure its a personal preference thing though.

I have little-to-no experience with using LabVIEW in an FRC environment. Are we able to use event structures? Most of the LabVIEW programs I write make heavy use of the Event Structure to control process flow.

Greg McKaskle 06-07-2013 08:12

Re: How to toggle a relay with one button?
 
Teams can use event structures, but few do. This is RT, so very little UI and not much need for user events.

As for the shift register versus feedback node. It took awhile for me to warm up to the feedback. I was so used to doing it with loops. I now use a mix. I typically use a shift register if it already has a loop or if it is a functional global. I use a feedback node if it is like the button example and is super local. I find that I change direction on the node when doing a compare for change, it makes much more sense to me. If I need the i-1 term for something else, I typically leave it in the default direction. I don't go for separating the init from the feedback. As you say, it is a style decision.

Greg McKaskle


All times are GMT -5. The time now is 22:56.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi