Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Addition of another channel (task) of current generation

Hello all!

 

I'm new for C# and also for measurement studio. Now I have a task to implement the current (frequency signal) generation with 2 channels.

 

I found this example in my computer C:\Documents and Settings\All Users\Documenti\National Instruments\NI-DAQ\Examples\DotNET4.5\Analog Out\Generate Current (my OS is Win XP), which allows me generate frequency signal for only one channel.

 

I tried to copy all the components of the first channel and added corresponding classes in mainform.cs, which obviously doesn't work. When I run the program an error message saying "the resource is preseverd for another task" shows out.

 

I'd like to know if it's possible to add another channel under the task, or add another task to implement my goal, and how.

 

Thanks in advance!

 

Chao

Immagine.JPG

0 Kudos
Message 1 of 18
(6,965 Views)

Hi jc,

 

I cant really see what you tried but ofcause you cant put two outputs to the same channel!

 

First of all try to assign another channel to the second task you created. So the output is redirected to another pin.

 

For further help please post your code.

 

greetings,

 

Kevin

0 Kudos
Message 2 of 18
(6,962 Views)

Hey Kevin,

 

Actually I was not putting 2 outputs into the same channel but creating 2 tasks with one channel per each.

 

My Mainform code is in attachment. Thank you.!

 

Chao 

0 Kudos
Message 3 of 18
(6,955 Views)

Sorry the attachment is here

0 Kudos
Message 4 of 18
(6,953 Views)

Hi Jc,

 

At a first look I cant see any problem. But I cant test your program because I dont have a device with AOs present. Please make sure you dont use any outpot channel, smaple timing or other resource more than once.

 

Sorry I cant help you any further.

0 Kudos
Message 5 of 18
(6,936 Views)

OK fine no problem. Anyway thanks for the suggestion!

 

Regards!

0 Kudos
Message 6 of 18
(6,932 Views)

Hi,

you can address multiple channel by using this syntax.

I hope this helps!

Bye,

 

Licia

0 Kudos
Message 7 of 18
(6,930 Views)

Hi Licia,

 

Sorry but do you mean what I shall do is like this?

 

Immagine.JPG

 

With one single physical channel combo box and 2 signal frequency test box like this?

 

But when running it shows that the number of channels I use doesn't match the channels the task contains.

 

I made this query 2 weeks ago and your colleague Massimiliano is responsible for this, but he's not capably to handle the C# thing.

 

So some suggestions? thanks.

 

Chao

0 Kudos
Message 8 of 18
(6,927 Views)

Hi Chao,

you have to modify the example (which is using AnalogSingleChannelWriter class) in order to call AnalogMultiChannelWriter Class.

This way, you can generate data from multiple channels, setting their names in physical channels input.

I hope this helps!

Bye,

 

Licia

0 Kudos
Message 9 of 18
(6,918 Views)

Hi Licia!

 

Thank you very much for the hint. I think that would help, but I got syntax error when I changed AnalogSingleChannelWriter into

 

AnalogMultiChannelWriter, as following:

 

Immagine.JPG

From the source code of AnalogMultiChannelWriter there are brackets after AnalogWaveform<double>, however here it's not correct. Any idea?

 

Thanks and regards!

 

Chao

0 Kudos
Message 10 of 18
(6,913 Views)