You are on page 1of 11
4 KEYBOARD AND DISPLAY eee For low-cost small systems, especially single-board microcomputers and micro- Processor-based instruments, the front panel (or console) is often implemented by ‘sing simple keyboard and display units as input and output devices. Through a Scanned wth CamScanner ail ett mia ty ‘or s decimal form. In addition to the numeric keys, a keyboard een ter monitor and control cor bane tered in the hex ude funetional memory addeses and 44 Keyboard Design —= Unlike & terminal, a mechanical contact keyboard, for whic the key switches are cxgaized in a matrix form, does not include any electronics. Figure 930 lieteane, how a 6t-Key keyboard can be interfaced to a microcomputer through two parallel {UO ports such as those provided by an 825A. When a key is depressed, de coresponding row and column are shorted to form a path. By detecting the tow and column positions of the contact closure, the code word representing the de- pressed key is determined. This process is called keyboard scanning and i accom plshed as follows. The output port sends 2 0 to row 0 and Is to all 7 of the other rows. The column lines are then read and checked, Ifa 0 isnot found in row O, then the process is repeated for row 1, then for row 2. and so on. When 2 found, a depressed Key is detected whose tow positon is known from the com. bination that was output and column position is known from the input, By com- bining the row and column positions af the 0. a unique word which indicates the positon ofthe depressed Key ean he found ‘There are two major problems associated with Keyboards; they are contact bounce and striking keys at about the same time. When a key is depressed or released, the contact may bounce between its open and close postion several times before it sete to a close oF open position, The duration of the bouncing varies andis normaly les than 10 ms. Contact closures due to bouncing must be discarded to prevent false key detection and this operation is called debouncing. Debouncing can be accomplished through either hardware or software, but the software ap- roach requires to0 much processor time for most applications. Multiple key los- ings are most easily handled by scanning the entire array and inputing the closures in the order they are detected S42 Display Design Visions pes of dev sie and alphanumeric day, es of devices are available for numeric anda 7 Seven-segment LED displays such as the one shown in Fig. 9-31 are typically used for hexadecimal digit display. A digit in seven-segment code is fed to the input Piso though g and DP Te input canbe represented by active Tow orate high signals, depending on whether the display unit is of a common anode or a simnon cathode pe Am india pment it when the eatesponding LED Stonerd bed ae Figure 9-32 shows a multiple-digit display that is configured ‘eight seven sens? Mama mae a ger ata latches from the display units, they can be connected to two -bit parallel ‘Scanned wih ComScanner ejursinplenete Tana aary Each di Unit, the fs ae SPY i driven for 1 ms and after rotating hrov Teturned ‘igure 9-30 Organization ofa mechanical keyboard to and the sequence is repeated. Thus. © ‘Scanned wih ComScanner utput ports and operated is y unis share tH | espa in 4 multiplexed mode. All display u! br | Select lines eet lines and only one unit is selected at a time through the 1 yall eight keyboard and Display D'S 4 so Arai] [DE o Lot. . p+ itt toe Lo or or ty | ttre Sly Unt (6) Common ete Figure 931 are repeatedly refteshed 10 give the illusion of a continuous! display. Since a typical average current through each turned-on segment could be as high as 20mA and more than one segment may be lit per digit the resulting sure cxceds the driving capability of a regular TTL gate. Therefore. digit deters ood segment drivers are needed. A low on the base of a digit driver transistor turns the transistor on and effectively connects that display unit to +$'V. A low on the base of a segment driver transistor turns on the transistor, thus letting current ow throught the segment. In addition, since the voltage drop across a forward-biasee segment diode is constant, a resistor in series with each segment is requited to lit, the cutrent, thus protecting the display and drivers, The design ress ‘esstors depends on the desired display brightness. Another type of hexadecimal digit display is the Texas Instruments (TT) TILSH shown in Fig. 9.33, which uses a matrix-dot array of 20 LEDs. It inputs a ‘bt binary number and internally decodes the digit input to light the LEDs cot ‘sponding to the equivalent hexadecimal digit, Since it fs built Latches and Constant current drivers, th ble, thus eliminating a need! Serna drivers and curzentlimiting resistors. Albo, the input latch hols data for ‘Onstant display and refresh is no longet requis. ly it multiple-digit of these input is TTL compa Seg Keyboard/Display Controller he ee Althous y to parallel LO ports is id niultiple-cigit displ a i ie neces Ssh a yyy senna iy ee he Pibcinnanly the the time-consunin anal refresh. operations ‘Scanned wih ComScanner keyboard and DISpay 4 BLANKING: Figure 9.33 TITILU mateodot hexadecimal display Figure 9-34 shows the general structure of the 8279 and its interface to the tus. The control and status registers share the odd address and the data buffer register uses the even address. The addressing is according to the following table: % RD WR = AD—_“Transfer Description 0 1&8 asta bus to data butter register 2 101 Data bus to control register 5 0-10 ata buffer register to data bus lenny 1 Stetus register to date bus ‘bere means high and 0 means low For keyboard control, the 8279 constantly scans each row of the Keyboard by sending out row addresses on SL2-SLO and inputting signals on the return lines RL-RLO, which represent the column adresses. Note that the SL3-SLO lines are Sed for both keyboard scanning and display refreshing and wil accommodate wp eal daplay units. When a depressed key is detected, the key is automascily Getounced by waiting 10 ms 10 check if the same Key remains depressed. If 2 qbtssed key is detected an 8-bit code word corresponding t0 the Key position S ‘Rrmbled by combining the encoded column positon, row poston, shit sts Control status as shown below. orp pele] sncoded row postion Tecan Hino across) ‘Scanned wih ComScanner < Damar >} 067-080 EI a our 3-20 eae FIFO Colusa tines semarmemery | RLT-RLO Krom keyboard suet |} Sean ines to st3-s.0 — ae ‘Scanned with ComScanner oyoard ond Osiay and CNTL pins are used primarily to support typewriter-like keyboards srl rere sr emery andthe IRQ Gnterup egies) ine ror gemory as previously em sae piste olletion of fag and reg The cml rb sommande nih re set fo the A298 o6d ade were common ermine meng ai ered, Alin it on re a eae epee yes sl ert formation sou cone ete lac oe comm rt od if the se are control ane tml play Mode Set—Speciies the input and display modes and is Keyboard Di of 179. Its format is: toed 10 initialize the 827 poop OKKS ‘L- contro! bits to set input mode: 000. Encoded keyboard scan mode with 4ey lockout Oo! Decoded Keyboard sean made with 24ay lockout O10. Encoded keyboard sean mode with N-key rollover O11 Decoded Keyboard scan mode with N-key rollover $00 Encoded sensor matrix scan mode Jo! Decoded sensor matrix sean mode T20- Strbed input with encoded display scen 111. Strobed input with decoded display scan Control bits to set display mode: (00 Left entry 8 8bitdsplovs Of Lett entry, 16 bit aispays 10 Right enty, 88-bit ispievs 11 Right enty, 16 bit displays Read FIFO Sensor Memory-—Specifies that a read from the data buffer register will input a byte from the FIFO memory and, if the 8279 is in the sensor rode, it indicates which row is to be read. This command is required before ‘inputting data from the FIFO memory. Its format is: trolx aad {ow address to be read ina sensor mode Don't care ‘Autoinerement bit if inthe FIFO Tals that if the input mode is a keyboard sam mode, a reads ame from it whic ist entered the FIFO, ene the Land AAS bits are ignored. par ses a ier resister wits {Display Memory—Indicates that a write to the data bul Dut data the aplay memory. This command mst be given before he 2s. the next input i rom the next byte ‘Scanned wih ComScanner 302 VO inert Ineriaces gy tag CPU can send the characters to be displayed t0 the 8279. 1s format jg Tool AAAR : TE sere ne ein for the next write wil ba stored 7 Whee the cag by 1 for each write mate ‘The 8279 provides two options for handling the situation in which me one Leni topped at about the sme time, With the (Workey lockout pny nother key is depressed while the fist Key is being debounced, the key which aaa sce il be entered into the FIFO. Ifthe second Rey is deprested wate Tao suan eyces after the first is debounced and the first key remains depreseg aoe ea eid one is released, then the fist depressed key i recognized, Othe seer inane ignored. The Nr-key rollover option treats each key éepresion Wiichenvently. If move than one is depressed, affer they are depressed they ae allentered in the order they were sensed. Ti addition, the 6279 has a sensor matrix mode under which signals on te return lines are stored into the FIFO at the row corresponding tothe scan adres nike « keyboard scan mode, the SHFT and CNTL status and the scan adres senor entered, This mode keeps an image of the status of the sensor matrix nd i cofl when information from several deviees is input by polling each deve through the scan lines. ‘The stots of the FIFO is kept in the status register. Bits 0, 1, and2of ths register give the number of data bytes currently in FIFO memory and bit indicates that this memory is full. Bits 4 and 5 indicate underfiows, which oxar ‘when an attempt is made to read from an empty FIFO memory, and veto, ‘which cecur when an input to full FIFO memory is attempted. In both caes2 1 signifies the presence of the error. A 1 in bit 6 reflects a closure when the aD is iit sensor matrix mode and a multiple closure when itis in special error node Bit 7 shows whether or not the display is available For display control, the 8279 provides a 16-byte display memory and est logic. Each address in the display memory corresponds to a display unit wit address 0 representing the leftmost display unit. Once the CPU loads the eh to be displayed into this memory, the 8279 needs no further instructions and he processor is released from refreshing the display units. The output is accompli by the 8279 repeatedly sending out characters over the lines OUT ASA? ‘OUTB3-BO and unit select addresses over SL3-SLO. Although the display mem can be diectly addressed, the processor may sequentially enter data tote SE) memory either from the left or from the right. For the autoinerement Ie oR after each write to the display the address is incremented by 1, $0 tht he Character appears in the next display unit wo the right, The uionere = cnt allows characters fo be displayed in the form used by mat) et a ‘causes the display to be shifted left one character and sto*es character from the right. it Figure 935 illustrates one way in which 64-key keyboard anda ‘Scanned with ComScanner Qudnoooo Scanned with CamScanner 394 seven-segment display can fare seanned and refreshed under the SLB pin is not connected Because OS a decoders have active low outputs ‘uher decoder enables one of the igh fe how to prosra ‘To demonstrat connected to a keyboard and ‘multiple addresses are FFES and F the device must De ster. The following be connected t0 3 man ‘and the inter sending * tions ih ewo-key Horkou ae ppoth the keyboard and di 0a re sles ena SLL ~ ol Sy eight spay ons. Both au say oper ts hg ma play 250% ig. 9-35, the S794 eaves mando the cot He sisplay conteller 10 en aesand its left entry eight fe keyb0# regi Faded Keyboard scan mode displays mode: a mov OxorrEsH mov AL? ur OXAL rogram 5 wm geoyte array KEYS with “Then, chat memory: AP fand store them 39 mov SB Mov OXoFFESH Mov A1.010000008 our DX AL, next: “Mov. DXOFFESH ue: IN ALOX. rest ALOFH ye iE Mov DxoFFEsH N Mov bec aNz ef ition pa te a i SI, the next three instru fom ven aes come fom FIFO, the three instruction IDLE fore the prosesor arrsale until an input is ready, and the following bree eee fer the input data to KEYS. The last two instructions ‘cause th errs ui ht horas hae been read eed fae ‘the CPU must first give a write display memory com ne even ee eae ‘The following instruction see Serene igits which are stored beginning a Le Mov si WV OXOFFESH Moy ALrgoroce0s out Ox AL NOV OXOFFESH ‘Scanned wih CamScanner MA Controllers segs AGAIN: — MOV OUT DEC JNZ 395 AL,DIGITS{SI— 1] DX,AL SI AGAIN The first instruction puts the digit count in SI, the following three instructions output the write display memory command, and the next instruction puts the address of the data buffer register in DX. The loop outputs the digits to the display memory. TT ‘Scanned wih ComScanner

You might also like