10Bit Joystick II

PCB Assembly
The first components soldiered are the smallest size, which are the diodes and resistors


Once you have soldered all components, It should look more or less like this:



 Before you insert the PIC and connect the PCB to your PC we need to check and ensure that
what we did is 100% correct.
 
CAUTION:
If the you reverse powered the PIC MCU, or the voltage is outside the specified values, the Chip will burn, and it will be useless to use. Another point to consider is the power from the USB port of your PC. The USB ports are capable to deliver a currents of up to 100mA, so a reverse polarity connection probably consumes more current, so you would shortcircuit the PCB. Under these conditions it is more likely, the USB port will not communicate, and hopefully you do not burn anything else.
 
We now proceed to test the Board
With a proven 5V DC power supply, we'll check the connections to the corresponding power pins for the PIC18F2455. We'll use a multimeter to carry out the test. When we connect the power, the LED should light indicating that power is present.

The pins in questions are :
Pin 8 & 19 – Vss
Pin 20 – Vdd

With the negative terminal of the multimeter (Black) connected to a negative Power point on the card,
we start testing the voltage with the red terminal at the above Pins. This is before we insert the PIC18F2455 or connect the PCB to the PC.



Then we can check the continuity between the different pin socket for the PIC and pins for the analog connections and the rows and columns for the keypad. Also we can test whether the S1 and S2 buttons are working well. With the multimeter positive terminal placed on
pin 1 of the socket, it should indicate about 5V, and when you press the S1 the voltage should decreases to 0V. The same goes for pin 6 and S2.
 
Getting PIC18F2455 Bootloader
Locate and download “MCHPUSB_Bootloader.HEX” from the following link :
http://uploading.com/files/YHIMECEX/MCHPUSB_Bootloader.hex.html

With any PIC programmer you must load the bootloader to the PIC18F2455 MCU. I use a basic JDM programmer, which is very easy to build. Another important tool is the software that will use to program the PIC. I use the WinPic800, which is very useful. It is a complete package and regularly updated with a support services for almost all the PIC micros. The program will run on any low end and old PC (Pentium II) with a serial port and Win98. To use the program in a current PC with Vista or XP, I have to do some odd jobs to load some additional drivers, but this is beyond the scope of this tutorial. First we should ensure that WinPic800 and the programmer are working OK, this is achieved
by running the tool and pressing Ctrl + D to detect the PIC18F2455 MCU.


Then we'll proceed with copying the HEX bootloader to the CIP. We have to check the USB cable wiring connections, so do not be tempted to plug the board to the PC just yet. If you use a female USB connector mounting on the board instead of the four pins (J1), it is convenient to use a cable with male connectors at both ends. For those who opted for the strip of pins, you can buy a cable with male connectors, cut one end to expose the wires to identify the cable's wires.
 
GND : Black
D+ : Green
D- : White
VBUS : Red
 
We set up the connector with the according to the PCB pin arrangements then connect it to
the board.

First time connection.
When you connect the PCB for the first time it will not be recognized by the PC, as the Bootloader should recognizes the card when the S2 switch is pressed. To continue we must first install the MCHPFSUSB Framework on the root drive of the connected PC. It is highly recommended to read the "User Guide" of the PICDEM located in the documentation section of MCHPFSUSB software using PICDEM FS USB Demo Tool. The guide describes the installation of the drivers in details. You must read it in order to avoid any confusion. Holding down S2 switch press the S1 switch (reset) once while keeping S2 pressed. If everything went well, you should hear a beep sound from the your PC speakers as it detects the newly attached device. Now run the PICDEM demo tool to start programming the PIC MCU as per the following picture.



Then load the. HEX our Joystick 0.1 by clicking "Load HEX File" .

The download for “MCHPUSB_Joystick 01.HEX” could be found here : 


Now click on "Program Device" and wait until the process ends, then press "Execute". This performs a soft reset to the MCU, just as if we pressed the S2 switch, the application will for the joystick 0.1 will start to run. Go to control panel and click on the Game Controllers icon. In properties tab you should see our Joystick 0.1 working perfectly


If the potentiometers are not connected or the button's pin array, it is likely to have erroneous readings picked up by the noisy behavior. This is because the micro legs should not be left
with no connections. If you are not using all analog or the buttons array, for example the three X, Y, Z axes and the 9 buttons, you would be getting a 0V value at the Rx, Ry, Rz, RC7, RB0 and RC0.
Once everything is working properly you can replace the diode D39 which was used for circuit
protection by bridging it. That is all for now. Last revised (02/06/2009).