Você está na página 1de 7

PROJECT: USB controller for DIY games on PIC18F2455

MAIN CHARACTERISTICS:
· 6 axes to 10 bits (1024 steps)
· 32 buttons
· Hat switch with 8 positions (0 to 315º)
SPECIAL FEATURES:
· Built-in bootloader
· Possibility to expand very easily with small auxiliary plates

NOTE: this tutorial is only intended to be a guide to get to the construction of the plate without
deepening on issues of USB connection, HID devices, or programming of microcontrollers. They are
only necessary basic knowledge of electronics, tin welding and circuit construction printed PCB.

THIS PROJECT IS PROVIDED IN THE CONDITION "AS IS", WITHOUT WARRANTIES.


I DO NOT MAKE ANY RESPONSIBILITY FOR THE UNFORESEEN USE OF THE PLATE, OR
FOR THE DAMAGE THAT MAY OCCUR, SINCE THE CONSTRUCTION IS ON ACCOUNT
OF THE INTERESTED.

Anyway, any questions that arise during the construction, evaluation, implementation
operation and future modifications, you can contact me in the XtremeRacers forum thread.
http://www.xtremeracers.info/forums/viewtopic.php?f=45&t=5696

The project is based mainly on the modification of the mouse example included in the Framework
V2.4 Microchip for the PICDEM FS USB development board. My special thanks to Rawin Rojvanit,
without his contribution this would not have been possible.The MCHPFSUSB can be downloaded
from:
MCHPFSUSB Framework v2.4
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2651&param=en5344
94

Schematic design
I have worked from figure A-2 found in the documentation "PICDEM FS USB UserGuide 51526a.pdf
"included in the Framework.
The basic modifications are:
I changed the way to enter the bootloader to have available the leg 25 of the PIC (RB4 - AN11)
Switch S2 is now connected to pin 6 (RA4)
List of components
1 PIC18F2455 Microcontroller (PIC18F2550) (IC1)
1 Socket for integrated 28 pins, otherwise one of 20 and one of 8
1 20 Mhz crystal (Y1)
2 Switch for PCB (S1, S2)
1 LED (D2)
2 Resistances of 10Kohm (R1, R2)
2 470 ohm resistors (R2, R4), can be 1Kohm
1 Resistance of 1Kohm (R5)
1 Resistance of 1Mohm (R6)
1 470nF electrolytic capacitor, 16V (C6)
1 electrolytic capacitor 10uF, 16V (C5)
2 ceramic capacitors of 22pF (C2, C3)
2 ceramic capacitors 0.1uF (104) (C1, C4)
2 Diodes 1N5817, 1N4001, 1N4148 (D1, D39) 1N4148 are convenient due to the small size
1 USB cable to connect to the PC
1 strip of 40 pins
Various female connectors for pins, one strip 40
Cover for the connectors, a pair of strips of 20
Construction of the PCB
The design of the PCB is made to simple face since the components can be well located and it is not
Necessary space optimization.
In addition, being a DIY version, it is convenient to use basic techniques to make it easy building.
Anyway, I have not dabbled in the construction of double-sided circuits yet. The method used for the
construction is to use a domestic iron to transfer the circuit from the paper to the copper plate sheet.
In the XtremeRacers forum, there is a thread dedicated to the construction of PCBs.
http://www.xtremeracers.info/forums/viewtopic.php?=45&t=5110&sid=6a98edec78b3f1885a09d88f54
eb7a36

Here the design of the PCB with the dimensions in millimeters so that the scaling can be done. CAD
file download link to print "Plate 18F2455 LT97.dwg"
http://uploading.com/files/O04HQ4KE/Placa 18F2455 LT97.dwg.html
Once we have made the PCB, we drill it and get the components started with the assembly of the plate.

Plate assembly
The first components that we will weld are the ones with the lowest thickness, which are diodes and
resistors. Once we have all the welded components, we would have to stay more or less like this:
Before placing the PIC and connecting the board to the PC, we have to make sure that everything
point is fine.

CAUTION:
If the PIC receives reverse power, or in values that are not specified, we will get it burn, being useless.
Another point to consider is the power from the USB port of the PC. The USB ports are able to deliver
currents up to 100 mA, so a connection with inverted polarity It will surely consume more current, the
same would happen with a short circuit. In these conditions what most likely the USB port is unusable,
and hopefully not burn something else.
Now we proceed to test the plate
With a 5V DC power supply we will test the pins that correspond to the PIC feeding. For this test we
need a digital multimeter. When turning on the power, at least the LED that indicates the presence of
voltage should light up.

The pins in question are:


Pin 8 and 19 - Vss
Pin 20 - Vdd
With the negative tip of the multimeter connected to the negative of the power supply, we proceed with
the tip positive to sense the voltage level in the indicated pins.

Then we can test the continuity between the different pins of the socket for the PIC and the pins for the
Analog connections and the rows and columns of the keypad. We can also test if pushbuttons S1 and S2
are working well. With the positive tip of the multimeter placed on pin 1 of the socket, we should have
a indication around 5V, and when we press the S1 this value decreases to 0V.
The same for pin 6 and S2.
Recording the PIC with the Bootloader
Download link of "MCHPUSB_Bootloader.HEX"
http://uploading.com/files/YHIMECEX/MCHPUSB_Bootloader.hex.html

With any programmer of PICs we must load the bootloader in the micro. I use a programmer based on
JDM, very easy to build. Another important tool is the software that will serve us for programming.
I use the WinPic800, which is very useful, it is very complete in features and updated with support
to almost all the mics. I almost always run the application on an old PC (Pentium II) with serial port
and Win98. To run this programmer on a current PC with Vista or XP I think you have to do some
searching and load additional drivers, but this is beyond the purpose of this tutorial. The first thing is to
see that the WinPic800 and the programmer are working OK, for what you can run the micro detect
tool by pressing Ctrl + D.
Then we proceed to look for the .HEX of the bootloader to copy it to the PIC. We were missing the
construction of the USB cable, I did not put it before to not be tempted to plug the board to the PC.
In case you use a USB female connector to mount on the board instead of the four pins of the J1, it is
convenient to use a commercial cable with male chips at both ends. For those who chose the strip of
pins, you can buy a cable with male tab and the other end indifferent.
Cut the opposite end to the male tab and proceed to identify the cables.
GND: Black
D +: Green
D-: White
VBUS: Red
We assemble a connector with the arrangement according to the PCB and connect it to the board. The
expected moment, the first connection. With the first connection, the PC will not recognize any plate,
since the Bootloader is recognized when starting the plate with the S2 pressed. To continue we must
have already installed on our PC the MCHPFSUSB Framework, which has been created a folder at the
root of our rigid. It is highly recommended to read the "User Guide" of the PICDEM in the
documentation section of the MCHPFSUSB to understand the operation of the software to use
PICDEM FS USB Demo Tool. In the guide it looks very detailed how to proceed with the installation
of the drivers. I do not think it appropriate to transcribe to avoid confusion. Keeping pressed the switch
S2 proceed to press the S1 (reset), eye, do not drop the S2. As everything went well, and we have the
speakers plugged in and with good sound, we will listen to the classic noise that indicates that our
system has detected a new device. Then we execute the Demo Tool application to proceed with
programming.
Then we will load the .HEX of our Joystick 0.1 by clicking on "Load HEX File" Download link of
"MCHPUSB_Joystick 01.HEX"

http://uploading.com/files/GRL238C2/MCHPUSB_Joystick 01.hex.html

We click on "Program Device", when the process finishes, and then in "Execute". This performs a soft
reset on the micro and since we have not pressed the S2, it has to start our application, in this case the
Joystick 0.1. We go to the control panel and click on Games Devices. Then in properties and we see our
Joystick 0.1 working perfectly. In case the potentiometers or the button matrix are not connected, they
will surely have erroneous readings and behavior with a lot of noise. This is because the legs of the mic
should not be left in the air. In case of not using all the analog or a smaller button matrix, for example:
Three Axes X, Y, Z and 9 buttons,
The inputs Rx, Ry, Rz, RC7, RB0 and RC0 must be set to 0V.
Once everything is working, the D39 diode can be replaced by a bridge. This diode
We had put in for circuit protection.
That's all for now, any questions you find me in: (last revision 06/02/09)
http://www.xtremeracers.info/forums/viewtopic.php?f=45&t=5696

Você também pode gostar