LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Local variables to determine loop time

Hi, I made a labview code which ,in one hand, writes 5 and 0 volt to a relay in order to make it on/off, on the other hand, reads the pressure values from the sensor. I use USB 6009 for data acquisition. 1) I used flat sequence structure for the writing part, before applying 5 volt to the relay I used delay duration and before applying 0 volt I used test duration. For the reading part I used a while loop which stops when pressed to exit button. But I dont want to use exit button. Instead of using exit button, I want the while loop stop reading according to the sum of delay and test durations. I think I have to use local variables for the purpose. But how can I connect these variables so that the while loop stops reading when the writing part is over. I would appreciate any help, thanks Ahmet
0 Kudos
Message 1 of 5
(3,022 Views)
Attached version should solve your problem.
0 Kudos
Message 2 of 5
(3,013 Views)

Thanks for quick reply JB,

But the main problem is still there. I want to remove the exit button. In the flat sequenced structure, as you see, I use delay time and test time. For example for delay time I gave 2, and for test time I gave 8. The program waits for 2 seconds and then makes the relay on by applying 5 volts and then holds the relay on position for 8 seconds, then applies 0 volt thus turning its position to off. During this process, the pressure reading goes on. But after the relay is off, the reading still continues. I press the exit button, and it stops. What I need is that : I dont want to use exit button. I want the reading to stop automatically when the relay is off (the last part of the flat sequenced structure). That's why I thought to use sum up local variables (delay time local variable and test time local variable) and connect to this to my while loop somehow. But I think I can just connect boolean to stop the loop. Thus it makes me think that I should use something else instead of while loop. I am not sure, however. There might be other solutions, but I don't know what they are.

 

Thanks

0 Kudos
Message 3 of 5
(3,004 Views)
I want the reading to stop automatically when the relay is off (the last part of the flat sequenced structure)

This is exactly what the code does !

The exit boolean is initialized (set to FALSE) before starting the process and is set to TRUE - to stop the while loop - once it is finished.

Hide the button (diagram >> right-click on the terminal of exit >> Hide Control) or move it outside the visible part of the front panel to avoid the user to click on it. That's all !

Message 4 of 5
(2,999 Views)

Hi JB,

 

Your solution has worked, thanks for your help.

 

Ahmet C

0 Kudos
Message 5 of 5
(2,985 Views)