LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I use the symbol "or" in a while loop

I have an error in the attach Vi. Do you know how I can fix it? Thanks
0 Kudos
Message 1 of 9
(2,758 Views)
The OR (primitive) vi will perform the OR operation between two objects of the same type. So you cannot perform the OR of a number and a boolean.

What do you want to do?

1 - Do you want to stop the VI when the STOP botton is pressed OR when the "wait  time after infusion (s)" reach certain value?
2 - Do you want to stop the VI when the OR operation between two numbers result in one (1) or zero (0)?

Regards;
Enrique

Message Edited by Enrique on 03-20-2006 03:37 PM

www.vartortech.com
0 Kudos
Message 2 of 9
(2,745 Views)

You cannot OR a boolean with a number. Smiley Very Happy

You need to capture the system time when you start the loop and add your wait time to that value to give you a "finish" time.
Then as you loop compare the current time to the "finish" time and when the current is greater than the finish, you will have a second TRUE Boolean that can be used to stop the loop.

0 Kudos
Message 3 of 9
(2,740 Views)
You can OR two numbers together (i.e. 0x011 OR 0x100 = 0x111) or two Booleans (i.e. True OR False = True) but you can't OR a number and a Boolean. Exactly what are you trying to do. Do you want the while loop to stop when the user changes the front panel control to some value? If that's the case, you could add a comparison function.
0 Kudos
Message 4 of 9
(2,739 Views)
Did you look at the Context help box when you place the wiring tool over one of the broken wires? It says you have connected two different wire types, numeric and boolean. You can OR numerics, but not mix them. Many experienced LV programmers keep the context help on all the time.

Based on the control label "wait time after infusion," I don't see why you would want to OR that with the Stop boolean. If you want to stop after the wait time or when the button is pressed, you need some additional logic.

Lynn
0 Kudos
Message 5 of 9
(2,732 Views)
I modified the Vi (while-comparison in attachment) but still doesn' work. I would like the while loop to run for a certain time A or as long as I do not press the stop button. Thanks 
0 Kudos
Message 6 of 9
(2,732 Views)

No. When you compare two numbers, you get a number out. Look at and read the function help. Try this. The function I used is Elapsed Time. Somehow the label got mangled when I pasted it into paint.

 

Message Edited by Dennis Knutson on 03-20-200602:35 PM

0 Kudos
Message 7 of 9
(2,720 Views)
This vi shows the proper way to exit a loop with either the stop button or some time elapsed.
- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 9
(2,716 Views)
Make it look like this:

Message Edited by Warren Massey on 03-20-200601:38 PM

0 Kudos
Message 9 of 9
(2,712 Views)