CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

if(USB_attached) Is always true - Warning

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ibsumith



Joined: 24 Jul 2009
Posts: 21

View user's profile Send private message

if(USB_attached) Is always true - Warning
PostPosted: Sat Jul 25, 2009 4:15 am     Reply with quote

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 Smile
Ttelmah
Guest







PostPosted: Sat Jul 25, 2009 5:09 am     Reply with quote

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

View user's profile Send private message

ibsumith
PostPosted: Sat Jul 25, 2009 5:22 am     Reply with quote

Thank you..
There is no connection sense pin implemented...Whether it will create problem???Like system reboot or crash something like that????
thank you Very Happy
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group