I am currently making a rapid fire code, and I am wanting to make it work with both matrix and cg
Since I do not have a spare matrix controller to test on, I am coming to you guys. So what is different on a matrix controller. Here is what I have so far for a cg
RT/LT-High-pressed, low-unpressed
ABXY, etc-High-unpressed, low-pressed
RB/LB/RS/LS-this is going to be the next part I will work on, so I dont know yet, anyone want to fill me in
So what is different on the matrix?
In general there are two approaches to getting the buttons to work for a Matrix style controller.
The first is a hardware approach. You can use some sort of circuit to electrically connect the two sides of the button pads when you want to have the mod press a button. If you go this route, then I recommend using an Analog Switch. (If you are unfamiliar with them, they are basically a semiconductor version of a mechanical relay.) If you go this route, make sure to find a switch that has a low supply voltage (down to 1.8V or so) and that has a very low Ron. I sell boards like this in bulk for $2 each if you aren't really looking to reinvent the wheel.
The second method is a software approach. You tie to all 8 pins in the diagram from RDC that KingMike posted. Then you use interrupts to sync your mod to the controller as it round-robins through the different pins to check buttons. If you want more detailed info on this, let me know. The really cool thing about controlling a Matrix style controller is that you can control all 14 buttons with just 8 wires. Versus CG were it's a wire for each button.
And if you are looking for code that is universal, I recommend reading your triggers using the Analog to Digital Conversion (ADC) function on your mod chip. Then your mod will know what board it is installed in based solely on the readings it gets from the triggers. (At least that's how I do it.)
Also, for the CG...
CG stands for Common Ground. What that means is that every button is triggered by tying to ground. So every button will have two sides. One side will be tied to ground. The other will be tied back to the microcontroller. Always tie to the microcontroller side and just bring it low to force a button push.
Note: When I say "button" I mean every Digital input. The Analog inputs (triggers and joystick x/y axes) will always work a little differently.
I hope this helps.