07-03-2012 01:00 PM
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!
Solved! Go to Solution.
07-03-2012 01:02 PM - edited 07-03-2012 01:05 PM
*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.
07-03-2012 04:21 PM
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.
07-03-2012 06:48 PM - edited 07-03-2012 07:05 PM
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.
07-03-2012 07:03 PM
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.
07-03-2012 07:10 PM - edited 07-03-2012 07:11 PM
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) 😄
07-03-2012 07:24 PM - edited 07-03-2012 07:31 PM
@altenbach Mine's better.
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.
07-03-2012 07:46 PM
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.
07-05-2012 12:36 PM
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!
07-05-2012 01:21 PM - edited 07-05-2012 02:08 PM
Here's a significantly simplified version using events.
This will make the code more maintainable in the future. Modify as needed. 😄