Go to Post [how to read the rules] Slowly, carefully, word by word, taking your time as if it was the last corndog of the summer. - Foster [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 31-01-2012, 12:53
MotorHead's Avatar
MotorHead MotorHead is offline
Programming Mentor
AKA: Jeff Beltramo
FRC #1922 (OZ-Ram)
Team Role: Coach
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Concord, NH
Posts: 68
MotorHead is a splendid one to beholdMotorHead is a splendid one to beholdMotorHead is a splendid one to beholdMotorHead is a splendid one to beholdMotorHead is a splendid one to beholdMotorHead is a splendid one to beholdMotorHead is a splendid one to behold
Difference between Shift Register and Feedback Node

This is a general question about LV programming, but would love to hear some opinions on this...What is the difference between using Shift Registers and Feedback Nodes? They appear to be functionally the same, just drawn differently in the Do Loop. Is there performance differences between the two?

I did some poking around NI website with this question and found some great debates about their use, but most of the discussion were referencing a few rev's back of LV. Is there a definitive answer on when to use one over the other for the latest revisions of LV?
__________________
Jeff Beltramo
Team #1922
Concord, New Hampshire

Reply With Quote
  #2   Spotlight this post!  
Unread 31-01-2012, 13:17
Omar's Avatar
Omar Omar is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Huntsville, AL
Posts: 122
Omar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of light
Re: Difference between Shift Register and Feedback Node

They are pretty much the same. I used them at different times more from a personal preference. I use shift reg more just because I have been programming with LabVIEW from the early 90's and grew up with shift reg.

I use shift reg 3/4 of the time.

I use feedback nodes to save space on the block diagram and to keep from running wire all cross my block diagram. I most only use the feed back nodes pointing to the right. I do not like to have any wires going from right to left. So in those cases I use shift reg. These are all personal preferences and not the same for everyone.

I have never seen any real speed differences that really matters.

The feedback mode dose have some built in functions that to do the same with shift reg you would have to add a little code. But anything you can do with a feed node you can do with a shift reg and a little extra code.

There are some extra initialization setting (configuring) that the shift reg does not have, but I never had a need for them.

Which one you use is up to YOU.
__________________
Omar
Reply With Quote
  #3   Spotlight this post!  
Unread 31-01-2012, 16:00
tilky's Avatar
tilky tilky is offline
Registered User
AKA: Ryan Thielke
FRC #3137
Team Role: Programmer
 
Join Date: Nov 2011
Rookie Year: 2011
Location: Connetquot
Posts: 188
tilky is an unknown quantity at this point
Re: Difference between Shift Register and Feedback Node

i hope you aren't using shift registers under teleop
Reply With Quote
  #4   Spotlight this post!  
Unread 01-02-2012, 00:31
SuperS_5's Avatar
SuperS_5 SuperS_5 is offline
[Certified LabVIEW Developer]
FRC #1219
 
Join Date: Dec 2010
Rookie Year: 2010
Location: Canada
Posts: 140
SuperS_5 will become famous soon enoughSuperS_5 will become famous soon enough
Re: Difference between Shift Register and Feedback Node

Quote:
Originally Posted by tilky View Post
i hope you aren't using shift registers under teleop
Single run loops are a common design when using uninitialized shift registers. I have personally stated to move away from this, towards feedback nodes. This is mostly due to some misunderstandings with junior programmers. I find that feedback nodes offer more information at first glance. This is particularly important for code review. This however, comes with the risk of sloppy looking code. I believe uninitialized shift registers, used in single run loops have some overhead due to the loop. I am unsure of how the compiler optimizations affect this. I often will use them interchangably.
__________________
Mike B
Reply With Quote
  #5   Spotlight this post!  
Unread 01-02-2012, 08:50
Omar's Avatar
Omar Omar is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Huntsville, AL
Posts: 122
Omar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of light
Re: Difference between Shift Register and Feedback Node

Quote:
Originally Posted by tilky View Post
i hope you aren't using shift registers under teleop
We use shift reg all the time in teleop.
The number one way I use shift reg is in single loop while loop just to store a value for later use.
__________________
Omar
Reply With Quote
  #6   Spotlight this post!  
Unread 01-02-2012, 08:51
zaphodp.jensen zaphodp.jensen is offline
Alumni and Mentor of 3130
AKA: Pierce Jensen
FRC #3130 (East Ridge Robotics Ominous Raptors (E.R.R.O.R.'s))
Team Role: Mentor
 
Join Date: Oct 2009
Rookie Year: 2009
Location: Minnesota
Posts: 76
zaphodp.jensen is a jewel in the roughzaphodp.jensen is a jewel in the roughzaphodp.jensen is a jewel in the rough
Re: Difference between Shift Register and Feedback Node

Simply, shift registers are just a way to pass a value from one iteration of a loop to the next iteration of the loop. They require a "host loop" that they connect within.

Loop iterations (0 is the initial value passed into the shift register)
0 1 2 3 4 5 6 7
Output (This looks weird, but due to the design of the shift register, the output comes before the input, left to right)
0 0 0 1 2 2 3 0
Input
0 1 2 2 3 0 7
Final output 7

A feedback node is basically a shift register without the loop. The shift register takes and delays the incoming signal one iteration of the vi. This would be used in Teleop, where you can't have loops.

VI iterations
0 1 2 3 4 5 6 7
Input
0 0 1 2 2 3 0
Output
0 0 0 1 2 2 3 0

Last edited by zaphodp.jensen : 01-02-2012 at 09:00. Reason: Added more information.
Reply With Quote
  #7   Spotlight this post!  
Unread 01-02-2012, 16:33
MotorHead's Avatar
MotorHead MotorHead is offline
Programming Mentor
AKA: Jeff Beltramo
FRC #1922 (OZ-Ram)
Team Role: Coach
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Concord, NH
Posts: 68
MotorHead is a splendid one to beholdMotorHead is a splendid one to beholdMotorHead is a splendid one to beholdMotorHead is a splendid one to beholdMotorHead is a splendid one to beholdMotorHead is a splendid one to beholdMotorHead is a splendid one to behold
Re: Difference between Shift Register and Feedback Node

Quote:
Originally Posted by Omar View Post
We use shift reg all the time in teleop.
The number one way I use shift reg is in single loop while loop just to store a value for later use.
Could you explain more about this? Post a code example perhaps. I was under the impression as well that you could not do this since the shift register involved a loop and you didn't want the loop tying up telop. In the past, I have written information to a Global Variable and let a loop inside of Periodic Task access the value.
__________________
Jeff Beltramo
Team #1922
Concord, New Hampshire

Reply With Quote
  #8   Spotlight this post!  
Unread 01-02-2012, 16:50
Thad House Thad House is offline
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,105
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
Re: Difference between Shift Register and Feedback Node

Our team uses while loops with shift registers to run all of our inputs and outputs. Inside each loop is a case structure with an enum for 3 modes, which are init, run and end. All the code that would normally be placed in the begin VI is placed in the init case, and then that case is run in begin. In run is all of our code that is used at runtime. In end it the code that is normally located in finish. This shift registers are used to transfer the references between the 3 states. This means that we do not need to use refnums which saves some resources.
Attached Files
File Type: zip Drive Motors.zip (9.9 KB, 46 views)
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
Reply With Quote
  #9   Spotlight this post!  
Unread 01-02-2012, 17:48
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,579
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Difference between Shift Register and Feedback Node

Quote:
Originally Posted by MotorHead View Post
Could you explain more about this? Post a code example perhaps. I was under the impression as well that you could not do this since the shift register involved a loop and you didn't want the loop tying up telop. In the past, I have written information to a Global Variable and let a loop inside of Periodic Task access the value.
The trick is that the stop of the while loop is wired to a true constant, so that the loop only runs once.
Reply With Quote
  #10   Spotlight this post!  
Unread 02-02-2012, 00:25
SuperS_5's Avatar
SuperS_5 SuperS_5 is offline
[Certified LabVIEW Developer]
FRC #1219
 
Join Date: Dec 2010
Rookie Year: 2010
Location: Canada
Posts: 140
SuperS_5 will become famous soon enoughSuperS_5 will become famous soon enough
Re: Difference between Shift Register and Feedback Node

Quote:
Originally Posted by sst.thad View Post
Inside each loop is a case structure with an enum for 3 modes, which are init, run and end.
Just be careful with Enums like this. This is very common practice BTW, and one method to keep your code isolated. Your action Enum, (Init|work|end) should always be a TypeDefd control. This also presents the possibility of the constant value automatically changing if the typedef is updated. I typically will write the desired value as a BD note, next to the Enum constant.
__________________
Mike B
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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