USB Human Interface Joystick Demonstration Create a HID USB Device (sample Joystick) By Jared St.Clare, October 2009 Version 1

Similar documents
3. USB DRIVER Installation of USB driver Driver for Infinity SD Data Logger. INFINITY Series Acquisition Tools Manual

An Introduction to MPLAB Integrated Development Environment

Configuring FSUIPC with the CH USB Yoke, Rudder Pedals and Throttle Quadrant. version by John Cook

Coyote SP - Installation Notes

Basic Use of the SPC Feature on 1100R+/H+ Testers

1 Getting Started. Before you can connect to a network

Guide to Installing BBL Crystal MIND on Windows 7

How To Use An Ams 5812 Pressure Sensor With A Usb Starter Kit

How To Set Up A Local Printer On A Remote Computer With A Local Computer (Or Remote) On A Local Network (Or A Remote) With A Printer On Your Local Computer On A Pc Or Ipod) On Your Pc Or Mac Or Ip

Midland BT Updater BTUpdater Program Program file (x86) ), Midland

Installing Cobra 4.7

Configuring USB Driver, ConFiG SoftRock Tool and High Definition Software Defined Radio Revised 27-September-2015

Low Profile Ultra ATA-133 RAID PCI Host

Checklist for Migration to Windows 7

Adding the BU IMAP Inbox 1. Along the left side of the screen, there is a Mail column. Look for the All Mail Folders section.

LEN s.r.l. Via S. Andrea di Rovereto 33 c.s CHIAVARI (GE) Tel Fax mailto: len@len.it url: http//

Using Karel with Eclipse

Installation Instructions

AIM SOFTWARE AND USB DRIVER INSTALLATION PROCEDURE

Enjoying EPUB ebooks on Your Nook

Copy Documents from your Computer (H Drive) to a Flash Drive

Plena Voice Alarm System Firmware update

How to install and set up the WinSCP software for Secure File Transfer

How to download ebooks to a PC and transferring them to a Nook device

Downloading ebooks to a PC & Transferring the ebook to a Sony Reader or Nook

Execu/Touch Printer Set-up

Iridium Extreme TM Satellite Phone. Data Services Manual

PIGCHAMP MOBILE. PigCHAMP Knowledge Software. Installation Guide for Mobile Units

Installing FileMaker Pro 11 in Windows

Working Together - Your Apple Mac and Microsoft Windows

Print Audit 6 Network Installation Guide

Install USB drivers on Windows

Firmware & Software update procedures Amicroe TouchTAB IV.

Compressor Supreme Force Feedback User Manual

Centurion PLUS CPC4 Download Guide

Global Monitoring + Support

Database Operations (Backup/Restore/Move/Manage) Technical Support Engineering Rosslare Security NA For more information please see

SOFTWARE INSTALLATION INSTRUCTIONS

STIM202 Evaluation Kit

Do not connect the printer to your computer s USB port until step #10

CANON FAX L360 SOFTWARE MANUAL

Technical Information Sheet Page 1 of 8

Instructions for Installing and Using the FOCUS DL-15 Data Transfer Software

Tutorial for MPLAB Starter Kit for PIC18F

Filtering with Microsoft Outlook

Colorfly Tablet Upgrade Guide

1. How to install CDM driver on PC for Lambda devices

64-Bit Compatibility with Micromeritics Applications

How to install USB driver (MICRO/I)

Allworx OfficeSafe Operations Guide Release 6.0

USB3.0 Docking Station. User Manual (DA-70546)

Installing Global Logger USB Drivers

How to install USB driver (MICRO/I)

ENTTEC Pixie Driver API Specification

CISCO VPN CLIENT INSTALL AND UPDATE INSTRUCTIONS

Xythos on Demand Quick Start Guide For Xythos Drive

QL-PROG Microchip MCU Programmer User s Manual Qianlongsheng Electronic Technology Co., Ltd.

Rogue RE-CONN Utility

Orange Apps UserLogonUSB V1.0

How To Install Galaxy Desktop On A 64 Bit Computer (For A 64Bit) On A 32 Bit Computer Or Ipad Or Ipa (For An Ipa) On An Ipad (For Pc) Or Ipac (For Mac) On

COMBOGARDPRO. 39E Electronic Combination Lock SOFTWARE INSTALLATION INSTRUCTIONS

Page 1 S5.5 Monitoring Software Manual Rev 1.2 for Software Ver 1.0

SP8 Programmers 硕 飞 科 技. User's Guide. TEL: FAX: WEB:

InSciTek Microsystems 635 Cross Keys Park Fairport, NY Setting up Your Phones

How to make a VPN connection to our servers from Windows XP

Why should I back up my certificate? How do I create a backup copy of my certificate?

WA Manager Alarming System Management Software Windows 98, NT, XP, 2000 User Guide

Seagate Manager. User Guide. For Use With Your FreeAgent TM Drive. Seagate Manager User Guide for Use With Your FreeAgent Drive 1

Please read and understand this instruction manual thoroughly before using this product.

POS-X Stock Manager User s Guide

Theater Management Software V5.6

Volume AIG. AGKSOFT ActiveSync Inventory Guide. ActiveSync Inventory Guide

Fruit Machine. Level. Activity Checklist Follow these INSTRUCTIONS one by one. Test Your Project Click on the green flag to TEST your code

Maintaining the Content Server

Virtual Office Remote Installation Guide

An introduction to nxpusblib. March 2012

Netwatch Installation For Windows

WA1791 Designing and Developing Secure Web Services. Classroom Setup Guide. Web Age Solutions Inc. Web Age Solutions Inc. 1

How to Configure Outlook 2003 to connect to Exchange 2010

Contents First Time Setup... 2 Setting up the Legal Vault Client (KiteDrive)... 3 Setting up the KiteDrive Outlook Plugin Using the Legal Vault

Energy Monitoring Dashboard. User Manual

Site Monitor. Version 5.3

UMI3 Parametric USB MIDI Foot Controller. User s Manual

Project management integrated into Outlook

Configure Outlook 2013 to connect to Hosted Exchange

GIGATRAK CLIENT INSTALL HANDHELD TERMINAL

Only smart people read the manual.

Updates Click to check for a newer version of the CD Press next and confirm the disc burner selection before pressing finish.

Hosting Users Guide 2011

ANDROID RECOVERY STICK QUICK START GUIDE

BioWin Network Installation

ø Mobile Broadband User Guide Pay & Go

Install MS SQL Server 2012 Express Edition

User Guide HUAWEI UML397. Welcome to HUAWEI

Addendum Advanced POS Printer Drivers

HOW TO INSTALL FS USB TRANSCRIPTION SOFTWARE (OFFICE ADMIN MEDICAL)

Pro Flight Rudder Pedals

1 Basic Configuration of Cisco 2600 Router. Basic Configuration Cisco 2600 Router

COPYRIGHT TOP NOTCH TABLETS LLC HOW TO: Install the Drivers to your PC so you can Flash Firmware to your RK3066 Powered Tablet.

Connecting Your Windows Mobile Device to Your PC

Transcription:

Create a HID USB Device (sample Joystick) By Jared St.Clare, October 2009 Version 1 1. Use EasyHid to create the generic files and USB files. Select the correct pic chip that you plan to program. We re going to call this project Racewheel. 2. If this is not the first time using EasyHid you need to generate a new PID serial number. Default values should be ok. 3. EasyHid will create files in two folders. We want all the files in the PicBasicPro folder. These can be moved to your working directory. The other folder (VisualBasic) can be deleted. 4. Of all the files you just copied, we re interested in just two: Racewheel.pbp main program (or hardware config) DescRacewheel.asm our descriptors (or software config). 5. At this point we need a plan on what our device will do (i.e. number of buttons, axis etc). For this joystick we ll use 4 buttons and 2 axis. 6. First, we will be using the Descriptor Tool to build our descriptor report. A report descriptor is built from scratch by adding Hid Items. Eventually we will copy the completed report descriptor into our DescRacewheel.asm file. 7. The report must always follow this general format: Usage Page(Generic Desktop) Usage ( type of hardware ) Collection (Application) Usage ( type of hardware ) Collection (Physical) Usage [Page] ( featured part of hardware ) Logical Min Logical Max Usage Min Usage Max Report Size Report Count Input (data, Var, Abs) Usage [Page) ( featured next part of hardware ) Same format etc etc End Collection End Collection I ve found that it is possible to leave some items out and your device will still work, however, the more you describe about the device the better chances you have that Windows and more importantly other software can use it without problems. Page 1

Report count, report Size,. Do yours add up? The USB data is sent in (multiple) byte (8 bit) blocks. The byte must be completely filled in else Windows will tell you your device isn t working properly. For example, if we have 8 buttons we would send the on/off status of these buttons in a single 1 byte report block. For 8 button reports: For 4 button reports: Report Count = 8 (8 buttons) Report Size = 1 (each button only requires 1 bit) Button 0 is LSB, Button 8 is MSB Report Count = 8 (4 buttons + 4 spare ) Report Size = 1 (each button only requires 1 bit) All 8 bits are still used, because the report block must be complete. We just ignore the 4 wasted bits. This is a descriptor report for a 4 button joystick. Page 2

What about the analog axis reports? Like above, the report block is sent as a 1 byte block. This makes things pretty straight forward, esp. if the analog value of our pot (axis) is 8 bit (0 255 range). For a x2 axis report: Report Count = 2 (2 axis inputs eg X+Y) Report Size = 8 (8bits = 256 analog value of pot) All 8 bits are used per report block, and the PIC is sending two blocks. The rest of the report is pretty much a no brainer. Study the included example for a better understanding of the different Hid items and their values. Here is our completed descriptor file for 4 buttons and 2 axis Joystick: 8. Save the report to a.hid file for later use and save the report as a.h (header text file) so that we can edit in MicroStudio. Open up the.h header text file (desc1.h). 9. Step 1: use Replace to add RETLW 0x to all of the fields starting with 0x. Step 2: use Replace to change the // comments out to a ; Step 3: use Replace to change all commas to a space Step 4: put each RETLW on it s own line Step 5: delete any other junk at top and bottom of the report. I use a batch file to do most of the editing for me. Page 3

This is what part of the edited descriptor looks like. 10. Now cut and paste all of the descriptor into the DescRacewheel.asm file. This must go between the [ReportDescriptor1]. [EndReportDescriptor1] section (replacing all the data that was already there). Save this file. 11. Time to edit the main program Racewheel.pbp file. As stated before, I like to think of this as hardware setup. All the basic USB stuff has already been configured by EasyHid. We need to do a few things to finalize our program settings. Configure hardware (ports, clock freq etc) Modify the USBBufferSize based on our USB report descriptor Configuring hardware is no different to any other pic program. Our project requires four digital inputs and two analog inputs. Since the joystick will only be sending data to the pc, we can delete all references to DoUSBin and RxBuffer. USB buffer size, how big should it be? We have 4 buttons, and 2 axis. The buttons require 1 bit of data, and each axis requires 8 bits. That s a total of 8 + 8 + 4 = 20 bits. As the data is sent in 8 bit blocks, the USBbuffer requires 3 bytes (3x8bits = 24bits). The last 4 bits won t be used, sound familiar? Byte 0: Bits 0 7 for Axis X Byte 1: Bits 8 15 for Axis Y Byte 2: Bits 16 19 for the buttons Page 4

This is what our program looks like for setting the buffer size: USBBuffer is a 3 byte array. Now all we need to edit is the main program loop. This is what it looks like: So our program loops through, reading the analog value of X axis, it s 8 bit value is stored into the first byte of our array, Y axis, stored in the second byte of the array, and the 4 buttons, stored the third byte of the array. Finishing up. Compile the program and run. Do Dee! Windows should detect and install the RaceWheel and you can monitor this via opening joysticks in the control panel. Disconnect the Pic and our RaceWheel is removed from the list of joysticks. Dee Do! What if it doesn t work? Do Do! Or device not working properly. If you get the dreaded Do Do! sound, leave the pic connected, open up windows device manager, expand the Human Interface Devices group and delete the Human Interface Device that corresponds to our joystick. Disconnect the pic and re-connect. This should fix it. If you still get device not working properly, there is a problem with your descriptor settings or your pic isn t configured properly. Page 5

RaceWheel Connected and ready to use: I hope this little demonstration gives you a foot in the right direction. Try adding a throttle axis or some more buttons. For you flight simmers, how about a 64 button overhead panel or make your own rudder pedals? Enjoy!. Jared St.Clare Page 6