LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

samples and cylcles per buffer

Hi. I am trying to use Daqmx to generate a sine wave and the use displacement sensors to measure the oscillations of a piezo. The problem that I am having is that the output sine wave stops changing after somewhere around 2kHz. Below 2kHz everything looks good. I am using an oscilloscope to measure the output frequency. At higher frequencies the frequency remains the same for a long period and then changes instead of changing when the code tells it to change. When I measure the Q curve of the piezo I am getting a step ladder instead of a smooth curve. I believe this has something to do with my cycles per buffer and samples per buffer but I am not sure. I have included the vi and the waveform generation vi that I am using. Please let me know what I am doing wrong.
0 Kudos
Message 1 of 4
(3,313 Views)
I can't look at this because your version is too new. However I have tried to code something very similar. The problem I encountered was this: You can only set the sampling frequency to certain values (an integer divided into the clock frequency) and the number of samples per cycle is obviously an integer. So you cannot sweep the frequency with arbitrarily fine increments. indeed figuring out how to sweep it is not trivial as it may involve changing both the number of points per cycle AND the clock divisor.

As a start you should probably decrease the number of points per cycle.

(Note that if you set the sampling rate DAQmx will round to a legal value if necessary. If you need to know the actual sampling rate use a property node to read it.)
0 Kudos
Message 2 of 4
(3,298 Views)
Thanks gwd. I have changed my cycles per buffer to 600 and my samples per buffer to 3000. Basically giving me 50 samples per cycle. Can you tell me how to change the clock divisor?
0 Kudos
Message 3 of 4
(3,274 Views)
Now you're getting to details where it really helps to see the code.

Looking at the Labview examples- the sample frequency might be determined implicitly (through the waveform), explicitly (through a property node setting the sample clock rate) or other ways (property node setting clock divisor). The important thing to keep in mind is- only some values of sample frequency are possible because it needs to be an integer divisor into the internal clock.

So can't really help more...
0 Kudos
Message 4 of 4
(3,258 Views)