11-02-2017 09:06 AM
Hello all,
I am new to Lab VIEW, but I have a sequence structure vi project, where in between the sequence I have a timer of 20 seconds wait. How can I make that time while is timing from 0 to 20 seconds do display in front panel ?
11-02-2017 09:18 AM
What have you tried so far?
11-02-2017 09:24 AM - edited 11-02-2017 09:31 AM
To begin with it is very helpful to post your vi so we can see exactly where you are having difficulty.
Also since you are new you should stop using the sequence structure (flat and stacked) now, before you fall into the bad habit of relying on it.
A proper program architecture makes every program run more efficient, easier to debug, and easier to scale or add functions and features.
I have found that a simple state machine architecture works in 99% of the programs I write. In your case it would be very simple to add a "timer state" with an on screen display in between two other states.
But in general I do timers like this: Notice it is also a "Timer" state in a state machine.
DON'T FORGET the "wait mS" vi giving the loop a 10mS delay.
This prevents Windows from using 100% of the CPU to spin that loop as fast as it can.
11-02-2017 09:55 AM
My project is to control a Power Supply with serial commands where I need to ramp up power by 50W every 20 seconds and then hold the upper threshold power for 3 Hr and then ramp down power by 50W every 20 seconds and then close session. After looking around and do a little research the only way I found is to do it is in sequence with VISA write and read and timers in between. Thank you for prompt response.
11-02-2017 10:12 AM - edited 11-02-2017 10:16 AM
Do a little more research.
Thinks about it you have a few discrete states
Setup instruments open VISA session
Ramp up
Wait
Loop to Ramp up until power = upper threshold
Wait
Ramp down
loop to Ramp down until power =0
Safe shutdown close VISA sessions
11-02-2017 11:38 AM
I would suggest to not put long running while loops in your states. And do not use the wait command to set this 20sec delay. Inside the timer/wait state, using whatever timer code you desire, check to see if 20sec has passed since you first entered the Wait state. If not, call the same state again. In that way, you are effectively creating a loop but you can call other states in between or process your UI commands, if necessary.