LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I set up an indicator to display for only 1 second?

How do I set up an indicator to display for only 1 second?

 

I am reading keys from a serial device and I turn on an indicator that corresponds to the key pressed

on the serial device but how do I set this up so that it only stays lit (enabled) for a second or two?

 

The indicator is inside of a case statement and turns on OK but I do not want it to stay on for more than

a second or two. How do I modify this to display for only a second or two?

 

 (P.S. I am running an old version 8.2 and can only see vis that are 8.2 or older.)

 

thanks

 

Serial-Report.PNG

0 Kudos
Message 1 of 14
(3,183 Views)

Hello

Check the following link: Visibility Property Nodes for Controls/Indicators in a Case Structure

 

In your case, just set up the indicator property node visible to True, wait 1000 ms and then switch the visibility for false.

This should helps.

 

Best regards.

Mondoni
0 Kudos
Message 2 of 14
(3,180 Views)

there might be a better way of doing this.....but select a value from the combo box and it will display on a string indicator for 3 secs. use shift reg to store your values and elapsed time to show them.

 

Spoiler
3sec.png

 

Message 3 of 14
(3,159 Views)

Simplest way to turn the indicator off (false value) after a set time is to use a Sequence structure (flat or stacked).

 

Frame 1, set to true,

Frame 2, Wait ms (wire millisecond value to wait)

Frame 3, set to false.

 

This method, however, prevents the code outside the case structure from running during that wait time.  

 

Something more elaborate will allow the external code to run.  What comes to mind is a shift register that holds the indicator name and the time stamp (in milliseconds) when it was turned on, in an array of clusters.  Each iteration of your loop will check this register to see if a certain time has passed (current time stamp minus turn on time).  If so, use a case structure to turn the indicator off and remove the elements from the shift register array (so you don't keep setting the indicator to false).  The array will let you control multiple indicators independently.

 

A problem with this option could arise from multiple readings.  Lets say you want to turn it off after 2 seconds, but you read the value again after 1 second (this means the indicator should be on for a total of 3).  The code would still turn it off after the 2 second mark.  Of course this really depends on the time intervals involved with your code.

Message 4 of 14
(3,150 Views)

Thank you for the helpful suggestions...

 

I settled with the following which works but I am having problems naming one of the cases to match an incoming

byte of serial data. The byte received is "\" but every time that I try to set the case name as "\" Labview names the case 

"\" "  or "\"". If I only enter | then Labview names the case as " "

 

 

bad case in LV8.JPG

 

0 Kudos
Message 5 of 14
(3,101 Views)

Maybe if you set up the case value to "\\" it will works.

It's probably a conflict with the ASCII format.

 

In the VI Snippet below, if I receive the "\\" message (set on the case structure), the boolean indicator would become true. And when I tried to send a \ in a string constant, the case returned true.

 

Slash.png

 

Hope this helps.

Best regards

Mondoni
Message 6 of 14
(3,089 Views)

Thank you...

 

The "\\" works!

 

Any ideas how to trap a tab?

 

One of the keys that I am trying to capture sends a tab character...

 

0 Kudos
Message 7 of 14
(3,072 Views)

If I'm not wrong, "\t" matches a tab character in the special characters table.

I can't guarantee you that this will work. Test this in your application and then tell me the results.

 

Regards

Mondoni
0 Kudos
Message 8 of 14
(3,068 Views)

@Japper wrote:

Thank you for the helpful suggestions...

 

I settled with the following which works but I am having problems naming one of the cases to match an incoming

byte of serial data.


Would you mind attaching actual code (VI or snippet) instead of images (for example, we cannot tell what's in the other cases). Somehow, things look much more convoluted than needed (e.g. your "AND true" just returns the lower input and can be omitted entirely here). Can you really afford a 300ms wait? How often does new data arrive? How many cases and indicators are there?

0 Kudos
Message 9 of 14
(3,061 Views)

Thanks for pointing that out altenbach.

 

I have cleaned this up a bit and can trap the tab with a "\t" but the Stop button does not work until another byte of

data comes through the serial port (another button pressed) as I need to somehow fold the stop button into the serial port

\read so that it is not waiting.

300ms is OK as I am waitiing for key presses and I wanted the appropriate indicator to flash on & off when the corresponding button was pressed.

 

Attached is my

Vi

 

thanks

 

0 Kudos
Message 10 of 14
(3,041 Views)