07-25-2012 07:26 AM
Hi,
I have an application where i display EMG data and a video (25fps), now i want to show a cursors which scrolls trough my waveform graph when i press the play button. I've made an event case with 40ms time out wired to it now when i press play, i control my x.pos value by adding some values to it every iteration, only i can't get to the speed of real time. My loop doesn't make the 40 ms delay, the maximum is some where around 60 or 70.
I've tried it with an almost empty VI, and then it wors, sort of, i already made an bigger jump instead of an increase of 0.04 i went to an interval of 0.16 and even 0.20, but when i got to the VI where the action happens (writting the new xpos) the thing goes slower!
Has anyone some tips for increasing the speed? So that the cursor can run smoothly...?
Regards,
Thijs
Solved! Go to Solution.
07-25-2012 07:40 AM
Hmm... When in doubt use brute force : get a new PC!
Just kidding of course... I have no magical solution, but there are a few thungs I would try to speed this up, can you show your code that runs too slow (or a screen shot)?
Do you hav a lot of data in you waveform graph? The redraw of the graph could be time consumming, have you tried with a small amount of data?
If you have lots of data you could either decimate or if you don't want to, you could use the panel property "defer panel update".
Just throwing ideas...
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
07-25-2012 07:40 AM
Is this a static graph, or are you trying to update the graph at that rate as well? You said you're also displaying video. How? Is this using, for example, an ActiveX control?
You said you tried this an "almost empty VI". Can you upload that code?
What version of LabVIEW are you using, and what operating system?
07-25-2012 08:17 AM
Hi,
It is a static graph and it now contains: 3 signals of 10 sec data with a sample frequency of 2048 Hz, so it is 20480 x 3 signals single float data points, i have decimated it to 5 times, but that didn't do much...
I am using LV 2011 and working with winxp
I can't upload my files because it's big program already. My structure of my program is the following:
- I referenced all my front panel objects and put all the references in a cluster.
- Every event case i have access to all my references and it's property nodes.
- In the timeout event case i have 40 ms on the time out and i update my xpos every 5th itteration so the jump in time is at 0.2 seconds (200 ms)
- i set the cursor to free (so doesn't have to measure where the data is)
All i want is a smooth scrolling cursor on my waveform graph...
Best regards,
Thijs Boeree
07-25-2012 08:18 AM
Hi again,
The video isn't finished yet, but it will work with an ActiveX control indeed!
07-25-2012 08:21 AM
My first question had a typo: it should be read as: works
[Quote]:
I've tried it with an almost empty VI, and then it works, sort of, i already made a bigger jump instead of an increase of 0.04 i went to an interval of 0.16 and even 0.20, but when i got to the VI where the action happens (writting the new xpos) the thing goes slower!
[/Quote]
07-25-2012 08:23 AM
Hi,
why increment the cursor by a fixed amount?
Maybe this approach will work:
Regards Florian
07-25-2012 08:52 AM
Hi!
It's a good approach, it only count on and on from when start up the vi, i have work around that, but it wil come, i want to reset the time when i push stop or pauze in my VI.
Regards,
Thijs
07-25-2012 08:59 AM
The loop in my example is not supposed to symbolize your main program loop.
The whole example is meant to go inside the part of the program you execute when play is pressed - this way the cursor will be reset on every new play.
To implement cursor pause you can use a shift register to keep track of the time when pause was pressed.
Regards Florian
07-25-2012 09:05 AM
Thanks!
I will figure it out! But it's i a good idea to keep track of the real time and use that as a correction for the slowness of the VI!
Best regards,
Thijs