Advertisement
Guest User

Untitled

a guest
Nov 5th, 2012
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.70 KB | None | 0 0
  1. unsigned char readbuff[64] absolute 0x500;   // Buffers should be in USB RAM, please consult datasheet
  2. unsigned char writebuff[64] absolute 0x540;
  3.  
  4. char cnt;
  5. char kk;
  6.  
  7. void interrupt(){
  8.    USB_Interrupt_Proc();                   // USB servicing is done inside the interrupt
  9. }
  10.  
  11. void main(void){
  12.   ADCON1 |= 0x0F;                         // Configure all ports with analog function as digital
  13.   CMCON  |= 7;                            // Disable comparators
  14.  
  15.   HID_Enable(&readbuff,&writebuff);       // Enable HID communication
  16.  
  17.   while(1){
  18.     while(!HID_Read())
  19.       ;
  20.  
  21.     for(cnt=0;cnt<64;cnt++)
  22.       writebuff[cnt]=readbuff[cnt];
  23.  
  24.     while(!HID_Write(&writebuff,64))
  25.       ;
  26.   }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement