LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timing an event

Hello,

I have a SubVI that executes each time the user clicks on a control.  I want to kick off a timer when they click and keep track of the time with a global variable.  When it reaches some value I define, I want to reset it, then repeat this process the next time a user clicks on something.

 

plan to wire the timer to a global variable that I will use in my main VI to delay the processing of something until the timer reaches the defined value.

 

Conceptually I know what I want to do, but I can't seem to find a primitive that will both time in ms and also allow me to reset it.

 

Another option I thought of was to just always be writing the current time to some variable, and then note it whenever the user clicks and just add x ms onto that amount, but I didn't see an option that let me time in ms resolution with that.

 

Any thoughts?

 

Thank you...

0 Kudos
Message 1 of 7
(2,986 Views)

You're right, well there many ways to solve a problem...

If you want to use a timer, you can find one here...


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 2 of 7
(2,974 Views)

This VI that you describe is obviously part of something larger and you really don't give enough to allow us to give you some concrete ideas. For example:

 

  • When the operator clicks the button to start the timeout, is there other stuff that needs to be happening while the timeout delay is running?
  • Is there just the one button that has a timeout? If there is more than one do they all have the same timeout?
  • If someone clicks the button before the timeout delay expires, what happens? Nothing? The timeout restarts? A hole is torn in the space/time continuuium? 
  • Can the timeout delay be interrupted?
  • What else happens when the timeout expires?

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 3 of 7
(2,943 Views)

1. yes, there are parallel processes running at the same time as the timer is running

2./3. there is only one timer.  The delay is small enough that it would be highly unlikely the user could click on 2 separate controls within the period of the timer, but I can write code to handle that scenario.

4. no interrupts.  Once the timer is running, it runs until it expires.

 

In this case, I have a telnet connection to an FPGA.  The FPGA is constantly streaming the contents of a select set of registers back to LabView.  These address/data pairs are stored within a queue in LabView, and this info is used to update the front panel.

 

When the user clicks on a control, this information flows via the telnet connection back to the FPGA.  However, it takes a finite amount of time after this happens before the data corresponding to that address in the queue is correct.  In other words, the information in the queue for that address is invalid until the next refresh cycle after the control is clicked.  So when a control is clicked, I want to ignore any instructions from a specific address within the queue (i.e. the address of the control that was clicked) until the timer expires.

 

What would be ideal is if you could create an event structure based on the Value Change of a global variable, but it appears LV won't allow that.

 

0 Kudos
Message 4 of 7
(2,910 Views)

In the values change event of the button you can get the Time it was pressed, store it in a shift register and use/reset it as needed.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 7
(2,903 Views)

That's not a bad idea but I have several hundred event structure entries that I would have to modify (as I understand it, anyway...I've not used the time field before but I assume it's specific to each case in the structure - please correct me if I'm wrong).  On the other hand, each of them ultimately calls the same SubVI, so if there was a way I could do this from the SubVI it would save me an enormous amount of work.

0 Kudos
Message 6 of 7
(2,900 Views)

@bmishoe wrote:

That's not a bad idea but I have several hundred event structure entries that I would have to modify (as I understand it, anyway...I've not used the time field before but I assume it's specific to each case in the structure - please correct me if I'm wrong).  On the other hand, each of them ultimately calls the same SubVI, so if there was a way I could do this from the SubVI it would save me an enormous amount of work.


The first option, i dont know when they introduced it, but you can link (r-click the node) right and left sides and autowire in the event structure. This way it's really easy to add the information.

The second option is that you usually have some main cluster with information, add the Time to that one.

The third option is to make an Action engine and store the information.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 7
(2,886 Views)