LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timer timing.

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 ?

0 Kudos
Message 1 of 6
(3,405 Views)

What have you tried so far?

 

 

0 Kudos
Message 2 of 6
(3,401 Views)

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.

ture.PNG 

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.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 6
(3,395 Views)

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.

0 Kudos
Message 4 of 6
(3,379 Views)

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

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 6
(3,369 Views)

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. 

aputman
0 Kudos
Message 6 of 6
(3,348 Views)