Вы находитесь на странице: 1из 11

Computer to Baudot Teletype Interface, Rev B

April 2014, Updated June 2015


I designed, built, and tested this interface in 1978-79 so I
could use my AN/FGC-25 teletype set to print text sourced by my
M6800 microcomputer. I got the hardware interface working using
a test program. Due to other life events I never completed the
design of additional software to convert ASCII text to Baudot
code for output to the teletype printer, until now.

I do not know if it is OK to ground one side of the TTY current


loop, but I did, and it worked. Note that the polarity of the
current loop wires must be known so they can be hooked up
properly to this interface.
The circuitry is built on a standard 4 x 6 plug-in board with
44-pin edge connector. Pin C is the 5V return (ground) for the
timer circuit. This allows you to externally disable the timer
circuit if desired. Normally you externally connect pin C to
same ground as pins X and Z.
The data input and timer output signals connect to the useraccessible MC6820 peripheral interface adapter (PIA), located on
1

the MEK6800D1 microcomputer board, via the backplane wiring of


my homemade microcomputer system.

The test software worked well enough to prove that I could


output and print the following repeating 43 byte test message;
<LTR><CR><LF><sp><sp>THIS OUTPUT CAME FROM MY COMPUTER<FIG>.<LTR><CR><LF>

May 2014- I decided to complete my design of a more useful ASCII


to Baudot conversion program so that I could print typical text
files on the teletype machine. I found a Freeware MC6800
assembler and simulator tool, SDK6800, which runs in Windows 7.
Some of the pseudo-op mnemonics are different from Motorolas,
and some other minor differences. I started with my old notes
and flow charts that I developed 36 years ago.

Test software listing;


;
MOTOROLA MC6800
;
SERIAL TTL TO CURRENT LOOP BAUDOT TELETYPE DRIVER
;
BY DONALD R. SENTZ
;
;ORIGINAL CODE AND HARDWARE INTERFACE WERE DEVELOPED AND ;SUCCESSFULLY
TESTED CIRCA 1978-1979
;THIS SDK6800 SIMULATOR VERSION WAS CREATED MAY 15, 2014
;
;THIS VARIATION OF MY ORIGINAL CODE WILL RUN ON THE FREEWARE
;SDK6800 SIMULATOR ON A WINDOWS 7 PLATFORM. THE SIMULATION
;CONFIRMS THAT THE BIT COUNTER SHOULD BE INITIALIZED TO 6
;INSTEAD OF 5 IN ORDER TO SHIFT THE STOP BIT ONTO PA0 OUTPUT
;LINE. IT IS POSSIBLE THAT THE VALUE 5 WORKED, BUT IT IS NOT
;STANDARD PROTOCOL TO OMIT THE STOP BIT. I MIGHT HAVE DONE IT
;AS AN EXPERIMENT, SINCE IT WOULD SLIGHTLY SPEED UP THE PRINTING
;CYCLE.
;
PREGA
.EQU $8008
;ADDR. OF MEK6800D1 PIA
XTEMP
.EQU 0046
;TEMP. STORAGE LOCATION
ORG $0000
JMP START
;SDK SIMULATOR PC STARTS AT 0000
;
;BELOW IS THE TEST MESSAGE BUFFER, 43 BYTES LONG
;
BUFFER .BYTE $7E,$50,$44,$48,$48,$60,$68,$4C,$4A,$48,$70,$4E
.BYTE $60,$6C,$4E,$60,$48,$5C,$46,$78,$42,$48,$5A,$54
.BYTE $70,$78,$48,$78,$6A,$48,$5C,$70,$78,$6C,$4E,$60
.BYTE $42,$54,$76,$78,$7E,$50,$44
;
.ORG $0100
START
BSR INIT
;SET UP PIA FOR BAUDOT SEQ.
REPEAT
LDX #3
;SET INDEX REG. TO ADDR. OF
DOBUF
LDAA 0,X
;START OF BUFFER, GET CONTENTS
BSR BAUDOT
;AND PUT OUT TO TELETYPE.
INX
;POINT TO NEXT BUFFER LOCATION
CPX #0046
;TEST FOR END OF BUFFER
BNE DOBUF
;IF NOT THE END, KEEP GOING
BRA REPEAT
;ELSE DO IT ALL OVER AGAIN
;
INIT
LDX #PREGA
;ADDR. OF PERIPHERAL REG. A
CLRA
;CLEAR CONTROL REG. A SO IT
STAA 1,X
;POINTS 8008 TO DATA DIR. REG.
LDAA #$7F
;CONF. PIA0 I/O PORT MSB TO INPUT
STAA 0,X
;AND THE 7 LSB'S TO OUTPUT.
LDAA #4
;SET BIT 3 OF CONTROL REG. TO 1 SO
STAA 1,X
;8008 WILL INDICATE PERIPH. REG. A
LDAA #1
;NOW OUTPUT A MARK SIGNAL TO
STAA 0,X
;CLOSE THE TTY CURRENT LOOP
RTS
;AND RETURN

;
;THIS SUBTROUTINE OUTPUTS ONE BYTE FROM THE CHARACTER BUFFER TO
;THE TELETYPE INTERFACE. THE BYTE CONSISTS OF B0=START BIT=0
;B1-B5 = BAUDOT CHARACTER, AND B6=TTY STOP BIT=1.
;
BAUDOT
STX XTEMP
;SAVE CHARACTER POINTER
LDX #PREGA
;POINT TO OUTPUT REGISTER
LDAB #1
;SET INTERVAL COUNT TO 1
BSR TIM1
;WAIT FOR START OF NEXT 1MS INTERVAL
;1MS WAIT PLUS THE STOP BIT 30MS (BELOW)= THE REQUIRED 31 MS
STAA 0,X
;PUT BYTE TO PIA OUTPUT REGISTER.
;THIS PUTS THE START BIT ONTO PA0 OUTPUT LINE AT BEGINNING OF
;A 22 MS INTERVAL
LDAA #6
;INITIALIZE BIT SHIFT COUNTER
SHIFT
LDAB #22
;SET TIMEOUT TO 22MS
BSR TIM1
;HOLD OUTPUT FOR 22MS
ASR 0,X
;PLACE NEXT BIT ONTO OUTPUT LINE
DECA
;DECREMENT BIT COUNTER
BGT SHIFT
;KEEP SHIFTING UNTIL DONE
LDAB #30
;HOLD STOP BIT 30MS
BSR TIM1
LDX XTEMP
;RETRIEVE CHARACTER POINTER
RTS
;AND RETURN FROM BAUDOT
;
;THIS SUBROUTINE COUNTS INTERVALS OF THE 1MS TIMER LOCATED
;ON THE TTY INTERFACE BOARD.
;
TIM1
TST 0,X
;CHECK IF PA0 IS LOGIC 1
BMI TIM1
;PROCEED WHEN IT GOES TO 0
TIM0
TST 0,X
;CHECK IF PAO IS LOGIC 0
BPL TIM0
;PROCEED UPON 0 TO 1
DECB
;COUNT DOWN AT 0 TO 1
BNE TIM1
;KEEP COUNTING DOWN UNTIL DONE
RTS

To run this software on the SDK6800 simulator (on Windows 7


platform) simply replace the BPL TIM0 instruction with NOP.

SDK6800 Simulator Window While Running TTY Interface Test Code


---------------------------------------------------------------January 25, 2015- Between May and December I resurrected my 6800
computer and one of my Macintosh 512Ks, and put them back in
operation as detailed in other reports. I resumed this TTY
interface activity in late December. I re-typed the ASCII-toBaudot printer driver source code into my Macintosh 512K (using
MacWrite) so I could use the M6800 MP-E Resident Assembler.
After some code modifications and debugging, I successfully
tested the code yesterday, using my Fluke multimeter to monitor
the data line from the PIA chip to the TTY interface card.
The 1ms timer on the interface card seems OK, but I am not sure
how close to 1ms it still is. I verified it as pretty close,
though, using a 1 minute interval timer program (TEST_TIMER.SRC)
and timing it with my wristwatch. I used my DVM to observe
activity on the data line from the PIA chip (MC6820) on the CPU
board to the teletype interface card.
I had to remove the 7406 chip from the interface card to see
proper logic levels on the PIA data line. I think there is
something wrong with the 7406 chip. It is supposed to be an
inverter, but it is not acting like inverter, and the logic
levels arent right. I removed it and hooked it up in a test
circuit on my proto-board. I confirmed that it is not inverting,
and the output low-level is higher than logic zero level should
be. I observed the same behavior for the inverter at pins 11-10
as the one at pins 9-8. This chip used to work, but that was in
1979.
5

January 29, 2015- Today I found a 7406 chip on my abandoned


paper-tape-punch driver board (which worked, by the way). After
verifying my test circuit using a good 7404 (without a pull-up
resistor) I tried this other 7406 chip (with pull-up resistor)
and it worked as I expected it should. I put it in the TTY
interface and the logic levels now make sense. The software and
the interface hardware now appear to be working properly, up to
the current loop switching transistor. TTY3.SRC is the current
MacWrite-formatted source program file for the TTY printer
driver. Save it as a text-only file for input to the assembler
(TTY3.SRC MacWriteTTY3.TXT MP-E AssemblerTTY3.OBJ).

Printer Interface Works Again after Replacing the 7406 IC

1 Millisecond Timer Circuit Works Fine After 35 Years


6

February 6, 2015- I wired up a 5 volt bench supply, 360 ohms of


series resistance, and LED as a current loop circuit to test the
MJE340 output transistor. The loop current was about 10
milliamps. The test was successful. I modified the timer test
program to turn on the LED at the 1 minute mark
(TEST_TIMER2.SRC TEST_TIMER2.OBJ). I estimated about 61.3
seconds using the LED, consistent with an earlier test which
used the MacTerminal bell signal as the 1 minute marker. This
suggests the timer frequency is about 979 Hz, too low.
I loaded UTMGR3.OBJ, TTY3.OBJ, and TTY_TEST.OBJ (text file) and
operated command 3, to print text buffer to TTY interface. I
observed the LED flickering in step with the serial output, and
normal OPERATION COMPLETE termination.
Next is to adjust the 1ms timer using my Fluke Model 79
multimeter. I just remembered today that it has a frequency
counter function.
---------------------------------------------------------------February 7, 2015- My multimeter measured about 965 Hz for the
timer. I was able to adjust it to within about 1 Hz of 1000 Hz.
The timer test result using the LED is now 60.0 seconds, vs. the
previous 61.3 seconds, as best I can estimate.
I decided to retest the audio cassette interface since the TTY
interface card is now installed. I had some trouble getting the
cassette tape-to-memory-load function to work right, but
eventually it worked OK. I suspect the audio plug connection to
the earphone jack on the tape recorder is ratty. Seems like this
happened before. Need to clean the plug contact surfaces again.
---------------------------------------------------------------It is now time to proceed with getting the teletype machine back
in operation. I plan to defer the opto-isolator modification
until after I achieve success with the present resources.
April 7, 2015- After restoring operation of the teletype machine,
I successfully sent text data to it via this interface, on April
2. The text printed correctly most of the time. There was one
error in my lookup table that was easy to fix with a software
patch to TTY3.OBJ.
During subsequent testing a condition occurred that resulted in
a blown 4-amp fuse in the teletype set, and two parts failed in
this interface; the 7406 chip (again), and the 2N2222A switch
driver transistor. This 2nd 7406 chip may have been from the same
lot as the first one that failed. I saw a forum posting on
internet a couple of weeks ago where a fellow replaced 2N2222s
7

that had gone bad in his old computer system. He said they were
susceptible to tin whiskers due to their age. The blown fuse
occurred right after the teletype printed the character &,
which is figures mode G. The printer was in figures mode when
it failed to receive the LTRS command correctly, before a
transmitted ABCDEFGHI sequence. The figures mode H is a MOTOR
STOP command. But since it was immediately followed by another
transmitted character, it attempted to restart before it had
completely stopped. I have concluded that this transient motor
condition caused an AC line current spike that blew the fuse.
Oddly, the computer interface parts failed at this very instant.
I have not been able to figure out why. The only thing I can
think of is that I have the "minus" side of the 60mA current
loop line tied to microcomputer ground on the computer interface
card. This should normally be OK.
After replacing the fuse, the 7406, and the 2N2222A, all is
working again, just as it was before the incident. I should
probably implement the new opto-isolator-based design that I
discussed earlier so that there will be no electrical path
between the teletype sets current loop and the computer.
This incident points out that it is possible for the printer to
be in figures mode when the computer thinks it is in letters
mode. I am updating my ASCII-to-BAUDOT conversion table to
define two of the ASCII command codes, DC2 and DC4, to
explicitly send the LTRS code and FIGS code, respectively.
April 8, 2015- The DC2 and DC4 command codes work fine. I
modified my software to send a header string to the teletype set
before sending a text file. The header string consists of
0,0,0,0,<DC2>,0,<DC2>,0,<CR>,<LF>. This header works great, so
far. There have been no print errors since I started using it.
I can now send ASCII text files from MacTerminal to the teletype
set for printing, via the MC6800 computer. I demonstrated this
capability for Episode 4 of my Teletype set videos, which I
filmed today; TTY Video Demo
--------------------------------------------------------------June 14, 2015- Over the past year I developed modifications to
the interface circuit so that 1)the polarity of the current loop
connection will not matter, 2) the current loop is electrically
isolated, and 3) a circuit for receiving data from the teletype
set is added.

The 22 ohm resistor in the receive path is supposed to carry


about 50mA of the 60mA loop current. The other 10mA goes through
the diode in the H11D1 chip.
Note that the collector resistor for the 2N2222A is changed to
352 ohms. This is so that the ON-state LED current in the H11D1
will be approximately 10 mA.
Yesterday I completed the upgrade of the TTY interface to the
new design. Here is the picture;

10

I tested the transmitter portion of the new design today, and it


works fine. At 58 mA loop current I measured 0.167 volts across
pins 4 and 5 of the transmit opto-isolator. I measured 0.853
volts across the emitter and collector terminals of the MJE340.
The receiver circuit LED correctly displayed the mark and space
states of the current loop. and the receiver circuit data output
signal at pin R was also correct. The final test is to 1) send a
message to the teletype set from the microcomputer, and 2)
receive a message from the teletype set to the microcomputer.
For this last test I still need to develop the software.
June 15, 2015
1. Messages transmitted successfully to teletype set.
2. I forgot that I had completed the TTY reader software over a
month ago. Today I tried it out. There were only two minor
mistakes that I was able to quickly identify and fix. The TTY
reader circuit and software work great. Here is the video demo.
The TTY interface card upgrades and the Utility Manager upgrade
are both complete.
Thank you for your interest,
-73

11

Вам также может понравиться