View previous topic :: View next topic |
Author |
Message |
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
USB 3.3v missing |
Posted: Sat Jan 12, 2013 12:59 pm |
|
|
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: 19513
|
|
Posted: Sat Jan 12, 2013 1:02 pm |
|
|
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
|
|
|
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
|
Posted: Sat Jan 12, 2013 1:53 pm |
|
|
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: 19513
|
|
Posted: Sat Jan 12, 2013 3:16 pm |
|
|
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
|
Problem solved! |
Posted: Sun Jan 13, 2013 2:10 am |
|
|
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. |
|
|
|