LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Outputting sine wave to motor -- While loop placement?

I'm having trouble creating a basic Labview program to drive a motor with a sine wave. I'd like to output one sine wave at a time to my motor and look at the response to eventually get a Bode plot. I'm using the Sine waveform VI and I've got a PXI-7358 controller card.

 

I'm having trouble figuring out what goes in the while loop. I'd like to output, for example, a 10Hz sine wave to my motor. But when I create a VI as shown below (& attached), my output waveform frequency is nowhere near my input frequency. When I type 10Hz I get no movement out. At 10.01 Hz input the motor oscillates at a few Hz, and at 10.1Hz input the motor oscillates wildly. I don't think it's a problem with my motor or my PID settings, because even when I eliminate the motor commands altogether (second figure below), I get the same unpredictable relation between the frequency I type in and the Waveform graph.

 

It seems that the output waveform depends on some sort of difference between the while loop execution rate and the PXI-7358 command generation rate. It seems to me that the Sine Waveform.vi should be outside the while loop, but in that case the Load Position.flx only seems to grab one position. Is there a good way to have direct control over output frequency of the sine wave?

 

block_diagram.JPGblock_diagram2.JPG

Download All
0 Kudos
Message 1 of 5
(4,655 Views)
0 Kudos
Message 2 of 5
(4,637 Views)

Please consider this to still be an unanswered question. The "duplicate" post is old.

 

Any help would be appreciated. Thanks.

0 Kudos
Message 3 of 5
(4,606 Views)
The other post is not 'old'. Keep everything to the original. As mentioned there, the while loop with just the sine wave generation is just fine.
0 Kudos
Message 4 of 5
(4,586 Views)

matthewg,

 

Dennis is right, let’s keep this to one forum since it is the same topic of discussion, and I will address some of the issues with your code there.

Chris_G
Sr Test Engineer
Medtronic, Inc.
0 Kudos
Message 5 of 5
(4,565 Views)