|
|
View previous topic :: View next topic |
Author |
Message |
Renjith_Beginow
Joined: 21 May 2014 Posts: 12
|
|
Posted: Fri May 23, 2014 10:39 pm |
|
|
Hi ezflyr,
I will go through seriously on that cdc header file and serial2 example.
Thanks for your support. |
|
|
Renjith_Beginow
Joined: 21 May 2014 Posts: 12
|
|
Posted: Mon May 26, 2014 1:10 am |
|
|
#include<usb_desc_cdc.h>
Hiii ezflyr and Ttelmah
Without the above header, my system is not recognizing the USB. Is this header important, but in that example its not using i think, could you help me, can you explain the details? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19553
|
|
Posted: Mon May 26, 2014 1:24 am |
|
|
The example does use that file.
It loads usb_cdc.h, which contains the lines:
Code: |
#ifndef __USB_DESCRIPTORS__
#include <usb_desc_cdc.h> //USB Configuration and Device descriptors for this USB device
#endif
|
This file is the 'usb descriptor' for a CDC device. It tells the driver what to 'say' when it receives an enumeration request from the PC.
The examples are configured to run with the hardware as setup for the demo board. You need to take a copy of ex_usb_common.h, into your project directory, and then edit it to match your hardware. The default is for a 12MHz clock, which is why it won't enumerate till this is corrected. |
|
|
Renjith_Beginow
Joined: 21 May 2014 Posts: 12
|
|
Posted: Fri May 30, 2014 5:35 am |
|
|
Have got a working code for usb with 18f26j50.
Code given in the example of ccsc, is not giving me any output,
Please help me a code.
Also mention me about the hardware, especially crystal.
My USB is getting enumerated, but not communicating with PC.
please do the needful.. |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Fri May 30, 2014 7:02 am |
|
|
Hi,
You are asking us to do your work. That is not how the forum operates. If you have a problem, you need to post your schematic, and a listing of your current code. Once you do that, we'll know exactly what you are working with, and we will be well equipped to lend a hand. So many details *matter*, so it's important not to take any shortcuts. The ball is in your court, not ours!
John |
|
|
Renjith_Beginow
Joined: 21 May 2014 Posts: 12
|
|
Posted: Tue Jun 03, 2014 4:51 am |
|
|
This is my code, but here the usb is getting enumerated and a com port has appeared, but not communicating, showing error "The device attached to the system is not functioning"
Is this due my clock. Iam using 8MHz crystal osc. But in some document i found they are using 12Mhz. Not getting communication.
Code: |
#include <18F26J50.h>
#FUSES NOWDT
#FUSES NODEBUG
#FUSES NOXINST
#FUSES NOPROTECT
#FUSES NOFCMEN
#FUSES NOIESO
#FUSES NOCPUDIV
#FUSES HSPLL
#FUSES PLL2
#FUSES RTCOSC_INT
#use delay(clock=48000000)
#include<usb_desc_cdc.h>
#include <usb_cdc.h>
char x;
void main(void)
{
int i, j, address, value;
setup_oscillator(OSC_PLL_ON);
delay_ms(100);
enable_interrupts(GLOBAL);
usb_init();
delay_us(100);
usb_cdc_init();
delay_us(100);
while(1)
{
usb_task();
if (usb_enumerated())
{
output_high(pin_c2);
delay_us(100);
if (usb_cdc_kbhit())
{
x = toupper(usb_cdc_getc());
printf(usb_cdc_putc,"%c", x);
if (x == 'S')
{
printf(usb_cdc_puts, "USB Working");
}
}
}
}
}
|
|
|
|
|
|
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
|