LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timer for indicator

Hey there,

I have a indicator in my code I want to show time elapsed in the front panel when the indicator is on. When Indicator is turned off and on again I need to ask user if he wants to continue from the previous time or restart the time from zero on my elapsed time indicator in front panel. How do I do that?

0 Kudos
Message 1 of 7
(134 Views)

Seems simple enough. What have you tried so far?

 

  • How do you define an indicator that is "off" as opposed to "on"? Display sentinel value, e.g. NaN? Not Visible?
  • If the user want to restart the timer, what is the new time zero? (when the timer is turned on? After the user answers the question?)
  • It help if you would attach a simple VI so we can see what you are trying to do?
  • What else is happening in the code?
0 Kudos
Message 2 of 7
(125 Views)

I have tried this and it works but the problem with it is my ch4 event has other operation and it is triggered occasionally so the dialog box will keep popping up. 

0 Kudos
Message 3 of 7
(109 Views)
  • Well, if the ch4 even has other operations, it would help to include these in the example.
  • It is completely silly to use a signaling event via an indicator. One event is sufficient.
  • You can tell from the "source" event data node if the event got triggered by the button or something else and act accordingly.
  • Your zero diagram constant has the wrong representation.
  • I probably would use "high-resolution relative seconds" to measure actual time, independent of loop rates and events.
Message 4 of 7
(104 Views)

Here's a quick draft. You still need to decide what should happens to the timer when the switch is operated, e.g. if it should count time when the button is off or not. Possibly, you need to add another shift register to store the ticker at the time it is turned off. (not shown)

 

 

Message 5 of 7
(96 Views)

Thank you for this I'll implement this and see if it requires any modifications. The code is big so unfortunately I can not put it here. 

I hope I can explain my problem as following:

1. I have numeric control if the value of it is greater than 0 than ch4 indicator will be on and of the value is zero then ch4 indicator will turn off.

2. I have put this ch4 indicator in numeric control's event and made it true.

3. The timeout of my event structure is -1 so cannot use that event structure for time counting.

4. I want to display and start timer whenever ch4 indicator is on but also it should ask user to restart or continue timing from the past timing.

 

0 Kudos
Message 6 of 7
(80 Views)

@doc_d wrote:

Thank you for this I'll implement this and see if it requires any modifications. The code is big so unfortunately I can not put it here. 

I hope I can explain my problem as following:

1. I have numeric control if the value of it is greater than 0 than ch4 indicator will be on and of the value is zero then ch4 indicator will turn off.

2. I have put this ch4 indicator in numeric control's event and made it true.

3. The timeout of my event structure is -1 so cannot use that event structure for time counting.

4. I want to display and start timer whenever ch4 indicator is on but also it should ask user to restart or continue timing from the past timing.

 


  1. ok
  2. Not sure what "making it true" means in this context.
  3. In order to keep track of time, you need to regularly poll. No way around that. Maybe you don't even need an event structure, just a plain state machine.
  4. An indicator is just that. Your decisions need to be based on the data in the wire.
  5. Instead of a blocking dialog box, maybe all you need is a checkbox next to the switch to decide if the counting should restart or continue at the last time. How the switch operation is not followed by an often inconvenient dialog box.
0 Kudos
Message 7 of 7
(68 Views)