LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Strange boolean shift register behavior

Solved!
Go to solution

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,

0 Kudos
Message 1 of 8
(1,673 Views)

Can you save for previous version?

0 Kudos
Message 2 of 8
(1,641 Views)

Open the block diagram, run it in highlight execution (lightbulb) mode and tell me why this is happening.  (It should become very obvious.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 3 of 8
(1,637 Views)
Solution
Accepted by topic author GilMaor

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.

 

altenbach_0-1602688960750.png

 

(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. ;))

 

Message 4 of 8
(1,609 Views)

Did that,

Silly me...

Thanks!

0 Kudos
Message 5 of 8
(1,558 Views)

Silly me...

Thanks!

0 Kudos
Message 6 of 8
(1,557 Views)

@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.

0 Kudos
Message 7 of 8
(1,530 Views)

As altebach suggested I was comparing the last compare result rather than the last button status.

I fixed the code so it will compare the last button status.  

 

0 Kudos
Message 8 of 8
(1,468 Views)