From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
05-06-2013 11:45 PM
See if this works.
05-07-2013 12:08 AM - edited 05-07-2013 12:14 AM
Your code makes absolutely no sense.
You really need to explain what you actually want to happen and how it is supposed to function. I am drawing a blank. Sorry. 😉
05-07-2013 01:22 AM
For example, when the user places the switches into CCW, Full Step, Continuous mode the selector case will be case “0”. In case “0” the input sequence for the motor to rotate counter-clock wise at full step is 0011 (wire 1), 1100 (wire 2), 1001 (wire 3), and 0110 (wire 4). These are the numbers I am trying to use the array to transmit to the stepper write VI in order for the motor to turn in the desired direction. This obviously is not working which is why I am seeking advice on the use of arrays. I understand that I have some other issues with my code (I am still learning) but, if you could suggest a better solution for what I am attempting to do starting with the arrays then working from there it would be welcomed.
05-07-2013 03:17 AM - edited 05-07-2013 03:24 AM
Sadly I cannot view your code because I use LV 2010, but I think I have some hints for you about using arrays.
First of all, define constant arrays with your sequences as boolean arrays, instead of double arrays with zeros and ones. This reduces the amount of resources necessary and might be helpful in future implementation of your solution into DAQ.
In order to do so, insert Array Constant, and then place boolean constant inside it. This way you create 1D boolean array. You can drag and drop a border of array to see more elements of it, but as someone noted before, it doesn't mean you set the array size by doing so!
The number you can see next to an array is used to scroll through an array. To be exact, this is the number of the first element you currently see. I assume you want to work with 8-bit arrays, so for the starters leave that number set to 0, and expand the view so you can see 8 boolean values. The full understanding of that number will come with experience.
Set desired values to array ements by setting true or false on each element. You will notice they change color to more solid green, which indicates that these values are added and recognized as array elements - those in more pale colors are NOT array elements and cannot be treated as such.
From that point, in order to use an array value for anything, use "Index Array" block form Array palette. Here you can wire an array, and a number of item you'd like to extract. It outputs the desired array element.
Oh, and when you switch the array type to Boolean array, you might need to change your controls and indicators on the front panel.
Hope this helps!
05-07-2013 07:51 AM
Ok, here's a cleaned up version of your VI that I'm guessing is what you want. I don't have your library, so it might not be totally correct. Some things I did:
VI saved in 2010.