LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean Crossing PtByPt in loop for boolean aray

Solved!
Go to solution

I want to use the Boolean Crossing PtByPt VI on an array of booleans.  I want to use it to detect a change (F-T or T-F) and update front panel LEDs. I've created a simple For loop with the Boolean Crossing PtByPt VI inside of it. My concern in the reentracy property of the VI and combined with the fact that the VI remembers state of the input the last time it was called.  Will my attached diagram work?  Will it get tripped up because it will remember the Input value from the previous array's boolean? Not sure how to test this thoroughly.  Thanks!

LabVIEW - Boolean Crossing PtByPt in a loop.png

 

 

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

You will be comparing index 1 to index 0, which sounds like it is not what you want.  I would use a Feedback Node to store the array from the previous call of the VI and then a Not Equals on the arrays.  Then your loop is just the case structure.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 8
(2,062 Views)

Ah, ok. One more curve ball, if you will: I didn't show this in the original VI because I wante to keep it simple for asking the question. The first of the LED outputs needs to be inverted before the Val(sgnl) property input. I am considering ANDing the case input with the loop count=zero.  True would invert the boolean before the Val(sgnl) property and False would not. 

0 Kudos
Message 3 of 8
(2,039 Views)

Try an exclusive Or

 

When one input is true, the other will be inverted and vise-versa.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 8
(2,034 Views)

Also, how do I take care of initial update to front panel (the Val property input)? Upon run, the states of the inputs (Bboolean Data Read) must be sent to the property node, only after that do we care to only update the front panel upon a change.

0 Kudos
Message 5 of 8
(2,022 Views)
Solution
Accepted by EduNI

1. I would use an In Place Element Structure to invert the first bit.

2. Use a First Call? and an OR to force sending the values on the first call of the VI.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 8
(2,015 Views)

I've marked the above as the solution but I have a followup question. I want to put the code from your last post in a sub VI, with the Boolean Ctl Array and the Boolean Data Read being passed in, so I can use in different parts of the LV code, but have a concern about the behavior of the First Call? vi.  The help states "Reentrant VIs have an instance per data space. Therefore, a shared reentrant VI returns TRUE for each data space instance the first time its top-level caller calls it." This sounds like it should work but have two questions:

1. Does it matter the Call Settings? (i.e. Load with callers, Reload for each call, Load and retain on first call)

2. Does it matter which Reentrancy mode I use? (i.e. Shared clone reentrant execution, Preallocated clone reentrant execution)

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

In this case, you want the Preallocated Clone reentrancy.  Here is the beginning of a blog series on Maintaining State that will help explain why (there are 5 parts to that series).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 8
(1,984 Views)