watchdog and usb slave

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Roy
Flowcode V4 User
Posts: 17
Joined: Thu Jul 30, 2009 9:13 am
Location: New Zealand
Been thanked: 1 time

watchdog and usb slave

Post 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.
Regards
Roy

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: watchdog and usb slave

Post 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.

Post Reply