03-31-2017 01:36 PM
I am trying to set up a watchdog timer to watch an action that opens up a com port between my pc and a device. sometimes the device might time out and just sit there for 5 minutes when it should only take 3 seconds tops. after it times out, the next time i run through it, the com port and pc are able to communicate no problem. So, i want to set up a watchdog timer to see if the communication is taking longet thatn 5 seconds to establish. I found an example of a watchdog timer here on the forums but i am not sure how to implement it into my code to do what i want it to do.
I want to set a WatchDogVariable right away. then begin the watchdog timer by executing a new thread for the timer sequence. If the WatchDogVariable is non zero, then it will enter a loop that has a wait set for 5 seconds, ie the amount of time i am limiting this communication to be established between PC and device. After the wait, if the main sequence has not reset the WatchDogVariable, ie successfuly opened up communication, before the wait expires, i want to try to open the communication one more time. I want to run this same timer agian on the same step and if it fails again i want the execution of the main sequence to run to cleanup.
I have attached a rough example of what i have so far. any ideas or pointers?
Thanks!
03-31-2017 03:24 PM
Why don't you try to do this watchdog inside of the code module? All the logic of timeout checking, looping of step you can do there; and will have "clean" sequence.
B/c what if you will need to take care about steps timeouts for other code modules?
I'd recommend to go this way - to do it inside code modules...
Sincerely, kosist90
04-06-2017 02:26 PM
How do you do this inside the module?
04-07-2017 09:29 AM
Hi,
You might take a look at this whitepaper for a better explanation of how to implement this within a LabVIEW code module:
http://www.ni.com/product-documentation/14616/en/