10-01-2012 10:25 AM
Hello.. I have a VI for my scale, and i need a autopress function, which automatically presses the button in every x minutes i can define it to. How to do that ?
10-01-2012 10:30 AM - edited 10-01-2012 10:34 AM
How about a while loop with an elapsed time function? You can OR the output with a front panel button.
10-01-2012 10:31 AM
You need to be more clear about what you want to do. Are you asking how to simulate a user hitting a button on your front panel or are you asking how to write a LabVIEW application to actually push some physical button?
10-01-2012 10:33 AM
Use the Value or Value(signaling) property in a loop timed to your needs.
You'll need to change the mechanical action to switch instead of latch.
10-01-2012 10:33 AM
@vt92 wrote:
How about a while loop with an elapsed time function? You can OR the output with a front panel button.
This will only update the value. If you wanted to actually do some work as a result of the button press then you you would want to use an event structure and update the value using a property node with value signalling. However, there are better ways than that. A basic state machine would work. You wouldn't even need a button on the front panel.
10-01-2012 10:35 AM
This is what I meant:
10-01-2012 10:43 AM
@vt92 wrote:
This is what I meant:
You don't need the elapsed timer. Simply use the timeout event on the event structure itself. Also, since the OP was asking about doing something repeatedly the "do something" code should be in the loop. Or in a separate task (producer-consumer architecture) and the event code would send a message to the consumer triggering the action.
10-01-2012 10:53 AM
I have uploadet my VI now.. I have i "measurement" button, which gives the measurement and the time in a array. I have to make a measurement in every x minutes or seconds.
10-01-2012 11:02 AM
Do not use two events strtuctures within a single VI. A VI should only have a single event structure. Also, since your code looks like it is identical make this a subVI. Then you can dynamically call them for as many scales as you need. You can also explicitly call it if you know the number of scales will always be the same. Rather than use the elapsed time VI I would recommend you use the timeout on the event structure itself. If you need to wait a long time (several seconds) just have the timeout event check to see if you have passed your time limit.
10-01-2012 11:11 AM
Thanks for the answers everyone. i also need a stopwatch to show the time in every measurement, so i have to use the elapsed time.. I so i must add a timeout event ?.. I made that program for a single scale, but the second scale is exactly the same type, so i copy/pasted the program and got two event structures. What is the disadvantage of having two event structures ?