Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

call 2 methods concurrently

Hello all!

 

Again I got problem of multichannel siganl generation with NI. This time, I shall generate 2 frequency siganls and 2 current siganls (frequency =0)

 

with all 4 channels of NI 9265. I'm stuck in the place where the generated siganl are written in the buffer. My code is like this:

 

Immagine.JPG

I shall use the 2 methods of writer, WriteWaveform and WriteSingleSample, to write the generated frequency signal of 2 channels and current signal of

 

2 channels to buffer. If I just put them in sequence like this, when running, the program detects only the waveform data, showing the error that the

 

channles in the data (2 channels) are less than the channels in the task (4 channels).

 

So I wonder if the solution is to make these 2 method run concurrently. If yes, how could I do that?

 

Thanks in advance.

 

Chao 

 

0 Kudos
Message 1 of 3
(5,303 Views)

Hello!!

 

The problem is probably due to a misconfiguration of the task. Can you post the codes of the task initialization and timing?

You can find useful examples of .net analog output in Daqmx folder (verify if you have installed the example files).

the following document could help you:

http://www.ni.com/white-paper/5489/en/#toc4

 

Maybe the solution posted on the following thread can help you:

http://forums.ni.com/t5/SignalExpress/How-do-I-determine-the-number-to-put-into-quot-value-to-write/...

 

 

0 Kudos
Message 2 of 3
(5,268 Views)

Hi Lamber,

 

Thanks for the reply. Actually after waiting for some time I just gave up this idea to write separately the waveform and DC current amplitude to 4 channels.

 

Instead, I just used one write.waveform for all the 4 channels, setting 2 of them with 0 frequencies just to pretend that they were DC currents. And that

 

works!

 

Anyway after these days I thought this post has long been forgotten, so really appreciate your reply.

 

I attached my FunctionGenerator.cs here showing what I did. Hope it might be helpful for others!

 

Chao

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