Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to properly use AOChannels.CreateFunctionGenerationChannel with a 6025E daq

Hi,
 
What is the best way to use AOChannels.CreateFunctionGenerationChannel to generate a square wave pattern.  Here is what I am attempting to do:
 

myTask =

new Task();

myTask.AOChannels.CreateFunctionGenerationChannel(

"Dev1/ao0", "aoChannel", AOFunctionGenerationType.Square, 45.0, 5.0);

myTask.AOChannels[0].FunctionGenerationSquareDutyCycle = 50.0;

writer =

new AnalogSingleChannelWriter(myTask.Stream);

 An exception with Status Code: -200432 : Create a Channel of an Output type that is supported by the physical channel, or select a physical channel that supports the output type.

 

Thanks,

 

Argneka

0 Kudos
Message 1 of 5
(4,532 Views)
Hi Argneka,
 
The only device that supports CreateFunctionGenerationChannel is NI Elvis 2 and the physical channel has to be "fgen". So if Dev1 is not an NI Elvis 2 device then you will get the exception. If Dev1 is an NI Elvis 2 device, then please change ao0 to fgen and the method should work.
 
Please let us know if you have anymore questions.
 
 
Regards,
Canisius
0 Kudos
Message 2 of 5
(4,519 Views)

Hi,

 

Ok,  then is there an easy way to generate a square wave on one of the 2 Analog output ports on the 6025E?  I need to be able to set freq and duty cycle.

 

Thanks,

 

Alan

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

Hi Argneka,

There are two possible options that may work for you.

1. Use the analog output channels.  This example may help you get started.

Continuous Analog Output on Multiple Channels with C#


2. Use the counters on your board to generate a pulse train.

DAQmx - Retriggerable Pulse Train Generation - LabVIEW - CVI - ANSI C - VB.NET - C#.NET


You can also look at the examples that should have been installed when you installed the NI-DAQmx driver.  They are usually found at:

C:\Documents and Settings\USERNAME\Documents\National Instruments\NI-DAQ\Examples


Hope this helps.

Jared T.
0 Kudos
Message 4 of 5
(4,506 Views)

Thanks,

 

This example is excally what I am looking for.  I am already using the co outputs and these work fine. 

 

Thanks for in great insight,

 

Alan

0 Kudos
Message 5 of 5
(4,501 Views)