LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

case structure

Hi,

I have two vi s which I want to connect through case structure.

I have 2 cases; true and false, in the case structure. I wanted to use a boolean button to control the case selection. If the boolean LED is turned on then true case should be selected and the first vi is connected to second vi. If the boolean LED is off then false case should be selected and first vi alone runs without connecting to the second vi. How to program it. Any suggestions please. I am new to programming and I am not sure whether my logic is correct. Please help. Thank you.

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

Hi ymadhuri,

 

it could be as simple as this example:

check.png

When you really have problems with such tasks you should go through some LabVIEW tutorials offered by NI (here or here)!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 14
(3,337 Views)

Thank you for your response. But I did exactly the sam way. When I execute the program it does nothing. So I kept excute highlight and run the program. The highlight execute comes only till first vi and continues only there even after selecting the case.  So I dont understand how to proceed .I attached the program code. Please check it and tell me where I am doing wrong. Run the Vi named "save image on event"

0 Kudos
Message 3 of 14
(3,331 Views)

Hi ymadhuri,

 

next time you should name your "main VI" so I don't have to search for it in your ZIP file...

 

The VI "save image on event" contains the other two, so I suspect it's your main VI. It also contains a lot of IMAQ functions which aren't installed on my computer.

So I can't say what is happening before your "Save" case structure is called.

 


The highlight execute comes only till first vi and continues only there even after selecting the case.


 

I really don't know what you're trying to say here...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 14
(3,327 Views)

The left portion of the block diagram before the case structure is used to acquire real time images using my laptop webcamera , process it and display. When I select the boolean LED "save" then the processed image is sent for pattern matching which is inside the case structure. When I execute the code with highlight execution I observe that only the code outside the case structure is executing, The case structure is not running. How to make my program function properly.

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

Hi ymadhuri,

 

when using highlight debugging you also should note when your LED is read! You should use some DATAFLOW when you need the LED read after the IMAQ stuff is processed! Right now that button is read just when the VI starts - switching the button later on has no effect! THINK DATAFLOW! As a simple solution to your problem you should use a sequence structure to read the button within...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 14
(3,321 Views)

Sorry I do not know about sequence structures. This is my first programming experience. So I am not sure about my logic also. Kindly help me in achieving my output. the code which I have attched is developed by modifying existing programs available in discussion forums and example codes.Am I proceeding in the correct way?

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

Hi ymadhuri,

 

- LabvIEW provides a lot of examples. See the help menu...

- LabVIEW provides a big help. See the help menu...

- LabVIEW (or NI) provides online crash courses. See here or here...

 

You should know LabVIEW is based on DATAFLOW. This is all you need to learn at the start 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 14
(3,313 Views)

I kept a flat sequence structure in the code. I found that there is an option of "stacked sequence structure". Which one would be suitabl for my application?

 

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

Hi,

 

in your case a single frame of a flat sequence is all you need...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 14
(3,301 Views)