LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dt is not working when building waveform from pattern

Hello,

I am trying to learning DAQ and modifying a VI from examples.

 

I wanted to generate an asymmetrical triangle wave on an oscilloscope, so I used "build waveform" from triangle pattern to output the signal.  What I see from wave graph looks fine, but on an oscilloscope the signal does not change its frequency as I vary the frequency ( defined by witdh) in the VI, oscilloscope always shows fix frequency. I checked several options and I believe that  ' dt ' in build waveform function is not working, seems like always default. However I did put same deltaT in triangle pattern and waveform. I think the time information must be wrong when passing data, but I couldn't figure out how.

 

Here's the modified part.

 

Hope one can take a look at this, really appreciated.

Yanan

 

PS: number of samples could change the frequency in oscilloscope which I also don't understand.

modified.PNG

0 Kudos
Message 1 of 9
(4,737 Views)

Hi Yanan,

 

Does the waveform still use the default dt even when directly fed a constant value?

Daniel Parrott
Software Product Marketing - Data Management & LabVIEW
National Instruments
0 Kudos
Message 2 of 9
(4,685 Views)

Hi Daniel,

 

Sorry for the late response. And the case is no matter what I connected to dt, it always uses default.

 

However I think I got an alternative way of doing this which works pretty good. Thanks.

 

Yanan

0 Kudos
Message 3 of 9
(4,654 Views)
How have you configured the task? Did you disable regen mode? You don't show anything prior to the while loop.
0 Kudos
Message 4 of 9
(4,644 Views)

I had attached the test.vi  when posted. The problems is that the dt in whlie loop is kind of conflict with the sample clock set before the while loop. So I set sample rate as needed to produce the dt I want.

 

Yanan

0 Kudos
Message 5 of 9
(4,639 Views)
I'm posting from my phone and you did not answer my question. You can also keep one sample rate and change the frequency of the signal.
0 Kudos
Message 6 of 9
(4,633 Views)

OK.  First the regneration mode was disabled in the first place. Actually I found it not affecting the output, which is a bit weird. 

Second the way I did to generate the waveform is right, it is just inconsistent with what is shown in the oscilloscope. The reason is that the sampling rate of Sample Clock function(In my case governs the signal written to NI borad) is inconsitent with the waveform. 

 

Maybe there is a better way of doing this or there are some mistakes I made in the program, please give some suggestions for improvement.modified.PNG

0 Kudos
Message 7 of 9
(4,620 Views)

Think!  If you are going to take many samples, what would you do?  You would (first) Start acquisition, then (in a loop) you would take samples until it was time to stop, then you would Stop acquisition.  Now do this in code:

Sample Task.png

Notice how the logic matches the code -- Start, loop, Stop, all organized by Data Flow.

 

Now to your question -- you say that dt is not working.  I notice that you are reading 1 sample at a time, although your DAQ device has a clock and can sample many sample per call.  Indeed, if you specify N Samples (and define N), you can get the output directly as a Waveform, and it will be accurate (certainly more accurate than the loop rate governed by LabVIEW running in Windows).

 

Possibly your problem is that you have an Express VI (boo!!) doing writing inside the Acquisition loop.  This means that to acquire the next point, you need to both acquire the current point and write it out (which might be relatively slow, and certainly is not a predictable or reproducible time interval.  You want to do data saving in a parallel loop (and definitely not one point at a time).

 

Bob Schor

 

0 Kudos
Message 8 of 9
(4,604 Views)
Bob,

What question are you trying to answer? The poster is writing, not reading and the write is set for n samples. No acquisition at all.
0 Kudos
Message 9 of 9
(4,593 Views)