The problem you are having is that the sampling of the wave is too slow for the speed of the wave.
If you look at 20130124-A0001.bmp you will see it is starting to look like the wave you have in your buffer repeated many times. If you can change the sample rate on your scope to the nsec range, by using timebases in the usec, range and you should see the wave spread out and look even cleaner.
Dear Martyn,
I was working on the problem for nearly a week; some phased progress has been acquired, for the entire waveform is already generated when I set the waveformsize twice of the real length of the sequence generating the wave, but there are still some zero- points are interpolated between the real points, making the while wave looks like the pictures I attached.
Is it an oversampling problem, and how can I avoid these unwelcomed zero-points? From my point of view, I don’t believe that the problem lies in the impropriate time interval because as the code you sent to me:
If the frequency is set 50Hz, according to Shannon sampling theorem, the sampling rate could be just set as 100Hz, which means that a time interval of 0.01 second is enough, while the actual time resolution is much higher than 0.01s, there must be some unwelcomed zero points was interpolated between the useful points generated by the sequence in waveform buffer.
I have done a serial of experiments, the frequency was respectively 50Hz, 100Hz, 1000Hz, and 10000Hz. The results are attached.
Thank you
If you are getting low/zero values out then they are probably in the buffer. Therefore I would suggest you look carefully at the data populating the waveform buffer as I am guessing that when you are reading your file in and populating the buffer some erroneous values are being added.
I have checked and I don't find anything wrong because all the elements are successfully read into the parameter of arbitrarywaveform, and the length of arbitrarywaveform just equals to that of the set sequence.
The AWG uses a phase accumulator to synthesize the output waveform from the samples in the waveform buffer, hence the equation to define phase from frequency. Your buffer contains a waveform with both a positive and negative component defined in 4096 samples, the positive part taking up the first half and the negative part the second half, yet the waveforms in your screen shots are all positive.
The reason for this is that the waveform buffer values are being converted to 16 bit integers as they are passed through to the driver resulting in a 4096 byte buffer in the driver that consists of the first 2048 values of your waveform with zero values between each one to make up the 4096 samples.
When the signal is created by the phase accumulator some of the time you are getting a true value and other times you are getting a zero, the balance is dependent upon the chosen frequency as this will define how the accumulator steps through the buffer. If you chose frequencies at 1024,2048, 4096 I think you would either get a clearer half wave of your signal with a few points at zero, or a zero signal with a few points corresponding to the actual waveform.
To solve this problem you need to ensure that the driver receives an array of bytes so please check the function declaration and the waveform declaration to ensure these are correct. If you are unsure post these.
dear martyn
the problem is fainlly solved with your continuous help, and since I figure you may live in Cambirdge, a special gift is prepared for you which is attached, I hope you would enjoy it.