LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

measuring time between samples

I'm working on a program in LabWindows/CVI to read measurements off of a device connected via GPIB.

I'm using the Delay (time) function to control how frequently the device is sampled, however, using a stop watch and measuring a couple hundred times indicates that at a collection rate of 2 Hz (as set by my code and half of what my instrument is capable of transmitting), I'm actually collecting quite a bit slower than that. Is there something obvious that I'm doing that is slowing my program down? I'm admittedly a rookie at this, but I can't seem to find anything, unless outputing my data to a strip chart is a very slow way of plotting.

Any advice would be much appreciated. Thanks.

For reference, I'm trying to connect
to a Keithley model 181 nanovoltmeter, and the problem could lie within the instrument driver files (found on the NI website). I've posted about those issues previously.

I'm running Windows 2K and LabWindows/CVI V. 6.0
Download All
0 Kudos
Message 1 of 3
(3,205 Views)
Hi,

I'm not understanding the situation completely. You are using a delay to collect data at 2Hz, but the program actually executes slower, Is that right?.

Just a couple of questions: How do you determine that the program is running slower?. How long does the instrument take for a reading?.

A great tool to debug this kind of problems is NI-Spy. Open MAX and run NI-Spy on the Tools menu. Start a capture and run the program. NI-Spy will capture all the GPIB calls made by the program, with the timestamp. This allows you to determine where the program might be slowing down.

DiegoF
National Instruments.
0 Kudos
Message 2 of 3
(3,205 Views)
That's exactly my problem.

I know it's running slower because I set the program to collect for, say 300 seconds, and then just do a little math to determine how many datapoints that is (at 2 Hz, 600). Then, I start a stopwatch as soon as I see the first point appear on my strip chart. The program takes something like 500 seconds to complete. So, admittedly, it's not the most precise way of measuring, but it works to a first approximation. I suppose I could put in a call to time() and find out exactly how long it takes, but this works for now.

This is also possibly related to my previous post (ONTEXT_CATEGORY_S=0&UCATEGORY_0=_318_&UCATEGORY_S=0>here) and fixing the problem with the driver may solve this problem too.

According to the manual for the instrument (181 nanovoltmeter) it collects data at a rate of up 4 Hz.

Thanks for your suggestion. I'll try that and see if it does any good.

-John
0 Kudos
Message 3 of 3
(3,205 Views)