SERIAL CONNECTIONS How to connect almost everything - by Mark J Swift and Simon N Goodwin. This is the fifth revision of an article previously published with the Amiga Qdos emulator and in several amateur Sinclair magazines. This version is revised for inclusion with the Linux Format emulation series. A tricky business? If you have ever tried to connect two pieces of hardware via a serial interface, you will know that things can get pretty tricky. The problem is compounded by the fact that no matter how many leads you have made up in the past, making a new one is like starting from scratch. With a little foreward planning however, making up a lead can be as simple as putting together a two-piece jigsaw... This articles explain in words and pictures how you can make cheap and reliable connections between many computers, like Amiga, Atari ST, BBC Micro, Apple Mac, Amstrad PCW (with CPS add-on) and PC-compatibles. The JIGSAW solution Each of the accompanying diagrams is drawn as a single piece of a two-piece jigsaw. To discover the cable connections required to connect two machines, simply take the relevant pieces - and snap them together! Other variations Not all the machines have their own picture - for instance, ST, Amiga and Amstrad PCWs all use the same 'standard' 25 pin connection. This was the old RS-232 'standard', used on old PCs, TRS-80s and many terminals. This fell out of favour because of the bulky connector with a large number of unused pins, sometimes assigned to conflicting 'extra' signals, and rather confusing names for the signals. Some 'AT' PCs and add-on serial boards for various micros replace the 25 way connector with a nine pin connector wired as for the SAM, but with the addition of DSR on pin 6 and a small voltage, usually between 5 and 9 volts, on pin 7. This is nominally RTS, but finds its most common use providing power for a serial mouse! Making your own pieces If you have a machine that is not featured here then you will need to make up a jigsaw piece of your own. You should be looking for which lines are DATA and which lines are HANDSHAKE. You should also take note of the GROUND line and whether the signal lines are INPUT or OUTPUT. It is wise to leave power connections, usually marked +5V or similar, well alone, as these are not needed for serial communications between computers and are most likely to cause damage if wrongly connected. If your machine does not match any listed here - and many with 9 pin or 25 pin D connectors correspond to the PC-9D and DTE diagrams - you must copy the diagram from one of these machines and replace the signal lines with corresponding ones for the new machine. In the manufacturers notes, the machine will be described as either DTE or DCE, and this will determine whether a line is input or output. DTE devices 'Data Terminal Equipment' is generally intellegent equipment such as Computers, Terminals and Printers. There should be at least FIVE signal lines as follows: TxD (output) / CTS (input) / GND / RxD (input) / DTR (output) DCE devices 'Data Communication Equipment' is generally dumb equipment such as modems, but the second QL serial port SER2 falls into this category. The signal names are taken from the intelligent end, so you will find for example that the Transmit Data (TxD) line is actually an input! This was one of the most confusing aspects of the original RS-232 serial standard. Again there will be at least FIVE signal lines as following: TxD (input) / CTS (output) / GND / RxD (output) / DTR (input) Too many cables? The jigsaw solution introduced earlier eases the problem of making cables, but there is another problem. As you acquire more and more machinery, you will need more and more cables - to the point where you could literally be lost in cables. For example if it is necessary to be able to connect any machine to any other then: with 2 machines - 1 cable is required with 3 machines - 2+1 = 3 cables are required with 4 machines - 3+2+1 = 6 cables with 5 machines - 4+3+2+1 = 10 cables with n machines - (n-1)+(n-2)+...+2+1 = n(n-1)/2 cables So you'd need 28 separate cables to link all the machines covered in these articles! There must be a better way, and emulator enthusiast Mark J Swift has found it. The ideal solution if you have lots of machines is to standardize the serial connector on each machine by fitting an adaptor, and then to use a SINGLE cable to connect between machines. The S5/8 Standard The S5/8 standard for serial connections came out of a Government study in the eighties. The S5/8 standard is based on an eight pole DIN connector and specifies nine signals as follows: 1 - DINP data input 3 - DOUT data output 4 - HINP handshake input 5 - HOUT handshake output 6 - SINP subsidiary input 7 - SOUT subsidiary output 8 - V+ power supply 2 - GND signal ground (common) SHIELD - EARTH earth A device containing an S5/8 connector should contain a socket, and each device is connected to another with a simple cross-over cable. Of the eight signal lines only 5 are necessary (hence the name S5/8 - five lines from eight), these lines are: 1 - DINP data input 3 - DOUT data output 4 - HINP handshake input 5 - HOUT handshake output 2 - GND signal ground (common) Handshaking The handshake lines are optional controls, used to temporarily pause the flow of data to make sure that none gets lost at high speeds. If these are not available you can usually ask your system to use 'software handshaking', sending special flow-control characters, often known as XON and XOFF, but this is less reliable and no good at all for binary data like program code, where the reserved control characters might appear anywhere. Making an S5/8 adaptor This article is accompanied by a set of 'jigsaw' diagrams for various computers. To find the cable connections required to convert one of the serial definitions into S5/8, simply snap this 'jigsaw' piece into place underneath the 'jigsaw' piece for the relevant hardware. This will standardize the hardware to be S5/8. The simple cable required to connect two S5/8 devices has its own diagram. You can use this cable to link two Thor XVI computers, as the serial ports on that machine use the S5/8 standard. Less cables - less hassle Now if it is necessary to be able to connect any machine to any other, you will need to make up the following leads: with 2 machines - 2 adaptors + 1 cable with 3 machines - 3 adaptors + 1 cable with 4 machines - 4 adaptors + 1 cable with 5 machines - 5 adaptors + 1 cable ... with n machines - n adaptors + 1 cable As you can see, the number of cables required no longer increases exponentially. With just four cables you can connect all three Sinclair serial ports, PC-ATs, SAM and Thors. Add one more (DTE to S5/8) and you can include Amigas, PC-XTs, Atari STs, Amstrad PCWs and TRS-80s in your collection - probably enough to start up a data-transfer agency! Other aspects You should make sure that both ends of the link are using the same speed and data size. Many machines default to 9600 baud and 8 data bits, with one or two stop bits. Extra stop bits do no harm. You may need to reduce the rate (at both ends) for flaky interfaces - particularly if you are not using hardware handshaking. Most links can work at 1200 baud or lower speeds with no need for handshaking. If you're hungry for further reading, check out the August 1986 issue of Electronics & Wireless World, for an article entitled 'S5/8 the technical details' by Andrew Hardie. This was the inspiration for our 'standard cable' system. While we cannot sort out your serial communications problems on an individual basis, these articles should at least ensure that you get the connections right. If you run into configuration problems you should consider writing a letter to the editor - it's quite likely that one of the other readers has encountered your problem and found a way round it. If you do write in, be sure to include full details of the software configuration commands and menu selections that you've tried at each end of the link. Good luck, and happy handshaking! M.J.SWIFT April 1993, extended by Simon N Goodwin 1994-2001. msw@blackpool.ac.uk, simon@studio.woden.com