01-24-2020 04:01 AM
Hi,
In order to ramp-up the frequency of the square wave powering my stepper motor, I am using a formula node to increment the frequency input for the signal generator vi. This is not working as it says the data types are different. The for loop is outputting a 1D array of doubles and the signal generator requires a double.
Any help or advice would be greatly appreciated.
Ciaran
01-24-2020 04:05 AM - edited 01-24-2020 04:06 AM
Hi Ciaran,
@C_Mongey wrote:
In order to ramp-up the frequency of the square wave powering my stepper motor, I am using a formula node to increment the frequency input for the signal generator vi. This is not working as it says the data types are different. The for loop is outputting a 1D array of doubles and the signal generator requires a double.
The generation of that array is working nicely. (Why do you need a formula node just to add 1? There is a "+1" function!)
Why do you convert the array to CDB/complex double?
Why do you even create an array when you need just a scalar DBL value???
01-24-2020 04:14 AM
Hi GerdW,
Thanks for the quick reply!, the CDB conversion was just left in by accident. I dont want to create the array ideally, however i think the program creates the array by default because of the for loop in the code.
Is there a simple conversion to output the scalar double from the for loop ?
Ciaran
01-24-2020 04:19 AM - edited 01-24-2020 04:32 AM
Hi Ciaran,
@C_Mongey wrote:
the CDB conversion was just left in by accident. I dont want to create the array ideally, however i think the program creates the array by default because of the for loop in the code.
Is there a simple conversion to output the scalar double from the for loop ?
Why do you need that inner FOR loop at all?
The simple conversion is named IndexArray - but again: clean up all that Rube-Goldberg before!
01-24-2020 04:27 AM
Hi GerdW,
I am using the inner FOR loop to increment the frequency at a time controlled rate using the wait vi. This brings the motor up to speed, and the next section of the flat sequence continues to run the motor at the peak frequency set by the FOR loop.
I removed the formula node and tried to increment the frequency output value using the FOR loop iteration number, however this produces the same issues with data-types.
Regards
Ciaran
01-24-2020 04:34 AM
Hi Ciaran,
@C_Mongey wrote:
I am using the inner FOR loop to increment the frequency at a time controlled rate using the wait vi. This brings the motor up to speed, and the next section of the flat sequence continues to run the motor at the peak frequency set by the FOR loop.
Both sentences show some lack of "THINK DATAFLOW!" knowledge!
(Please take the Training resources offered in the header of the LabVIEW board!)
That inner FOR loop does not increment the frequency used in the outer WHILE loop - due to DATAFLOW!
Using a sequence structure indicates you should use a statemachine instead!
01-24-2020 08:20 AM
If you want to use all generated values to control the frequencies then you need to send/control it as part of the loop ...
/Y