03-07-2016 10:54 PM
Hi,
In the attached VI I search for a byte labeled "CC" and build a subarray of length 5 starting at byte CC. I do this search in the 1D array which updates from an external source. The 1D array may contain incomplete data, where the first three bytes I need to build my subarray may appear up at the end of the 1D array and the next two bytes may appear up at the beginning of the next 1D array. But always successively...
If the five bytes are not present in the 1D array, I want to keep whatever I have in "memory" and complete the rest of the array using the next 1D array that updates.
Ultimately, each subarray of 5 bytes will go through another logic to convert them into engineering units and display on the control panel. Since Also, there may be multiple bytes labeled CC in the 1D array, I need to be able to capture each value and not just the last reading.
Thank you for your help.
Solved! Go to Solution.
03-07-2016 11:38 PM - edited 03-08-2016 12:07 AM
If I read that post correctly (I might not have done that) This should help. Even If I Did read that wrong you might get some ideas.
Note: I am showing several memory elements like Shift Registers and Feedback Nodes. And a few output tunnel option; Use Default if unwired, Last Value, Concatinating and conditional. The LabVIEW Help file will give you a lot of knowledge about those right-click options and memory elements. Queues are also (not shown) necessary to keep the processing loop updated with new data! Lots of good info to digest! Have some fun.
EDIT[ Match substring needed to be the first element in the strcat in the second case]
03-08-2016 12:09 AM - edited 03-08-2016 12:11 AM
03-08-2016 05:23 AM - edited 03-08-2016 05:24 AM
Jeff, what is up with that last case structure. Don't you realize it will always be TRUE?
Anyways, here is an alternative to Jeff's inner loop using the array instread of changing it to a string.
03-09-2016 08:37 AM
Hi,
I made progress with the examples you showed me and thank you for your help. Now I am struggling with one thing: I want to display all values (and it is doing that), but I want the last value to remain and not continue loop through all possible values. If I update Array 3, I still want the last update to remain on Array.
Any idea how I can do that?
Thanks!
03-09-2016 01:35 PM
Any ideas?
03-09-2016 03:21 PM
Got it to work.
Thanks to all who helped.
03-11-2016 05:43 PM
Hi Jeff and Crossrulz,
I am struggling to understand the logic you have going to the conditional terminal (the NOR gate), can you elaborate on the purpose of that?
Thanks!
03-11-2016 06:08 PM
We only want to include a value if the CC was actually found and there were still 5 bytes to get.
1. If CC was not found, the Search 1D Array returns -1. After the adding of 1, we will have a 0. If it equals 0, do not include.
2. If CC was found, but there were not enough bytes left, then the size of the subarray would be less than 5. But we don't want to include that since we need the full message.
So if either of those two conditions happened, we do not want to include them. So the NOR (Not OR) will become a TRUE only when both of those conditions are FALSE. The loop also stops when either of those conditions are met (conditional is set to Continue While TRUE).
03-15-2016 10:28 AM
Makes sense. Thank you Crossrulz.