|   | ||||||||
![]() |
||||||||
|   | ||||||||
|
||||||||
|
ii) Game portWelcome once again to our little lesson on port interfacing. This time it is the game port or the joystick port. In this tutorial I will try to provide you the bare minimum information that you might need to experiment with your game port. As usual let us see first of all the address range allocated to the game port. On your PC the game port is most likely to be having the addresses 0x200 - 0x207, where 0x means it's hexadecimal. That's 512 - 519 in decimal. The port is usually a 15 pin D-connector. The pin details are as follows
Now we can see that aside from the power supply and ground pins the port has only two types of inputs: digital and analog. This port is a specialized one. So in order to use it for our purposes, we have to see first of all, how the joystick interacts with the port. Let us call the two joysticks to be connected as A and B. Each joystick is intended to have two buttons apart from the "stick". Hence the two digital inputs per joystick. Here BA1 and BA2 belong to joystick A and BB1 and BB2 belong to B. These inputs are ordinary TTL types. To indicate a HIGH level all you need is to connect the 5V supply preferably through a 1k resistor the pins.
Now to find the time taken.If 't' is the time taken for the monoshot to change state (HI to LO) and Rp the potentiometer resistance, then So to find the position of the axes you have to poll the four inputs continuously. I mentioned a port 0x201 before. This is the only address we have to be concerned with and is that of the status port. As said we make an empty write operation to this port to start a conversion. After the monoshot goes low we read from this port. So in effect we need to continuously poll this port. The bit values are:
The bits 0-3 belonging to the analog pins give the status of the multivibrator output with 1 indicating HIGH. For digital values also a status of 1 indicates a HIGH.
|
  | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|   | |
|   | |
|   Tested on IE 6.0 , Netscape 4.7, Mozilla 1.0 | Best on 800x600 |
|   mail me | |