View previous topic :: View next topic |
Author |
Message |
ibsumith
Joined: 24 Jul 2009 Posts: 21
|
if(USB_attached) Is always true - Warning |
Posted: Sat Jul 25, 2009 4:15 am |
|
|
When I compiled a warning occoured whuch says this condition always returns TRUE....The condition which compiler points is if(usb_attached)
In
void usb_task(void) {
if (usb_attached()) {
if (UCON_USBEN==0) {
debug_usb(debug_putc, "\r\n\nUSB TASK: ATTACH");
usb_attach();
}
}
else {
if (UCON_USBEN==1) {
debug_usb(debug_putc, "\r\n\nUSB TASK: DE-ATTACH");
usb_detach();
}
}
It is a part of pic18_usb.c
thank you |
|
|
Ttelmah Guest
|
|
Posted: Sat Jul 25, 2009 5:09 am |
|
|
This depends on what you have done with the #define for the connection sense pin.
If you have a sense pin implemented, and have set the define to a pin number, then 'usb_attached', reflects the status of this pin. If the pin is turned off, then there is no way to detect the connection, so usb_attached returns true permanently.
If you look at the code for usb_attached, you will see exactly how it works.
Best Wishes |
|
|
ibsumith
Joined: 24 Jul 2009 Posts: 21
|
ibsumith |
Posted: Sat Jul 25, 2009 5:22 am |
|
|
Thank you..
There is no connection sense pin implemented...Whether it will create problem???Like system reboot or crash something like that????
thank you |
|
|
|