From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DC and AC at same time

Solved!
Go to solution

Hi all,

 

I use a PXI-6723 and I want to generate two different signals.

AO0:1 with a DC signal

AO1:2 with a rectangle signal

 

The basic program I used is attached.

I tried it, but I get an error message. How can I solve the problem. I used another postage to solve the problem. But that doesn't work.

http://forums.ni.com/t5/LabVIEW/2-channel-sine-wave-generation-and-2-channel-dc-voltage/td-p/149079

 

In a first try I made the DC as a wave form with an offset. But that is not a good solution, because after the task is stopped, the signal should go to zero.

 

Thanks for help.

 

0 Kudos
Message 1 of 7
(4,189 Views)

Some parts are not clear from your explanation. What is the error message? What are the channels? You wrote you want to use

"AO0:1 with a DC signal

AO1:2 with a rectangle signal"

Now you want to generate a DC signal with AO1, or a rectangle one? Maybe this is a mistypo, and you want to use the AO2:3 channels actually?

0 Kudos
Message 2 of 7
(4,176 Views)

Hello Blokk,

 

I try to explain it as good as I can. Yes it was a mistypo.

 

The channels AO 0 and AO1 shall output a DC signal, e.g. 2V and 5V. The other two channels AO2 and AO3 have make a rectangle signal at the same time. The result should be four signals for one test object.

 

The error message is:

Error -200963

Requested Sample Timing Type is not allowed, because there is already another task with analog output channels from the same device configured for a different Sample Timing Type. This is not supported on this device. Change your application so that all the channels from this device are used in one task, set Sample Timing Type to On Demand for all tasks, or consider using two devices for the two tasks.

 

I just have one device.

 

I hope now I gave all data.

 

Regards

 

0 Kudos
Message 3 of 7
(4,171 Views)

Hmm, this example came to my mind: http://www.ni.com/example/25354/en/

But it states that is does not work with NI 672X devices...

I try to think about some alternative option, besides someone might jump in with a solution...

0 Kudos
Message 4 of 7
(4,156 Views)
Solution
Accepted by M.Koki

@M.Koki wrote:

In a first try I made the DC as a wave form with an offset. But that is not a good solution, because after the task is stopped, the signal should go to zero.

 

 


An Analog Output Device does what you tell it to do.  If you say "Be at 5 volts" and then stop the program, it continues to do what you tell it to do, and stays at 5 volts.  If you want the signal to go to zero when you stop the program, then before you stop, set the voltage to 0.

 

The problem you are describing can be restated as "Output four waveforms simultaneously", which is a fairly simple task -- generate the 4-by-N array of points, send it to the DAQ device (4 channels, N samples), and repeat as needed.  The fact that two of the waveforms are constant just makes the computation simpler.

 

Bob Schor

0 Kudos
Message 5 of 7
(4,148 Views)

Hi Bob_Schor,

 

I tried your option. But now I get the error, that the task is still active, although I delete the first task. I don't know why. The error comes, if the while loop starts. I don't see a possibility at the moment.

 

Has enyone else an idea.

 

Thanks.

0 Kudos
Message 6 of 7
(4,109 Views)

Here are four signals, 1000 samples generated at 1KHz, with offsets of 1, 2, 3, and 4.  The first is a 0.4 amplitude square wave with a 50% duty cycle (white), the second an 0.4 amplitude square wave with a 20% duty cycle (red), the third an 0.4 amplitude square wave with 100% duty cycle, making it a constant (green), and the last an 0.2 amplitude square wave with 100% duty cycle (red).  Two "square waves", two "constants".  I did it all with the Function Generator, but you could also have created the "constant" waveforms easily "by hand" and tacked them on to the two waves you generated.

AC + DC.png

 

Bob Schor

0 Kudos
Message 7 of 7
(4,094 Views)