LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate single sine pulse waveform

Hi Jason
using previously named vi -Function Waveform Generation- set Fs=1K; #s=200, duty cycle 50 frequency =5
check that stop button is enabled or change with a boolean on BDso Continous loop only run once!!
Thus you will get just one cycle !!
Amend Fs, sampling and frequecny to suit requirement.

xseadog
0 Kudos
Message 11 of 26
(2,322 Views)

Jason,

Either remove the While loop or run it for one iteration like xseadog has suggested

0 Kudos
Message 12 of 26
(2,320 Views)
Hi,
 
Thank you very much. I will try.
 
Best wishes. Chan
0 Kudos
Message 13 of 26
(2,315 Views)

Hi,

I have taken out the loop. I can run the program and change the amplitude but i have some problems:

1. When i change the frequency, the frequency of the waveform generated doesn't change.
2. The waveform generated is not smooth. (try to run the program few times)

I have attached the program. Please help me to solve the problem.

Best wishes. Chan

0 Kudos
Message 14 of 26
(2,307 Views)

Jason,

I have modified the Cont Gen Voltage Wfm-Int Clk-Non Regeneration.vi  example to do what I think you are trying to do.  I am just setting the sampling rate very high to guarantee a nice waveform and to output only one cycle, I am dividing the sampling rate by the desired frequency to output that number of points.  Give this a shot.  It is done in LV 8.  In case you do not have LV 8, I have also attached a jpg of the block diagram and front panel.  I hope this works out for you.

Regards,

Lon

Download All
Message 15 of 26
(2,281 Views)

Hi Irallen,

The vi you sent me is usefull and this is the vi i want. Thanks. I am using PCI 6120. I still have some problem:

1. I try to generate the waveform until 20 kHz. When i try with 1 kHz and 2 kHz, the waveform is good. I can't do it with 3 kHz because error 200693 occur. So, this is my first problem.

2. My second problem is that, when i try to generate the waveform more than 4 kHz, i didn't get a symetry waveform. I attach it here.  

Please help me to solve these two problem with the vi you sent earlier. Thank you very much for your help.

Best wishes. Jason

 

0 Kudos
Message 16 of 26
(2,274 Views)
Hi Jason,

Regarding the error you are getting, we may want to set the buffer size (samples per channel set in the DAQmx Timing.vi) explicitly.  Otherwise the driver picks it's own buffer size to what it thinks is appropriate, leading to this error (when the buffer size multiplied by the number of channels you are outputting is not even).  If we know you are only outputting from 1 channel, we may be able to fix this by wiring the exact number of samples you are generating in the Basic Function generator VI into the Samples Per Channel input terminal on the DAQmx Timing.vi.  I have attached a picture that shows you where to wire this in your VI.  The new wire I added is highlighted in green.

To address the symmetry of your output: from your picture, it looks to me that you are getting the right waveform, except with a +3 Volt offset.  Are you grounding your scope and transmitter to any of the AO GND pins?

Thaison V
0 Kudos
Message 17 of 26
(2,240 Views)
Hi,
 
Thank you very much. I have modify the vi. base on the suggestion (add one more wire). This solve one of the problem. I will tell you in detail.
 
Problem Solve
1. Before modify, i cannot generate 1 cycle sine waveform below the frequency of 1000Hz. After modify, i can generate 1 cycle sine waveform below 1000Hz. Thanks.
 
Still have Problem (After modify)
1. I still cannot generate waveform with frequency of 700Hz, 3000Hz or 7000 Hz because error 200692 occur. The modification of the vi still can solve this problem.
2. Regarding the offset of the waveform, i didn't ground the transmitter to AO GRD. The waveform generated below 1000Hz are not offset but, the waveform generated above 1000 Hz are offset. I don't know what is the problem.
 
Thank you.
Best wishes. Chan (student)
0 Kudos
Message 18 of 26
(2,230 Views)
Hi Chan,

The errors you are getting (-200692 and -200693) are both due to the fact that if you take the value you are wiring into the "samples per channel" terminal on the DAQmx Timing.vi (or in the case of the -200692, the "samples per channel and multiply it by the number of channels you are writing to (which should be one channel from the information I have read), you are getting an odd number.  This is covered in the error descriptions of the two errors you have posted:

"Number of samples per channel to write multiplied by the number of channels in the task cannot be an odd number for this device.

Adjust the number of samples per channel to write or the number of channels in the task so that their product is an integer multiple of two."


If you have set your sample clock rate at 20,000 Hz, and are using a sine wave frequencies like
700, 3000 or 7000 Hz, the number of samples generated is going to be an odd number.  If you look at the block diagram of how the "#s" parameter is being calculated in the VI, you will see that it takes the sample clock rate (20 kHz) and divide it by your sine wave frequency.  20 kHz divded by 700, 3000, or 7000 Hz is not an even number.  There are two ways you can approach this:

1.  You may need to tinker with your sample clock rate so that the ratio between the sample clock rate and your sine wave frequency is an even number.

2.  You may need to tinker with how you are determining the number of samples to generate.  As of now, the VI is simply dividing your sample clock rate by the sine wave frequency to get this number, so you may need to figure out how to calculate the right number of samples while still having an even number.

Again, regarding the symmetry of your waveform: it may look fine when you have your rate down below 1 kHz, but if you are not grounding your transmitter to the AO GND pin, there is no way for us to guarantee that the signall will not have an offset like you are seeing.  The analog output of the board is relative to the AO GND pin, so if you are not utilizing this pin, your measurements may have an offset.

Thaison V
0 Kudos
Message 19 of 26
(2,216 Views)

Hi,

Thanks. Regarding the waveform offset, i do ground the wire to AO GRD. 

Transmitter:

Cable positif to AO 0

Cable negatif to AO GRD 

How to solve this problem. Thanks.

Best wishes. Chan

0 Kudos
Message 20 of 26
(2,211 Views)