User manual

668
mikoC PRO for dsPIC
MikroElektronika
Library Example
This example establishes connection with the HID terminal that is active on the PC. Upon connection establishment,
the HID Device Name will appear in the respective window. After that software will wait for data and it will return
received data back. Examples uses USBdsc.c descriptor le, which is in the same folder, and can be created by the
HID Terminal.
Copy Code To Clipboard
char cnt;
char readbuff[64];
char writebuff[64];
void USB1Interrupt() iv IVT_ADDR_USB1INTERRUPT {
USB_Interrupt_Proc();
}
void main(void){
AD1PCFGL = 0xFFFF;
HID_Enable(&readbuff,&writebuff);
while(1){
while(!HID_Read())
;
for(cnt=0;cnt<64;cnt++)
writebuff[cnt]=readbuff[cnt];
while(!HID_Write(&writebuff,64))
;
}
}
HW Connection