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

USB 3.3v missing

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



Joined: 10 Dec 2011
Posts: 376
Location: Sofiq,Bulgariq

View user's profile Send private message

USB 3.3v missing
PostPosted: Sat Jan 12, 2013 12:59 pm     Reply with quote

This is the code:
Code:

#include <18F4550.h>
#fuses NOWDT,NOMCLR,INTRC_IO,NOUSBDIV,VREGEN,CPUDIV1
#use delay(clock=8M)
#include <usb_cdc.h>

void main()
{
while (true)
   {
   output_toggle(pin_A0);
   delay_ms(500);
   }
}

My question is: Why I have not 3.3V on pin 18 wich is Vusb? Is there somthing wrong in my code? I thing that the fuse VREGEN should cause 3.3v occur on Vusb pin.
_________________
A person who never made a mistake never tried anything new.
Ttelmah



Joined: 11 Mar 2010
Posts: 19338

View user's profile Send private message

PostPosted: Sat Jan 12, 2013 1:02 pm     Reply with quote

Remember USB can't be used with the internal oscillator....
The regulator doesn't go on, till you turn on the USB peripheral. This doesn't happen till you call usb_init.

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jan 12, 2013 1:04 pm     Reply with quote

Read the 18F4550 data sheet:
http://ww1.microchip.com/downloads/en/DeviceDoc/39632e.pdf
Read about the USBEN bit and what it does.
rikotech8



Joined: 10 Dec 2011
Posts: 376
Location: Sofiq,Bulgariq

View user's profile Send private message

PostPosted: Sat Jan 12, 2013 1:53 pm     Reply with quote

Thanks a lot Guys! I have 3.3V already, but a new question has occurred. I have new code now, this is it:
Code:

#include <18F4550.h>
#fuses NOWDT,NOMCLR,HS,NOUSBDIV,VREGEN,CPUDIV1
#use delay(clock=16M)
#include <usb_cdc.h>

void main()
{
usb_cdc_init();
usb_init();
while (true)
   {
   usb_task();
   output_toggle(pin_A0);
   usb_cdc_putc('c');

   delay_ms(500);
   }
}

But when I plug in the usb cable, my computer don't recognize the device (Device Manager (appears) -> Unknown device). I think I need some drivers to install. Can someone tell me what driver do I need and where from can I download it?
Excuse my bad English! Thanks again fellows!
_________________
A person who never made a mistake never tried anything new.
Ttelmah



Joined: 11 Mar 2010
Posts: 19338

View user's profile Send private message

PostPosted: Sat Jan 12, 2013 3:16 pm     Reply with quote

If you are running with a 16MHz external crystal, then you need PLL4, and USBDIV.

Look at Table 2-3 in the data sheet

Top line of the section starting '16MHz'. PLL divisor needed.

You _only_ use 'NOUSBDIV', with a 6MHz master oscillator, and low speed USB operation.

The driver is in the CCS directory, 'DRIVERS', 'NT,2000,XP'.

If the clock is right, it won't be 'unknown device', it'll tell you it is the CCS CDC demo.

Best Wishes
rikotech8



Joined: 10 Dec 2011
Posts: 376
Location: Sofiq,Bulgariq

View user's profile Send private message

Problem solved!
PostPosted: Sun Jan 13, 2013 2:10 am     Reply with quote

Thank you SO MUCH Ttelmah!
My demo code is running properly now. I will develop my code in prospective, but most difficult is in the past.
Thank you again!
_________________
A person who never made a mistake never tried anything new.
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