I have a very strange situation where A shift register changes a boolean value with no apparent reason.
I have a very simple code should operate only if a switch has changes its value.
For some reason the value in the shift register is changing and I can not figure out why.
I have attached a simplified code with an on/off switch a loop with a shift register and a boolean indicator.
Solved! Go to Solution.
Open the block diagram, run it in highlight execution (lightbulb) mode and tell me why this is happening. (It should become very obvious.)
You want to compare with the previous switch value, not with the previous comparison result, so wire the switch instead of the result to the shift register on the right. Wire only the LED to the comparison result.
While there are also tools to detect changes (example), I typically just used a feedback node.
(Note that you can replace the "not equal" with "greater than" or "less than" to detect FALSE->TRUE and TRUE->FALSE transitions resp. You can even use "equal" to detect if the value is unchanged. ;))
Did what? And why is this reply marked as the solution? I'm assuming that you are referring to altenbach's reply. If so then you should mark his response as the solution. It's also nice to give kudos.