LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sampling rate drops immensely when I sample once in my default state in a state machine. The old approach sampled many many times in that default state. Help!

Hey everyone,

I noticed that in order to get a good value out of a device I'm reading data from (using a std-mil-1553 bus), I have to take somewhere between 1000 and 10,000 samples and average them.

I originally had a for loop right in the default state of my state machine that took 10,000 samples, and the data was good. But unfortunately, the user had to wait about 4 seconds for the system to respond to his input, as the state machine wouldn't examine changed inputs as long as it was sampling.

So instead, I tried setting it up so that the system would take one sample each time through the state mach
ine, so that the user wouldn't have to wait around for the computer.

Now, it takes samples at less than 1/100th the rate.

What is slowing the system down? Is it the state machine sub-vi's (setting up the queue of events and so forth) or is it all those local variables I added?

It doesn't seem like it should be a CPU intensive process, and I'm running this on a P-III.

Attached program is the one that samples once per default state. I foolishly saved over the old one, but I can easily remake it.

-Dobbs
0 Kudos
Message 1 of 3
(2,588 Views)
Mind you, this isn't a critical function of the program. The device itself puts out the data in a 12 bit format, and the range for voltage and current are 240 volts and 125 amps, respectively.

So, if the current changes by only one bit (least significant) that's still 0.06 amps of current. And since I'm testing with a power supply that can only put out 2 amps, I'm having significant fluctuations. Which, incidentally, is why I'm sampling so much.

However, the data that we'll actually use will be aquired not via the std-mil-1553 bus, but rather with dedicated measuring equipment. This is only to have a rough idea.

-Dobbs
0 Kudos
Message 2 of 3
(2,588 Views)
The 'Get Menu Selection' has a default timeout value of 200 ms. If you reduce this value you should see a huge improvement in performance.

Chris_Mitchell
Product Development Engineer
Certified LabVIEW Architect

0 Kudos
Message 3 of 3
(2,588 Views)