01-20-2017 10:53 AM
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!
Solved! Go to Solution.
01-20-2017 11:32 AM - edited 01-20-2017 11:33 AM
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.
01-20-2017 12:44 PM
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.
01-20-2017 12:59 PM
Try an exclusive Or
When one input is true, the other will be inverted and vise-versa.
Ben
01-20-2017 01:58 PM
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.
01-20-2017 02:26 PM - edited 01-20-2017 02:26 PM
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.
01-20-2017 05:40 PM
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)
01-20-2017 06:51 PM
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).