USB Endpoints


Closed Thread
Results 1 to 13 of 13

Thread: USB Endpoints

Hybrid View

  1. #1
    Join Date
    Jun 2006
    Posts
    13

    Cool

    look, here is a interrupt handler of keyboard LED on 16C745 / 765

    ' Define interrupt handler
    DEFINE INTHAND usbint
    ' Assembly language interrupt handler
    asm
    ; W, STATUS and PCLATH registers already saved, save FSR
    usbint movf FSR, W
    movwf fsave
    ; Check interrupt source and vector there
    movlw high ServiceUSBInt
    movwf PCLATH
    btfsc PIR1, USBIF
    call ServiceUSBInt
    btfsc PIR2, USBIF
    call ServiceUSBInt
    ; Restore saved registers
    banksel UIR
    movf 0xC8,w
    clrf STATUS
    movwf kbdLED
    movf fsave, W
    movwf FSR
    movf psave, W
    movwf PCLATH
    swapf ssave, W
    movwf STATUS
    swapf wsave, F
    swapf wsave, W

    retfie ; Return from interrupt
    endasm

    before the kbdLED should be defined in Picbasic static (important !):
    kbdLED VAR BYTE bank0 system

    on 18F Chips the code have to be placed in the USB interrupt routine.
    LEDs are using the EP0 control transfere.
    To get pc->pic communication use a component device with a HID + Keyboard interface.
    Last edited by sirnoname; - 27th June 2007 at 17:48.
    www.x-sim.de
    freeware simulator software
    with real MS Force Feedback solution

Similar Threads

  1. USB CDC Communications for Dummies!
    By Squibcakes in forum USB
    Replies: 104
    Last Post: - 15th January 2014, 13:43
  2. USB Bootloader.
    By HenrikOlsson in forum USB
    Replies: 22
    Last Post: - 2nd May 2013, 02:46
  3. Simple USB Comms Problem
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th January 2010, 20:17
  4. One USB keyboard to Two USB Ports
    By picnaut in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th June 2009, 00:04
  5. USB PIC without USB Connection
    By Tissy in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 26th December 2005, 17:39

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts