11-01-2013 08:15 AM
Hello guys,
I'm trying to create a simple VI for generating two square analog outputs with USB 6009. Each output powers a LED and it is necessary that only one LED shines at the time - so when Out0 is active, Out1 is zero and the other way around.
To start, I created a VI in which the outputs are switched manually by Boolean and that works fine (square signal v1.vi).
But I need the outputs to be switched automatically after given amount of time (I don't need high frequencies, just about 1 Hz). To do so, I modified "square signal v1.vi" into "square signal v2.vi" and put Case Structures into another While Loop that would be timed by Wait (ms) function. The idea was that the inner loop would switch the outputs at given frequency while the outer loop would ensure continuous execution of the program. But the reality is quite different and my low skills (this is my first VI) let me down. Could you please help me out of this? I appreciate any advice.
To sum it up: The VI should be continuously running program that would generate two dependent signals with adjustable amplitudes and opposite phases (when Out0 is active, Out1 is zero and the other way around.). Signals need to be switched automatically at given frequency.
Solved! Go to Solution.
11-01-2013 08:25 AM
The output DAQ assistants aren't going to execute until the inside loop is finished (by clicking stop2 boolean).
11-01-2013 09:19 AM - edited 11-01-2013 09:39 AM
there are plenty of generate analog output examples that come shipped with LabVIEW 'ni example finder' for you to look at.....
this VI will toggle between the two analog data controls, toggle rate will depend on the constant given (500). you can input this 1D dbl array into your Daq multichannel
11-01-2013 04:30 PM
Here is a simple flip-flop -- while the While loop runs, the Boolean line connected to Digital Output changes from True to False to True ... with the timing determined by the times you put in the Waits (note that you can independently have different times for the True = On and False = Off cases). Of course, the signal (shown as "Digital Output") lives "inside" this loop -- you would need to put the DAQmx Write Digital Boolean 1Line 1Point VI inside the loop, or come up with a way (such as a Queue) to get the data from inside to outside.
11-06-2013 02:55 AM
Hi guys:)
Thank you so much apok and Bob! Later, I wanted to modify my VI so the outputs (True x False) have adjustable durations, in an exact way Bob suggested. So I took both of your ideas and put them together. The final VI has the ability to adjust amplitudes of the pulses as well as their durations.
,