LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time switched output signal USB 6009

Solved!
Go to solution

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.

Download All
0 Kudos
Message 1 of 5
(3,130 Views)

The output DAQ assistants aren't going to execute until the inside loop is finished (by clicking stop2 boolean).

aputman
0 Kudos
Message 2 of 5
(3,127 Views)

there are plenty of generate analog output examples that come shipped with LabVIEW 'ni example finder' for you to look at.....

Example_VI.png

 

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

0 Kudos
Message 3 of 5
(3,111 Views)
Solution
Accepted by topic author MartinCe

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.Flip-flop.png

0 Kudos
Message 4 of 5
(3,080 Views)

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.

pulse signal generator.JPG

,

 

 

0 Kudos
Message 5 of 5
(3,041 Views)