*** Enhanced joypad series part 2 / 725 words *** A bit more padding In this second article, Xav takes a more detailed look at the humble joypad. Just in case you missed part one let me start with a brief description of the 'joypad'. The joypad is an input device, designed primarily for games playing, and is the standard controller for a Jaguar. Standard joypads have three fire buttons, a twelve button numeric keypad, pause and option buttons, and a directional pad, sometimes referred to as a 'D-pad'. This article will explain the inner workings of the joypad, as the principles used here are fundamental to many of the EJP projects that can be made. A brief description of the joypad hardware was given in part 1, and it may be useful to refer back to that if you have a copy. *** pad_1.gif *** Circuit diagram of the hardware - please don't turn over just yet - it's not as intimidating as it looks and is quite simple when viewed at as a number of building blocks, trust me. Trigger Happy Taking the circuit diagram vaguely from left to right, the numbered circles (and those along the top) represent the pins of the joypad connector. Those on the left carry the input to the computer as simple high or low voltages - which are provided by that big rectangular object. This is a 'Schmitt triggered octal buffer.' Impressive sounding stuff, maybe, but all it does is take signals in from one side (the wide end of the triangles), clean them up a bit so they don't scare the computer too much, then squirt them out the other side (the pointy end of the triangles). At the top is a connection for the positive power supply (from pin 7), and at the bottom is the connection to ground (pin 9). There are also a couple of other inputs at the bottom - the 'enable' connections. These effectively switch the whole chip on and off, and are activated when 'pulled low' (that's what the bar over the top means). For our purposes we always want the chip active, so they are permanently grounded. Next along we have a number of resistors which connect the Schmitt triggers to the positive supply. Their sole purpose here is to ensure that the computer normally receives 'high' values unless a button is being pressed and read from. All of which brings us neatly onto... The buttons Each button, as can be seen, is connected at one end to the Schmitt trigger, and at the other end to one of the pins along the top. Associated with most of the buttons is a diode. This can be thought of as a one-way valve for electricity, and prevents the Schmitt trigger from reading the buttons of adjacent columns when it's not supposed to. Since the Pause button doesn't share its Schmitt trigger with anything else, it doesn't need a diode. When a button is pressed it effectively transfers a high or low voltage from the pin to which it's connected, onto the diode. If the voltage is high, the diode blocks it. If the voltage is low, the diode 'pulls' the input to the Schmitt trigger low as well. This signal is then cleaned up and passed to the computer. Therefore in order to read any one switch it is necessary to make the appropriate column low, and all others high. This is done by using some of the pins on the EJP as outputs and setting them accordingly. Then it is a simple case to read the values returned on the input pins. Next Issue It's worth reading through this page a couple of times to make sure you understand what's going on, as a good grounding in the hardware of the joypad will make it much more understandable to program - which is what we'll be starting on next time. Meanwhile you'll find a couple of goodies on the reader disk (you do take the reader disk, don't you?). First of all, there is a GEM file of the joypad circuit diagram, for those hardware hackers amongst you that would like it printed a little larger. Secondly there is a joypad test program - nothing too exciting at the moment, but I hope to develop it in line with this series as an aid to the testing of some of the projects.