新聞中心

電腦鍵盤工作原理

作者: 時間:2012-01-25 來源:網(wǎng)絡(luò) 收藏
ines are high (open-collector).
總線空閑時,兩條線都是高電平(集電極開路)。

This is the only state where the keyboard/mouse is allowed begin transmitting data.
在這種狀態(tài)下,/鼠標(biāo)才允許開始傳輸數(shù)據(jù)。

The host has ultimate control over the bus and may inhibit communication at any time by pulling the Clock line low.
主機對總線有最高的控制權(quán),在任何時候通過將時鐘線拉低就可以禁止通信。

The device always generates the clock signal.
時鐘信號總是由設(shè)備端生成的。

If the host wants to send data, it must first inhibit communication from the device by pulling Clock low.
如果主機想發(fā)送數(shù)據(jù),它必須先將時鐘拉低來禁止來自設(shè)備端的通信。

The host then pulls Data low and releases Clock.
然后主機再拉低數(shù)據(jù)線,釋放時鐘。 注釋:釋放時鐘,就是再恢復(fù)時鐘為高

This is the "Request-to-Send" state and signals the device to start generating clock pulses.
這就是"請求發(fā)送(Request-to-Send)"狀態(tài),提示 設(shè)備端 開始生成時鐘信號。

Summary: Bus States
Data = high, Clock = high: Idle state.
Data = high, Clock = low: Communication Inhibited.
Data = low, Clock = high: Host Request-to-Send
總結(jié):總線狀態(tài)
數(shù)據(jù) 0 1

0 ---------通信禁止-----------
時鐘
1 主機要求發(fā)送 總線空閑


The clock and data pins are bidirectional, open-collector
signals that are pulled to 5 V by pullup resistors in the keyboard.
時鐘和數(shù)據(jù) 引腳時 雙向 集電極開路的信號,可以被內(nèi)部的上拉電阻 拉高到5V


Data sent from the device to the host is read on the falling edge of the clock signal; data sent from the host to the device is read on the rising edge.
從設(shè)備發(fā)送給主機的數(shù)據(jù)時在時鐘信號的下降沿讀取的;從主機發(fā)給設(shè)備的數(shù)據(jù)是在上升沿讀取的。


The clock frequency must be in the range 10 - 16.7 kHz. This means clock must be high for 30 - 50 microseconds and low for 30 - 50 microseconds..
時鐘頻率必須在10-16.7KHz之間。這意味著時鐘必須是 高電平持續(xù)30~50毫秒,低電平持續(xù)
30~50毫秒。


If you're designing a keyboard, mouse, or host emulator, you should modify/sample the Data line in the middle of each cell. I.e. 15 - 25 microseconds after the appropriate clock transition.
如果你設(shè)計一個 鼠標(biāo) 或者 主機模擬器,你必須 在每個單元的中間時刻 (也就是,在時鐘跳變之后的15~25毫秒后) 修改/取樣數(shù)據(jù)線.


Again, the keyboard/mouse always generates the clock signal, but the host always has ultimate control over communication.
重復(fù)一遍,鍵盤/鼠標(biāo) 總是 生成時鐘信號, 而 主機 控制著整個通信過程。


Timing is absolutely crucial. Every time quantity I give in this article must be followed exactly.
時序是非常重要的。在本文中給出的時間數(shù)必須嚴(yán)格遵循。


設(shè)備發(fā)送數(shù)據(jù)到主機

The Data and Clock lines are both open collector.
數(shù)據(jù)和時鐘線都是集電極開路的。

A resistor is connected between each line and +5V, so the idle state of the bus is high.
在+5V 和每根線 之間連接著一個電阻,所以 總線的空閑狀態(tài) 是 高電平。


When the keyboard or mouse wants to send information, it first checks the Clock line to make sure it's at a high logic level.
當(dāng)鍵盤或者鼠標(biāo)想發(fā)送數(shù)據(jù)時,它首先必須檢查時鐘線 ,確認(rèn)它處于高電平。

If it's not, the host is inhibiting communication and the device must buffer any to-be-sent data until the host releases Clock.
如果不是,主機禁止通信,設(shè)備必須緩沖任何要發(fā)送的數(shù)據(jù),直到主機釋放時鐘。


The Clock line must be continuously high for at least 50 microseconds before the device can begin to transmit its data.
在設(shè)備開始傳輸數(shù)據(jù)之前,時鐘線 必須持續(xù)為 高電平的 時間 必須 至少50ms


The keyboard/mouse writes a bit on the Data line when Clock is high, and it is read by the host when Clock is low.
當(dāng)時鐘為高電平時,鍵盤/鼠標(biāo)寫一個bit到數(shù)據(jù)線上;當(dāng)時鐘為低電平時,主機從數(shù)據(jù)線上讀取這個bit 。

電腦鍵盤工作原理

The Data line changes state when Clock is high and that data is valid when Clock is low.

當(dāng)時鐘位高時,數(shù)據(jù)線 改變狀態(tài);
當(dāng)時鐘位低時,(數(shù)據(jù)線上的)數(shù)據(jù)是有效的。




The clock frequency is 10-16.7 kHz.
時鐘頻率是10-16.7KHz

The time from the rising edge of a clock pulse to a Data transition must be at least 5 microseconds.
從時鐘脈沖的上升沿到數(shù)據(jù)跳變 的時間必須至少 5ms

The time from a data transition to the falling edge of a clock pulse must be at least 5 microseconds and no greater than 25 microseconds.
從數(shù)據(jù)跳變 到時鐘脈沖的下降沿 必須 至少5ms,且不超過25ms

The host may inhibit communication at any time by pulling the Clock line low for at least 100 microseconds.

主機可在任何時間禁止通信,只需要將時鐘線下拉位低電平超過100ms即可


If a transmission is inhibited before the 11th clock pulse, the device must abort the current transmission and prepare to retransmit the current "chunk" of data when host releases Clock.
如果在第11個脈沖時禁止傳輸,設(shè)備必須中止當(dāng)前的傳輸,準(zhǔn)備重新傳輸當(dāng)前的數(shù)據(jù)"chunk(塊)"當(dāng)主機釋放時鐘時


A "chunk" of data could be a make code, break code, device ID, mouse movement packet, etc.
一個數(shù)據(jù)塊可能時 通碼,斷碼,設(shè)備ID,鼠標(biāo)移動包 等等。

For example, if a keyboard is interrupted while sending the second byte of a two-byte break code, it will need to retransmit both bytes of that break code, not just the one that was interrupted.
舉個例子,如果當(dāng)發(fā)送 一個兩字節(jié)斷碼的 第2個字節(jié)時,鍵盤被中斷,它將需要重新發(fā)送
此斷碼的兩個字節(jié),而不僅僅時被中斷掉的那個字節(jié)。


If the host pulls clock low before the first high-to-low clock transition, or after the falling edge of the last clock pulse, the keyboard/mouse does not need to retransmit any data.
如果在第一個 高->低 時鐘跳變 時,(或者在 最后一個時鐘脈沖的下降沿 之后)主機將時鐘拉低,鍵盤/鼠標(biāo) 不必重新傳輸任何數(shù)據(jù)。


However, if new data is created that needs to be transmitted, it will have to be buffered until the host releases Clock.
但是,如果新產(chǎn)生的數(shù)據(jù)需要傳輸,它必須將數(shù)據(jù)緩沖,知道主機釋放時鐘。


Keyboards have a 16-byte buffer for this purpose. If more than 16 bytes worth of keystrokes occur, further keystrokes will be ignored until there's room in the buffer.
鍵盤有一個16字節(jié)的緩沖區(qū)。如果有超過16個字節(jié)的擊鍵存在,更多的擊鍵將被忽略。直到
緩沖區(qū)有空地。


Mice only store the most current movement packet for transmission.
鼠標(biāo)只能緩沖最近的一個要傳輸?shù)模ㄒ苿?數(shù)據(jù)包。

電腦鍵盤工作原理


時間參數(shù) 最大值/最小值
T1數(shù)據(jù)跳變到時鐘的下降沿 5/25 us
T2時鐘的上升沿 到 數(shù)據(jù)跳變 5/T4 - 5 us
T3時鐘inactive 30-50 us
T4時鐘active 30-50 us
T5 >0/50 us



Time to auxiliary device inhibit after clock 11 to ensure the auxiliary device does not start another transmission


The auxiliary device checks the 'clock' l

DIY機械鍵盤相關(guān)社區(qū):機械鍵盤DIY




關(guān)鍵詞: 電腦 鍵盤 工作原理

評論


相關(guān)推薦

技術(shù)專區(qū)

關(guān)閉