KB controller ------------8742/8741 programming scheme: 1. 8742 STRUCTURE DATA MEMORY MAP 127 レトトトトトトトトトトトトトソ ウ ウ ウ 8742 RAM ウ ウ ウ 64 テトトトトトトトトトトトトトエ ウ 8741 RAM ウ 32 テトトトトトトトトトトトトトエ ウ Bank 1 ウ ウ R7 ウ ウ .. ウ ウ R1 ウ ウ R0 ウ 24 テトトトトトトトトトトトトトエ ウ 8 level ウ ウ STACK ウ 8 テトトトトトトトトトトトトトエ ウ Bank 0 ウ ウ R7 ウ ウ .. ウ ウ R1 ウ ウ R0 ウ 0 タトトトトトトトトトトトトトル PROGRAM MEMORY MAP 2047 レトトトトトトトトトトトトトソ 8042 ウ ウ Page 7 8742 ウ 8742 ROM ウ ウ ウ ウ ウ Page 4 トトトトトトトトトトト 1024 テトトトトトトトトトトトトトエ ウ ウ ウ Page 3 8041A ウ 8741 ROM ウ ウ 8741A ウ ウ Page 1 & 256 テトトトトトトトトトトトトトエ トトトトトト 8042 ウ ウ ウ 8742 ウ ウ ウ テトトトトトトトトトトトトトエ ウ 7 ウ TIMER INT. ウ ウ テトトトトトトトトトトトトトエ ウ ウ Page 0 テトトトトトトトトトトトトトエ 3 ウ IBF INT. ウ ウ テトトトトトトトトトトトトトエ ウ ウ ウ ウ テトトトトトトトトトトトトトエ ウ 0ウ RESET ウ ウ タトトトトトトトトトトトトトル トトトトトト (1) PC - Program Counter Stack 10-bit counter starting from data memory address 8 to low nibble of address 9. (2) PSW - Program Status Word 8-bit register used to store general information about program execution. bit 0 - 2 : Stack Pointer Bits S0, S1, S2 bit 3 : Not used bit 4 : Working Register Bank bit 5 : User flag(F0) bit 6 : Auxiliary Carry(AC) bit 7 : Carry(CY) (3) Location 0 - Reset vector Following a RESET* input to the processor, the next instruction is automatically fetched from location 0. (4) Location 3 - IBF inerrupt vector An interrupt generated by an Input Buffer Full(IBF) condition (with EN I instruction) causes the next instruction to be fetched from location 3. (5) Location 7 - Timer interrupt vector A timer overflow interrupt(with EN TCNTI instruction) will cause the next instruction to be fetched from location 7. (6) Instruction Cycle 1/(X MHz/15) = Y microseconds (7) Timer - 1/[X MHz/(15*32)] = Z microseconds The STRT T instruction enable the counter. The STOP T instruction disable the counter. 2. 8741/8742 FEATURE (1) 8-bit CPU (2) 8-bit data bus interface registers (3) 1K(2K) by 8 bit EPROM for 8741/8742 (4) 64(128) by 8 bit RAM memory for 8741/8742 (5) Interval timer/event counter (6) Two 8-bit TTL compatible I/O ports (7) Resident clock oscillator (8) 12M Hz operation for 8041AH, 8742, 8042 3. DBBOUT, DBBIN and STATUS registers (1) DBBOUT - Data Bus Buffer OUTput The host processor(system) may read data from DBBOUT. (2) DBBIN - Data Bus Buffer INput The host processor(system) may write command or data to DBBIN. (3) STATUS The status of DBBOUT, DBBIN and user_defined status is provided in the STATUS. This SPECIFICATION of 8042/8041 include 1. PORT definition 2. COMMAND 3. Timing of TRANSMITTING(error conditions included) 4. Timing of RECEIVING(error conditions included) 5. Timing of RECEIVE XT KB data The DETAILS of the above PORT DEFINITION レトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトソ ウ Port 60h Input/Output Buffer for Keyboard and Auxiliary Device ウ ウ (8042 only) ウ ウ ウ ウ * The output buffer is an 8-bit READ ONLY register at Port 60h. ウ ウ When the output buffer is read, the 8042 uses it to send informa- ウ ウ tion to the system microprocessor. ウ ウ THE INFORMATION CAN BE SCAN CODES RECEIVED FROM KEYBOARD, DATA ウ ウ FROM AN AUXILIARY DEVICE, or DATA BYTES THAT RESULT FROM A COMMAND ウ ウ FROM THE SYSTEM MICROPROCESSOR. ウ ウ ウ ウ * The input buffer is an 8-bit WRITE ONLY register at Port 60h. ウ ウ When the input buffer is written, a flag is set that indicates a ウ ウ data write.DATA WRITTEN TO PORT 60H IS SENT TO THE KEYBOARD UNLESS ウ ウ THE 8042 IS EXPECTING A DATA BYTE FOLLOWING A 8042 COMMAND. Data ウ ウ should be written to the 8042 input buffer only if the input ウ ウ buffer full bit (bit 1) of Status Port 64h = 0. ウ ウ ウ ウ Port 64h 8042 Command Port (WRITE) ウ ウ ウ ウ * 8042 commands written through port 64h : ウ ウ ウ ウ # common command ウ ウ @ 8041 command ウ ウ 8042 command ウ ウ ウ ウ . 21-3F read 8042 RAM ウ ウ # . 20 read 8042 command byte ウ ウ . 61-7F write 8042 RAM ウ ウ # . 60 write 8042 command byte ウ ウ . A4 test password installed ウ ウ . A5 load security ウ ウ . A6 enable security ウ ウ . A7 disable auxiliary device interface ウ ウ . A8 enable auxiliary device interface ウ ウ . A9 interface test for auxiliary device 'clock' ウ ウ and 'data' line ウ ウ # . AA self test ウ ウ # . AB interface test for keyboard 'clock'& 'data' line ウ ウ @ . AC diagonstic dump ウ ウ . AC reserved ウ ウ # . AD disable keyboard interface ウ ウ # . AE enable keyboard interface ウ ウ # . C0 read input port ウ ウ ウ . C1 poll input port low - port 1 bit 0-3, in status bits 4-7 ウ ウ ウ . C2 poll input port low - port 1 bit 4-7, ウ ウ in status bits 4-7 ウ ウ . C3 light panel LED ウ ウ # . D0 read output port ウ ウ # . D1 write output port ウ ウ NOTE: Bit 0 of output port is connected to ウ ウ system reset. This bit should not be ウ ウ written low ウ ウ . D2 write keyboard output buffer ウ ウ . D3 write auxiliary device output buffer ウ ウ . D4 write auxiliary device ウ ウ # . E0 read test inputs ウ ウ # . F0-FF pulse output port ウ ウ ウ ウ Note: ウ ウ (1) Definitions of the command byte (for command 20h & 60h): ウ ウ Bit For 8042 | For 8041 ウ ウ ------------------------------------+---------------------------ウ ウ 7 Reserved = 0 | the same as 8042 ウ ウ | ウ ウ 6 IBM translate mode | the same as 8042 ウ ウ = 1, 8042 translates the | ウ ウ incoming scan code to scan | ウ ウ code set 1. | ウ ウ = 0, 8042 passes the | ウ ウ keyboard scan codes | ウ ウ without translation. | ウ ウ | ウ ウ 5 Disable auxiliary device | IBM PC mode ウ ウ interface | = 1, PC keyboard interface ウ ウ = 1, disable | = 0, PC/AT keyboard ウ ウ = 0, enable | interface ウ ウ | ウ ウ 4 Disable keyboard | the same as 8042 ウ ウ interface | ウ ウ = 1, disable | ウ ウ = 0, enable | ウ ウ | ウ ウ 3 Reserved = 0 | Disable inhibit switch ウ ウ | = 1, disable ウ ウ | = 0, enable ウ ウ | ウ ウ 2 System flag | the same as 8042 ウ ウ | ウ ウ 1 Enable auxiliary interrupt | Reserved = 0 ウ ウ = 1, enable | ウ ウ | ウ ウ ウ ウ 0 Enable keyboard interrupt = 1, enable | the same as 8042 | ウ ウ ウ ウ (2) An interrupt occurs if the interrupt is enabled in the ウ ウ command byte. ウ ウ ウ ウ (3) Enable inhibit switch causes the KEY LOCK funtion to fail. ウ ウ ウ ウ ウ ウ Port 64h 8042 Status Port (READ) ウ ウ ウ ウ Bit For 8042 | For 8041 ウ ウ ----------------------------------+--------------------------ウ ウ 7 Parity error | the same as 8042 ウ ウ 6 General time out | Receive time out ウ ウ 5 Auxiliary output buffer full | Transmit time out ウ ウ 4 Inhibit switch | the same as 8042 ウ ウ 3 Command/data | " ウ ウ 2 System flag | " ウ ウ 1 Input buffer full | " ウ ウ 0 Output buffer full | " ウ ウ ----------------------------------+--------------------------ウ ウ ウ ウ * PROGRAMMING CONSIDERATION ウ ウ ウ ウ . port 64h (status register) can be read at any time ウ ウ . port 60h should be READ ONLY when the output buffer full ウ ウ bit in the status register is a 1 ウ ウ . the auxiliary output buffer full bit in the status register ウ ウ indicates that the data in port 60h came from the auxiliary ウ ウ device. this bit is VALID ONLY when the output buffer full ウ ウ bit is a 1 ウ ウ . port 60h and 64h should be written only when the status register ウ ウ input buffer full bit is 0 ウ ウ . the devices connected to the 8042 should be disabled before ウ ウ initiating a command that generates output. if output is ウ ウ generated, any value in the output buffer is overwritten ウ ウ . an external latch is used to hold the level sensitive IRQ until ウ ウ an I/O read from address 60h is executed by the system ウ ウ ウ タトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトル COMMAND レトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトソ ウ#20 read 8042 command byte ウ ウ Read command byte and put it into output buffer. ウ ウ ウ ウ 21-3F read 8042 RAM ウ ウ Read 8042 RAM address 21h to 3fh and put it into ウ ウ output buffer. ウ ウ ウ ウ#60 write 8042 command byte ウ ウ The next byte written to port 60h will update the command ウ ウ byte. ウ ウ ウ ウ 61-7F write 8042 RAM ウ ウ The next byte written to port 60h will update content of ウ ウ 8042 RAM address 21h to 3fh accordingly. ウ ウ ウ ウ A4 test password installed ウ ウ Test if there is a password installed in the 8042 RAM, ウ ウ if installed, place FAh into output buffer, else ウ ウ place F1h into output buffer. ウ ウ ウ ウ A5 load security ウ ウ Load password into 8042 RAM, the password must be written ウ ウ to port 60h in scan code set 1 format, and will be ウ ウ terminated until a null(0) is written to port 60h. ウ ウ ウ ウ A6 enable security ウ ウ Enable the 8042 security feature, this command is VALID ウ ウ ONLY when a password is currently stored in 8042 RAM. ウ ウ When the security is enabled, the status byte(64h) bit 4 ウ ウ (inhibit switch) will become 0. ウ ウ ウ ウ A7 disable auxiliary device interface ウ ウ Set bit 5 of the 8042 command byte, this disable the ウ ウ auxiliary device interface by driving the CLOCK line low, ウ ウ data is not sent(received) to(from) auxiliary device. ウ ウ ウ ウ A8 enable auxiliary device interface ウ ウ Clear bit 5 of the 8042 command byte, this release the ウ ウ auxiliary device interface. ウ ウ ウ ウ A9 interface test ウ ウ Test auxiliary device clock and data line, and place test ウ ウ result in output buffer. ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ#AA ウ ウ ウ ウ#AB ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ@AC ウ ウ ウ ウ ウ ウ AC ウ ウ#AD ウ ウ ウ ウ ウ#AE ウ ウ ウ ウ#C0 ウ ウ ノヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘサ コ Test Result Meaning コ コ コ コ 0 No error コ コ 1 AUX clock stuck low コ コ 2 AUX clock stuck high コ コ 3 AUX data stuck low コ コ 4 AUX data stuck high コ ネヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘシ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ self test ウ Perform 8042 internal diagnostic tests. 55h will be put ウ into output buffer if no errors are detected. ウ ウ interface test ウ Test KB clock and data line, and place test result in ウ output buffer. ウ ノヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘサ ウ コ Test Result Meaning コ ウ コ コ ウ コ 0 No error コ ウ コ 1 KB clock stuck low コ ウ コ 2 KB clock stuck high コ ウ コ 3 KB data stuck low コ ウ コ 4 KB data stuck high コ ウ ネヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘシ ウ ウ diagonstic dump ウ Send content of 8042 RAM address 0 to 0fh, ウ current state of input port(P1), ウ current state of output port(P2), ウ 8041 program status word(PSW) to system sequentially. ウ ウ reserved ウ ウ disable keyboard interface ウ Set bit 4 of the 8042 command byte, this disable the ウ KB interface by driving the CLOCK line low, ウ data is not sent(received) to(from) KB. ウ ウ enable keyboard interface ウ Clear bit 4 of the 8042 command byte, this release the ウ KB interface. ウ ウ read input port ウ Read input port(P1), and place the data in output buffer. ウ This command should be used ONLY IF the output buffer is ウ ウ ウ ウ EMPTY. NOTE: (1) 8042 input port(P1) definition: ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ C1 ウ ウ ウ C2 ウ ウ ウ C3 ウ ウ ウ ウ ウ#D0 ウ ウ ウ ウ ウ#D1 ウ ウ ノヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘサ コ Bit General Definition コ コ 7 Reserved コ 6 " コ コ 5 " コ コ 4 " コ コ 3 " コ コ 2 5V コ コ 1 PD data コ コ 0 KB data コ ネヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘシ ウ ウ コ コ コ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ 8041 output port(P2) definition: ノヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘサ コ Bit General Definition コ コ コ 7 KEY LOCK -> 0:lock コ コ 6 Reserved コ コ 5 " コ コ 4 " コ コ 3 " コ コ 2 " コ コ 1 " コ コ 0 " コ ネヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘシ * indicate conjugate of that signal ウ ウ ウ コ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ poll input port low Place input port(P1) bits 0-3 in STATUS bits 4-7. ウ ウ ウ poll input port high Place input port(P1) bits 4-7 in STATUS bits 4-7. ウ ウ ウ light panel LED ウ The next byte written to port 60h is defined as: ウ set to high speed : data = 1 ウ set to low speed : data = 0 ウ ウ read output port ウ Read output port(P2), and place the data in output buffer.ウ This command should be used ONLY IF the output buffer is ウ EMPTY. ウ ウ write output port ウ The next byte written to port 60h will be output to ウ output port(P2). ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ ウ D2 ウ ウ ウ ウ D3 ウ ウ ウ ウ D4 ウ ウ NOTE: (1) Bit 0 of output port is connected to system reset. This bit should not be written low ウ ウ ウ ウ (2) For AT model with PS2 mouse, i.e., 915V, 1100SX,ウ ONLY bit 0 and 1 can be modified. ウ ウ (3) 8042 output port(P2) definition: ウ ノヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘサ ウ コ Bit General Definition コ ウ コ コ コ 7 KB data* コ ウ コ 6 KB clock* コ ウ コ 5 IRQ 12 コ ウ コ 4 IRQ 1 コ ウ コ 3 PD data* コ ウ コ 2 PD clock* コ ウ コ 1 Gate A20 コ ウ コ 0 Reset コ ウ ネヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘシ ウ ウ 8041 output port(P2) definition: ウ ノヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘサ ウ コ Bit General Definition コ ウ コ コ コ 7 KB data コ ウ コ 6 KB clock* コ ウ コ 5 Reserved コ ウ コ 4 IRQ 1 コ ウ コ 3 Reserved コ ウ コ 2 Reserved コ ウ コ 1 Gate A20 コ ウ コ 0 Reset コ ウ ネヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘシ ウ * indicate conjugate of that signal ウ ウ write keyboard output buffer ウ The next byte written to port 60h is written to output ウ buffer as if initiated by KB. ウ ウ write auxiliary device output buffer ウ The next byte written to port 60h is written to output ウ buffer as if initiated by PD. ウ ウ write auxiliary device ウ The next byte written to port 60h is transmitted to PD. ウ ウ ウ ウ ウ#E0 read test inputs ウ ウ Read T0 and T1, place in data bit 0 and 1 respectively, ウ and place data byte in output buffer. ウ ウ ウ ウ#F0-FF pulse output port ウ ウ Bit 0 - 3 of the 8042 output port(P2) may be pulsed low ウ ウ for approximately 6 microseconds. ウ ウ Bit 0 - 3 of this command indicate which bits are to be ウ ウ pulsed. A 0 indicates that the bit should be pulsed, a 1 ウ ウ indicates that the bit should not be modified. ウ タトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトル ウ TIMING OF TRANSMITTING NOTE : The clock is provided by KB. The KB controller shall communicate with the AT KB using synchronous serial protocol. The following figure shows the function of each bit and timing. bit bit bit bit bit bit bit bit bit bit bit 10 9 8 7 6 5 4 3 2 1 0 ------------ stop (high) parity (odd) data bit7 (MSB) data bit6 data bit5 data bit4 data bit3 data bit2 data bit1 data bit0 (LSB) start (low) Figure 1-1 : function of each bit (code ED) レトトトソ レトトトトトトトソ レトトトトトトトトトトトトトトトトトソ レトトトトトトトト data トトトトトトトトル タトトトル タトトトル タトトトル レトトトソ レトソ レトソ レトソ レトソ レトソ レトソ レトソ レトソ レトソ レトソ レトトトトトトトトト clock トトトル タトル タトル タトル タトル タトル タトル タトル タトル タトル タトル タトル start 0 1 2 3 4 5 6 7 parity stop Figure 1-2 : Sending data to AT KB timing . If the AT KB does not start clocking the data out of KB controller within 15 milliseconds or complect that clocking within 2 milliseconds, the resend code(0feh) will be sent to system, and sets the transmit time-out bit in status byte. . The AT KB is resquired to response for all transmission data. If the AT KB doesn't complete to response data within 25 milliseconds, place hexFE in KB controller's output buffer, and sets the transmit time-out and receive time-out bits of status byte. . When the KB controller received the response data from the AT KB, and found the KB parrity error,a hexFE is placed in KB controller's output buffer, and parity error and transmit time-out bits of status byte will be set. The follwings are steps and notes of KB controller sending data to KB. . Set KB data and clock inactive, when KB controller start to communicate with AT KB. . Set KB clock active, then wait KB pull clock low within 15 ms. . Send data to KB from LSB to MSB synchronously during inactive period of clock(data bit 0 to data bit 7). Each bit(data bit 0 to data bit 7, parity bit and stop bit) must be complete sending within 0.3 ms. Else timer overflow. . Send parity bit with respect to ODD parity. . Pull KB data active, wait KB data transfer from low to high, then STOP CTNT, this end the transmission process. NOTE : (1) For 8742, all the transmit time-out or receive time-out in 8741 must be replaced by timeout error. (2) For 8742, the KB timing protocal is the same as 8741 KB. (3) For 8742, the auxiliary device timing protocal is similar to 8742 KB protocal. TIMING OF RECEIVING The following figure are AT keyboared synchronous serial protocol. (code AA) トトソ レトトトソ レトトトソ レトトトソ レトトトトトトトトトトトトトトトトトトトトトトトト data タトトトトトトトル タトトトル タトトトル タトトトル トトトソ レトソ レトソ レトソ レトソ レトソ レトソ レトソ レトソ レトソ レトソ レトトトトト clock タトル タトル タトル タトル タトル タトル タトル タトル タトル タトル タトトトトトトトトトル start 0 1 2 3 4 5 6 7 parity stop Figure 1-3 : AT keyboard timing . KB controller shall pull KB clock and data high when there is no data in DBBIN and DBBOUT and KB interface is enabled. . If KB controller cannot complect receiving KB data within 2 millisecond, a hexFF is placed in the DBBOUT, and set receive time-out bit of status byte. . If KB controller check the AT KB parity error occurs, then send a hexFE to KB, and wait for KB respond within 25 ms. . If the AT KB cannot complect response within 25 millisecond, a hexFE is placed in the DBBOUT, and set receive and transmit time-out bits of status byte. . If parity error occurs again, a hexFE is placed in the DBBOUT, and set parity error, receive time-out bits of status byte. The follwings are steps and notes of KB controller receiving data from KB. . Wait for KB clock change from high to low, then check if data is low; if it is, then continue, else ignore this noise. . Wait KB clock active, then receive the data bit 0 at the first falling edge of clock. . Receive data bit 1 to data bit 7 and parity bit at falling edge of the successive clock. . Check if there is parity error, if parity error, then set parity error flag. . If parity OK, then wait for falling edge of stop bit and STOP CTNT. . Inhibit KB(pull KB clock low), send data from KB to system. NOTE : The data from AT KB belong to scan KB controller must translate it to to command byte bit 6. Example: receive 0eh (make code) 0f0h ソ 0eh ル(break code) タトトトトトトトトトトトトトトトトトトトトトトトル scan code set 2 code set 2 format, scan code set 1 accoring -> send 29h to system -> 0a9h タトトル scan code set 1 RECEIVE XT KEYBOARD DATA The following figure are XT KB synchronous serial protocol. bit bit bit bit bit bit bit bit bit 8 7 6 5 4 3 2 1 0 ---------- data bit7 (MSB) data bit6 data bit5 data bit4 data bit3 data bit2 data bit1 data bit0 (LSB) start (high) Figure 1-4 : function of each bit (code 15) レトトトトトトトトトトソ レトトトトソ レトトトトソ data トトトトル タトトトトル タトトトトル タトトトトトトトトトトトトトトトトトト トトトソ レトトソ レトトソ レトトソ レトトソ レトトソ レトトソ レトトソ レトトソ レトトソレトトト clock タトトル タトル タトル タトル タトル タトル タトル タトル タトル タル start 0 1 2 3 4 5 6 7 Figure 1-5 : XT keyboard timing The follwing are steps and notes of KB controller receiving data from XT KB. . Receive XT KB data within 15 ms. . If timer overflow, then place hexFF in DBBOUT, and set receive time-out of status byte. . Wait KB clock inactive, then check if KB data is active. If it is inactive, then ignore this noise, else continue. . Receive start bit at the first rising edge of KB clock. . Receive data bit 0 to data bit 7 at rising edge of the successive clock. . Inhibit KB(pull KB data low), send data from KB to system. NOTE : (1) The data from XT KB belong to scan code set 1. (2) The reset KB command must pull KB clock low at least 12.5 ms, then pull KB clock high. (3) The KB controller places a hexEE in DBBOUT if system issues an echo(eeh) command to KB. (4) KB controller places a hexFA in DBBOUT for all the command to KB except RESET and ECHO.