LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

case structure with string as a case selector

Solved!
Go to solution

hello every one !
i have little issue with the case structure 
situation :
I have created the case structure and case selection is done by the string,
according to the case selection respected led should glow 

the case structure is as follow :

case 1 [when string is "abc"]

            {

              led 1 = true 

              led 2 = false

            }

case 2 [when string is ''pqr'']

            {

             led 1 = false

             led 2 = true

            }

case3 [when string is '''',default]

            {

             led 1 = false

             led 2 = false

            }

 

now what is happening :
i clicked on the "run continuously"

now when i type the any of the string nothing is happening !! Smiley Frustrated

 

my observation :
when i type abc/pqr in the string input, it actually blinks the led for very small fraction of time which i can not see and finally set into the default case.

 

what I am expecting from this code !
when i put "abc" in the string input , 'led 1' should be turn on and remain on untill i put pqr into the string input
same when i put pqr into the string input, led 2 should be turn on and remain on untill i put abc into the string input !

 

Thanks in advance !
 

Download All
0 Kudos
Message 1 of 20
(17,200 Views)

First of all -Do not use run continously! ?instead put this case structure in while loop and that should do the trick

 

Message 2 of 20
(17,191 Views)

hello 
I have tried it already 
actually i am using it as a sub program 
and main program is already in the while loop 
the string is coming from an instrument --> string is updated by certain interval,  till new string is available i have to show the older string ![to show which string is available i am using leds] !

but thanks a lot for the super instant reply ! Smiley Wink

0 Kudos
Message 3 of 20
(17,181 Views)

But the VI you've attached is case-sensitive on strings:

string 1

string 2

others

And I'm getting desired results...

0 Kudos
Message 4 of 20
(17,169 Views)

Your picture and your conversation about abc and pqr do not match the VI you've attached.

 

My guess is that you have the string in your abc/pqr picture set to update continuously while typing and you are getting a match for that fraction of a second after you've typed abc and before hitting the \

0 Kudos
Message 5 of 20
(17,160 Views)

How do you use it in your main program? Maby this is the issue...

0 Kudos
Message 6 of 20
(17,155 Views)

are u sure Because in my computer LEDs are not glowing: Smiley Frustrated:

0 Kudos
Message 7 of 20
(17,151 Views)

@jay_sidd wrote:

are u sure Because in my computer LEDs are not glowing: Smiley Frustrated:


Who are you responding to?

 

Which VI are you trying to work with here?  The one you actually attached, or the one you talk about and show a screenshot of?

0 Kudos
Message 8 of 20
(17,139 Views)

let  me elaborate
i have 10 VISA read / write block connected one by one 
first i am requesting the data lets say :MODE? [operation mode]

in response instrument will give me either :MODE CC or :MODE CP data type is string 
after giving this response labview will go to next VISA R/W block and so on 
once labview reaches at the end it will start the same routing again !
so once i get the mode status, i will get it again after some time till that time, I have to show the previous mode status 

{I am distinguishing the string by simple led }

now what is happen
visa reading and writing is happening
and once string is generated it doesnot set the led and case structure remained  in the default case which is nothing but a off leds  

new to this forum 
so dont exactly know how to tag the person to whom u r replying 

0 Kudos
Message 9 of 20
(17,134 Views)

Now you are talking about a third, more complicated version of your VI.

 

We can't even attempt to help you debug that since you haven't attached that one at all.

 

Be sure to put in there some controls where you data from the serial port is saved as default, or the strings are put in there as constants so we can see what the actual data looks like.  Perhaps you have control codes or termination characters you aren't accounting for.

0 Kudos
Message 10 of 20
(17,124 Views)