Basics on Keyswitches and Keyboards    Page No.:D03-2
 
        Basics about keyboard decoders and how they work  
     
 

 
Basics about keyboard decoders and how they work
 

After we treated the topics of the keyswitches themselves very close in the first part - the topic of the matrix was only spotted with very few lines and the decoders had been left for this page.

So before we treat the decoders we should switchback to the matrix again and view the function of this "trick". Basically we have at the Apple II and II+ a keyboard with 57 keys and at the Apple IIe -model there have only 5 keys added :

the left shiftkey - for uppercase
the right shiftkey - also for uppercase So this one does the same as the switch above ( except in very rare special cases like in some games )
the Capslock-key which is in fact a "real switch" that remains in one position open or close until itīs pressed again....
the open-apple-key ....      - in modern keyboards itīs comparable to the "Alt"-key
the closed-apple-key.....   - itīs comparable to the modern "AltGr"-key .

In technical view only the capslock-key is a real switch, while all other keyswitches act in fact like "push-buttons" that only give contact of pressed and immediatly open contact again in the moment they are released.

So if you would like to determine which key is pressed without a matrix this would reqire 1 common line along to every switch with for example +5Volt and 57 lines for the apple II or 62 lines at the apple IIe ! this wonīt be very smart and it would waste a lot of wiring and if you like to decide
to make a PCB it would become very complicated to handle the task by avoiding that one line hits another line.......

So the big trick to solve the problem is the matrix !
Itīs something like a chessboard where you can determine each field by a "row" and a "column" number.
lets view below some scetches of matrix-models:
 

Section A) of the picture above explains the last part of the text above showing the one powerline and each keybutton with a single own line without using a matrix. In very early somputersystens and testing- or microprocessorlearningsystems instead of using keybuttons the input was also sometimes done by entering directly the bytes ( 8 Bit per Byte ) with small Dualinlineswitches and a Button representing something like an "Enter"-button.  So each of the single bits was represented by one switch and all 8 switches together were set for entering one byte. The enter-command was given by a button that gave an impulse to the board-logic and the byte was pushed into a flipflop register where the CPU pickup the input and moved it to memory. To be very exact the Byte was entered with two strikes because each Hex-number only represented half of the Byte and the lower hexnumber represented the bits 0 to 3 and the second Hexnumber represented the Bits from 4 to 7 ! Thats also the reason that programs in magazines noted in pure machine code are always written each command with 2 hexnumbers ( ( i.e. OE 10 07 A0 A6 .... and so on..... )

The next step was to enter the bytes with two strikes of a Button and that was immediatly translated to a Byte as input. The decoding was executed with the help of a diodematrix which caused the byte to be set by each buttonstrike. In both of this cases we talk about so called "hardware-decoded-keyboard", because the functions are wired with diodes and could not be changed ( schemata B) and C) ).

Such systems were very timeeating because all inputs and outputs were handled directly with machine-code in hex-code ( based to the basic of the number 16 and these were represented with characters from 0 to 9 and A to F ). Such systems didnīt even have a Editor or a symbolic assemblerprogram ! The next picture after this textbloxk shows such a system with 6502 CPU and the Display was given mostly also in Hex-code by hexadecimal LED-Display- in this System it displayed by single  LEDs
for each Bit one LED .
 


Now lets take a look at Section D) 2 pictures before. It displays 2 examples of a matrix...... the first splits the wires in a matrix 4 x 4 and you might be able to mount 16 pushbuttons..... the other matrix is 5 x 3 and it provides us only with the possibility to mount 15 pushbuttone and not displayed in the picture but explained by simple arithmetics would be a matrix of 2 x 6 and the matrix would only offer 12 points for mounting pushbuttons..... so with 8 wires representing 8 Bits a matrix of 4 x 4 offers best resolution.....  probably you might waist some time thinking about why this phenomenon happens ???
A hint: itīs got to do something with a greek man called Pytagoras and a thing he discovered.....

But now back to the picture before and the section E) ......  matrix-models used with decoderchips in the 70īs to 80īs use 8 x 8 lines resulting in 64 possible crossingpoints where a keybutton can be mounted...... and with a special trick there can be up to 255 key-codes generated....
"Stop !" you might say loud ... "how can that be, that 64 buttons can resolve up to 255 items ( or how can you make 255 situations with only 64 buttons )? "

well lets examine the keys at the computer itself to discover the trick..... the very first time the trick was performed was when advancing from the Apple II to the II+ or II europlus. The key we talk about was the shift-key ! All keys had before at the older models only one code issued and one sign displayed and that old models only had uppercase characters ! By adding the shift-key the computer became the ability to do the same as the most typewriting-machines by displaying upper case as well as lowercase.....
so that one key doubled the amount of displayed and representable keys and characters.... it was done by just adding the amount of 64 bit to the true value of every key ! This was done by the encoderchip that detected each keypress in the matrix and treated some keys with very special "permissions"
to be pressed "together with another key"!  The moment we switched in the discusion from the basic 64 keys possible to be decoded with diodes and wires to instead be decoded by a matrix and a decoder chip is the very moment were we switched from "hardware-coded-keyboards" to "software-coded-keyboards". This happened in the years about 1979 to 1980 when a complete familly of microprocessors were brought up to the market known as the 65XX-family and the 8051-family. These chips had some special features in those days ( now thats nothing really upraising at all ... ) but in those days it was amazing that these new chips did not only contain a CPU but also some small amount of ROM and RAM inside and a lot of lines outside as special "communication"-lines....   this permitted the chip to be progrqammed with a small program to act / react to incidents happening at the communication-lines  and the lines were used to act as a matrix and the program permitted special treatment / reaction to the hit of special selected connections....
- and violá ! the encoder-chip was born....

the rest is rather simple ... after the schift.key was "invented" soon at apple the "open-apple" and "closed apple" key were invented at the apple computers while in the Commodore-world and at IBM the Ctrl-key and Alt-key instead took place. This enabled the programmers to make a giant leap in programming special functions to ebable software to do a lot of things with double keystroke instead of long lasting commandchains... the trick by decoding was performed by adding at the open-apple-key with another key the value of 128 was added to the other key and with the closed apple-key the value added was 192 !
you could call it a kind of "instant-driving a program with special-key-commands" .... at the Apple the program Appleworks was one of the very first programs with such enhancements .... that was the birth of the so called "command-key-charts" often printed on a carton and covered with plastic put on top of the keyboard untill the user knew the commands by mind without the charts....

the "losers" in those days were the guys that just copied the disk and forgot to also xerox the commandcharts because they never used the programs full features and power....  and the biggest losers were those guys that were to lazy to inspect the help-files on the disk too.... because in the most help-files there was also some documentation on the "special-key-commands" .... so a lot of games never had been played with joy but rather more stoking around the keyboard to find out how to just even get the game running and how to move around at all.....

if you ever get in such a situation the firstaid is allways to hunt for documentation and for the help-files ... it will save a lot of painfull struggles at the keyboard....

but now back to the topic itself .... another common thing in those days was the fact that a lot of computers sold in foreign countries had been equipped with a Char-ROM that contained a "national" ( say better foreign "local" ) Character-set. This was a nice thing ... but there was one big disadvantage :
A lot of companies were to lazy to translate their programs developed for the U.S. Market to another language - so a very large amount of programs requested to run with U.S. Character-set..... so one of the most common modifications at the Apple computers was replacing the Character ROM with a larger Chip and a wire leading to a switch to permit switching between the two Character-sets : the local one and the U.S. version...... nearly the half of all Applecomputers ( including the original ones and the clones ) had such a switch somewhere - you would only have within the USA a chance to find computers without such a switch....   Itīs a often performed mistake to think this to be a task related to the decoder chip .... Itīs NOT ! This is only related to the Character ROM !

But back to the encoderchips: with upgrowing needs ( in other words: with growing amount of sold computers ) the chip-companies like AMI, Intel National semiconductor and others started to make own special decoderchips and "public" decoderchips......

So whats the difference ? The public decoder-chips could be bought by any customer at any electronic-shop or it could be at least ordered from the catalog and these chips had a documentation within the catalogs of the chip-suppliers and a related "datasheet" that uncovered the decoding itself by long lists of bytes being emitted when striking a defined key ... the so called "truth-tables".... this kind of decoders where used also by companies that built different keyboards for different computers and different computer models......

The opposite to this were the so calles "custom-chips" - this special decoders were made on the demand of companies making a large amount of same keyboards.... the went up to the chip-company and asked them to make a series of some say 10.000 chips with a decoder program only known by the company itself and the code and the documantation was given back to the keyboard-making-company and these chips were never sold in public or documented in public....  this is true for quite a lot of keyboards from cherry and a lot of keyboards made in Taiwan in the late ī78 to ī85 made for clones....
most of this kind of chips have stange marks like TK-10 or something like that and usually they donīt even have a real company Logo.

But you should not condemn them all together.... some of these keyboards were sold for a lot of bucks and the programmers in those days loved some of them... just for example the so callesd "Apple keyboard commander" : these keyboards had a special feature - a "function"-key that permitted "rapid" programing ... instead of typing the entire command "for " you just stroke once while pressing the "function"-key the f-key and the entire sequence of letters apeared at the prompt and the cursor was positioned right one empty space after "for "... just waiting for you to only enter the linenumber and then to continue entering program-code... each letter when used with the function-key was representing an entire command.... and that saved a lot of typing at the times of the Apple II+ ! Several keyboards from clones had that feature too......   in most cases you could identify these kind of keyboards by the fact that the caps on the keys also had on the front side written very small the commands related to the very key.....

The next point with this topic of decoder chips is the following: at hardwired keyboards the so called "debouncing" of the keys was realized by wired logic omn the board that was related to the so called flip-flop-chips and the "bus-transcievers"/"latches" ...  every mechanical key produces while being pressed a series of so called "micro"-contact-hits and that generates a number of keystrokes issued within parts of a second.....

But of course the user only normaly wants to get one "a"-letter when striking the key and not a series of 6 to 8 "a"īs ! So every keyboard circuitary contains some kind of timing circuit to eliminate the additional amount of letters. When the decoder-chips came into the market this kind of timing was integrated into the decoder chips -usualy realized with a so called R-C combination with a capacitor and one resistor that together set the time of delay before a new keystroke will be accepted by the chip...... the resisitor loads up the capasitor and when the capacitor was loaded to a defined limit the circuit opens the gate for new entered strikes....  this is for example a common problem with old keyboards.... if the ceramic-capacitor at the decoderchip is damaged this causes a series of letters issued to the computer if one single stroke was issued..... at the IIe its the one with the marking C70 and the resistor R32 close to the notched side of the decoderchip KR 3600-pro at the right front ( towards the keyboard ) of the mainboard.

And finally we can now finish the roundup by talking about the communication between the decoder chip and the computer itself......
there must be some communication between both .... the chip must give a signal to the computer that a kaystroke happened and the computer must give some kind of notice to the chip after it picked up the byte from the chip and tell the chip that the task has been performed.......
so in normal case there is a signal line like "Strobe" that indicates the keystroke and the line to instruct the chip that the computer picked up the information like "control". The correct used terms change from company to company so using the correct term usually affords to read the datasheet of the chip.

Now following will be the datasheets of the most common decoderchips and at the beginning sometimes some short remarks by me.Thereafter is every time a link to permit downloading the datasheet.
 

The MM5740 was used in the datanetic keyboard and is now also searched for the Mimeo or other replications. The chip was also used in some very early Apple IIīs.

                                     the MM5740 Datasheet as PDF-file
 

The MM5745 chip wasnīt used within the apple computers, but you might find the chip used in keyboards from thirdparty manufacturers...
 

                    the MM5745 datasheet as PDF-file
 
The AY-5-3600 was NOT used in the Apple IIe.  The correct chip is below of this one ! This chip is similar but NOT the same to other chips
that just have other extensions.
 



                        the AY-5-3600 chip datasheet  
 
    The AY-5-3600 PRO was the chip that was really used in the Apple IIe series....



                             the AY-5-3600-PRO decoderchip
 

The KR3600 decoderchip sound quite similar to AY-5-3600 but it isnīt similar at all ! But it was acommon used chip in third-party keyboards.
 


          the KR3600 decoderchip datasheet  
 And here is a basic application note about keyboard decoderchips for those who demand for more information to the topic.....


              
 
 
       Application Notes about keyboard decoder chips
 
 
      back to the keyswitch and keyboardpage Part 1  
       back to the downloadpage  
         
       due to european laws and german court decision:
 I hereby declare no responsibility to any "deep links" resulting from the links in this page. I have no influence to the pages linked hereby in this page and the
 contents in those pages. I therefor canīt take any kind of responsibility to contents in the pages, where these links direct the readers browser to nor to the
 contents resulting from following up links from those pages. The reference to contents by this links is dependent ro the status of the date when the links have
 been set ( April 2013 ) and it might occur that references and contents may change by the fact that domains may have been discontinued from their former owners.
 In such cases i canīt take any kind of responsibility to the changed contents. this is specialy valid to banners, advertisements or merchandising links in the targeted
 pages.

 

 

some other keyboard encoderchips will be added soon.....