SPECTRUM PORTS : The Aargh Interface Mark II - Peter Lovett
This circuit provides up to eight input an eight output ports from the Spectrum
bus edge connector. It is named after the mouse on which it should eventually
appear, which is so named because that's what people will say when they see it.
My thanks are due to David Buckley, and others, without whose help the prototype
would not have worked. The full circuit diagram is shown in Figure 1.
Barg Newsletter Issue 3/4 - Page 11
How it works
The Spectrum ROM uses port addresses in which any of address lines A0-A4 are low, so we may use only the eight permutations of A5--A7 wfth A0-A4 hiqh. This will give ports with addresses 1F, 3F....FF (hex), A BASIC IN or OUT statement will cause /RD or /WR respectively to go low, and /IORQ to go low, while placing the port address on the address bus A0-A15. When the following 3 conditions are fulfilled, the 74LS138 (IC2) is enabled, selecting one of the port enable lines, and /EN is taken low.
Address lines A5 to A7 determine which port enable line, /P0 to /P7 is selected.
- 1 An i/o instruction takes /E1 on IC2 low
- 2 A0-A3 all high, so /E2 goes low
- 3 A4 is high, so E3 goes high
So when an I/O request for one of Aargh's ports is made, /EN is low and one of lines /P0-/P7 goes low. IF it's an OUT, /WR will be low and the appropriate 74LS273 (IC6) will have Its E pin taken high, latching the data byte from data lines D0 - D7 on its Q0 to Q7 pins. Similarly, for an IN, /RD and the port's address line will take the /OE pin on a 74LS373 (IC7) low, bringing in its peripheral's data for the processor to digest; this is the only occasion when Aargh decides what the Spectrum data bus will contain, therefore the only occasion when the bus buffer's /DIR pin is taken low.
The line marked /CLEAR will be low for about lmS after power is applied, then high thereafter, which ensures that output data lines start in a low state.
IC1 74LS20 dual 4-input NAND
IC2 74LS138 1 of 8 decoder
IC3 74LS02 quad 2-input NOR
IC4 74L532 quad 2-input OR
IC5 74LS245 octal 3-state bi-directional buffer
IC6 74LS273 octal D-type latch
IC7 74LS373 octal 3-state transparent latch
Cl lOuF electr
C2 0.luF disc
plus one 0.luF capacitor for each i/c
Innovonic's Spectrum edqe connector
0.1" matrix Veroboard
One each of IC6 and IC7 and
a quarter of IC3 and IC4 is required for each additional port.
- 1 Lay out your circuit on Veroboard or similar. A Verostrip has enough space to get a port each way, or you could go for a more square board and use a 3 mm drill to break tracks on it. Put in Veropins where your gadgets will plug in to data lines, and put crimp terminals (see parts list) on the gadgets. A BARG standard ? [ Not likely - Ed ]
Barg Newsletter lssue3/4 - Page 12
- 2 Fit the edge-connector and Spectongue at one end, then solder on the chips (or sockets if you prefer) and other components. Check the circuit very carefully before applying power, as any faulty wiring can easily damage the Spectrum. Figure 2 shows one way of fitting the edge-connector. Soldering the Spec-tongue to the connector is tricky. Hold the corner pins with small dabs of solder, then check that the assembly is level when fitted to the Spectrum. When you're happy, solder the other pins, then redo the original four. Trying to adjust the fit afterwards Is almost impossible.
- 3 The moment of truth. If you're using sockets, then before inserting the chips, check every connection you can think of, especially that power lines are not shorted to anything. If you measure resistance between the 5V and GND lines, the meter needle may swing for a second or two as the 10uF capacitor charges up from the meter's battery, but should then drop back to infinity. Now plug into the Spectrum bus, take a deep breath and power up. If you get the copyright message, you've just executed millions of Z80 Instructions including some i/o to Sinclair's ports, so all is well. Remove the power, insert the 74LS138 in its socket, and power up again. Repeat this one chip at a time until success or failure. The order to follow is gates first, then the 74LS245, then the latch chips. As with any device on any data bus, never plug or unplug it, or insert chips, while the power is on.
- 4 Test the output lines with a meter or logic probe, and the inputs by leaving unconnected for high, or grounded for low. The values set or returned by the BASIC i/o commands should be reflected in the physical connections at the port. If all is still well, put a box around the board and paint "Aargh" somewhere on the box. Then go and build a robot to plug into your Aargh.
Figure 2 - Fitting edqe connector and Spectongue to port board
Barg Newsletter Issue 3/4 - Page 13
Next - BARG Newsletter #3/4 pages 14 - 20 -- Polaroid Ultrasonic Ranging System - Richard Moyle