LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Comparator realisation: input signal - waveform, threshold - double constant

Solved!
Go to solution

I modified setup (please see the snapshot below).

Acquisition mode is "1 Chan, 1 Sample", so at the output of the DAQmx Read - a single double value.

Actually it must work ... signal and threshold are of same type and dimension.

But LED blinking is completely desynchronized with input signal (sawtooth, amplitude = 4V, frequency = 1Hz): LED blinks much slower than input signal changes.

 

Any ideas ?

 

Thanks

 

Pavel

 

P.S. The trhreshold is 2V.

 

 

 

 

comparator_realisation_problem (2).JPG

0 Kudos
Message 11 of 24
(1,261 Views)

Have you plotted the signal on a waveform chart to compare? Are you sure your signal is coming across as the 1Hz sawtooth and should be triggering the LED like you expect? If noise is the issue, then you can filter the signal.

 

Please include a Snippet of your code, or attach your VIs, so that we can better assist you. Screenshots aren't the right way to share what you're coding.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 12 of 24
(1,256 Views)

Hi Pavel,

 

are you sure you want to set a sample rate of 100kS/s and then read those samples one by one?

Are you really sure what you are doing here???

 

Btw. when your while loop will never stop you don't need to clear the DAQmx task after the loop… 😞

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 13 of 24
(1,248 Views)

Thanks GerdW and James

 

I'm reading your respnces once returning at home.

I'll send my snippet tomorrow.

 

Concerning sample rate ... I've tried with different values to see if there some impact ... 100ks is just last value that I tried.

 

... you don't need to clear the DAQmx task after the loop…

Sure, it's just redundancy of copy/past from my previous setup.

Anyway, thank you for this remark.

 

Best Regards

 

Pavel

0 Kudos
Message 14 of 24
(1,236 Views)

Hello GerdW and James

 

Here is VI.

I've also put small video, that shows the problem:

https://www.youtube.com/watch?v=qztnfe0T_Zk&feature=youtu.be

 

You can see that LED changes to ON at about 11 sec and remains until 21 sec.

So, the duration of ON is about 10sec, whereas from the setup we can see that sawtooth period is 1 sec and threshold is 0V.

How to explain such discrepancy ?

 

Regards

 

Pavel

 

0 Kudos
Message 15 of 24
(1,200 Views)

The problem disappeares when I specify sampling rate on DAC (AI0) to 10'000 or 1'000 (instead of 100'000) it becomes correct ... strange that I missed this issue before.

Also strange that the problem appears with sampling rate 100'000 (according to USB-6343 datasheet, the maximum sampling rate on analog inputs is 500kS/sec)

Regards

0 Kudos
Message 16 of 24
(1,197 Views)

One more observation - sampling is OK (i.e. LED blinks correctly) until sampling rate = 50kS/sec. At 55kS/sec it's already "bad"

0 Kudos
Message 17 of 24
(1,187 Views)

Hi Pavel,

 

could you downconvert your VI to LV2014?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 18 of 24
(1,177 Views)

Hi Pavel,

 

never (never ever!) try to read an input channel one sample at a time, when you have configured a sample rate of more than 100S/s!

 

The solution of your problem was given here!

Best regards,
GerdW


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