Enabled: False Interval: The program in its entirety is presented at the bottom of this page. Hopefully, the code is sufficiently-well commented to enable the reader to figure out how the program works. The code is fairly generic, so it should be possible to make modifications to the implementation with only minor changes to the code. In this single-player version of the game, the computer operates the left-hand paddle according to the program logic provided. It attempts to vertically align its paddle with the ball when the ball enters the left-hand half of the court travelling from right to left. The player operates the right-hand paddle, and always serves first; after that, whoever wins the point gets to serve.

Author:Faucage Meziramar
Language:English (Spanish)
Published (Last):12 November 2004
PDF File Size:16.32 Mb
ePub File Size:14.67 Mb
Price:Free* [*Free Regsitration Required]

The USB device consisted of a microphone, the microprocessor and other hardware and the device sent audio data to the host computer. Hopefully this information will be helpful to your project. Table of Contents Results - the project worked! This involved building the device hardware microprocessor, microphone, and supporting electronics and software microprocessor code and host computer code. To top. There are lots of other features of USB. The specifications for USB are available at www.

Be warned that while this information is very thorough, it is not very practical for developing a device or software. Technical documents are available at www. Here is a quick overview of what is involved in USB. The signal wires usually operate in differential mode one is high while the other is low. There are two types of USB devices: high speed and low speed.

There are differences in the type, length and connectors that can be used with the two types. Generally the requirements are stricter for high speed devices.

A high speed device can transfer data at a maximum of 12 Mbs while low speed is limited to 1. The PIC 16C can only operate at low speed standard. The connector at the computer A End is a flattened rectangle while at the device B end the connector is square with two cut-off corners necessary to be compliant with the high-speed standard but optional for low speed devices.

Each USB device is able to draw mA from the cable which allows a device to be bus powered. A device can negoiate up to mA once connected to the USB cable but this power may not be available. If the power is unavailable the device must stay in a low power setting. Obviously devices can be powered externally as well. The Software: When a device is connected, the computer or a hub detects the device by a pullup resister see circuit. When detected a series of enumeration steps are started.

The enumeration process assigns an identifier number to the device there can be a maximum of devices on a network and also tells the host computer what sort of capabilities a device has input, ouput, etc. If the device identifies itself as a HID Human Interface Device then the device describes how the data should be interpreted. See the section on HID. During the enumeration process, the device describes the information that it can receive and send.

This allows a host computer to handle the data being received from the USB device without requiring a specially designed device driver. The HID class is supposed to include devices such as a mouse, joystick, keyboard, etc. Because the host computer knows what the data means a device driver is not necessary for HID devices, the operating system can supply a generic HID driver. For instance, if you plug in a USB Mouse, it will immediately work because the OS knows how to interpret information received from a mouse.

Information on the HID class can be found at www. Some other useful tools are available from Intel University Press[ 1 ]. Unfortunately the program is more complicated than it needs to be and is not a good example of using the USB functions. This chip belongs to a two chip family along with the 16C called the 16c7xx.

The 16C is a 28 pin microprocessor operating at 24 Mhz. It has 8K of program memory, bytes of RAM and 5 x 8bit analog inputs the 16C has 40 pins and 8 analog inputs.

The specifications are available from Microchip. The reference manual for the mid-range microprocessors is also useful. Another necessary component is the USB firmware. The support files that I used seem to no longer exist on the Microchip web site being replaced by a more sophisticated USB example. The name comes from the set the messages being described in Chapter 9 of the USB specification. The HID interface support.

This file handles requests for information relating to the HID specification. This is a file called hidclass. The device descriptor. This file contains the data that will be sent to the host during the enumerator process. Most of the values are fully specified by the USB spec but the vendor id, product id and version number all specified here. Importantly, the HID descriptor is stored in this file. This file is called descriptors.

The version you download identifies the device as a mouse to the host. The demo program. This program sets up the interrupts and initializes the USB code. It also runs through a loop that causes the cursor to move in a box shape on the screen. This program demonstrates how you use the USB specific functions to communicate with the host. This file is called main. Even a single difference in a hex value will cause a failure in the enumeration process.

If you are using a HID descriptor, make sure that the number of bytes described in your descriptor is exactly the same as the number of bytes you are actually sending. Because this chip is not available in a flash version, a UV light is also required in order to erase the program before it can be reprogrammed. If you are looking for a suitable third party programmer, look for those that have an external power supply of at least 12V.

Host Computer Code Once a have is connect, you want to send and receive data from your applications. It is also possible to do this in Visual Basic see below The following examples assume you are using Windows Windows 95 did not fully support USB. I used to have links directly to the appropriate page on the Microsoft MSDN website but Microsoft, in their wisdom, rearrange their website every 6 months or so, breaking all the links.

Compiling code to use these function calls requires that you install the Windows DDK Device Development Kit which used to be freely available from the Microsoft website see below obtaining copies of the required dlls and header files. A good source of examples is at the web site for the book USB by Example[ 1 ]. The files HIDinterface. The code returns a file handle to the USB device which allows a program to read and write data with the device just like with a regular file handle.

Note that this code is not a fully working program - it requires, at the minimum, a main function. The code samples are: usb. These are from the Microsoft DDK which used to be freely available.


USB Development Board PIC16C765



USB and PIC Microprocessors 16C745 and 18F2455


Related Articles