10-14-2020 03:02 AM
Hello All,
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.
Thanks!
Gil,
Solved! Go to Solution.
10-14-2020 06:37 AM
Can you save for previous version?
10-14-2020 06:43 AM - edited 10-14-2020 06:44 AM
Open the block diagram, run it in highlight execution (lightbulb) mode and tell me why this is happening. (It should become very obvious.)
10-14-2020 10:18 AM - edited 10-16-2020 02:54 PM
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. ;))
10-15-2020 02:53 AM
Did that,
Silly me...
Thanks!
10-15-2020 02:54 AM
Silly me...
Thanks!
10-15-2020 06:09 AM
@GilMaor wrote:
Did that,
Silly me...
Thanks!
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.
10-17-2020 11:03 AM