I am new to Labview, usually work in the embedded world so please go easy on me. I am working on a motorised x y table that uses Zaber units that have Visa drivers supplied. I can control the movement of the x y units, no problem.
What I am seeking advice on is how to implement a Switch Matrix on the Front Panel. This is a 10 x 10 matrix where the operator will use the mouse to select a position for the x y table to move to. I was thinking that I could use a "matrix" of Radio Buttons which would indicate that that particular x y co-ordinate has been selected. Behind the Radio Button would reside the x and y co-ordinate values.
Is using a Array of Clusters the best way to approach this and pass the x y variables to the block diagram. And if so, can someone point me in the right direction? I have searched through examples etc and couldn't find anything that related to my particular request. Having a Case structure with 100 possiblities seems cumbersome so I don't think I should go down that path.
Solved! Go to Solution.
Try a 2D array of boolean. Use a rectangular LED (adjust size to square) and change it to a control. You will need to do some scanning of the array to find the element clicked and to clear the previous element.
The LED array will work fine, but I need to have the X,Y co-ordinates to go with it. I have tried a 1d Array of Clusters and can run a VI okay but when I have a 2D Array of Clusters the Wire inside the for loop is broken. VI showing both 1D and 2D Arrays is attached.
So I need help with unbundling a 2D array of clusters.
The reason your VI is broken is that the autoindexing by the for loop changes the 2D array from Array 5 to a 1D array inside the loop. You need to index again to get to the cluster. Do you have the Context Help window on? If so moving the cursor over the broken wire will show the problem. Also clicking on the broken Run arrow will pop up a dialog listing and showing all the errors in the VI.
Here is an example based on the array I showed earlier. I put comments on the front panel and the block diagram. The two keys to this method are (1) separating the control from the indicator logically on the block diagram while making them appaer visually as one on the front panel and (2) converting the 2D array of booleans to 1D arrays and converting the 1D arrays to numerics. The first row with a non-zero value is the one which had the button pressed. The row index is just "i" while the numeric value is 2^^j where j is the column index. I could have used Logarithm Base 2 to find the index but chose a simple lookup.
" Do you have the Context Help window on? If so moving the cursor over the broken wire will show the problem. Also clicking on the broken Run arrow will pop up a dialog listing and showing all the errors in the VI."
Yep, context help on, cursor over broken wire only shows the For Loop and no errors. It does show an error when on the Broken Run Arrow but not very descriptive.
Thanks for your suggestion Lynn, I think I can work with it, I might have the indicator stay on so the operator knows which segments have been used.
The cursor has to be the wiring tool to show the error for broken wires. If you have automatic tool selection on, I am not sure what it shows. I started using LV long before the automatic tool selection was available and have never learned to use or like it.
If you want the indicator to accumulate the used cells, you will need to add a shift register for Array 2 and OR in the new data each time a button is pushed.