LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong value of Duty Cycle in Square Wave generation


Dennis_Knutson a écrit :
Why do you have the DAQmx Write inside a loop? If you set for continuous generation, you would only need to call the wire once.

continious generation ... how to set it in given setup ?

0 Kudos
Message 11 of 16
(1,166 Views)

DAQmxTiming…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 16
(1,160 Views)

Well, I've tried with continuous generation option (please, see the scrrenshot below).

The problem persists.

 

SquareGeneration_DutyCycle_Issue_ContinuousGeneration_not_working.JPG

 

0 Kudos
Message 13 of 16
(1,151 Views)

GerdW a écrit :

Hi Pavel,

 

I don't think this is a good solution!

- Dennis mentioned the problem of calling DAQmxWrite in a loop.

- Creating a waveform of 1000 samples / 1kHz samplerate with a frequency of 1.7Hz gives 1000/1.7=588 samples for one full period. The next "period" in the signal only has 412 samples left, so the duty will fail for the second part of the waveform… Simple math, eh?


In this setup the samplerate isn't 1kHz, but 1.7kHz (Freq. x 1000). So 1000 samples "cover" exactly 1 periode: 1/1700 * 1000 = 1.0/1.7 (the periode of specified frequency). Isn't it ?

0 Kudos
Message 14 of 16
(1,143 Views)

Hi Pavel,

 

In this setup the samplerate isn't 1kHz, but 1.7kHz (Freq. x 1000).

Yes, you're right. I just looked at the "sample info" control…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 15 of 16
(1,131 Views)

So, can you confirm, that solution based on adaptation of the sampling rate to the signal frequency is not so bad ... and probably the only solution for managing fractional frequencies.

I've tried the suggestion proposed by Dennis and supported by you (i.e. specify continuos generation) ... at least as i understood it, but seems that it doesn't arrange affair.

Thanks

0 Kudos
Message 16 of 16
(1,119 Views)