Code: Select all
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))
;
}
}
Also include the USBdc.c file in the project but the hex file generated by this code is too small of 1 KB or of few lines as shown:
:0400000034EF0CF0DD
:1018CE000902290001010080320904000002030010
:1018DE0000000921010100012221000705810340BA
:0918EE000001070501034000019F
:1018F7000600FF0901A10119012940150026FF0073
:101907007508954081021901294075089540910293
:01191700C00F
:1019180012034800490044002000540045005300C9
:02192800540069
:10192A001201000200000008341201000100010245
:02193A000001AA
:0A193C000A035400650073007400F4
:041946000403090489
:020000040030CA
:0E00000020321F1EFF8881FF03C003E0034073
:00000001FF
where the example Hex file of MikroC is of 17 KB.
Problem is that my code is not working at all and no error is showing by the compiler where statistics show 37.1% of RAM and 39.5 of ROM but small hex file didn't look in that mood. And if I compile the example project in my compiler it's hex become small and code don't work at all on Proteus V8.1.