Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

handling events in a while loop

In a while loop, I need to stop the loop after a change of state from false to true or true to false or I can do this by detecting a certain string from the serial port. Seems like I should be able to do this simply by using a counter which is edge triggered. Please Help.
0 Kudos
Message 1 of 4
(3,452 Views)
I would love to help but you have provided very little for me to go on.

RE: your boolean, if you recall the previous state and compare to the current using an exclusive OR operation, It should return a true when the previous and current values are different.

On the string thing, you could compare the read string with a constant and get a true when they match.

The above are simply lame ideas that may be of use. If you could go into greater detail, I may be of greater assistance.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 4
(3,452 Views)
Hi Ben,

What I ended up doing is what you suggested. I read the string prior to the while loop to get an initial value which I then compared to the current value.

Thanks,
Lou
0 Kudos
Message 3 of 4
(3,452 Views)
Cool!
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 4
(3,452 Views)