Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

mikroc pro 18f4550 connection problem

Status
Not open for further replies.

muhammadali_16

Full Member level 3
Joined
Jul 15, 2011
Messages
161
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
2,335
hiz

i am trying to connect 18f4550 through usb. i used the mikroc pro sample code. its fine when i use proteus and HID terminal. last night i burnt controller and tried.

computer is giving no response when i connect the controller.
can anyone tell me what is the problem
 

If you use HID library, i think everything will be ok. Maybe, cause is your circuit having trouble.
 

Pullup resistor at mclr
crystal 8mhz
usb connector
1uf cap at Vusb.
thats everythng which i have connected. Wht more i should connect?
 

I mean your circuit isn't worked, maybe for interferences, routing or componet.........
 

I simulate the whole code. whole c# GUI intrface has been checkd on proteus. Data was sending and reciving perfectly
 

post your project files with proteus file zipped. Is the USB cable ok?
 

Have checkd evrythng. My code is exactly the same as in the help of mikroc pro 2011 help(code sent which it recive). I am messaging frm mob. Have no access to internet. Wil post evrythng aftr sometime.
 

How are you posting messages when you don't have Internet access? Are the buffers in the C# code and mikroC code same?
 

i was messaging from mobile.


<code>
#include "USBdsc.c"

unsigned char readbuff[64] absolute 0x500; // Buffers should be in USB RAM, please consult datasheet
unsigned char writebuff[64] absolute 0x540;
int num;

char cnt;
char kk;

void interrupt(){
USB_Interrupt_Proc(); // USB servicing is done inside the interrupt
}

void main(void){
ADCON1 |= 0x0F; // Configure all ports with analog function as digital
CMCON |= 7; // Disable comparators
TRISD=0x00;
HID_Enable(&readbuff,&writebuff); // Enable HID communication

while(1){
while(!HID_Read());
//asciitonum(readbuff[0],num);
//str2dec(readbuff[0],num);
//num=0x0[&readbuff[0]];
num=readbuff[0];
// num=48-num
PORTD=num;

for(cnt=0;cnt<64;cnt++)
writebuff[cnt]=readbuff[cnt];

while(!HID_Write(&writebuff,64));
}
}
</code>



this is the code

and the image is attached. check that
 

Attachments

  • PIC_USB.png
    PIC_USB.png
    121.4 KB · Views: 57

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top