06-21-2011 07:13 PM
Hello,
I am running two devices with sending two AO signals (sine wave) out simultanously in my code. I need to duty cycle my signals. in other words, I want to turn ON and OFF the devices continously.In order to do that, I am using a square wave generator with 50% duty cycle. The devices should be running when the square wave has positive values and should be OFF when it is negative.
The code almost does that, but it does not seem to be as fast as it is supposed to, based on the square wave's frequency. I was wondering if anyone can help me with this problem. In addition, I am not sure if this is the best method to do that, please let me know if there is a better way. I also attached the VI .
Thanks,
Pooya
Solved! Go to Solution.
06-22-2011 01:03 AM
What NI device you are using for generation?
1) This basically occurs because of the llimitations of the NI device that you are using. The update rate may not be as fast as you are expecting it to be. In other words the rise time and the fall time may be in terms of microseconds, while what you are looking for is a square wave generation (which generally has rise time and fall time in nanoseconds). It also depends on the frequency of the square wave you are generating.
2) The better thing is that you can use a counter output (if at all available on your NI device) for pulse generation. You can vary the duty cycle of the pulse. But the thing is that the counter produces TTL amplitude levels. You can use this only if it is compatible with the instrument specs
Give Kudos if this helps..!!
06-22-2011 09:53 AM
I am using NI-PCI 6071E with BNC 2120as an interface. I am not sure if the problem is the hardware limits. Attahced please find the subvis which I used in my main VI.
one of the which has a for loop (duty_cycle.vi) works just fine and the other one (duty_cycle(new).vi), which is the one I am using in my VI, does not. Any thoughts?
06-22-2011 06:20 PM
I figured it out. Instead of controling the AO signals with the square wave and case structure, I just made a square wave from 0 to 1 and multiplied the sqaure wave to AO signals (sine waves). That way, when the amplitude of the square wave is 1, it sends the sine waves out and when it is 0 it sends out 0.
Please just note that all the signals (sine and square) should have the same sampling info.
06-23-2011 12:59 AM
First of all you say that you want to generate a square wave with some duty cycle. And now you are talking about generating the sine wave as the output.
Whats that? Are you serious?
06-23-2011 09:35 AM
Please take a look at my question, on the first line I said I am sending out two AO signals (sine waves) to run two devices. Then I talked about using a square wave to control the ON/OFF period of the sine waves. Creating a square wave with duty cycle was not the problem (I have already had the square wave in my first vi). Using it to control the sine waves was the problem.
Thank you though for taking time and helping me.
Pooya