usb joystick

Not rated 15,985

Circuit Image

With the phasing out of game, serial, and parallel ports from modern computers and the increasing popularity of USB, it is beneficial for hobbyists to learn how to work with USB. However, USB is a complex protocol that can be intimidating to implement. Fortunately, there are several solutions available that simplify the process of creating USB devices. This project focuses on using a USB PIC and the mikroC compiler to convert an old game port joystick for USB use. One advantage of the mikroC compiler is its built-in USB HID libraries, which facilitate the creation of USB HID devices. When programming USB code with the mikroC compiler, the resulting USB device is a generic HID device capable of transferring data to and from the PIC. However, the USB descriptor generated by mikroC can be modified to create a specific USB HID device, such as a keyboard, mouse, joystick, or graphics tablet. The 76H1571 is a 4-button joystick featuring a throttle and a POV hat. Notably, the throttle and POV hat cannot be used simultaneously; only one or neither can be active at a time. The two slide switches on the joystick's front allow the user to toggle the throttle and POV hat on and off, enabling the selection of which feature to use. Since this restriction does not apply with USB, the converted joystick will allow both the throttle and POV hat to function simultaneously, rendering the two switches redundant. They can be repurposed as additional buttons. When the compiler generates the USB HID code, it creates a descriptor sent to the USB host, indicating the type of USB device. A HID device descriptor is slightly different, containing an extra descriptor that specifies the HID device type and its usage. This section can be modified to configure the device as a joystick. The USB Implementers Forum (USB IF) website offers a useful tool for creating HID report descriptors, known as the HID Descriptor Tool, which can be downloaded for free from the HID Tools page. After downloading and extracting the archive, running Dt.exe allows users to create a custom report descriptor for their joystick (or any other HID device), specifying the number of axes, buttons, and additional features such as rudder pedals and throttles. The tool also includes pre-made descriptors that can be immediately utilized or modified, located in the same folder as the executable and identifiable by their .hid extension. The pre-made joystick descriptor is named joystk.hid, which is the one used in this project. Upon loading, the user will see the REPORT_SIZE property, defining the data width for the parameter, and the REPORT_COUNT property, determining how many reports are sent for the parameter. After creating the report descriptor, it needs to be exported into C code. This can be accomplished by selecting File -> Save As in the HID Descriptor Tool and changing the file type to Header File (*.h). Incorporating the header file into the descriptor generated by mikroC requires some adjustments. The mikroC descriptor features a comma zero following each byte (excluding quotes), which necessitates modifying the generic report descriptor to include this padding. Once this adjustment is made, the descriptor will resemble a specific format. The next step involves deleting the report descriptor generated by mikroC and replacing it with the custom one. This process begins by creating the mikroC descriptor using the mikroC HID tool and then opening it in an editor for further modification.

The project involves several key components and steps to successfully convert an old game port joystick to a USB-compatible device. The use of a USB PIC microcontroller allows for seamless integration with the USB protocol, while the mikroC compiler streamlines the coding process through its built-in libraries. The HID Descriptor Tool is crucial for customizing the joystick's functionality, enabling the specification of buttons and axes according to the user's requirements. Additionally, the ability to repurpose the joystick's original switches as extra buttons enhances the device's usability. The implementation of a custom HID report descriptor ensures that the joystick can fully utilize its features without the limitations imposed by the original game port design. Overall, this project exemplifies the transition from legacy input devices to modern USB technology, providing an engaging opportunity for hobbyists to explore and innovate in the field of electronics.With the phasing out of game, serial and parallel ports from modern computers and the ever increasing popularity of USB, it makes sense that hobbyists start getting to grips working with USB. Unfortunately, USB is not a simple protocol and can be daunting to viagra online paypal implement. Luckily, there are several solutions on the market that ca n make implementing a USB device much easier. This project focuses on the use of a USB PIC and the mikroC compiler to convert an old game port joystick to utilize USB. One of the advantages of the mikroC compiler are the built USB HID libraries that make creating a USB HID device a doddle.

When writing USB code using the mikroC compiler, the USB device produced is a generic HID device that can be used to transfer data to and from the PIC. However, it is possible to modify the USB descriptor generated by mikroC so that it produces a specific USB HID device, like a keyboard, mouse, joystick or graphics tablet.

The 76H1571 is a 4-button joystick with a throttle and POV hat. What`s interesting to note is that you can`t use the throttle and POV hat at the same time you can only use one or neither. The two slide switches on the viagra prescription online front of the joystick are used to switch the throttle and POV hat on and off, so that you could choose which one you wanted to use.

Because there is no point for this restriction with USB, the converted joystick will be able to use both the throttle and POV hat at the same time. This then makes the two switches at the front redundant, so why not add those as two extra buttons When the compiler generates the USB HID code, it creates a descriptor that is sent to the USB host that tells it what type of USB device it is.

A HID device descriptor is slightly different as it has an extra descriptor embedded in it that specifies the type of HID device and how it is used. It is this section that will be modified to change our device into a joystick. The USB IF website contains a useful tool that greatly facilitates the creation of HID report descriptors.

It`s called the HID Descriptor Tool and can be downloaded for free from the HID Tools page. Once downloaded, extract the archive and run Dt. exe. Using the tool, it is possible to create your own report descriptor for your joystick (or any other HID device), specifying the number of axis and buttons it has and any other features (rudder pedals, throttles etc). However, the tool also comes with some premade descriptors that you can immediately use or modify to suit your needs.

They are found in the daily cialis pill same folder as the executable and are distinguishable by their. hid extension. The premade joystick descriptor is calledjoystk. hid and this is the one I used. Once loaded, you`ll be presented with the following screen: You`ll notice that theREPORT_SIZE property defines the width of the data used to represent the parameter and theREPORT_COUNT property determines how many reports are sent to represent the parameter.

With your report descriptor created you need to export it into C code. To do that, click onFile->Save As in the HID Descriptor Tool. In the Save dialog that appears, change the file type toHeader File (*. h). Adding the header file into the descriptor generated by mikroC requires a little bit of work. If you have a look at the mikroC descriptor, you`ll notice that every byte is followed by, 0` (ignoring the quotes, that`scomma zero). You will need to modify the generic viagra caverta caverta pillshoprxcom report descriptor you generated to include this padding.

After doing that you`ll end up with a descriptor that look something like this: Now that the descriptor has been padded, the next step is to delete the report descriptor generated by mikroC and replace it with your one. To do that, first create the mikroC descriptor using the mikroC HID tool, then open it up in the editor.

The actual descriptor data itself i 🔗 External reference