# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Boolean Crossing PtByPt in loop for boolean aray

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!

Message 1 of 8
(2,108 Views)

## Re: Boolean Crossing PtByPt in loop for boolean aray

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.

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 2 of 8
(2,088 Views)

## Re: Boolean Crossing PtByPt in loop for boolean aray

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.

Message 3 of 8
(2,065 Views)

## Re: Boolean Crossing PtByPt in loop for boolean aray

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
Message 4 of 8
(2,060 Views)

## Re: Boolean Crossing PtByPt in loop for boolean aray

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.

Message 5 of 8
(2,048 Views)
Solution
Accepted by topic author EduNI

## Re: Boolean Crossing PtByPt in loop for boolean aray

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.

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 6 of 8
(2,041 Views)

## Re: Boolean Crossing PtByPt in loop for boolean aray

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)

Message 7 of 8
(2,019 Views)

## Re: Boolean Crossing PtByPt in loop for boolean aray

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

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
(2,010 Views)