maniyuri
Newbie level 6
Hi all,
I have tried using the USB example code from the library of MikroC with PIC18F4550 but it is not working. It gives an error :Main function not defined.
Please help me out. I am totally new to USB interfacing. If there is some material that you could refer, it would be of great help.
I also had some other doubts. What is the value in front of the first two lines (absolute 0x500, absolute 0x540). Any help will be greatly appreciated.
Regards.
I have tried using the USB example code from the library of MikroC with PIC18F4550 but it is not working. It gives an error :Main function not defined.
Code:
unsigned char readbuff[64] absolute 0x500; // Buffers should be in USB RAM, please consult datasheet
unsigned char writebuff[64] absolute 0x540;
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
HID_Enable(&readbuff,&writebuff); // Enable HID communication
while(1){
while(!HID_Read())
;
for(cnt=0;cnt<64;cnt++)
writebuff[cnt]=readbuff[cnt];
while(!HID_Write(&writebuff,64))
;
}
}
Please help me out. I am totally new to USB interfacing. If there is some material that you could refer, it would be of great help.
I also had some other doubts. What is the value in front of the first two lines (absolute 0x500, absolute 0x540). Any help will be greatly appreciated.
Regards.
Last edited by a moderator: