LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Breaking graph plotting

Hi,
 
in my application I plot waveforms and sometimes it takes some time, so I would like to have the possibility to break plotting in any moment and get back to "main program" - how can I do this?
Breaking graph plotting is just an example, how can I break some process in LabWindows/CVI (without breaking the whole program)?
 
Regards,
Tomek
0 Kudos
Message 1 of 3
(3,150 Views)
Tomek,

afaik it is not possible to "break graph plotting" itself. here is why:
plotting a graph is usually nested in one function. since this function is provided by CVI, you have no chance to modify the function. within the function, there is no method to interrupt the plotting to compute other things.
in general, if you want to compute things while staying in another function "ProcessSystemEvents()" is the function you have to call in your function. this does not work here because the plot-function is already built without it in it. another way of using functions in parallel is multithreading.
if drawing the plot takes too much time for you, there are several ways to solve this:
a) the larger the graph, the slower the update. make the graph smaller
b) the more points you display the slower the update. reduce the number of points to be displayed.
c) if you do not need to know about the previous plots, you can choose to use canvas instead of a graph. canvas is often much faster than graph since canvas does not need to store data for each plot (for scrolling, cursor, ...).

Norbert B.

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 3
(3,134 Views)

Tomek,

I would add to what Norbert already suggested, that you look for the Programming with Graph Controls section of the online help, and in that topic read the Performance section. There are several trade-offs there that you might be able to take advantage of, if you are trying to reduce plot speed.

Having said that, if plotting is still taking too much time, and you want your program to be doing something else while you plot, then the best solution is for you to create a secondary thread and do your plotting from this other thread. You cannot decide to do this after you have already started plotting, however. You either have to plot the entire array in the secondary thread, or in the main thread.

If multi-threaded programming is new to you, and you would like to learn more about it, I suggest you read the Multithreading in LabWindows/CVI application note in the documentation bookshelf (click Help>>LabWindows/CVI, then click on Application Notes and White Papers, and then click on Multithreading in LabWindows/CVI)

Luis
NI

0 Kudos
Message 3 of 3
(3,115 Views)