06-15-2005 10:05 AM
06-15-2005 10:19 AM
10-23-2021 12:26 AM
Hi,
I needed something like this, (triggers that repeat at regular sub iterations through a loop). Thinking in hexadecimal with bits all high, here is an example that produces a true on every 7th and 15th (#F) loop iteration:
10-23-2021 09:46 AM
Tom,
Not sure why you posted to a 16 year old thread - which seemed only partially relevant to what you were demonstrating. Your prerogative.
But I did want to make sure you realized that the code you posted doesn't do what you labeled it as, strictly speaking. Your Boolean outputs from your "Equals?" nodes will actually be TRUE every 8 iterations, and every 16 iterations. As you think of the loop iterator in binary, the LSBs 111b and 1111b will occur every 8 and 16 patterns respectively (NOT every 7 and 15!), and they'll be coincident when the 16th pattern occurs.
Below is a snippet that shows one way to get either set of behaviors, demonstrating the distinction, since I wasn't certain which behavior you actually wanted (every 7th and 15th, or every 16th on the 0x7 and 0xF cases). It's certainly not the only way, but for these sorts of things I use the quotient & remainder (modulo) node, it makes intent clear IMO.
Best regards,
Dave
10-23-2021 10:34 AM - edited 10-23-2021 10:35 AM
Since this thread has been resurrected...
I prefer using a shift register to keep my counts. I got into this habit from doing FPGA, where the loop iterator will max out fairly quickly. On Windows, it is easy to just use the Quotient & Remainder to reset the count. But that is really expensive on an FPGA. So I use a Select function to reset the count instead.
10-23-2021 10:53 AM
Hi Dave,
The good news is, this isn't a 16 year old thread any more! LOL!
To answer your query as to why I posted to such an old thread, these threads are brand new to many, (like me) who searched on this subject recently. With that in mind, I think it is our duty to share kindly with the community when we solve an issue.
Sometimes people might want to clear the count because they want a trigger on a subset of the main loop. If not, then my simple solution isn't appropriate for them.
I definitely should have clarified my statement on the 7th and 15th count which includes the 0th count or first loop iteration.
I'm giving you a kudos for that one Dave!
Blessings,
Tom
10-25-2021 05:21 AM
@John Rich wrote:
While you can't reset the output of the iteration terminal in the while loop ...
Of course you can reset the iterator.
Stop the loop. Restart it. Note that the iterator is reset. 😎
Of course utilizing this results in rather silly code, it is a fact. Usually this results in questions like: " How can I keep my count if my loop stopped".