LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

ReadCounterScalar Timeout error

Solved!
Go to solution

I am using DAQmxReadCounterScalarF64 function I have my timeout set to 0.002 sec.  I am running this function and collecting data at 100Hz.  While looking at the collected data I seen inconsistency in the Frequency.  I used NI I/O Trace to find out what was going on.  The following is what I found. 

 

DAQmxReadCounterScalarF64 (0x6DED5130, 0.002, 0, NULL)     Call Duration 00:00:00.076    Status: -200474 (0xFFFCF0E6)

 

As you can see the call lasted 0.076 sec.  This is a longer time than the 0.01 sec that my code runs.  

 

My question is why does this function not timeout in the specified time?

 

My system running the .exe is Win7, DAQmx Device Driver 9.5.5, PCI 6036E.  Code was compiled with CVI 2010 v10.0.1

 

 

0 Kudos
Message 1 of 17
(4,229 Views)

Hello MikeD, 

 

The timing of the 6036E is completely controlled by software.  This means Windows is controlling the timing of your data aquisition.  To increase your data acquisition timing, reduce the amount of processes in your acquisition loop and ensure you are starting your task before you start reading data.

Patrick W.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 17
(4,208 Views)

All of my required task are started at the begining of my program.  If I run the program with a simulated DAQ card the total process time of the loop is 0.002 sec.

 

I have attached my NI Trace results to show that at times the funtion DAQmxReadCounterScalarF64 reads in the proper amount of time while at other times the function hangs up.

 

0 Kudos
Message 3 of 17
(4,198 Views)

MikeD, 

 

Could you please post your code so that i can recreate this on my end?

 

Thanks!

Patrick W.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 17
(4,179 Views)

You should be able to recreate it with the example called Pulse Width located at the following folder: C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Counter\Measure Period or Pulse Width

0 Kudos
Message 5 of 17
(4,170 Views)

Alright, it isn't your code.  I do believe running at 2 ms is too fast for a software-timed device.  Try increasing the timeout to say .05 seconds, and see if you still see a value around .076 ms.  

 

Also, what API are you using?

 

Thanks!

Patrick W.
Applications Engineer
National Instruments
0 Kudos
Message 6 of 17
(4,160 Views)

API NI4882  I am new in this area of my company and coding.  I have been trying to update all of our test stands to Win7.  With that upgrade I also had to change the code that was being used.  Most of our test stands was not using DAQmx.  The stand that I am currently working on was on of those not using DAQmx.  Prior to the upgrade in code it worked just fine.  Unfortunally, there is no one left with the company that woked with the original code to help me understand the difference.

 

 

0 Kudos
Message 7 of 17
(4,156 Views)

Hello Mike, 

 

Before upgrading to Windows 7, what operating system were these test stands running?  The only way I could think to get that kind of accuracy is by using NI Real Time operating system.  

 

For some more information, please see the following links:

http://forums.ni.com/t5/Counter-Timer/counter-timeout-6211/td-p/1953287

http://forums.ni.com/t5/Multifunction-DAQ/Counter-in-PCI-6229-to-count-edges/td-p/765209

 

Hope this helps!

Patrick W.
Applications Engineer
National Instruments
0 Kudos
Message 8 of 17
(4,135 Views)

Previously XP with traditional DAQ.

0 Kudos
Message 9 of 17
(4,132 Views)

Miked, 

 

Perhaps it would help if I knew a bit more about your application.  What are you trying to accomplish with this function, and this program in general?

 

Also, did you try different values for the timeout and seeing if this problem remained?  If so, what was the result of that test?

Patrick W.
Applications Engineer
National Instruments
0 Kudos
Message 10 of 17
(4,114 Views)