HID USB on 18F87J50


Closed Thread
Results 1 to 40 of 57

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    755

    Default Re: HID USB on 18F87J50

    I try cdc from pbp/usb18 and add config, but still nothing...
    I use 8MHz crystal, so PPLDIV is 2 is that correct?
    What are the chances that the USB module on 3 PIC are broken?

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530

    Default Re: HID USB on 18F87J50

    Not very high. But (speaking for myself), the chances of the problem being behind the keyboard is pretty high! Just not sure what I could be missing here, doing it two different ways hid, and cdc, and with a USB bootloader, and without. So I am running out of things I can think of to try....

    Yes, divide by two would be correct for a 8 mhz.

  3. #3
    Join Date
    Sep 2009
    Posts
    755

    Angry Re: HID USB on 18F87J50

    I check hardware and recheck, and everything seems ok.
    Here is code for cdc from pbp/usb18:
    Code:
        asm
        CONFIG PLLDIV = 2       ;for 8 mhz chip
        CONFIG XINST = OFF
        CONFIG STVREN = ON    ;stack overflow reset
        CONFIG WDTEN = OFF    
        CONFIG CP0 = OFF    
        CONFIG IESO = OFF    
        CONFIG FCMEN = OFF    
        CONFIG CCP2MX = DEFAULT    
        CONFIG WDTPS = 32768 
        CONFIG CPUDIV = OSC1  ;DIVIDE BY 1 MODE
        CONFIG FOSC = HSPLL
        CONFIG MSSPMSK = MSK5  
        endasm
        Include    "cdc_desc.bas"    ' Include the HID descriptors
    
    Define  OSC     48
    
    buffer    Var    Byte[16]
    cnt    Var    Byte
    
    
        OSCTUNE.6 = 1        ' Enable PLL for 18F87J50 family
        Pause 10
    
        USBInit            ' Get USB going
    
    ' Wait for USB input
    idleloop:
        USBService        ' Must service USB regularly
        cnt = 16        ' Specify input buffer size
        USBIn 3, buffer, cnt, idleloop
    
    ' Message received
        buffer[0] = "H"
        buffer[1] = "e"
        buffer[2] = "l"
        buffer[3] = "l"
        buffer[4] = "o"
        buffer[5] = " "
        buffer[6] = "W"
        buffer[7] = "o"
        buffer[8] = "r"
        buffer[9] = "l"
        buffer[10] = "d"
        buffer[11] = 13
        buffer[12] = 10
        buffer[13] = 0
    
    outloop:
        USBService        ' Must service USB regularly
        USBOut 3, buffer, 14, outloop
    
        Goto idleloop        ' Wait for next buffer
    I spend another day on it, and nothig, rely, nothin on usb...
    I really don't know what to do.

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