Digital Joystick Question


Undefined Error

Still Fresh
Joined
Oct 25, 2005
Messages
20
Age
40
Location
Tucson, AZ, USA
Website
Visit site
Pardon this newcomer's simple question, but I have been doing a lot of research into the GP2X as of late, as it sounds like a really cool system. (I gotta love anything that's open to homebrew! :D ) Thanks to informative sites like this one, I've been able to piece together what to expect of this machine, for the most part. There's just one detail that confuses me, and I'm hoping that some of the people here may be able to answer my question:

How many directions does the digital joystick recognize? And how are those directions laid out?

I've heard it said by some sites that it recognizes 16. (Which makes sense: 4 cardinal directions + 4 intermediaries + the 8 in between those)

I've also heard it said that it recognizes 12 directions. (I guess that would be 4 cardinal directions + 2 directions between each of those.... seems like an odd setup because you lose the popular 45-degree angles)

And I've also heard it said that it recognizes 12 directions but programs will only be able to use 8. (No idea what that means... does it recognize the 4 cardinal directions + the 4 intermediaries and then have 4 imaginary directions into the nth dimension that humans can't comprehend or something?)

So, what's the real deal? 16? 12? 8? 91? (Hut-hut-hike!) gp32_console

EDIT: Added links to sites claiming each of the first two. (I'm having some trouble finding the site that claimed the last one...)
 
Last edited by a moderator:
Last edited by a moderator:
So the definative (as far as I can tell) is:

There are 8 microswitches, so each of the 4 main directioon and the immediate diagonals have there own switches (which is a good thing). N NE E SE S SW W NW

It is then also possible (via software) to detect the extra 8 directions between these microswitches for 16 way. NNE ENE ESE SSE SSW WSW WNW NNW
 
The joystick is reported on a single 8-bit I/O port, hence can only report 8 different directions. It doesn't matter if the joystick itself has 12, 16, 24, or 200 switches.
 
Offhand, I'm inclined to go with DaveC's explanation in the other thread for why there are 12 things on the circuit board and only 8 directions that programs can read. For those too lazy to look this up, his explanation is that what we see are 12 contact points. Each microswitch requires two contact points. (Think of a light switch, if you've ever wired one of those... there's an "in" wire and an "out" wire.) He suspects that the switches for the cardinal directions (N, S, E, W) have a contact point on top of the board and a contact point on the bottom, while the diagonals (NE, SE, NW, SW) have both their contact points on the top. This means that there are 16 contact points, but we only see 12 of them, giving the illusion of 12 "things" on the circuit board. Since it takes two contact points for a switch, 16 contact points means 8 switches, which matches up nicely with the 8 directions readable from I/O and the 8 obvious directions for the stick to work in.

Of course, ultimately, as Squidge has said here and countless others have said elsewhere, there are 8 directions that programs can read from the hardware. So no matter how many switches there are or what strange munging of them GPH does to read the direction of the stick, programs will see 8 directions in the obvious locations. (N, NE, E, SE, S, SW, W, NW) And that means programs will be able to read 16 directions in total.

(For those of you confused by this last statement, which is probably not many of you, but I feel like being complete: Think of the old Nintendo cross-shaped D-pad. It only technically detects if you're pressing up, down, left, or right. But if a program sees up and right pressed at the same time, then it knows that you're really pressing up-right. So programs can see eight directions from the 4 that the pad actually detects. The same thing applies here, only now we actually do have hardware in place to detect all eight of those directions, meaning we can now detect directions in between those. i.e. If N and NE are pressed, then the stick must be in the NNE position. And honestly, that's more precision than most handheld games will need for the time being. :p )
 
don't forget you can also press the joystick, so that's another switch.

Also, it would be fairly stupid to have a ground for every single direction, it would make more sense to have a common ground. This would mean 9 switches, 1 ground, and two left over. Unless the middle button has it's own ground.
 
Dang, I knew there was something I was forgetting! ....Well then I don't know what to say. :p Maybe the extra connectors are just leftovers on the devboard from another design. I can't seem to access the pics on Ibiblio at the moment, so I haven't seen it to say myself. (Not like I'm an Electrical/Computer Engineer anyway... wouldn't know a microswitch if it slapped me on the behind.)

Anyway, the important thing is that it's 8-way hardware in the end... somehow... and hopefully none of the stuff in between will prove to be a bad design decision that will cause bizarre stick failures or inaccuracies, ala the GP32... which I guess is my true fear. <_< But I'm sure they've learned from that and moved on.
 
Squidge posted on Oct 25 2005 at 09:16 PM said:
don't forget you can also press the joystick, so that's another switch.

Also, it would be fairly stupid to have a ground for every single direction, it would make more sense to have a common ground. This would mean 9 switches, 1 ground, and two left over. Unless the middle button has it's own ground.

I think what was confusing was that from the pics you could see 12 solder joints. You could only see 1 each for NSEW when in fact there are two but one per switch was likely in a different spot and hidden. The one for pressing the stick was likely on the back and the contacts not visible for that one. Since the microswitches are discrete components both pins must be soldered in. I would be pretty sure 1 of those two contacts on each switch was soldered to a common ground but you still would see the joint.
 
Last edited by a moderator:
Back
Top