Author Topic: Difference between matrix and cg  (Read 5268 times)

Offline Bigandrewgold

  • ½ Pint
  • *
  • Posts: 35
  • Post quality +0/-0
  • Acidmods User
Difference between matrix and cg
« on: May 08, 2012, 07:09:06 PM »
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?

Offline KingMike_OS

  • Shop Owner - Products & Support
  • Acidmods Alumni
  • Acid Modder
  • *
  • Posts: 929
  • Post quality +14/-0
  • Gender: Male
  • R&D
    • Modding Shop At the end of the Universe
Re: Difference between matrix and cg
« Reply #1 on: May 08, 2012, 08:08:40 PM »
The trigger are High Unpressed and Low Press So there backWord ..

and more info On Button LayOut thanks to RDC can be found here

https://www.acidmods.com/forum/index.php/topic,34545.0.html

Offline SethMods

  • Registered BST
  • King of the Wii-tards
  • *
  • Posts: 189
  • Post quality +17/-1
  • Gender: Male
  • Acidmods User
Re: Difference between matrix and cg
« Reply #2 on: May 09, 2012, 01:29:00 AM »
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.

Offline Bigandrewgold

  • ½ Pint
  • *
  • Posts: 35
  • Post quality +0/-0
  • Acidmods User
Re: Difference between matrix and cg
« Reply #3 on: May 09, 2012, 05:20:40 PM »

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.)


I hope this helps.
so, on startup you would have it check if RT, for example, was high or low.  And if it is low you would go into cg mode and if it is high it would go into matrix mode.

Offline SethMods

  • Registered BST
  • King of the Wii-tards
  • *
  • Posts: 189
  • Post quality +17/-1
  • Gender: Male
  • Acidmods User
Re: Difference between matrix and cg
« Reply #4 on: May 09, 2012, 07:36:17 PM »
Yes, except I highly recommend doing an Analog to Digital Conversion on the triggers. Otherwise you are reading an Analog signal over a Digital pin on the Microchip.

There are cutoffs that Microchip states will register a 1 and a 0 if you are using Digital inputs. And then there is a huge gray area in between.

Here's an excerpt from the 12f683 datasheet.


So for instance if you are feeding a 12f683 with 3V then anything over .15 * Vdd = .45V has the ability to be read as a High signal (or a 1).
And anything below (.25 * Vdd) + .8 = 1.55V has the ability to be read as a Low (or a 0).

So anything in between .45V and 1.55V can read a 1 or a 0. And it can change from one microsecond to the next. There are not any guarantees.

(Although my experience and I'm sure many would agree that the chips operate much more stable than that. But still...)

Also if you need any specific help (i.e. coding up ADC to read a trigger) let me know. I would be more than happy to help.

 

SMF spam blocked by CleanTalk
SimplePortal 2.3.5 © 2008-2012, SimplePortal