Hi Toodles, I ordered the exact parts as specified on your UPCB assemble tutorial on www.instructables.com. Currently I am having trouble getting the sanwa JLF to work on the breadboard. Before I describe my problem in detail I’ll just briefly go over what I have done.
- I made minor changes to your v2.5 UPCB code. I made changes to main.c.
I deleted all the code that deals with determining which consolde the pcb is connected to and set ps3 as the default. This is what “void main(void)” looks like now.
void main(void)
{
/* Set all of the console pins to input, as well as the button & stick
pins, using the macros from upcb.h. The console pins used for output
will be set as needed in those system’s main routine. For now, we want
everything nice and safe as inputs */
ADCON1 |= 0x0F; //set all input as digital.
mInitAllLEDs();
mLED_1_Off();
mLED_2_Off();
mInitConsolePins();
mInitButtons();
mInitStick();
//Init_Piggyback();
mLED_2_On();
Program_Load_Mappings(SMA_USB);
PS3USB_main();
// if we get here to the end, we haven't matched any of the supported controllers
// so sit and spin and wait for a replug
mInitAllLEDs();
mLED_1_On();
mLED_2_Off();
while(1)
{
Delay10KTCYx(250);
Delay10KTCYx(250);
Delay10KTCYx(250);
Delay10KTCYx(250);
Delay10KTCYx(200); // at 12 MIPS, 1.2mil cycles augh to = 1 sec
mLED_1_Toggle();
mLED_2_Toggle();
};
}//end main
-
Linker Script rm18f4550.lkr was used (could this be the problem since I’m not using the bootloader but programming the PIC microcontroller directly from MPLAB IDE)?
-
I compiled your code with MPLAB v8.1 with academic version of C18 compiler. I programmed the chip with a modified PICKIT2. (This modified programmer from www.auelectronics.com allows you to directly program a PIC on a breadboard). From within MPLAB IDE with the newly compiled hex loaded, Programmer->Select Programmer->PICkit 2.
-
Here is a diagram of how I arranged the parts on the breadboard.
http://img9.imageshack.us/img9/5825/breadboardsetup2k.jpg
- Here is a picture of my board and the parts on it
(http://img24.imageshack.us/img24/289/pictureofbreadboard.jpg)
Having done all the above, I am able to connect to the PC and PS3. Both platforms have no trouble recognizing me pressing the ‘SHORT’ or ‘START’ button.
The problem I have now however, is that I cannot get the Sanwa JLF joystick to work. After connecting all the wires to the breadboard and connecting to the ps3 or pc, I see that the upcb is giving off random left, right, up, down commands at rapid succession with the joystick in neutral position! I’m not doing anything to it yet It seems as if someone is doing 360’s like mad. I then removed all the wires but left the black (ground) and green(right) wire connected. I noticed that the upcb would then behave as if I pushed right on the joystick and held it there. I really have no clue what is happening and desperately need your advice. Please help me ^^
One more thing, the 4 resistors that sit between the PIC microcontroller and the 4 joystick wires are
Digikey#4.7KQBK-ND, the same ones I have sitting between the sanwa buttons and PIC microcontroller. Could I be using the wrong resistors?
P.S. I notice that the upcb is very unstable. It would disconnect from my computer when I get up from my chair, or when I place my keyboard next to it (the bread board is placed on my desk). It seems as if the shocks caused from just walking near it causes it to connect and reconnect lol. Could this be due to the fact that the legs of the crystal/resistors/capacitors are too long?
Thanks in advance.
fesodes