BAUDOT-MACHINE INTERFACE WITH MICROCOMPUTERS Sengoda G. Gan...n, Merwyn Bruhn• and William C. Dixon Northam Illinois University Th is paper describes an interface technique for Baudot machines with microprocessor based computer systems. The hardware for Interrupt 110 and software drivers is analyzed in detail. INTRODUCTION The exponential growth of microprocessors has stimulated considerable interest in the area of digital peripherals. Modern computer systems can be built with peripherals such as line printers, video terminals. and floppy disk drives. Extensive design changes have been made on the line printers over the past three decades to improve the1r speed and data handling capabilities. Modern line printers are designed to deal w1th about 600 wpm in ASCII code whereas the old model, Baudot pnnters. can operate only at a maximum rate of 1 00 wpm in Baudot code. These Baudot machines are cheaper and are fast enough for many applications. Programmable 110 ports play an important role in the interface design. These ports are designed to be compatible only with the modern teletypes and therefore. hardware change s and additional circ Uitry w ill be needed for implementing Baudot machine-based microcomputer systems. Th1s paper descnbes an interrupt 110 interface technique for an 8080 based computer system with a Te letype Model 1 5 KSR Baudot machine. INTERFACE The computer system. Fig. 1 . cons1sts of a bas1c system, a teletype model 1 5 KSR machme, and an USART based-Interface circuit. The bas1c system IS Implemented with Intel 8080 microprocessor. The system consists of 512 bytes of memory with two pages. The first page of the memory map is implemented with an Intel 1 702 UVPROM. The firmware in the UVPROM consists of power up rout1ne, USART Initialization routine, teletype keyboard input service driver, and look up table for code conversion. The RIW memory in the second page of the map is for data and user onented program storage. The teletype handles data in Baudot code. The keyboard consists of 31 keys representing 57 Baudot characters. The characters are classified into two different categories. All the numeric keys are called 'letters' and the alphabetic and special characters are called ' figures '. The keys can be used in two different modes. If a key is pressed follow1ng a ' letter' key, then 1t IS treated as a letter character. A key-press is interpreted as a figure character if it follows a 'figure' key. The Baudot characters are represented by a 5 bit code and a listing of the various Baudot key code assignments is given in Fig. 2. The important aspect of the teletype interface is that the processor deals with parallel data transfer and that the Baudot mach1ne handles the data transfer in serial mode. The keyboard and the printer of the teletype machine can be operated independently with an average speed of 60 wpm. The speed can be 1ncreased to a maximum of 1 00 wpm with a proper drive gear selection. The printer magnet requires a signal with a cu rrent capability of at least 60 ma. The USART's incoming data from the teletype must be compatible with TTL-signal requirements. These USART and printer requnements can be achieved by an external power supply and buffenng transistors as shown 1n F1g. 1 . The interface between the teletype and the computer system IS by an Intel 8251 USART. The functions of USART are two-fold. It converts the parallel data from the processor into a serial data and the serial data from the Baudot machine into a parallel data. Also, it establishes a hand-shake between the teletype and the processor to compensate for the slow operation of the Baudot machine. The data fram1ng speed of the USART is called Baud Rate and is exclusively controlled by 67 The frequency of the time, Baud Rate Generator, is determined by the speed of the Baudot machine. For example, for a machine speed of 60 wpm, Table 1, the bit length is 22 ms and the Baud rate is 45 bps 11/22x1o· 3). The Baud rate generator drives both the TXC and RXC of the USART so that the USART transmits and receives the data at the same speed. The timer speed~s increased by a factor, Baud Rate Factor, of 16 for efficient data framing . Since the CTS input of the USART is always enabled, whenever the processor fills up the transmit buffer or the TTY transmits data to fill up the receiver buffer, the USART starts data framing synchronously. An interrupt 1/0 technique is used for transmitting data from the teletype keyboard to the computer system whereas, a software hand-shake technique is used for transmitting data to the printer. The interrupt 1/0 is achieved by driving the INT input of the processor with RXRDY signal of USART. Whenever a key is pressed, the receiver buffer in the USART will be filled up with the key code. The buffer will then activate the RXRDY signal which in turn interrupts the processor. Upon a qualified INT input, the processor will generate an INT A signal. Since the INT A output of the system is pulled high at 1 2 volts, the controller places a RST • 7 instruction to switch the processor into the keyboard input routine located in trap· 7. In the output mode, the processor places an 8 bit data word in the transmit buffer and stays in a loop. In the wait loop, the TXE status of the USART is monitored by the processor. The processor leaves the loop only when the TXE status is detected as active. SOFTWARE Upon power up, the system starts with the first page of the memory. The USART is a computerized 1/0 port. Therefore, it must be programmed before the system is used for data transmission. The initialization routine is located from 000 0009 to 000 0258 locations of the UVPROM memory. In this routine, the stack pomter, the register pairs B and Dare Initialized as a first step. The reg1ster pair B is used a pointer for the storage of object program in the R/ W memory. The object program is loaded into the system in Baudot octal code through the TTY keyboard. The register paid D is used as a pointer for the storage of the text {Source) in R/ W memory in Baudot code. Once the memory pointers are initialized, the mode of the USART is programmed. The mode programming includes framing details such as number of start and stop bits, the data size, and the Baud rate factor. Usually, the number of start bits is chosen to be 1 and stop bits as 2 . For Baudot teletype machines, the data size IS 5. A Baud rate factor of 16 is chosen for eff1c1ent data fram1ng . Data transmission does not start until a command word is programmed into the USART. The command word enables both the transmitter and receiver of the USART. At the end of the initialization, the processor enables the ruption and waits for interruption in halt mode. The flow chart for the power up routine and the initialization program are as in Figs. 3 and 5 . The keyboard input is by interrupt 1/0 operation. When a key is pressed, the key code is loaded 1nto the receiver buffer os USART. The USART will then sw1tch the processor 1nto the keyboard input routine 1000 0708 · 000 18291. In this routine, the processor emptys the USART, stores the data in the text memory using the register pair D. and echos the data back to the printer. The processor waits in a loop reading the status of the USART. As soon as the transmission is complete, the processor starts the object program storage. Before getting into the discussion of the object program storage, it is important to compare and contrast the object program and text. The object program is in object code, ' figures' , whereas the text is any Baudot character. The object program is an user-oriented driver, possibly, for the text. Whenever an object program is boot strapped through the keyboard, the keyboard service routine just echos it back as a text and decodes the object program into binary code. In the object program decoding logic, the processor takes three successive octal digits and converts them into an 8 bit binary word using the look-up table (000 0308 • 000 04 71. In order to boot strap a word of an instruction, one has to generate an 8 bit binary word. This binary word can be stored in R/W memory using the reg1ster pair B as the pointer and'S' key as the strobe. The flow chart and a complete listing of keyboard routine are as m Figs. 4 and 7. Once the object program is stored, it can be executed by simply entering the address of the starting location of object program and pressing the 'G' key. 68 If it is desired to dump the text of any part of the memory, a memory dump program must be boot strapped through the keyboard. When the text is dumped, carriage and line feed options are not needed because these characters are part of the text and are built into the text when it is manually keyed into the memory. CONCLUSION The system discussed in this paper is good enough to be a complete terminal if one is not too conce rned about the speed. Also, this system does not have any utility program such as assembler. If one wishes to use the Baud ot machine as one of the peripherals in the computer system, there must be some provisions for code conversion from Baudot to ASCII code. This can either be done by a look up table or by a character generator. If the peripherals tn the system require various clocks, a programmable interval timer such as Intel's B253 may be used. REFERENCES Intel Corporation. Intel 8080 Microcomputer System User's Manual, Santa Clara, California, 1977. Hill-burn J .L., and Julich, P.M ., M icrocomputers/Microprocessors: Hardware, Software, and Applications, Englewood Cliffs, N.J .• Prentice Hall, Inc. , 1 976. Bruhns, M ., Analysis of Programmable 110 Ports, Northern Illinois Un1versity, DeKalb, Illinois. 1980. Words Per Minute 60 66 75 100 Data Rate 45 50 57 75 bps bps bps bps Table 1. Characters Per Second 6 6.6 7.5 10 Bit Pulse Width 22 ms 20 ms 18 ms 13 . 5 ms Stoo Pulse Width 31 30 25 19 ms ms ms ms Operations Per Minute 368 400 460 600 Physical Characteristics of Teleprinter Speeds for Baudot Machines 69 • 8080 BASIC SYSTEM 'tr,....--------3-w-R u~~ -..j ~R xRDY +12vRESET 1KJ'\. 0 ... DATA BUS 6.!\. PRINTER MAGNET ~v FIG.1 A BAUDOT MACHINE-BASED TERMINAL Bot Numb4rt 54321 0 1 c... Uppet (Fituros) CoM Communiea1tona csw..b rdl Boll Svt~em ITWX) Stoclo Market We~ thor c~ - Bl>nk E Lino fted A B!lr,k 3 Uneftod Blank 3 Line Fted 3 00000 00001 00010 00011 4 5 6 7 00100 00101 001 10 00111 Space $pece Sp..:e (Apool (A poll 8 9 10 11 0 1 000 01001 010 1 0 01011 Car Ret 0 R J Cat Ret SWRU 4 Bell 12 13 14 IS 0 I 100 0 11 0 I 011 10 011 11 N F i K ( 16 T s ..s 18 19 10000 10001 10010 1001 I 2 3 /4 2 20 21 22 23 10100 1 0101 10110 10111 H • •6 6 0 1 0 1 24 25 11000 1 1001 11010 11011 9 518 6 Fi<jures •\ 2 '-I lower (L otion) 11 26 27 28 ~;} 30 31 1 1 I 00 11 I 0 I 11110 1 1 I 11 s I u c z L w y p a 0 B G Figures M X v Lttlers - 8 7 •I 6 0 1 9 ? 6 Figurn . I Lotttn 8 3 LlneFHd t Space Bell I 7 l Cat Ret Car Ret 4 Bell 4 718 114 118 112 ... s , " 0 -• 5 • "2 • I 3/8 9 FiturH I Letters • LAtten -----· L . . . . - - Figure 2. Baudot key code Assignment ...., N FIG 3 INITIALIZATION FIG. 4 FLOW CHART FOR TTY INPIIT 000 001 002 003 004 005 006 007 010 011 012 013 014 015 016 017 020 021 022 023 024 025 Instruction LXI SP 000 Initialize the stack pointer 070 071 072 073 074 075 076 077 100 101 102 103 104 lOS 106 107 110 111 112 113 114 115 116 117 120 121 122 123 124 125 126 127 130 131 132 133 134 135 136 002 LXI B 000 001 LXI D 200 001 HVI A 302 OUT 001 HVI A 047 OUT 001 El HLT Jlf> 021 Initialize the object memory pointer Initialize the text memory pointer Set USART mode Enable the transmitter and receiver Enable Interruption 000 -...1 (,.} FIGURE 5. 030 031 032 033 034 035 036 037 040 041 042 043 044 045 046 047 001 003 007 007 012 Initialization Program Baudot 3 Baudot 7 Baudot 4 004 020 005 025 006 026 000 027 023 023 002 Baudot 5 Baudot 6 Baudot 0 Baudot 1 I Baudot 2 FIGURE 6. Baudot to Binary look-up table Instruct ion IN 000 STAX D OUT 000 IN 001 ANI 004 JHZ 075 000 LDAX D IHX D PLISH D PLISH H HVI 0 010 LXI H 026 Input the USART Store in memory Echo it on TTY Read USART Status Stay in the loop until TXE•l Retrieve the data Increment pointer Save the pointer Set the table size 000 INX H INX H DCRD JZ 145 000 CHP H JNZ 115 000 INX I«JV POP POP HOV HOV RAL RAL H A, H H 0 H,A A,L Jump if 'letter' Move binary code 137 140 141 142 143 144 145 146 147 150 151 152 153 154 155 156 157 160 161 162 163 164 165 166 167 170 171 172 173 174 175 176 177 200 201 202 203 Instruction RAL ANI 370 ORA H I«JV L,A RET POP H POP D CPI Check if 'L' key 022 JNZ 156 000 HOV C,L RET CPI Check if 'H' key 024 JNZ 165 000 I«JV B, H RET CPI Check if 'S' key 005 JNZ 176 000 MOV A,L STAX B INX B RET CPI 032 RNZ HOV L,C I«JV H,B PCHL FIGURE 7. TTY Keyboard input routine Check if 'G' key