I created a vi that I expected to work this way:
when the local variable changes the value FAE to FC the Elapsed Time counter actives, the chart is clean and it defines the minimum range by Get Start Time (s) from counter and the maximum range by minimum + a constant. When the counter reaches the time, it changes the local variable's value to FAE and reset the program until the user change again the local variable's value to FC.
But it doesn't work like I imagined. What is my mistake? could someone help me?
To achieve what you described for your application, I would sugest you to change the architecture of your code for a event driven state machine, where each state will acomplish the task you want. So you'll have to states, one for each state of your control value, inside each case event you'll create your code. Taking a look at your code I would suggest you to avoid using flat sequence structure, because you can do it without the sequence structure and avoid the unnecessary use of memory, the same thing fo the local variable, and you don't need to use the timed loop for this (unless you're are going to use determinism or the timing functions of the loop), you can use a simple while loop. Use one state to adjust the scales you want and the other to reset your settngs just like you said.
Here follows the event driven state machine tutorial:
If you need any help doing it we'll be glad to help you.
Hi Thiago, thank you for your advices but my real problem is the x axis. I would like to define programally the minimum range with the start of data acquisition and the end of range displayed with minimum plus a constant, for example 10:00 h. But when I define any value to xscale.minimum the chart becomes crazy. My use of this code is to get a recharge battery graph, when a specific condition happen I will get the voltage of the battery every second for 8 hours then it will resume for previous condition until the specific condition will happen again.
Yes that's true, if you ain't collecting it real time you could use a graph instead. This one doesn't have any problems to scaling.
You are having problems because the way you are building your LabVIEW code is not an ideal way. There are a lot of architectures developed and tested that ensures the correct functionality of your code, this problem of your chart getting crazy is related to the way your code was built, so using a state machine with a state where you programatically changes the range values of your chart/graph will avoid this problem.
If you have any problems just ask.
Thiago, I did a small code using state machine and the same way, the x axis doesn't work properly. Any value attributed to xscale.minimum in property node different from zero becomes the axis crazy. I am considering this as a bug in labVIEW.
I am really thinking to substitute the chart with a graph. I was avoiding to use arrays, but i think this is the unique solution