LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Slider Control yields Jumpy Analog output

Solved!
Go to solution

Hi,

 

I've made a simple VI in which I have a slider which I'd like to use to control a single output voltage.  For some reason, the output is quite jerky, not nice and smooth, even though the motion of the slider is smooth.  What am I doing wrong?

 

Thanks for the help!

 

slider_ao.png

0 Kudos
Message 1 of 11
(2,990 Views)

*Deleted*

 

Sorry, I misread the code.

 

Generally though, don't use flat sequences and local variables.

 

Also it looks like your while loop is spinning out of control.

 

A wait in there might help you.  Right now, it's probably the UI calls that are setting your time between iterations.

0 Kudos
Message 2 of 11
(2,989 Views)

Thanks for the reply.  I've tried adding a wait, but no luck.  I guess the jumpiness must be caused by the graphics updates (I'm using an ancient PXI computer on loan from NI).  I tried the example: "Gen Mult Volt Updates - SW Timed.vi" which is essentially the same as my example, only without a slider (data comes from a pre-defined array), and that example works nice and smoothly.  Seems incredible that a single slider graphic could cause so much lagging.

0 Kudos
Message 3 of 11
(2,975 Views)

You are breaking all dataflow and constantly hammering the system with synchronous property nodes. Why do you use value(sgl) properties if there is not even an event structure in sight?

 

Rearchitect using proper dataflow and most problems will probably disappear.

 

0 Kudos
Message 4 of 11
(2,967 Views)
Solution
Accepted by topic author ishmael

There is no need to continuously update the output value, you can use an event structure to only update on change.

 

If you coerce the slider to only allow the increment value multiples you will get less updates when sliding.

 

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 5 of 11
(2,962 Views)

An event structure is useless here, because the loop spins anyway at a regular rate.

 

Make the booleans latch action and eliminate all locals and value property nodes (except one local for the slide)

Eliminate all that other weird and unecessary stuff.

 

I don't have DAQ, so I had to blank out the IO parts. You can easily restore it.

 

Even easier would be to get rid of all the math and extra buttons and locals and show the decrement/increment buttons of the slide digital indicator. Set the increment to 0.2 and you are all set already! (not shown in the attached code) 😄

0 Kudos
Message 6 of 11
(2,958 Views)

@ Mine's better. Smiley WinkSmiley Very Happy

 

You don't need to continuously update therefore event structure will do. Only update value on change.

 

How is the rate regular with just a while loop? The only thing controlling the rate then is how long it takes to send an update to the NI-DAQ.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 7 of 11
(2,952 Views)

That is easily possible. Since I don't have DAQ installed, I couldn't really tell what's going on.

 

Currently posting via phone, i'll look at it later. 

0 Kudos
Message 8 of 11
(2,942 Views)

Thank you both for the excellent rewrites of my VI.

 

@TroyK: You're right, yours is better.  🙂  I tried both of the modified versions and altenbach's still exhibits the jerky output I was seeing originally, while your event-based version results in much smoother output.  Reading your code is also quite educational for me.  Thanks!

0 Kudos
Message 9 of 11
(2,908 Views)

Here's a significantly simplified version using events.

 

  1. A single event case instead of five
  2. two local variables instead of five
  3. no property nodes instead of four.
  4. One instance of AO write instead of four.
  5. One shift registers instead of two.

This will make the code more maintainable in the future. Modify as needed. 😄

 

 

Download All
Message 10 of 11
(2,901 Views)