12-01-2020 06:57 AM
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
Solved! Go to Solution.
12-06-2020 12:04 PM
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.
12-07-2020 01:09 AM
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.
12-26-2020 12:01 PM
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?
01-05-2021 04:55 AM
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.