Hi Ronald,
There's a very simple solution to this. Assign a single I/O-pin as the USB bus-attach input.
Here's how;
ground --100k resistor----PIC input pin ----4.7k resistor----+V from USB connector.
When the USB cable is plugged in, the input will see +V from the USB port. When the USB
cable is removed, it will see ground.
Don't attempt to send/receive any data until you see +V on the USB bus-attach input pin.
Very simple. Very effective.
Bookmarks