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!