|
ME Labs, Inc. 719-520-5323 |
|
|
|
ME Labs, Inc. | 1-719-520-5323 | Example Program - USBJADEM.pbpPICBASIC PRO USB sample program implements the functionality of the Jan Axelson demo which accepts two numbers from the host, increments each and sends them back. An application running on the host sends the numbers and displays the returned values. Compilation of this program requires that specific support files be available in the source directory. You may also need to modify the file USBDESC.ASM so that the proper descriptor files are included. For detailed information, see the file PBP\USB18\USB.TXT.' Name : USBJADEM.pbp
' Compiler : PICBASIC PRO Compiler 2.6
' Assembler : MPASM
' Target PIC : PIC18F4550 or similar type
' Hardware : LAB-XUSB Experimenter Board
' Oscillator : 20MHz external
' Keywords : USBSERVICE, USBINIT, USBIN, USBOUT
' Description : PICBASIC PRO USB sample program implements the
' functionality of the Jan Axelson demo which accepts two numbers
' from the host, increments each and sends them back. An application
' running on the host sends the numbers and displays the returned values.
' Compilation of this program requires that specific support files be
' available in the source directory. You may also need to modify the
' file USBDESC.ASM so that the proper descriptor files are included. For
' detailed information, see the file PBP\USB18\USB.TXT.
'
Define OSC 48
Include "ja_desc.bas" ' Include the HID descriptors
buffer Var Byte[8]
cnt Var Byte
USBInit
' Wait for USB input of 2 numbers.
idleloop:
USBService ' Must service USB regularly
cnt = 8 ' Specify input buffer size
USBIn 1, buffer, cnt, idleloop
' Message received. Increment the bytes and send them back.
buffer[0] = buffer[0] + 1
buffer[1] = buffer[1] + 1
outloop:
USBService ' Must service USB regularly
USBOut 1, buffer, 2, outloop ' Send the bytes back
Goto idleloop ' Wait for next buffer
End
Download the program file. |
|
Copyright 2022 ME Labs, Inc. PO Box 8250 Asheville NC 28814 (719) 520-5323 (719) 520-1867 fax email: support@melabs.com |
|