Documente Academic
Documente Profesional
Documente Cultură
Hello everyone,
The start of another wet weekend in my part of the world is just the excuse I
needed to resume my ZX81 projects. In 1997 I designed an interface which
connects a NINTENDO game-pad to my ZX97 or a ZX81 with a 8255 I/O adapter
(which I will post next). I have interfaced both the wired NES controller version
and the more interesting wireless infrared (IR) game pad unit.
Aside from it's obvious use for games, you will be surprised by the many other
possible applications for this game controller. Talk about instant results: most of
the work is already done and you only need to solder a DB25 connector, add a few
jumpers, batteries and some software to get up and running. So pick up an old
Nintendo game-pad at your local thrift shop for a few dollars and take a couple of
hours of your time to "get connected". Then share your ideas with the rest of us!
enjoy
wilf
The NINTENDO (NES) game-pad circuit, shown in FIG 1, uses a standard CMOS 8 bit
parallel to serial shift register (MC4021B) connected to 8 switch contacts. Switch
data is loaded into the shift register by the game system with a positive pulse on
the P/S line. The data is clocked out on the rising edge of each clock pulse on the
CLK line. The eight data bits appear sequentially on the Q8 line with the A switch
first.
0V +5V
_________________________________| |
| __________________ | ___________________|
| | | |
| RESNET [10K] MC14021B | |
| | _______ | |
RIGHT |------o_o----+----7|P1 VDD|16-- | -------------------|
LEFT |------o_o----+----6|P2 | | |
DOWN |------o_o----+----5|P3 DS|11---| __ |
UP |------o_o----+----4|P4 VSS|8----+--BRN----|0 \ |
START |------o_o----+---13|P5 CLK|10------RED----|0 0|-WHT-+
SELECT |------o_o----+---14|P6 P/S|9-------OR-----|0 0|
B |------o_o----+---15|P7 Q8|3-------YEL----|0 0|
A +------o_o----+----1|P8 | |____|
SWITCH 1-8 |_______| NINTENDO
CONNECTOR
1 de 5 26/4/2010 12:04
Hello everyone, http://www.user.dccnet.com/wrigter/index_files/NINTENDO%20to%...
Since the game-pad uses a CMOS chip with low clock rates, it requires less than 1
mA
of current easily supplied by 3 AAA batteries or equal. When disconnected and no
keys
are depressed the current is essentially zero. A second NES game-pad can be added
by
connecting all lines in parallel except output Q8b which is wired separately to pin 14.
MALE DB25
FRONT VIEW
+4.5V____WHT____________________
Q8b____YEL_______________ |
__ | |
Q8a ---YEL----1|o \ | |
P\S ---OR-----2|o o|14__| | 4.5V
CLK ---RED----3|o o| _-_
|o o| | + |
|o o| | |
|o o| | |
|o o| | |
|o o| |___|
|o o| |
|o o| |
|o o| |
|o o| |
|o o|25-------|
|___/ |
0V_____BRN____________________|
The infrared wireless game-pad made by Radio Shack (58-9854) is shown in FIG 3.
It uses a single chip remote IR transmitter to convert 8 contacts to a serial bit
stream which modulates a 40 KHz IR carrier. In addition, there are the "turbo"
keys which produce pulsing A and B signals. The P1/P2 switch selects one of
two game-pads which can be used simultaneously with the IR receiver. The IR
remote use 3 AAA type batteries with 22 mA average current when transmitting
but no power drain unless a contact is closed. The IR transmitter range is about
30 feet "line of sight" and about 20 feet when bounced of a white ceiling.
\\ \\
4.5V -----+----------+------------|>|----|>|----270----+
| | IR LED |
| SWITCH11 | _______ |/
P1/P2 +-o_o---+ +--6|VDD OUT|7-------------------| 2N2222A
+------o o---+----16|P1/P2 | // |\
0V |------------------8|VSS ON|4-----|>|---|>|------+-----0V
RIGHT |------o_o--------19|P1 | 1N4448 RED LED
LEFT |------o_o---------1|P2 | 470p
DOWN |------o_o--------20|P3 OSC|9___________________||______0V
UP |------o_o---------2|P4 | | | ||
START |------o_o--------17|P5 | | _ | _
2 de 5 26/4/2010 12:04
Hello everyone, http://www.user.dccnet.com/wrigter/index_files/NINTENDO%20to%...
The infrared serial data from the remotes is demodulated with the Radio Shack
IR receiver (58-9855) which can receive 16 bits of data from two 8 bit remote units.
The same data transfer protocol as the NES game pad is used and the demo
software is compatible. The IR receiver is normally connected via two NINTENDO
connectors which are replaced with a single cable and male DB25 connector in FIG 4.
The two P/S and two CLK lines are operated in parallel and are joined with two
jumpers and connected to pins 2 and 3. The two Q8 lines are connected separately
to pins 1 and 14. The 0V line is connected to pin 25 of the DB25. In addition, two
double AA battery holders are placed in the base of the receiver to supply the +5V
supply. The IR receiver unit draws about 3 mA and batteries should be removed
to conserve power when the unit is not in use.
MALE DB25
470p ________ FRONT VIEW
0V__||____________1|OSC |
|| | | | Q8b|10__________________WHT______________
__|__ | | | ___ |
455K _|_|_ 1M | Q8a|7___________________YEL____1|o \ |
| | | P/Sa|4___________________OR_____2|o o|14_|
0V__||___|____|__16|OSC P/Sb|12____| _______RED____3|o o|
|| | CLKa|5___________| |o o|
470p | CLKb|13__________| |o o|
| VDD|15_________________ |o o|
| | 220uf| | 4.5V |o o|
| | __||__| _-_ |o o|
| | | ||+ | + | |o o|
| VSS|3__|________ | | |o o|
| VSS|2___________| | | |o o|
|________| | |___| |o o|
| | |o o|25_
| | |___/ |
|______|_BRN_____________|
This project has many possible remote sensing and control applications.
The game-pad data can be read with the ZX81/ZX97 machine code program in
listing 2. The 16 bits of data are stored as "1" or "0" in array A$. This makes it
easy to test the individual bits or bit combinations in a BASIC program using
various string commands as shown in the short example in listing 1, using a
game-pad to control the PLOT position.
I have included a decimal listing of the machine code in listing 3 which must be
poked in a 63 byte REM line starting at address 16514.
3 de 5 26/4/2010 12:04
Hello everyone, http://www.user.dccnet.com/wrigter/index_files/NINTENDO%20to%...
LISTING 1
;LISTING 2
4 de 5 26/4/2010 12:04
Hello everyone, http://www.user.dccnet.com/wrigter/index_files/NINTENDO%20to%...
RET
16514 - 118,118,024,004,062,131,211,223,042,016,064,017,008,000,025,006,
16530 - 008,062,001,205,182,064,219,215,079,205,175,064,025,121,031,205,
16546 - 175,064,237,082,035,062,002,205,182,064,016,234,201,047,230,001,
16552 - 198,028,119,201,211,199,175,211,199,205,070,015,216,207,000
Another interesting application uses two game-pads and two IR receivers for
bi-directional data transfer between a PC and a ZX97 (or another PC).
Game-pad P1 and IR receiver P2 output is connected to a PC printer port.
Game-pad P2 and IR receiver P1 output is connected to a ZX97 as shown in FIG 5.
This arrangement would be quite useful in a robotics application.
If you get a chance to try out some of these ideas in your own applications, why not
write a little article about it and post it on ts1000.us
enjoy
wilf
5 de 5 26/4/2010 12:04