Abstract : SK5278 is a managed 16 key keyboard controller , the device has to shake the internal processing circuits can be directly output button key code , and serial mode or microprocessor and microcontroller interface, the use of the Microcomputer hardware and software components to simplify the keyboard interface . In this paper, the characteristics of the device , pin descriptions and usage, and to AT89C2051 microcontroller as an example the corresponding interface circuit and the corresponding procedures .
To constitute the core MCU for smart instruments, meters , industrial equipment and household appliances , the composition of the keyboard interface circuit human-computer interaction is essential , and the corresponding keyboard management hardware and software design is too much trouble . There is a simple matrix keyboard CPU- hardware and software resources, a response to slow, the preparation of complex issues such as monitoring software , a dedicated keyboard interface devices such as INTE8279, HD7219 often with LED digital display circuit , if only to use its keyboard management , Then there exists a waste of hardware resources , interface circuit complexity , high cost and other issues , SK5278 is to address the problem of the keyboard management introduced a keyboard controller chip .
1 Features and pin functions
Is SK5278 Technology Co., Ltd. shell to the kernel introduced by PIC keyboard controller . The chip with 4 -wire serial interface with any type of microcontroller interface; it has a key and effective instruction output , can interrupt management of the keyboard ; the line and column line X0 ~ X3 line Y0 ~ Y3 may constitute 4 × 4 keyboard matrix; SK5278 16- key keyboard controller contains processing circuitry to jitter , which can directly output keys ; In addition, the device supply voltage range of wide and 4 ~ 6V; SK5278 using DIP 18 -pin DIP package . The pin arrangement shown in Figure 1 ,
The pin description is as follows:
- 1DIOO data output , read the keyboard data, this foot in the CLK rising edge of the output data
- 2KEYO key effective output , usually is low , when the detected effective keys , this pin becomes high . After reading the keyboard , this pin goes low again
- 3,14 VDD Positive Power Supply
- 4RST reset port
- 5VSS power to Matrix
- 6 ~ 9X0 ~ X3I southbound keyboard input
- 10 ~ 13Y0 ~ Y3O matrix keyboard column output line
- 15OSCOO oscillation output pin , the output frequency of RC oscillation frequency of a quarter of
- 16RC external oscillator connected side , R = 3.3kO, C = 20pF , the oscillation frequency of 4MHz
- 17CSI Chip select , the pin is low, the chip can read the keyboard data 18CLKI clock input , read the keyboard data, the rising edge of this foot level , said data valid
- 2 Work
SK5278 available southbound X0 ~ X3 and column lines Y0 ~ Y3 constitute a 4 × 4 matrix keyboard . At the same time in the chip can automatically scan , decoding , to shake processing and other tasks. When SK5278 valid key is detected , the key is effective to indicate "KEY" pin from low to high , and has been maintained up to the key code is read . In "KEY" is high during receive if SK5278 " keyboard data read "command , (the "CS" pin goes low ) , then the output of the current key of the keyboard code , SK5278 keyboard code in the range of 00H-0FH. If you receive "read the keyboard data " without a button press , SK5278 output FFH. Reading the keyboard in a process is completed, key effective instruction "KEY" will become a low level . Effective use of key instructions "KEY" and microcontroller connected to the external interrupt terminal , complete with the keyboard interrupt control functions , thereby enhancing the efficiency of the CPU ,

Reduce the button response time. SK5278 work, the need for external RC oscillator for system work , RC components, typically R = 3.3kO, C = 20pF, then the oscillation frequency of about 4MHz, because of this high frequency oscillation , it is in the printed circuit board Wiring , all components in particular oscillator components should be close to the chip , and the shortest possible connection to the circuit .
SK5278 's RESET reset port in the case of general application , can be directly connected with the positive power supply , high reliability in case of need , you can connect an external RC reset circuit , power or received in the side of the reset signal RESET , SK5278 approximately 25ms after the reset time to enter into normal operation . Procedures should reduce the CPU as much as possible the number of visits to the SK5278 to improve the process efficiency.
It is worth noting that if there are two keys pressed simultaneously , the SK5278 can only be given one of the buttons of the code, so SK5278 not suitable for the needs of two or more than 2 keys are pressed at the same time applications . Really need to be used in combination as double bonds or a combination of increasing the number keypad can be a microcontroller I / O pin access to a shared group key with the double bond SK5278 keyboard monitoring circuit .
3 serial interface and timing
SK5278 serial manner with a microcontroller or microprocessor interface, serial data from the "DIO" pin-out , by the "CLK" side issued a synchronous clock pulse. SK5278 is detected when the key is pressed , the button is effective to indicate "KEY" becomes higher , SCM detected "KEY" signal changes from high , they put a chip select terminal "CS" down , which makes the SK5278 will get the keyboard data "CLK" pin 's rising edge from the "DIO" foot in turn sent . 8 is issued in the MCU clock pulse , you can from the "DIO" terminal to read 8-bit key code , the code for the highest value of D7 , D0 is the lowest , and then re- enable MCU chip select "CS" becomes higher , And to "KEY" to re- output low side , thus , read the end of key processes . Serial Interface Timing SK5278 shown in Figure 2 . The figure , T1 that from the "CS" to the first falling edge of CLK rising edge of the delay , typically 15µs; T2 for the CLK pulse width , typically 10µs; T3 for the CLK pulse interval , typically 10µs.

4.Application Circuit
Serial interface using SK5278 MCU port lines occupied by low and no key is pressed without CPU intervention characteristics , can easily constitute a microcomputer keyboard interface circuit , Figure 3 shows the composition AT89C2051 microcontroller and SK5278 keyboard and the interface circuit .Figure 3 shows the composition AT89C2051 microcontroller and SK5278 keyboard and the interface circuit.
AT89C2051 of P1.2, P1.3, P1.4 port line and SK5278 , respectively the "CS", "CLK", "DIO" terminal is connected . In order to improve the response speed and reduce the buttons MCU intervention. The program will SK5278 buttons effective instruction side "KEY" and AT89C2051 INT0 external interrupt terminal connected to INT0 is low because interruption , Guer joined a non- door to make the "KEY" after connecting with the RP . Circuit in Figure 3 correspond with the keyboard handler is as follows :
Bit definitions;
COUNT DATA 70H
RXBUF DATA 20H ;
I / O Definition
DIO BIT P1.4
CS BIT P1.2
CLK BIT P1.3 ;
The main program
MAIN: MOV SP, # 50H
MOV P1, # 0FFH; will be set to input portP1
SETB IT0; INT0 is edge triggered
SETB PX0; INT0 interrupt as high priority
SETB EX0; open INT0 interrupt SETB EA;
CPU interrupt open
LCALL DL25ms; delay 25ms reset wait SK5278 ;
INT0 keyboard interrupt program
INT0: LCALL RECEIVE; read key
MOV A, RXBUF; key to send A
CJNE A, # 00H, KEY-1; K0 key pressed the switch under the key
LJMP KEY0; K0 key is pressed , the corresponding key processing subroutine into
KEY1:CJNE A, # 01H, KEY-2;
LJMP KEY1; K1 key is pressed , into the corresponding key processing subroutine
KEY2: ... ... ...
KEY15: CJNE A, # 0FH, KEYFH; K15 key not pressed , the interrupt return
LJMP KEY15; KEY15 key is pressed , the corresponding key processes into
KEYFH:RET; no key is pressed the keyboard interrupt return value of process time
ECEIVE: CLR CS; read keyboard data valid
SETB DIO; will be set to high input state DIO
ACALL DL 15µs; T1 delay
MOV COUNT, # 08H; of eight Data
LOOP: SETB CLK
ACALL DL 15µs; T2 delay
MOV A, RXBUF RL A; data left a
MOV RXBUF, A
MOV C, DIO; read a data
MOV RXBUF.0, C
CLR CLK
ACALL DL 15µs; T3 delay
DJNZ COUNT,
LOOP SETB DIO; will be reset to the high input DIO
ACALL DL 15µs SETB CS; read the keyboard data is invalid
RET

Click to enlarge the figure 3
Conclusion
Application of SK5278 keyboard controller can make the SCM system, human-computer interaction and control procedures keyboard interface circuit is very easy , while reducing the occupation of the microcomputer hardware and software resources , so that the device constitutes a small number of SCM is a better keyboard interface circuit Options .