//This program echoes characters received via USB
//Use the mikroElektronika HID Terminal (Tools menu)
//to send/receive characters

//<USB>
char USBin[64];
char USBout[64];
//</USB>

void interrupt() {
  USB_Interrupt_Proc();
}

void main() {
  OSCCON = 0b01110000;          //8MHz
  PLLEN_bit = 1;                //Enable PLL (now 48MHz)
  HID_Enable(&USBin,&USBout);   //Enable HID communication
  while (1) {
    if (HID_Read() != 0) {
      strcpy(&USBout, &USBin);
      HID_Write(&USBout, 64);
    }
  }
}