08-09-2013 12:23 PM
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.
I 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...
08-09-2013 01:13 PM
You're right, well there many ways to solve a problem...
If you want to use a timer, you can find one here...
08-11-2013 12:27 AM
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:
Mike...
08-12-2013 05:57 AM
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.
08-12-2013 06:14 AM
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
08-12-2013 06:17 AM
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.
08-12-2013 08:13 AM
@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