USB Endpoints


Closed Thread
Results 1 to 13 of 13

Thread: USB Endpoints

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429

    Default

    Quote Originally Posted by Squibcakes View Post
    Thanks nimonia,

    Yeah I just use EP 1 for my usb programs and it seems to always work. There is a lot of stuff out there on USB, but most of it's jargon and doesn't explain it easily.

    I too have been messing with a HID keyboard interface and almost have it working.

    I can mimic the Num lock, scroll lock, and caps lock leds on my test PCB when they're pressed on the main PC keyboard.

    I can send the special keys (shift, control, GUI)

    I can and send regular key chars but... I have a problem with the chars repeating. So if I press the key "J" for instances it keeps on sending, my program seems to be stuck in the DoUSBout out loop. I've tried sending a $00 code as a keystop but this doesn't work.

    Have you run into this problem at all? Anyone else?
    Cheers
    Squib

    ----

    OK I sussed this one out hrs after posting... always the way!
    Squibcakes, could you post your code for using USBIN to receive the PC's packets with the keyboard LED status?

    I'm also making a USB keyboard, and I've got the PIC->PC communication working perfectly, but struggling with the PC->PIC communication.

    Thanks

  2. #2
    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