Easy HID Command -Response application


Results 1 to 26 of 26

Threaded View

  1. #9

    Default

    Where should this go?

    I cut'n'pasted from the above code section, into microcodestudio, then added this to the top, before the define

    Code:
    ' **************************** Added from other demo
    buffer	Var	Byte[16]
    cnt	Var	Byte
    LED	Var	PORTB.0
    Define  OSC 48
    '****************************************************
    
    high led


    Then at the bottom after overusbservice I added the usb in/out and a led flash to show its alive

    Code:
    idleloop:
    
        low led
        pause 500
        high led
        pause 500
    
    	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:
    	
        USBOut 3, buffer, 14, outloop
    
    	Goto idleloop	' Wait for next buffer
    usbinit and usbservice was removed from the code of the other demo like it says to.

    It looks to me like a worker, but i get compile errors, lots of them

    This one

    Code:
    IDLEIF             VAR UIR.4         ; USB Idle Interrupt Flag
    <
    gives me a bad datatype (first of a few)

    and this one

    Code:
        UIE = $7F                    ; enable USB interrupts
    throws up a syntax error with some more below it


    I tried it as

    INCLUDE "USB_ASM_Service"

    At the top of my little test and MCS opened it as a 2nd page, and threw up the same errors.

    Just for completeness thats here
    Code:
    include "USB_ASM_Service.pbp"
    
    ' **************************** Added from other demo
    buffer	Var	Byte[16]
    cnt	Var	Byte
    LED	Var	PORTB.0
    Define  OSC 48
    ' ****************************************************
    
    high led
    
    idleloop:
    
        low led
        pause 500
        high led
        pause 500
    
    	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:
    	
        USBOut 3, buffer, 14, outloop
    
    	Goto idleloop	' Wait for next buffer
    Last edited by f_lez; - 1st November 2009 at 17:05.

Similar Threads

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