Hamid Ullah Jan
Newbie level 3
- Joined
- Dec 8, 2010
- Messages
- 4
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,409
Hi Everyone!
I want to communicate between pic18f4550 and pc through usb communication, i have written the code for pic and when i connect it to the pc, the pc should detect and install the drivers for this. but pc does not even detect it. i m posting the code here so please help me what might be the problem.
void main()
{
// unsigned char ii=0;
unsigned int prog_data=0;
//===================usb===================================
unsigned char i, ch,m;
unsigned char index;
unsigned char buff[70];
//=========================================================
// ANSEL=0x00; //All pins as digital i/O
ADCON1=0x0F; //All pins of PORTA as digital i/O
PORTA=0x00;
TRISA=0xE0;
PORTB=0x00;
TRISB=0x00;//4D;//0xCD;
PORTC=0x00;
TRISC=0x00;
INTCON = 0; // Disable GIE, PEIE, TMR0IE,INT0IE,RBIE
INTCON2 = 0xF5;
INTCON3 = 0xC0;
RCON.IPEN = 0; // Disable Priority Levels on interrupts
PIE1 = 0;
PIE2 = 0;
PIR1 = 0;
PIR2 = 0;
//------------------------------
Pwm_Init(2000); // Initialize PWM module
Pwm_Change_Duty(51); // Duty cycle 20%
Pwm_Start(); // Start PWM
//------------------------------
prg_mode_on();
delay_ms(300);
HID_Enable(&userRD_buffer, &userWR_buffer);
Delay_ms(1000);
Delay_ms(1000);
while(1)
{
PORTB.F7=~PORTB.F7;
}
will waiting for your response please.
I want to communicate between pic18f4550 and pc through usb communication, i have written the code for pic and when i connect it to the pc, the pc should detect and install the drivers for this. but pc does not even detect it. i m posting the code here so please help me what might be the problem.
void main()
{
// unsigned char ii=0;
unsigned int prog_data=0;
//===================usb===================================
unsigned char i, ch,m;
unsigned char index;
unsigned char buff[70];
//=========================================================
// ANSEL=0x00; //All pins as digital i/O
ADCON1=0x0F; //All pins of PORTA as digital i/O
PORTA=0x00;
TRISA=0xE0;
PORTB=0x00;
TRISB=0x00;//4D;//0xCD;
PORTC=0x00;
TRISC=0x00;
INTCON = 0; // Disable GIE, PEIE, TMR0IE,INT0IE,RBIE
INTCON2 = 0xF5;
INTCON3 = 0xC0;
RCON.IPEN = 0; // Disable Priority Levels on interrupts
PIE1 = 0;
PIE2 = 0;
PIR1 = 0;
PIR2 = 0;
//------------------------------
Pwm_Init(2000); // Initialize PWM module
Pwm_Change_Duty(51); // Duty cycle 20%
Pwm_Start(); // Start PWM
//------------------------------
prg_mode_on();
delay_ms(300);
HID_Enable(&userRD_buffer, &userWR_buffer);
Delay_ms(1000);
Delay_ms(1000);
while(1)
{
PORTB.F7=~PORTB.F7;
}
will waiting for your response please.