The diagram above shows the circuit for the serial-to-parallel link: Surely the 470 Ohm resistors seem an unnecessarily caution, and the triac optoisolator is overkill for this application, but cautious is the site's middle name, and users of spares' boxes cannot be choosers! The resistor value shown for R1 worked, but would be reduced to some extent if trouble were met.
Circuits like the revered 6850 ACIA or the 8250 UART would automatically take care for you of baud rates, the start bit, 7 or 8 data bits, one or two stop bits, parity and so on, even in the early eighties. However, they were not in my box of spare components.
If you have never read about the serial port before, the following information is needed: The (old!) RS232 standard specifies that a logic zero is between 3 and 15 Volts, while a logic one between -3 and -15 Volts. If rather counterintuitive, the convention is certainly very well established! About twenty mA of current will normally be expected to be drawn from RS232 outputs. A logic zero on the following pins has the corresponding meaning (the description pertains to the signals on the computer connector). All numbers refer to a 9- pin D-type connector:
A sure sign that the software is doing all the work is the low component count: On the compatible computer, a command sequence like:
Mode Com1 Baud=9600 Data=8 Parity=n
Copy filename Com1
will do, but on the receiving computer (a twenty year old 1Mhz board, 6502 based!) a short program is needed.
At 1200 baud, the program mostly waits, but at 38400 baud timing is tight. Two delays are needed, one between the beginning of the start bit and half way into the first (LSB) data bit, and one between successive bits: For 38400 baud, the delays are tuned individually, but the following table gives values for lower data rates:
Baud | Delay loops |
1200 | 74 |
2400 | 19 |
4800 | 7 |
9600 | 3 |
19200 | 1 |
The values shown are for the 1MHz board, and need to be changed under any other circumstances. They were found to be tight, which implies this is not a good design. At 19200 baud, the simple circuit shown did not need any modifications, but at 38400 it almost latched up when required to deliver a short positive pulse, such as the one representing a zero byte. Not bad for a twenty year old board- the inexpensive Internet connection in my district seems to be 42 kbps!
Transmission was error free, so parity was not used. It is easy to modify the program to ignore any incoming parity, but most systems have not used it for more than twenty years. A CRC, on the other hand, is always a good idea, and may be shown in a future section. Here is the code:
Lda #0 Sta direction ; Set port for input Sei ; Disable interrupts .back Ldy#8 ; Eight data bits .wait Lda port Bmi wait ; Wait for start bit Jsr del Jsr del Jsr del ; Wait until half way into 1st data bit .more Lda port Asla .store Ror base ; shift bit to form byte Jsr del Jsr del ; wait until next bit Dey Bne more ; Collect 8 bits Inc store+1 ; Prepare to store next byte Bne back Inc store+2 ; 256 bytes stored, so increment high byte of store Lda store+2 Cmp # 2+(base+fileLength) Div 256 ; The file is padded with zeros ; So its file length is an integral multiple 0f 256 Bne back Cli ; Restore interrupts Rts .del Ldx delay ; 1 for 19200 baud .still Dex Bne still RtsThe RS232 standard stipulates a minimum working distance of 50 feet (it will almost certainly work over longer distances). Four yards of twisted pair were only needed between the computers. The full 50 feet of cabling should have been tested, strictly speaking, but by Monday another project was on its way, and enough time had been spent on a configuration of no general usefulness, anyway. There is also a parallel-to-serial circuit and program, which will be shown soon.