Introduction
In this workshop, we'll look at:
- Using the Plus 1's analogue port to sense the outside world.
- Creating a DIY games paddle for the analogue port.
- Solving tape loading problems the easy way.
Hard To Port!
Upon purchasing a Plus 1, you are supplied with a small blue book called the Acorn Plus 1 User Guide. Frankly, this book left me more confused than when I had started to read it. It turns out jargon such as:
"Devices other than joysticks and games paddles may be connected to the analogue port, provided they are electrically compatible with it and are wired as described above. The peripheral may either generate a DC voltage in the correct range itself which is proportional to the measurement, or may take the reference voltage from the interface and return a fraction of it which is proportional to the measurement (ie. may act as a potential divider)." |
If you understood that on first reading the Plus 1 User Guide, why haven't you submitted ideas for projects we can attempt?
To interface anything with the Plus 1's analogue port, you'll need a 15 pin male D-type plug.
You can buy this type of plug from any good electronics shop such as Tandy. By far the easiest pins to use on the analogue socket are 13 and 10 - the Push Button pins. Pin 13 is PB0 and pin 10 is PB1.
These pins sense whether a circuit is complete or broken. In other words, if a switch is on or off. In a joystick, the "Fire" button would be connected to these pins.
Using a push-button switch, solder a wire to pin 10 and the other end to one of the terminals of the switch. Then solder another wire to the other switch terminal and the other end to one of the 0v pins, eg. pin 2. This is the most simple circuit it is possible to make. However, it is incredibly useful!
The circuit diagram - in all its complex glory - can be called from the first Articles Menu. Note the symbol for the push-button switch - it'll be cropping up for sure later on.
Please note: Do not solder to the "D" plug when connected to the computer and don't solder directly to the port at the back of the Plus 1! This may sound silly but you'd be surprised at what some people do!
Useful Tip: Check for splashes of solder causing connections between the pins on the D-plug.
The following program senses whether the push-button is being pressed:
10 REM Analogue port program 1 20 REPEAT 30 button=ADVAL(0) AND 2 40 IF button THEN PRINT" Button Pressed " ELSE PRINT" Button Not Pressed" 50 UNTIL FALSE
To check if the button is being pressed, ADVAL is used with a channel number of 0 as in line 30. The value of 'button' then tells you which buttons (if any) are being pressed. These values are shown in the Plus 1 User Guide and are as follows:
button=0 | no buttons pressed | ||
button=1 | PB0 pressed | ||
button=2 | PB1 pressed | ||
button=3 | both buttons pressed |
ADVAL is used like any other function. We can place the value returned into a variable:
button%=ADVAL(0)
as in line 30, or we can print its value on the screen:
PRINT ADVAL(0)
The value in the brackets after the ADVAL instruction is the channel. This can be in the range of 0 to 4 but we'll talk about this another time.
Tape Troubles
Loading old or worn tapes is a nuisance for everyone, or should I say "was"!! Here's a simple answer that requires absolutely no soldering. If you use a connecting lead with three jack plugs on your tape recorder, then simply remove the plug to the EAR socket and plug it into the headphone socket of a modernish personal stereo or Walkman. Place the tape in the Walkman and set the volume to about two thirds. Not every tape will load, but because modern stereos give such high quality sound, I've found that even some of the most 'useless' tapes will now work.
Next Time
Most modern games computers use digital, nine-pin joysticks, but before these were the analogue variety. Analogue joysticks are harder to make and are far less reliable, so why did they appear in the first place?
The answer is that when joysticks first appeared, games 'paddles' were popular. Games paddles were analogue devices, so joysticks were made the same for reasons of compatibility. As the Plus 1 has an analogue port, it is easy to fit a DIY games paddle, at the same time demonstrating some important techniques.
Marc Harris, EUG #4