Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

WriteSingleSampleSingleLine respond time

Solved!
Go to solution

Hello,

 

I have a question.

I have a NI DAQ USB X 6343.

In Visual Studio (C#) I create a Digital outputchannel on 1 line (PO.28).

This line is used as a trigger, I send a 0 or a 1 to it.

Works all fine.

But....

The software call "WriteSingleSampleSingleLine(true,0/1)" in C# takes about 7 mSec. So the call returns after 7 mSec.

My question is: how quick responds the physical output (P0.28).

Is it immediately after calling "WriteSingleSampleSingleLine" or at the end when the call returns so after 7 mSec.

On a scope i can see that it works fine but not how quick the output responds.

 

Thanks

 

 

0 Kudos
Message 1 of 5
(1,667 Views)

Hello,

 

How exactly you measure that delay? You are attaching scope to the output and you run your code or you have some poop there?

Try to change the state from 0 to 1 and then immediately down to 0 and measure that time.

__________________________________________
The best way to thank, is to give KUDOS
0 Kudos
Message 2 of 5
(1,618 Views)

Thanks for thinking with me.

 

little example:

 

Stopwatch sw = new Stopwatch();
sw.Start();

 

long t1 = sw.ElapsedMilliseconds;

 

digWriter.WriteSingleSampleSingleLine(true, true); ==> output goes to "1"

 

long t2 = sw.ElapsedMilliseconds - t1; <=== t2 is 7 (7 milliseconds)

 

t1 = sw.ElapsedMilliseconds;

 

digWriter.WriteSingleSampleSingleLine(true, false); ==> output goes to "0"

 

t2 = sw.ElapsedMilliseconds - t1; <=== t2 is 7 (7 milliseconds)

 

t1 = sw.ElapsedMilliseconds;

 

digWriter.WriteSingleSampleSingleLine(true, true); ==> output goes to "1"

 

t2 = sw.ElapsedMilliseconds - t1; <=== t2 is 7 (7 milliseconds)


Every call to WriteSingleSampleSingleLine returns after 7 milliseconds


What i see on the scope is that the signal goes to "1" and 7 milliseconds it goes to "0" and again 7 milliseconds later it goes to "1" again.

Looks perfect only, and that is my problem, i dont know when in this 7 milliseconds that the call to WriteSingleSampleSingleLine lasts

the output goes to "1" or "0".

Immediately at the beginning of the call to WriteSingleSampleSingleLine or at the end.
It doesnt matter how many times i send a "1 (true)" or "0 (false)" they all last 7 milliseconds.

 

Why do i want to know this? I have a time critical process and i have to do something in the software
after i set the output using WriteSingleSampleSingleLine to "1". When the output goes immediately to "1"
i can continue in the software otherwise i have to build a delay in it.

 

 

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

Under this command (or method) documentation remark I find the following; This method returns immediately if the output buffer has sufficient space for the samples. Otherwise, the call is blocked until the application generates enough samples to fit the new data into the output buffer. 

 

Maybe there is a problem in buffer?

 

Additionally, if you don't use this sw.ElapsedMilliseconds command do you see same delay with scope?

__________________________________________
The best way to thank, is to give KUDOS
0 Kudos
Message 4 of 5
(1,567 Views)
Solution
Accepted by topic author VeH

Thank you for your reply.

I finally fixed my problem (soooo easy).  I didnt start the task where i created my Aanalog OUT channel.

So at every WriteSingleSample(true, value) the task had to be started, and that took 6 to 7 mSec now it takes less than 1 msec.

Thank you all.

Message 5 of 5
(1,539 Views)