Hi all.
I'm here again and have question :
how detect if device is plug in usb or not.
If I have powered my PCB from differ power source I need detect if is plug in to usb or not.
If yes then I internal enable usb function , if not then I use different mode.
I create small PCB like avr butterfly but support USB boot-loader and usb to serial port converter with internal function (LCD ,RFID, may SDcard, I2C relay ... ).
there is more solution how to detect if usb is plug.
1. logic state of power line of usb (but need one free pin)
2. every 100 or more ms control INT0 flag , if every time change it's mean so mcu communicate , or use (atmega168) pin change interrupt flag
but exist any function in V-USB where can I check if mcu is plug in to USB or not? or how can I check it.
I want use usb as charger for internal li-ion cell and can using solution 1.
regards
detect if usb is connected....
Re: detect if usb is connected....
There may be a built in usb-v funciotn for this not sure but why not just watch the pin state? Or use a pin-change interrupt.
Re: detect if usb is connected....
Hi .
I thinks so easy will be use pin change interrupt flag.
OK .
thats all ..
regards
I thinks so easy will be use pin change interrupt flag.
OK .
thats all ..
regards