How do I implement a cog watchdog
BillDer
Posts: 33
I am using BS2 function's "debugin" to get input. However, I would like it to time out if the user doesn't enter their name.
inside the code it has a reference to implement a cog watchdog, using the example... but I don't see the example.
Does anyone know how to do this?
Thanks in advance
inside the code it has a reference to implement a cog watchdog, using the example... but I don't see the example.
Does anyone know how to do this?
Thanks in advance
Comments
These are used because they put the cog running them into a low power state, saving power. They're equivalent to the following loops:
To add a timeout, define another local variable "time" after "BR" in the declaration of SERIN_CHAR and define a constant "timeOut" at the beginning of the object in one of the CON sections like "timeOut = 10000" for a 10 second timeout between characters. You'd then do:
Note that you also have to modify the SERIN_DEC, SERIN_STR, and other SERIN_ routines to use a -1 as a buffer terminator in addition to a return (13) code or they'll store the -1 in the buffer (as a 255) and keep calling SERIN_CHAR which will continue to timeout thus filling up the buffer.
Also note that the timeout is limited to about 50 seconds with an 80MHz system clock.
Thanks again!!!