perm filename SERIAL.DOC[KBD,ROB] blob sn#486122 filedate 1979-11-30 generic text, type C, neo UTF8
C00001 00001
C00002 00002	Writeup on the Micro Switch Keyboard Serialzers
C00003 00003	Functional description
C00006 00004	Physical characteristics
C00008 00005	Electrical characteristics
C00009 00006	Some notes on EIA and current loop protocols
C00013 00007	Programming considerations
C00017 00008	Signal definitions
C00022 00009	prototype notes:
C00025 00010	production notes:
C00027 ENDMK
Writeup on the Micro Switch Keyboard Serialzers

	**** WARNING ****

As of 27-May-79, the prototype is still being built, and the information
contained herein does not neccessarily reflect the way the Keyboard
Serializers will end up.

last update:
25-Jun-79	Spacewar poll character must be a specific character
Functional description

The Keyboard Serialzers take the 10 bits of parallel data from the Stanford
Micro Switch keyboards (11 bits if you count the keyboard strobe), and
transmits this data as two 8-bit bytes on a serial line.  Whenever a key
is pressed that generates "KBDSTROBE", a sequence starts which transmits
first a byte containing the "Bucky bits" (Control, Meta, Shift, and Top
keys), followed by a byte that has the actual key data.  This data goes
out over a two-wire, electrically floating, passive current loop.

There are times when the host computer wants to know what keys are being
pressed at that moment.  To accomplish this, the serializer is built to
receive data as well as transmit it.  When the serializer receives the
magic charatacter "***", the seriailzer will transmit a pair of bytes,
exactly as if a key were newly pressed.  (This mode of operation is called
"Spacewar Mode" for reasons that date back to the game of the same name.)
Note that if more than one key is pressed, the logical OR of the bits are
read in, just as in the (old) keyboard scanner.

Physical characteristics

The Keyboard Serializers are built on a printed circuit board and mounted
inside of the Micro Switch keyboards.  They ride "piggyback" on the
existing circuit boards, and connect to them via a short edge-card
connector jumper cable.  The serializer provides power to the Micro Switch
keyboard circtuitry through this jumper.

Another edge connector on the serializer board connects to the I/O cable.
This cable provides power (5 volts) and ground, and two pairs of current
loop signal (on transmit and one receive).

Electrical characteristics

Some notes on EIA and current loop protocols

The two states of an EIA or current loop line are called MARK and SPACE.
An idle keyboard will send continuous MARKS.
An unplugged keyboard (or a keyboard with the BREAK (sic) key pressed) will
send continuous SPACEs.  Continuous SPACEs will cause "framing errors" in
the receiving UART.

In EIA land, a MARK is signified by a low voltage.  (On the DCA, this is
about -12 volts).  A space is signified by a higher voltage (on the DCA,
approching 0? volts).

In current loop land, a MARK is signified by a conducting wire, (as if there
were a closed switch at the far end of the loop).  A SPACE is signified by an
open circuit (no current flow).

The first bit of a transmitted byte is the START BIT, which is always a SPACE
(EIA → low voltage, CurLoop → not conducting).  The next eight bits are data
bits, where a 1 bit is a MARK and a 0 bit is a SPACE.  The last transmitted
is a STOP BIT, which is always a MARK bit.  (Note that the line stays in the
MARK condition until the next byte gets transmitted).

When we say that this is the format of the transmitted data,

(first byte)---------------------------¬(second byte)---------------------------
|  00   01   02   03   04   05   06   07|  10   11   12   13   14   15   16   17|

We really transmit:

 mrk  mrk .... mrk  spc  mrk  spc  spc swrq kbst meta ctrl  top  mrk 

		    spc  spc shft  kb5  kb4  kb3  kb2  kb1  kb0  mrk  mrk  mrk...

See magic book:
Tech Aspects of Data Comm.
John E McNamara
Digital Press via Educational Services Dept. $20.

Elect Indus Assoc
2001 I St. NW
Wash DC 20006

Programming considerations

The serializer sends out two bytes for each keyboard strobe. The order of the
bits are:

(first byte)---------------------------¬(second byte)---------------------------
|  00   01   02   03   04   05   06   07|  10   11   12   13   14   15   16   17|

name	comments
SWRQ	If this bit is on, it means that this data is being sent in response to
	a spacewar request to read the keyboard.
KBST	If this bit is on, it means that this data is being sent because somebody
	typed a key.
META	The META key from the keyboard.
CTRL	The CONTROL key from the keyboard.
TOP	The TOP key from the keyboard.
SHFT	The SHIFT key from the keyboard.
KB5-KB0	The keyboard data proper. These are not decoded ASCII, remember.
	See the table below for the character codes for each key.

Note that the high order bit of the first byte is always on, and the high order
bit of the second byte is always off.  This should make it possible to get back
in sync if somehow we forget which byte we were on.

It is possible for both SWRQ and KBST to be on in the case where a
spacewar request was issued, and a key was concurrently typed.  However,
if both these bits are off, there is an error of some sort.


	 0   1   2   3   4   5   6   7  

     00  --- a   b   c   d   e   f   g  
     10  h   i   j   k   l   m   n   o  
     20  p   q   r   s   t   u   v   w  
     30  x   y   z   CR  \   LF  --- ---
     50  (   )   *   +   ,   -   .   /  
     60  0   1   2   3   4   5   6   7  
     70  8   9   :   ;   BS  ALT --- ---

Signal definitions

Here is a list of the signals used in the keyboard serializers:

BHI	  Logical HIGH signal used whenever a TTL signal needs to be tied to HIGH.
BSEL	  Low means first byte selected (bucky bits), high means second byte
	  selected (data bits).
CTRL	  "Control" key from keyboard.
DONE	  Come true when the second byte has been loaded in the UART for 
GND	  Logical LOW.
KB0-KB5	  Data bits direct from the keyboard.
KBSTROBE  Comes high when any key is pressed, and valid data appears on KBO0-5.
META	  "Meta" key from keyboard.
MRCLOCK	  MasteR CLOCK, runs at 16 times the baud rate.
SERRCV	E5(20)     TIP	-1.60	0.01	RI	UART	TR1602	DATA5	B7
SERXMT	E5(25)     TO	1.60	-0.20	TRO	UART	TR1602	DATA5	B7
SHIFT	  "Shift" key from keyboard.
SPWRQST	E3(14)     TIP	-0.80	0.02	4A	74LS157	LS157	DATA5	B3
SYNC	  When true, we have just loaded a character into the Transmitter
	  Holding Register, and better not switch the Byte Select or anything
	  silly like that.
THRE      Transmitter Holding Register Empty, the UART is ready to have a character
	  loaded into it for transmission.
THRL   	  Transmitter Holding Register Load.
	  When true, data is latched into the Transmitter Holding Register.  On
	  the transition from true to false, the data is strobed into the
	  Register (if no character is currently being transmitted).
TOP	  "Top" key from the keyboard.
VCC	  Illogical HIGH, +5V, used to power the chips and current loop converter.
XMRQ	  Means that there is a request to transmit a character, either due
	  to a keyboard strobe or character received from the host.

prototype notes:

This is where some signals are found

name	PC board loc	BURNDY loc	DEC padl	Serial PC
	(note 1)	(note 2)	(note 3)	board name
GND	 1		B		AC2		AA2
+5V	 2		A		AA2		AB2
KB0(lsb) 7		D		AS2		AH2
KB1	 6		E		AR2		AF2
KB2	 5		F		AP2		AE2
KB3	11		J		AN2		AM2
KB4	10		H		AM2		AL2
KB5(msb) 9		G		AL2		AK2
SHIFT	 N		K				AN1
TOP	 K		L				AK1
CTRL	 L		M				AL1
META	 J		N				AJ1
STROBE	12		b				AN2

note 1:	 PC Board Loc means the pin number on the edge connector.
	 Letters are on the component side, numbers on the sslder side.
	 While previously used to carry the data in parallel to
	 the multi-conductor cable, this connector will jumper to the
	 the serializer PC board.

note 2:	 The BURNDY loc refers to the pin on the 38 pin Burndy
	 connectors currently in use (5-Jun-79).  Their function will
	 be replaced by the serializer, and thus they will be replaced.
	 This info is really only for hooking up the prototype.

note 3:	 The Prototype loc refers to the location on the DEC-style
	 wire-wrap panel on which the prototype serializer is
	 built.  It will be flushed even sooner than the BURNDY
	 connectors (I hope).

note 4:	 Notice that I really mean lower-case "b" for STROBE on the
	 BURNDY connector.

note 6:	 Throughout this documentation, the data bits are numbered B0
	 to B5 (B0 is the least-signigicant bit).  The Micro Switch
	 documentation numbers them B1 through B6.  Beware when looking
	 at the Micro Switch documentation.

picture of the serializer PC board:

    ↓ connections to outside world	   jumper to microswitch board ↓
	|						        |
  === BA2	 (solder side shown, A≡AA1 on other size)	AA2≡ 1 ===
  === BB2	+Y						AB2≡ 2 ===
      ...	↑						...
  === BN2	.→ +X						AN2=12 ===
	|						        |
production notes:

The keyboard connects to the outside world via a piece of Belden 8446
six conductor wire.  One end of the wire connects to the jumper PC board,
the other end to a 15 pin D-type connector (as in the little brother to
the standard 25 pin EIA connectors).

Here are the mappings used:

signal name	wire color	DB15 pin #	50 pin cable pin #
Printer+	blue		01		33
Printer-	green		09		08
Keyboard+	red		02		32
Keyboard-	brown		10		07
+5		white		07		--
Ground		black		15		--

The term 'keyboard' here means 'the path from the keyboard to the computer'.
Clearly, the keyboard doesn't have a printer, but we use the term 'printer'
to mean 'the path from the computer to the keyboard'.  This is used to allow
the computer to poll the state of the keyboard (called 'Spacewar mode', for
reasons near and dear to our hearts).