The program I'm working on is supposed to test two switches. It uses fieldpoint to send a signal to the switches then read the data. At all times one switch should be open and the other should be closed. The program runs as it is. The problem is that I want the program to stop at certain cases.
1. If both switches are either opened or closed
2. If the close switch does not respond to the signal
3. if the open switch does not respond to the signal
I've attached a copy of the program. Any help on this would be greatly appreciated.
I attached a picture of an easy way to test if both are open or both are closed.
For the seitch fails to open, you can wire the time stamp of the write signal (in your state 1) to the time stamp of the valve opened and if they are different by say 10 secs (I am not sure how long it takes to open the valve) return a true and have that go into another Or statement to your stop function.
Consider that real, mechanical switches may have a state lasting a few milliseconds where both contacts are open simultaneously. And they may bounce: close, then open for a short time, close again, repeating multiple times before staying closed. If your DAQ hardware and software is faster than the switch bounce time, you need to provide debounce (filtering) before making any decisions.