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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with distortion with DAQ Generating Sine wave

Hello,

 

I have a little problem with my VI who is made for driving a biphased stepper motor:

 

When I change dynamically the output frequency of my DAQ Generaor, I have some weird effect (see picture). It happend progressivelly like this :

 

(the start frequency doesn't matter)

 

95Hz - nothing

95-100Hz progressivelly grow

100Hz :

 

Capture1.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

100-105 Hz degressive

105Hz - nothing

 

So I generate 2 phases with a rate of 1M and 100k for sampling. All other stuff are set with the same settings.

My device is an NI USB-6356 (1.25MS/s/chanel)

 

I have tried to set all things at 100k but when I do that my motor won't turn.

 

Does anyone know why it does this ?

 

Thank you in advance 😉

0 Kudos
Message 1 of 9
(3,001 Views)

I assume you are talking about the phase discontinuity. I would be suspicious of the Express VIs you are using. 

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 9
(2,972 Views)

Hello Mike,

 

I use 2 simulate signal setting in sine : see Capture2.png

 

and both DAQ Gen and Acq : Capture3.png / Capture4.png

Download All
0 Kudos
Message 3 of 9
(2,962 Views)

You need to write more samples.

If you're only writing 100k samples into the buffer and sampling at 1MS/s, you have 0.1 seconds of sample.

This is only good for frequencies which fit an integer number of cycles into 0.1 seconds.

You'll be good at each 10 Hz increment. You'll have discontinuities in between.

 

0 Kudos
Message 4 of 9
(2,938 Views)

Hi Taki,

 

So I'm blocked .. because with a number of samples superior to 100k it's too slow and my VI doesn't work.

 

So thanks you guys 🙂

0 Kudos
Message 5 of 9
(2,931 Views)

What's too slow?

How are you running this?

What frequencies are you trying to work with?

For 100 Hz, you'll be fine with 0.1 seconds of sample. (Even 0.01 seconds of sample would work)

For 95 Hz, you need to fit 95 cycles in a second so you need 0.0105 seconds of sample.(or some integer multiple)

For 105 Hz, you'll need .0095 seconds of sample or some integer mulitple to avoid the discontinuity.

 

If you change frequency, you'll also need to change the number of samples in your buffer or change your sample rate.

0 Kudos
Message 6 of 9
(2,926 Views)

Because when I set the sampes over 100k i have this message : see Capture5.png

 

The VI is on my first post, and it's running in a while loop.

 

I want to be able to work since 1Hz to 10kHz.

 

And if I set the rate lower, my motor won't turn ..

 

P.S I haven't any probleme with discontinuity when I start at any value (95 , 100 105 Hz). The problem appear if I change theses values during the run of the VI.

0 Kudos
Message 7 of 9
(2,922 Views)

Ah. I didn't notice that the Express VI calculates an integer number of cycles so it takes care of the initial configuration on first run.

Looks like it isn't doing it properly on subsequent runs.

Your posted VI didn't include the while loop so I got a little confused.

 

I think you'll have to break away from the Express VI or find a way to force it to reinitialize.

0 Kudos
Message 8 of 9
(2,915 Views)

This little VI is take in my Main VI. so I have built the loop in the main VI.

 

I will look for this modification

0 Kudos
Message 9 of 9
(2,904 Views)