There are many advantages in adding a serial port to a ZX81/TS1000. It allows the computer to use other devices which have a serial port, such as modems, eprom programmers, serial printer etc. And since computers have serial ports, it must also be possible to connect two ZX/TS together, each thinking the other was a modem. Or connect a ZX/TS to a QL, an Apple or an Amiga. How about going mainstream and connecting it to a PC/XT/AT compatible computer or to a 33MHZ 80386 machine?
The trick is to know which pins to connect. There are different types of serial ports, RS422, RS423, RS449 to name a few, but the ones that we usually see in the consumer market is the RS232. And even within this group, some manufacturers have chosen their own types of connectors which creates different pin out arrangements. To keep some sort of standard, our project will be to link the ZX/TS to a PC compatible computer.
The requirements for the PC is that it must have a RS232 serial port and a communications program. If you’re looking for software, the Vancouver Public Library down on Burrard and there may be others, offer a Free/Share Ware service called “PC-Sig”. Just bring in your formatted 5 1/4″ 360K or 1.44M diskettes and get copies of what you need. You might also want to pick up a word proccessor program and a program called “PseudoSam Cross Assembler 80Z and 85.”
The requirements for the ZX/TS is that it will be running the communications program ZX-Term*80 and using the Westridge TS2050 or equivalent, RS232 serial port. Other serial ports can also be use such as the Memotech and the Byte-Back, but all of the examples will be given for the Westridge. In additon we will be writing some of our own routines and adding in a memory upgrade.
What will this allow us to do?
- Store ZX/TS programs from cassettes to floppies.
- Save ZX/TS ramdisk contents to floppies.
- Use the PC to call ZX BBS, taking advantage of the higher baud rates and allowing more than one program to be down/up loaded. Transfer programs over to the ZX/TS later.
- Write big relocated ZX/TS machine code programs through the PC. Or use HOT-Z to disassemble M/C programs into text files for rewritting on the PC.
- Mini desktop publishing for writing article for the club newletter. Send COPY, LLIST and LPRINT contents to PC for editing and for inserting text.
- Transfer ZX/TS BASIC programs to the PC where it can be edited to run.
We’ll also look at how to program the serial port and try to write our own “sort of” 1200+ baud terminal program. And we’ll even change some of the ROM routines.
I should stress a warning at this time that this is not a beginner’s project as mistakes will be quite costly. A second problem is that although there seems to be a standard, manufacturers are not forced to follow.
With that in mind, now some theory. Why and What is RS232? It is used to minimize errors in data cable transmissions caused by electrical noise and cable capacitance. This is accomplished by using a wider voltage swing. A logic high is -3 to -15 volts while a logic low is +3 to +15 volts.
There are several important key points to remember;
1. Serial equipment are divided into two groups, DTE, data terminal equipment and DCE, data communications equipment.
general rule :
DTE : | DCE :
originate or | connect directly
receive digital | to telephone line
information |
------------------------|----------------------
computers | modems
video display | multiplexers
terminals |
serial printers |
|
DB25P | DB25S
pin 2, | pin 3,
-3v to -15v | -3v to -15v
|
-----------------------------------------------
2. The DCE serial port is the exact signal opposites of the DTE serial port, even though each pin on the DCE connector uses the same names as those on the DTE. This allows the DCE connector to be connected directly to the DTE, pin for pin.
3. The DTE uses a 25 pin plug connector called the DB25P while the DCE uses a 25 pin socket connector called the DB25S.
4. Of the 25 pins, below is a list of all of the signal lines required to connect DTE to DCE. The other pins are either unassign or not used in microcomputer applications. These pins are numbered on the connectors.
This chart would be an example of connecting an auto answer modem to a computer. Pin 22 is not required if the modem is not auto answer. The directions of the signals is also shown.
to to PIN DTE DCE DESCRIPTION SYMBOL ------------------------------------------- 1 frame ground FG 2 --> transmitted data TD 3 <-- received data RD 4 --> request to send RTS 5 <-- clear to send CTS 6 <-- data set ready DSR 7 signal ground SG 8 <-- data carrier detect DCD 20 --> data terminal ready DTR 22 <-- ring indicator RI -------------------------------------------
5. A more accurate method of identifying the group is to measure the voltages on pins 2 and 3 with respect to ground on pin 7. DTE will show 3V to 15V on pin 2 while DCE will show it on pin 3.
6. Connecting DTE to DTE means that the cable will have to direct the signals from one connector to the proper points of the other connector. Below would be an example of connecting a computer to a serial printer. This chart also shows the directions of the signals.
TO TO 2ND PIN SYMBOL DTE DTE PIN SYMBOL ------------------------------------------- 1 FG 1 FG 2 TD --> 3 RD 3 RD <-- 2 TD 4 RTS --> 5 CTS 5 CTS <-- 4 RTS 6,8 DSR,DCD <-- 20 DTR 7 SG 7 SG 20 DTR --> 6,8 DSR,DCD -------------------------------------------
We can make this project simpler by not using any of the “handshaking lines.” Our serial port will be hard wired into thinking that the other port is always ready. The only signals that we will required then is pin 7 for ground, pin 2 for transmitting data and pin 3 for receiving data.
The first order of business is to obtain a TS2050 or equivalent, RS232 serial port. Rather than converting a perfectly good modem, there were many surplus boards available at one time that you might want to track down. Jim Horne had quite a few the last time I spoke with him. Wilf Righter has designed an excellent equivalent circuit which would make a great project. (Hint for the hardware group.)
The Westridge TS2050 modem actually consists of two parts. It contains a serial chip which formats the 8 bit wide data to flow through a single stream and a modem chip which converts this stream into tones which can travel through the telephone lines.
To convert the TS2050 into a serial port, we tap the required signals from the 8251 serial chip and feed them to level translating chips which changes them to RS232 levels. Using the new MAX232 IC helps simplify the construction. It contains two output transmitters and two input receivers with its own built in voltage converter. The completed port would be DTE because of the directions of the handshaking signals if they were used.
We can also program the MC14569 counter to allow the port to operate at 300, 600, 1200, 2400 or 4800 baud. This topic will be covered in the next installment but here’s a brief explaination to allow you to experiment. Both ZX-Term*80 and Mini Xmod automatically sets the serial chip’s mode word to 79. This establishes the serial protocal to 8 data bits, 1 stop bit with no parity and its internal “divide by clock” to 64. Changing the dip switch setting for the MC14569 will allow the port to operate at 300 or 600 baud.
mode dip baud
word (Dec) switch (Bin) rate
-----------------------------------
77 01101000 9600
unreliable
78 11010000 300
78 00110100 1200
78 00011010 2400
78 00001101 4800
79 00110100 300
79 00011010 600
-----------------------------------
But if we use the mode word 78, this still allows the same format but sets its internal “divide by clock” to 16. Changing the dip switch setting, the port can now operate at 300, 1200, 2400 or 4800 baud.
At 9600 baud we run into difficulty as errors appear in the exchange. More experiments will be needed in this area. Here we use the mode word of 77 which sets its internal “divide by clock” to 0.
As a general rule, the ZX/TS must be in the fast mode in order to operate without error at baud rates higher than 300. We’ll look into this situation more closely in a future article. Unfortunately the modem circuitry itself has been designed to operate only at 300 baud. We’ll report if we can somehow improve on this.
There is a wiring error on some of these boards. 74C00 pin 11, should be connected to MC14412 pin 12 while 74C00 pin 12, should be connected to 8251 pin 23. I’ve come across a couple of boards where these connections are reversed which prevents the modem circuitry from working properly.
If you’re using the serial port for other applications which might require all of the handshaking lines, another MAX232 IC will be required. Instead of adding the two jumpers, the four handshaking signals from the 8251 will now be brought out to the connector. The traces will still have to be cut. Pin 24, DTR and pin 23, RTS which are outputs will each be connected to a transmitter while Pin 22, DSR and pin 17, CTS which are inputs will each be connected to a receiver. Refer to the above DTE to DCE or DTE to DTE charts for correct pin out and cable arrangements. See the article in the Jan88 issue of ZX-Appeal for additional information. It originally appeared in the May/June issue of Sincus News.
As in the article, a switch can be installed to allow the TS2050 to be used both as a port or as a modem. Just remember to unplug it from the phone line when you are using it as a port since the modem circuitries are still active.
I haven’t yet had the opportunity to test a TS2068 with the serial port. But it too should operate quite comfortably at 4800 baud and should operate a 1200 baud modem with no problems at all. “Should” is always a big word.
Next time, we’ll look at programming.
