Easy HID Command -Response application


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Gremlins, or maybe the cats (if you have any).

    Make sure you have plenty of capicitance on the VUSB pin. (.22uF to .47uF)
    And have both a 10uF and 0.1uF capacitors on the Power Rails (VSS-VDD).

    Plugged, RX_READY and TX_READY are just normal "Bits".

    RX_READY indicates that data has been received. It should be cleared after use.
    Code:
    Main:
        IF RX_READY THEN        ; USB data has been rcvd
            RX_READY = 0        ; clear the Ready flag
            USBIN 1, Buffer, Cnt, Main
            LCDOUT $FE,1,STR Buffer
        ENDIF
    TX_READY indicates that the device is plugged in and the SIE is ready to accept data to send.
    Code:
        IF TX_READY THEN         ; USB is Ready to transmit
            TX_READY = 0         ; clear the Ready flag
            ADCIN 0, ADval
            ARRAYWRITE Buffer,[DEC4 ADval," "]
            USBOUT 1, Buffer, Cnt, TXfail
          TXfail:
        ENDIF
    GOTO Main
    DT

  2. #2

    Default

    Thanks for that i'll have a play with them tonight, shame i am away form home for tomorrow as i know this will be on my mind all day, issue is having two incoming serial data streams, and an outgoing serial + the usb out....

    Neither of the incoming streams seem to wait, so i have to write code that will be quick enough to read a command and react according ly before waiting for the next serial command or change of IO state, which would also require a serial out for status.... Oh and a RTC would be nice so i can say what time things happened.

    Its all so simple when i explain it real life....

  3. #3

    Default

    Hallo Darrel
    a question i have used your code and it work 100% with a array of 8 values, if i would like to transfer more values do i need to edit your file as well as in the main program

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    No, there's nothing in the USB_ASM_Service.pbp file to change.
    But you'll need to edit the report size in the Descriptor file, and the arrays in your program.

    If you were using DT_HID, you could do it all in your main program.
    DT

  5. #5

    Default

    Mabe i mis understand something i have a file in my project called DESCUSBProject witch acording to me is the file i need to change but i i understand corectly it is already setted to use 64 bytes but as soon as i try to send more than 8 my device shows a conection but no data comes through below a part of the descriptor file
    Code:
    #define	EP0_BUFF_SIZE		64	; 8, 16, 32, or 64
    #define	MAX_NUM_INT		1	; For tracking Alternate Setting
    #define	MAX_EP_NUMBER		1	; UEP1
    #define	NUM_CONFIGURATIONS	1
    #define	NUM_INTERFACES		1
    
    #define	MODE_PP			    _PPBM0
    #define	UCFG_VAL		    _PUEN|_TRINT|_FS|MODE_PP	; Full-speed
    
    ; DEVICE CLASS USAGE
    #define USB_USE_HID
    
    ; HID
    ; Endpoints Allocation
    #define	HID_INTF_ID		  0x00
    #define	HID_UEP			  UEP1
    #define	HID_BD_OUT		  ep1Bo
    #define	HID_INT_OUT_EP_SIZE	  64
    #define	HID_BD_IN		  ep1Bi
    #define	HID_INT_IN_EP_SIZE	  64
    #define	HID_NUM_OF_DSC		  1

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Assuming it's a descriptor file from EasyHID, and you have PBP 2.50 or prior.

    A little further down in the file you'll find a ReportDescriptor1.
    Inside that, there's an *** INPUT REPORT *** and *** OUTPUT REPORT ***
    And each of those has a ...

    Code:
        ; report count (number of fields)
        retlw    0x95
        retlw    0x08
    The 0x08 needs to be changed to match your array size.
    Only 8, 16, 32 or 64 are valid.

    hth,
    DT

  7. #7

    Default

    Thank you i entered it in hex and everything works

Similar Threads

  1. USB hid maker help please.
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd April 2013, 14:49
  2. i cant get 18f2550 work as HID
    By Ahmadabuomar in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 13th October 2009, 16:39
  3. Unusual Interrupts Application Problem
    By Joe Rocci in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th May 2009, 11:55
  4. Hid Maker FS Problems
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 24th April 2009, 21:27
  5. Making your own HID descriptor file
    By NL2TTL in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 27th April 2005, 12:35

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