Unequal execution times while reading T7 with while-loop | LabJack
 

Unequal execution times while reading T7 with while-loop

2 posts / 0 new
Last post
JaquesDuCoudray
JaquesDuCoudray's picture
Unequal execution times while reading T7 with while-loop

Dear all,

I wrote a small vi to implement a T7 in LabVIEW.
For reading the AINx I utilize LJM_eReadNames.vi in a while loop.
This works pretty well but there are some issues.

Please see attached an extract of my gained data.
Column:
1 - Iteration count
2 - Time total
3 - Time between iteration

The time between the iterations is supposed to be 10 ms (Wait Until Next - LabVIEW).
First I thought my PC power is not sufficient, but that is not the case. It can handle higher frequencies.

What do I wrong?
Is there a better way to assure a (more) precise read of the T7 in LabVIEW?


Another question.
How can I name the columns header from "Untitled" to my chosen name?

Sincerely
Jacques

 

File Attachment: 
LabJack Support
labjack support's picture
2 - Time total

2 - Time total
3 - Time between iteration

What are the units?  ms?

 

The time between the iterations is supposed to be 10 ms (Wait Until Next - LabVIEW).

Use Tables A.1.2 and A.1.4 to estimate how long the hardware communication should take each loop:

https://labjack.com/support/datasheets/t-series/appendix-a-1

For example, if you are doing 4 channels at ResolutionIndex=8 (default c-r resolution for a T7) and Range=10V (default range for a T7 or T7-Pro), the estimated time over USB is about 0.6 + 4*1.1 = 5.0 ms.  If you use ResolutionIndex=1 the estimated time over USB is about 0.6 + 4*0.04 = 0.76 ms.

Try using the C-R Speed Test examples from \Examples\More\Testing.  The addresses example is usually a little faster.  It converts names to addresses before the loop so that does not have to be done every time.  Even the names example, though, should show that T7 communication is not your problem.  I ran both of the above scenarios on my computer with the names speed test.

C-R Speed Test AIN eNames.vi
# AIN Channels = 4
# Iterations = 1000
Range = 10.0
Enable Interval Timing = True

ResIndex=1, Avg 0.47 ms/iteration, Intervals all in 0-2 ms range

ResIndex=8, Avg 5.9 ms/iteration, Intervals mostly 5-7 ms with one or two at 20-40 ms.

So even at ResIndex=8, most of the iterations take 5-7 ms, so if you have a 10 ms loop that is usually taking longer than 10 ms it is likely something else in your loop that taking too much time.  Likely culprits are math, writing to file, and updating the screen (updating graphs and numeric indicators).

You can drop a "Wait Until Next ms Multiple" into the for loop to see what sort of intervals you get with a 10 ms timer in the loop.

 

Is there a better way to assure a (more) precise read of the T7 in LabVIEW?

The summary of the above is that you can do 10 ms command-response loops where almost every iteration is right around 10 ms.  If you want to be sure inputs are scanned every 10 ms (or faster), however, use stream mode:

https://labjack.com/support/datasheets/t-series/communication

 

How can I name the columns header from "Untitled" to my chosen name?

That sounds like a matter of LabVIEW program, not something about the LJM library.  I suggest the NI forums to get general LabVIEW programming help:

https://forums.ni.com/