07-11-2025 01:19 PM - edited 07-11-2025 01:40 PM
Hello,
If I have a state machine that's running a portion of code that uses shift registers that change with each iteration, when the state machine moves to a different loop, then returns to the loop with the shift registers, will they maintain their latest know value, or be reset? There is no code that would programmatically reset them.
With the shift registers on the outside while loop, I would guess that they maintain the latest value while the state machine runs in the internal case structure.
Thanks!
07-11-2025 03:22 PM
You need to attach a simplified version of your code.
We cannot tell what vague terms mean (loop, different loop, outside, internal, change, ...)
It is all in the dataflow and if the shift register wire goes through a case or event structure, make sure to wire it across all cases.
If you are unsure, a small test program would probably answer all your questions! Have you tried?
07-11-2025 03:35 PM
Okay, thanks.
07-13-2025 10:39 AM
When you say "State Machine", I assume you mean a While (or possibly For) loop surrounding a Case Structure, with Shift Registers on the Loop structure. When you finish any of the While "cases" and "loop" to the next State, the (left) Shift Register values are updated.
If the Case itself contains a While Loop with Shift Registers (I'm not sure I've done that, myself), it won't affect the "outer" Shift Registers unless the "inner" loop wires itself to one of the "outer" registers on exit. [I think -- hard to visualize such a case ...]
Bob Schor
07-17-2025 12:03 PM
Without seeing your code all I can say is you must pass a wire through all cases to connect the shift register.input and output