LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic arrays

Hi all,
 
I am controlling a two level stepper motor via  a USB 6009. I created the pulses using software timing by setting an array of elements to change between 0 and 5 V continuously as shown in the attachement. The probelm now is that i want to be able to control the number of degrees that the motor moves by so say 1 degree = 35 elements in the array. How do I do that using dynamic arrays? i'd like to be able to specify the number of degrees and hence the number of elements in the array of values 0 and 5. I am completely new to labView so any ideas or examples will be great.
 
Thank you
 
Myriam
0 Kudos
Message 1 of 4
(2,394 Views)
First, a few suggestions to improve your code:
  • Instead of the case structure use the "Select" function (it's in the "Boolean" palette). All you're doing is selecting one task or another based on a Boolean. In this case the "Select" function is better.
  • Just out of curiosity, how did you create that array constant on the block diagram? Please don't tell me you did it by hand, since it's 1500 elements. Use the built-in signal generation functions. There are numerous functions that work well with DAQ.
  • Don't expect the software timing to work the way you want to. That is non-deterministic, as software timing in the 1 millisecond range is not realistic.
As for your specific question, it sounds like you just want to chop off the array you generate that's the entire signal. For this you just need the "Split Array" function. You feed it the index where you want the split to occur and you get the separate arrays.
0 Kudos
Message 2 of 4
(2,368 Views)
Thank you very much for your prompt answer. I thought the built in signal generation functions require a clock and the USB does not have a clock on it. That is why I am using software timing. If it is still possibel to use the buillt in signal generation functions then where do i get them from on Labview if i want to create a square pulse? and yes i did create them all by hand becuase i didnt know where these functions are and if they would work with USB 6009 without the clock.
 
With the code that I have sent you, the motor moves continuously once the usb is connected. The only way i can stop it is if i unplug the USB.  What i want to be able to do is to be able to conrol the motor so that it stops after a certain number of degrees specified by the user. This is what i wanted the dynamic array for. Another way that i thought of for doing that is using a timed loop to control the motor motion instead. So say it takes 1 sec to move 1 degree then 30 secs to move one degree and use that to control the degree of motion rather than the elements in the array. Would that still work? if not then how can i modify the array to do that? as it moves continuously with 1500 elements so how can i limit when it stops?
 
Sorry if my problem is too complicated but i am new to labview so any help is welcome.
 
Thank you in advnace for your help
 
Myriam
0 Kudos
Message 3 of 4
(2,363 Views)
That's too bad about the USB-6009. As for the signal generation, there's built-in functions for generating a variety of waveforms. The one you want is the "Square Wave". It's in the Analyze->Signal Processing->Signal Generation palette. This will generate a nice pulse train for you by adjusting the number of samples and the frequency.
0 Kudos
Message 4 of 4
(2,342 Views)