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 CCS Technical Support

USB Device not recognized

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



Joined: 05 Oct 2016
Posts: 120

View user's profile Send private message

USB Device not recognized
PostPosted: Thu May 04, 2017 3:23 am     Reply with quote

Hello

I have a pcb board (the pic is 18f4550 tqfp) and i am doing some tests o it. I want to check usb connection on my board. I uploaded this code to my pic. I hear the usb connection sound on windows but it gives the warning, usb device not recognized. I want to learn, whether the problem is on hardware or on my code. Any ideas?

Thank you so much!

Code:

#if !defined(__PCH__)
 #error USB CDC Library requires PIC18
#endif

#include <18F4550.h>
#fuses  HSPLL,NOWDT, PUT, NOLVP,NOMCLR,NOPROTECT,NOLVP,NODEBUG,NOBROWNOUT,USBDIV,PLL5,CPUDIV1,VREGEN,ICSP2          //ICPRT enabled
#device ADC=10
#use delay(clock=48000000)

#include<usb.h>
#include<usb_cdc.h>
#include <pic18_usb.h>
#define rp_getc usb_cdc_getc
#define rp_putc usb_cdc_putc


void main()
{
  usb_cdc_init();
  usb_init();
  usb_task();
}


Best wishes

Doguhan
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Thu May 04, 2017 3:59 am     Reply with quote

The code you have dies...
Drops off the end, so isn't running.
When Windows tries to enumerate the device, there is no code there to answer...
doguhanpala



Joined: 05 Oct 2016
Posts: 120

View user's profile Send private message

PostPosted: Thu May 04, 2017 5:35 am     Reply with quote

Ttelmah wrote:
The code you have dies...
Drops off the end, so isn't running.
When Windows tries to enumerate the device, there is no code there to answer...


sorry for the newbie mistake... i will add a while(true). thank you so much Ttelmah!
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