05-14-2015 07:29 PM - edited 05-14-2015 07:31 PM
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.
05-15-2015 03:56 PM
Hi Yanan,
Does the waveform still use the default dt even when directly fed a constant value?
05-17-2015 11:03 AM
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
05-17-2015 11:30 AM
05-17-2015 12:00 PM
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
05-17-2015 12:14 PM
05-17-2015 12:46 PM
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.
05-17-2015 02:46 PM
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:
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
05-17-2015 02:56 PM