View Single Post
  #2   Spotlight this post!  
Unread 28-12-2014, 11:39
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: reset the shift register?

I can make a couple comments about the code that you attached, but I'm not sure that they will help you solve your problem. If you'd like help writing the code that performs the logic, it would be better to attach more of the code and a more thorough description of what it is trying to accomplish.

First, notice that the enable terminal in your example serves no purpose. By placing the shift register and add inside of a case, you have double guarded the operation. The value going to the enable must always be True, which is equivalent to hiding it again. Or you can possibly remove the case statement, but I can't tell for sure since I can't see enough of your code.

Second, I find it helpful to think about feedback nodes as delaying your input for N cycles of execution. The only purpose for the initializer is for the initial execution. After that, you control their next output by controlling this input. In the code that you showed, this will likely be accomplished by simplifying ... by removing the case statement and using a select statement instead. I suspect that what you may want is something like this ...

Notice that it writes to the feedback node each execution, either a zero or an incremented count. There are many other ways to write this, but first, let's make sure it does what you intended.

Greg McKaskle
Attached Thumbnails
Click image for larger version

Name:	From Clipboard.PNG
Views:	32
Size:	16.2 KB
ID:	17646  
Reply With Quote