Page 1 of 1

watchdog and usb slave

Posted: Sun Aug 16, 2009 2:27 pm
by Roy
I am new to flowcode and pic programming in general, however I must say that with flowcode I managed to do what I want with one exception,
For my program to work I used a string usb slave port, all I do is in one line write a string to set outputs and in the same scan read in all inputs.
It is working very well. All I now need to do is put in a timer (watchdog ) that will if a variable or there is no activity on the usb to power down some or all of the outputs every 6 seconds. This is in case we loose usb comms the outputs will not stay in a high condition.
The problem I have is that no matter what I do with the usb slave either in another routine, main routine or the usb routine, it interrupts the comms to the pc.
Can anyone help plse.

Re: watchdog and usb slave

Posted: Wed Aug 19, 2009 2:31 pm
by Benj
Hello Roy

The watchdog timer acts to reset the device which will in turn reset the USB connection and therefore invalidate the handle the PC software has to the USB connection.

Instead you should user a timer interrupt. There are examples available on how to do this in the examples folder.

Hope this helps.