TWI590105B - Input Device and Status Detecting Method Using the Same - Google Patents

Input Device and Status Detecting Method Using the Same Download PDF

Info

Publication number
TWI590105B
TWI590105B TW105119872A TW105119872A TWI590105B TW I590105 B TWI590105 B TW I590105B TW 105119872 A TW105119872 A TW 105119872A TW 105119872 A TW105119872 A TW 105119872A TW I590105 B TWI590105 B TW I590105B
Authority
TW
Taiwan
Prior art keywords
interrupt
flags
flag
input
input device
Prior art date
Application number
TW105119872A
Other languages
Chinese (zh)
Other versions
TW201800908A (en
Inventor
葉書瑋
徐瑞慶
郭俊志
Original Assignee
宏碁股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 宏碁股份有限公司 filed Critical 宏碁股份有限公司
Priority to TW105119872A priority Critical patent/TWI590105B/en
Application granted granted Critical
Publication of TWI590105B publication Critical patent/TWI590105B/en
Publication of TW201800908A publication Critical patent/TW201800908A/en

Links

Description

輸入裝置及其狀態偵測方法Input device and its state detection method

本發明關於一種用於一輸入裝置之狀態偵測方法及裝置,尤指透過中斷處理的方式來偵測輸入裝置元件狀態的方法及其相關裝置。The present invention relates to a method and apparatus for detecting a state of an input device, and more particularly to a method for detecting the state of an input device component by means of interrupt processing and related devices.

隨著資訊技術的發展,電子競技的興起帶領相關產品的蓬勃發展。一般而言,電子競技的週邊電子設備的性能優劣往往直接影響參賽選手的表現,進而成為影響勝負的關鍵。例如,鍵盤及滑鼠的反應速度、週邊設備產生錯誤反應的機率等。由於現行矩陣陣列式的鍵盤於偵測到按鍵被敲擊的同時,需對鍵盤陣列的訊號線逐行逐列掃描(Scanning)來確認被敲擊按鍵在鍵盤矩陣的位置,並且根據該位置經由查表後取得按鍵的掃描碼,最後再依照轉譯的格式將相應掃描碼送出,如此一來,處理時間較長也導致了反應過慢的問題。此外,當使用者輸入組合鍵或同時鍵入多個按鍵時,亦有可能發生掉鍵或鬼鍵(Ghost Key)等問題。儘管現有的鍵盤以不同的掃描技術及偵測方式,來加快鍵盤的反應速度或防止鬼鍵或鍵位衝突的問題。然而,現行的鍵盤經由鍵盤偵測掃描、檢查是否存有鬼鍵等步驟後,反而增加鍵盤的反應時間。如此一來,若使用者於平時或電子競技使用時,不僅造成使用者的不便,更可能因鬼鍵或鍵位問題影響使用者於參賽時的表現。With the development of information technology, the rise of e-sports has led to the vigorous development of related products. In general, the performance of e-sports peripheral electronic devices often directly affects the performance of the contestants, and thus becomes the key to the outcome. For example, the response speed of the keyboard and mouse, the probability of a peripheral device generating an error reaction, and the like. Since the current matrix array type keyboard detects that the button is tapped, the signal line of the keyboard array needs to be scanned line by line to confirm the position of the tapped button in the keyboard matrix, and according to the position, After checking the table, the scan code of the button is obtained, and finally the corresponding scan code is sent according to the translated format. As a result, the long processing time also causes the problem of slow response. In addition, when the user inputs a combination key or types a plurality of keys at the same time, problems such as a drop key or a ghost key may occur. Although the existing keyboard uses different scanning technologies and detection methods to speed up the response of the keyboard or prevent ghost key or key conflicts. However, the current keyboard detects the scanning via the keyboard, checks whether there are ghost keys, and the like, and instead increases the response time of the keyboard. In this way, if the user uses the game or the e-sports, it not only causes inconvenience to the user, but also affects the performance of the user at the time of the competition due to ghost keys or key problems.

因此,本發明之主要目的即在於提供一種用於輸入裝置的狀態偵測方法及其相關裝置,以提升輸入裝置的反應速度及避免偵測錯誤的機率產生。Therefore, the main object of the present invention is to provide a state detecting method for an input device and related devices for improving the response speed of the input device and avoiding the probability of detecting errors.

本發明揭露一種輸入裝置之狀態偵測方法,用於一電腦系統,包含有:當該輸入裝置之複數個輸入元件被觸發時,產生相應於該複數個輸入元件之複數個中斷訊號;根據該複數個中斷訊號,設立對應於該複數個輸入元件之複數個中斷旗標;根據該複數個中斷旗標中之複數個第一中斷旗標,傳送相應於該複數個第一中斷旗標之輸入元件之掃描碼至該電腦系統,其中該複數個第一中斷旗標之數量係相關於一位址暫存器之容量;清除該複數個中斷旗標中之該複數個第一中斷旗標;以及偵測該複數個中斷旗標中尚未被清除之至少一第二中斷旗標,並據以傳送相應於該至少一第二中斷旗標之輸入元件之掃描碼至該電腦系統。The invention discloses a state detecting method for an input device, which is used in a computer system, comprising: when a plurality of input components of the input device are triggered, generating a plurality of interrupt signals corresponding to the plurality of input components; a plurality of interrupt signals, a plurality of interrupt flags corresponding to the plurality of input elements are set; and the input corresponding to the plurality of first interrupt flags is transmitted according to the plurality of first interrupt flags in the plurality of interrupt flags Scanning code of the component to the computer system, wherein the number of the plurality of first interrupt flags is related to the capacity of the address buffer; and clearing the plurality of first interrupt flags in the plurality of interrupt flags; And detecting at least one second interrupt flag of the plurality of interrupt flags that has not been cleared, and transmitting a scan code corresponding to the input component of the at least one second interrupt flag to the computer system.

本發明另揭露一種輸入裝置,包含有:複數個輸入元件,其中每一輸入元件被觸發時產生相應之中斷訊號;一資料暫存器,用來儲存相應於該複數個輸入元件之複數個中斷服務常式;一位址暫存器;以及一控制器;其中,當該輸入裝置之複數個輸入元件被觸發時產生相應於該複數個輸入元件之複數個中斷訊號,該控制器根據該複數個中斷訊號設立對應於該複數個輸入元件之複數個中斷旗標並根據該複數個中斷旗標中之複數個第一中斷旗標傳送相應於該複數個第一中斷旗標之輸入元件之掃描碼至該電腦系統,其中該複數個第一中斷旗標之數量係相關於一位址暫存器之容量,該控制器清除該複數個中斷旗標中之該複數個第一中斷旗標;以及偵測該複數個中斷旗標中尚未被清除之至少一第二中斷旗標,並據以傳送相應於該至少一第二中斷旗標之輸入元件之掃描碼至該電腦系統。The invention further discloses an input device comprising: a plurality of input elements, wherein each input element is triggered to generate a corresponding interrupt signal; a data register for storing a plurality of interrupts corresponding to the plurality of input elements a service routine; an address register; and a controller; wherein, when a plurality of input elements of the input device are triggered, generating a plurality of interrupt signals corresponding to the plurality of input elements, the controller is based on the plurality of Interrupt signals establish a plurality of interrupt flags corresponding to the plurality of input elements and transmit scans corresponding to the input elements of the plurality of first interrupt flags according to the plurality of first interrupt flags in the plurality of interrupt flags Code to the computer system, wherein the number of the plurality of first interrupt flags is related to the capacity of the address buffer, and the controller clears the plurality of first interrupt flags in the plurality of interrupt flags; And detecting at least one second interrupt flag of the plurality of interrupt flags that has not been cleared, and transmitting an input component corresponding to the at least one second interrupt flag Scan code to the computer system.

請參考第1圖,第1圖為本發明實施例之一輸入裝置10之示意圖。輸入裝置10用於一電腦系統,其包含一控制器102、複數個輸入元件104、一位址暫存器106及一資料暫存器108。每一輸入元件104各自獨立地耦接至控制器102。當每一輸入元件104被敲擊或操作時會產生相應之中斷訊號。也就是說,每一輸入元件104與控制器102係一對一(one-to-one)對應架構。控制器102藉由位址暫存器106儲存複數個輸入元件104被觸發時的狀態資訊。資料暫存器108用來儲存相應於複數個輸入元件104之複數個中斷服務常式(Interrupt Service Routine,ISR)。其中每一個輸入元件有一專屬之中斷服務常式,當專屬之中斷服務常式被自資料暫存器108讀取並執行後會將相應輸入元件之掃描碼送出至電腦系統以資運用。輸入裝置10可為不同的輸入裝置,例如鍵盤、滑鼠、遙控器等,且不限於此。輸入裝置10可包含有多個輸入元件104,例如鍵盤按鍵、滑鼠按鍵、遙控按鍵等。當使用者敲擊或操作複數個輸入元件時,該些輸入元件會觸發產生相應於該複數個輸入元件之複數個中斷訊號(例如使用者使用鍵盤時,同時按下多個按鍵的組合鍵)。為了提升使用者的便利性,本發明透過複數個輸入元件104與其訊號之間的一對一直接的對應關係,也就是說,當控制器102偵測到至少一輸入元件104被觸發時,控制器102可直接偵測輸入元件104,並將輸入元件104的掃描碼送出,如此一來,本發明可正確且快速的反應輸入裝置的狀態。Please refer to FIG. 1. FIG. 1 is a schematic diagram of an input device 10 according to an embodiment of the present invention. The input device 10 is used in a computer system, and includes a controller 102, a plurality of input elements 104, an address register 106, and a data register 108. Each input element 104 is independently coupled to the controller 102. A corresponding interrupt signal is generated when each input element 104 is tapped or operated. That is, each input element 104 is in a one-to-one corresponding architecture with the controller 102. The controller 102 stores the status information when the plurality of input elements 104 are triggered by the address register 106. The data register 108 is used to store a plurality of Interrupt Service Routines (ISRs) corresponding to the plurality of input elements 104. Each of the input elements has a dedicated interrupt service routine. When the dedicated interrupt service routine is read from the data register 108 and executed, the scan code of the corresponding input component is sent to the computer system for use. The input device 10 can be a different input device such as a keyboard, a mouse, a remote controller, etc., and is not limited thereto. Input device 10 can include a plurality of input elements 104, such as keyboard keys, mouse buttons, remote buttons, and the like. When the user taps or operates a plurality of input elements, the input elements trigger a plurality of interrupt signals corresponding to the plurality of input elements (for example, when the user uses the keyboard, the combination of multiple keys is simultaneously pressed) . In order to improve user convenience, the present invention directly controls a one-to-one correspondence between a plurality of input elements 104 and their signals, that is, when the controller 102 detects that at least one input element 104 is triggered. The device 102 can directly detect the input component 104 and send the scan code of the input component 104. Thus, the present invention can correctly and quickly reflect the state of the input device.

請參考第2圖,第2圖為本發明實施例之一偵測流程20之示意圖。偵測流程20可被編譯為電腦可讀取媒體而儲存於控制器102中,並且經由控制器102指示及執行對應操作。偵測流程20包含下列步驟:Please refer to FIG. 2, which is a schematic diagram of a detection process 20 according to an embodiment of the present invention. The detection process 20 can be compiled into computer readable media for storage in the controller 102 and instructed and executed via the controller 102. The detection process 20 includes the following steps:

步驟202:開始。Step 202: Start.

步驟204:當複數個輸入元件被觸發時產生相應於複數個輸入元件之複數個中斷訊號。Step 204: Generate a plurality of interrupt signals corresponding to the plurality of input elements when the plurality of input elements are triggered.

步驟206:根據複數個中斷訊號設立對應於複數個輸入元件之複數個中斷旗標。Step 206: Set a plurality of interrupt flags corresponding to the plurality of input elements according to the plurality of interrupt signals.

步驟208:根據複數個中斷旗標中之複數個第一中斷旗標,傳送相應於複數個第一中斷旗標之輸入元件之掃描碼至電腦系統。Step 208: Transmit a scan code corresponding to the input elements of the plurality of first interrupt flags to the computer system according to the plurality of first interrupt flags in the plurality of interrupt flags.

步驟210:清除複數個第一中斷旗標。Step 210: Clear a plurality of first interrupt flags.

步驟212:偵測該複數個中斷旗標中尚未被清除之第二中斷旗標,並據以傳送相應於第二中斷旗標之輸入元件之掃描碼至電腦系統。Step 212: Detect a second interrupt flag of the plurality of interrupt flags that has not been cleared, and accordingly transmit a scan code corresponding to the input component of the second interrupt flag to the computer system.

步驟214:結束。Step 214: End.

簡言之,根據偵測流程20,當使用者使用輸入裝置10(例如,鍵盤)時,敲擊多個輸入元件104(例如,鍵盤上的按鍵)時觸發產生複數個中斷訊號及中斷旗標,藉由輸入元件104所觸發的一對一對應的中斷訊號及中斷旗標,控制器102將可偵測到所產生的中斷訊號及其對應的中斷旗標,並據以將對應於該些輸入元件的掃描碼送出提供至電腦系統。如此一來,本發明不需要藉由傳統鍵盤之操作流程(鍵盤偵測掃描、鬼鍵預防、查詢代碼表等步驟),而直接於按鍵被觸發時,立即回傳按鍵的掃描碼,以確保輸入裝置的每個輸入元件的觸發訊號皆被確實的處理,並且防止掉鍵的狀況發生,進而提升鍵盤的反應速度。In short, according to the detection process 20, when the user uses the input device 10 (eg, a keyboard), when multiple input elements 104 (eg, keys on the keyboard) are tapped, a plurality of interrupt signals and interrupt flags are triggered. The controller 102 will detect the generated interrupt signal and its corresponding interrupt flag by the one-to-one corresponding interrupt signal and the interrupt flag triggered by the input component 104, and accordingly, corresponding to the The scan code of the input component is sent out to the computer system. In this way, the present invention does not need to use the operation flow of the traditional keyboard (keyboard detection scan, ghost key prevention, query code table, etc.), and directly returns the scan code of the key when the button is triggered, to ensure The trigger signal of each input component of the input device is surely processed, and the state of the key is prevented from occurring, thereby increasing the response speed of the keyboard.

詳細來說,於步驟204中,當使用者敲擊或操作複數個輸入元件104時,會觸發產生相應於被敲擊或操作之輸入元件之複數個中斷訊號。於步驟206中,根據該複數個中斷訊號設立對應於被敲擊或操作之複數個輸入元件之複數個中斷旗標。例如當輸入裝置10之字母按鍵A~D被同時敲擊時會產生中斷訊號INT_A 、INT_B、INT_C 及INT_D,並設立中斷旗標INT_A flag、INT_B flag、INT_C flag、INT_D flag。In detail, in step 204, when the user taps or operates a plurality of input elements 104, a plurality of interrupt signals corresponding to the input elements that are tapped or operated are triggered. In step 206, a plurality of interrupt flags corresponding to the plurality of input elements that are tapped or operated are set according to the plurality of interrupt signals. For example, when the letter buttons A to D of the input device 10 are simultaneously tapped, the interrupt signals INT_A, INT_B, INT_C, and INT_D are generated, and the interrupt flags INT_A flag, INT_B flag, INT_C flag, and INT_D flag are set.

接著,於步驟208中,根據複數個中斷旗標中之複數個第一中斷旗標,傳送相應於複數個第一中斷旗標之輸入元件之掃描碼至電腦系統。其中第一中斷旗標之數量係相關位址暫存器106之容量。例如第一中斷旗標之數量等於位址暫存器106所能儲存位址之數量。具體而言,由於硬體限制,位址暫存器160所能儲存位址之數量有限。於步驟208中,可先根據位址暫存器106之容量大小,處理所有中斷旗標中之部分中斷旗標(即複數個第一中斷旗標),以傳送相應於複數個第一中斷旗標之輸入元件之掃描碼至電腦系統。Next, in step 208, the scan code corresponding to the input elements of the plurality of first interrupt flags is transmitted to the computer system according to the plurality of first interrupt flags in the plurality of interrupt flags. The number of the first interrupt flag is the capacity of the associated address register 106. For example, the number of first interrupt flags is equal to the number of addresses that the address register 106 can store. Specifically, due to hardware limitations, the address register 160 can store a limited number of addresses. In step 208, a part of the interrupt flags (ie, a plurality of first interrupt flags) of all the interrupt flags may be processed according to the capacity of the address register 106 to transmit a plurality of first interrupt flags. Mark the scan code of the input component to the computer system.

舉例來說,若位址暫存器106為一堆疊暫存器(Stack register),其所能儲存位址之數量為3個。當輸入裝置10之字母按鍵A~D被同時敲擊時而產生中斷訊號INT_A 、INT_B、INT_C 及INT_D以及中斷旗標INT_A flag、INT_B flag、INT_C flag、INT_D flag,可先處理中斷旗標INT_A flag、INT_B flag、INT_C flag、INT_D flag之中的其中3個中斷旗標。例如先處理中斷旗標INT_A flag、INT_B flag、INT_C flag。請參考第3圖,當電腦系統之處理器執行到主程式之某一行時,字母按鍵A~D經由使用者的觸發產生中斷訊號時,處理器依據該些中斷訊號舉起中斷旗標INT_flag作為通知,接著停止主程式動作,並將目前主程式所執行的位址(例如0x00A0)儲存於位址暫存器106。控制器102根據中斷旗標INT_A flag、INT_B flag以及INT_C flag取得相應於中斷旗標INT_A flag及中斷旗標INT_C flag之字母按鍵A、B及C的中斷服務常式之位址。接著,跳至中斷旗標INT_A flag之字母按鍵A的中斷服務常式之位址,準備開始執行INT_A flag之字母按鍵A的中斷服務常式。由於尚有中斷旗標INT_B flag及中斷旗標INT_C flag還未處理,此時,相應於中斷旗標INT_A flag之字母按鍵A的中斷服務常式的位址(例如0xF0A0)會被儲存至位址暫存器106,並跳至中斷旗標INT_B flag之字母按鍵B的中斷服務常式之位址,以準備開始執行相應於中斷旗標INT_B flag之字母按鍵B的中斷服務常式。在此情況下,由於尚有中斷旗標INT_ C flag處理,此時相應於中斷旗標INT_B flag之字母按鍵B的中斷服務常式的位址(例如0xBBA0)也會被儲存至位址暫存器106,並跳至中斷旗標INT_C flag之字母按鍵C的中斷服務常式之位址(例如0xB0A0),以準備執行相應於中斷旗標INT_C flag之字母按鍵C的中斷服務常式。For example, if the address register 106 is a stack register, the number of addresses that can be stored is three. When the letter buttons A to D of the input device 10 are simultaneously tapped, the interrupt signals INT_A, INT_B, INT_C, and INT_D and the interrupt flags INT_A flag, INT_B flag, INT_C flag, and INT_D flag are generated, and the interrupt flag INT_A flag can be processed first. Three of the interrupt flags, INT_B flag, INT_C flag, and INT_D flag. For example, the interrupt flag INT_A flag, INT_B flag, and INT_C flag are processed first. Referring to FIG. 3, when the processor of the computer system executes to a certain line of the main program, when the letter buttons A to D generate an interrupt signal through the trigger of the user, the processor raises the interrupt flag INT_flag according to the interrupt signals. The notification then stops the main program action and stores the address (eg, 0x00A0) currently executed by the main program in the address register 106. The controller 102 obtains the address of the interrupt service routine corresponding to the letter buttons A, B, and C of the interrupt flag INT_A flag and the interrupt flag INT_C flag according to the interrupt flags INT_A flag, INT_B flag, and INT_C flag. Then, jump to the address of the interrupt service routine of the letter button A of the interrupt flag INT_A flag, and prepare to start the interrupt service routine of the letter A of the INT_A flag. Since the interrupt flag INT_B flag and the interrupt flag INT_C flag have not been processed yet, the address of the interrupt service routine (for example, 0xF0A0) corresponding to the letter A of the interrupt flag INT_A flag is stored to the address. The register 106 jumps to the address of the interrupt service routine of the letter B of the interrupt flag INT_B flag to prepare to start executing the interrupt service routine corresponding to the letter B of the interrupt flag INT_B flag. In this case, since the interrupt flag INT_C flag is still processed, the address of the interrupt service routine (for example, 0xBBA0) corresponding to the letter B of the interrupt flag INT_B flag is also stored to the address temporary storage. The device 106 jumps to the address of the interrupt service routine of the letter C of the interrupt flag INT_C flag (for example, 0xB0A0) to prepare to execute the interrupt service routine corresponding to the letter C of the interrupt flag INT_C flag.

接著,執行相應於中斷旗標INT_C flag之字母按鍵C的中斷服務常式,以傳送字母按鍵C之掃描碼至電腦系統。於相應於中斷旗標INT_C flag之字母按鍵C的中斷服務常式被執行完後會自位址暫存器106取得相應於中斷旗標INT_B flag之字母按鍵B的中斷服務常式的位址(例如0xBBA0)並執行相應於中斷旗標INT_B flag之字母按鍵B的中斷服務常式,以傳送字母按鍵B之掃描碼至電腦系統。同樣地,於相應於中斷旗標INT_C flag之字母按鍵B的中斷服務常式被執行完後會自位址暫存器106取得相應於中斷旗標INT_A flag之字母按鍵A的中斷服務常式的位址(例如0x0FA0)並執行相應於中斷旗標INT_A flag之字母按鍵A的中斷服務常式,以傳送字母按鍵A之掃描碼至電腦系統。如此一來,字母按鍵A、B及C之掃描碼即被提供至電腦系統。接著,電腦系統會自位址暫存器106中讀取先前所存入之目前主程式所執行的位址(例如0x00A0)並回至原先主程式的執行位置。也就是說,於步驟208中,可依據位址暫存器106之容量處理複數個中斷旗標中之部分中斷旗標並將其相應之掃描碼至電腦系統。Next, an interrupt service routine corresponding to the letter button C of the interrupt flag INT_C flag is executed to transmit the scan code of the letter button C to the computer system. After the interrupt service routine corresponding to the letter C of the interrupt flag INT_C flag is executed, the address of the interrupt service routine corresponding to the letter B of the interrupt flag INT_B flag is obtained from the address register 106 ( For example, 0xBBA0) and execute the interrupt service routine corresponding to the letter B of the interrupt flag INT_B flag to transmit the scan code of the letter button B to the computer system. Similarly, after the interrupt service routine corresponding to the letter B of the interrupt flag INT_C flag is executed, the interrupt service routine corresponding to the letter button A of the interrupt flag INT_A flag is obtained from the address register 106. The address (for example, 0x0FA0) and the interrupt service routine corresponding to the letter button A of the interrupt flag INT_A flag is executed to transmit the scan code of the letter button A to the computer system. In this way, the scan codes of the letter keys A, B and C are supplied to the computer system. Then, the computer system reads the address (for example, 0x00A0) executed by the current main program stored in the previous address register 106 and returns to the execution position of the original main program. That is to say, in step 208, part of the interrupt flag of the plurality of interrupt flags can be processed according to the capacity of the address register 106 and the corresponding scan code is sent to the computer system.

由於相應於複數個第一中斷旗標之輸入元件之掃描碼已被傳送至電腦系統,於步驟210中,清除該複數個第一中斷旗標中之複數個第一中斷旗標。Since the scan code corresponding to the input elements of the plurality of first interrupt flags has been transmitted to the computer system, in step 210, the plurality of first interrupt flags in the plurality of first interrupt flags are cleared.

接著,於步驟212中,偵測該複數個中斷旗標中是否尚有未被清除之中斷旗標(即第二中斷旗標)。若有的話,表示尚有輸入元件所觸發產生之中斷訊號及相應中斷旗標尚未被處理。於步驟212中,依據未被清除之中斷旗標傳送其相應之輸入元件之掃描碼至電腦系統。舉例來說,若位址暫存器106為堆疊暫存器,其所能儲存位址之數量為3個。當輸入裝置10之字母按鍵A~D被同時敲擊時而產生中斷訊號INT_A、INT_B、INT_C 及INT_D以及中斷旗標INT_A flag、INT_B flag、INT_C flag、INT_D flag。如第3圖所示,若字母按鍵A、B及C之掃描碼已被提供至電腦系統。再者,依據步驟210,中斷旗標INT_A flag、INT_B flag、INT_C flag也已被清除。在此情況下,由於尚有中斷旗標INT_D flag存在而未被清除。於步驟212中,如第4圖所示,輸入裝置10可偵測到中斷旗標INT_D flag尚未被清除。電腦系統之處理器將目前主程式所執行的位址(例如0xFFA0)儲存於位址暫存器106。接著,控制器102根據中斷旗標INT_D flag取得相應於中斷旗標INT_D之字母按鍵D的中斷服務常式之位址(例如0xA0FF)。接著,跳至中斷旗標INT_D flag之字母按鍵D的中斷服務常式之位址(例如0xA0FF),並執行相應於中斷旗標INT_C flag之字母按鍵D的中斷服務常式,以傳送相應於INT_D flag之字母按鍵D之掃描碼至電腦系統。如此一來,輸入裝置10之字母按鍵A~D之掃描碼即全部被傳送至電腦系統,而不會有掉鍵及鍵位衝突的狀況發生。再者,本發明之輸入裝置藉由一對一的架構來偵測按鍵的狀態,可有效省去冗長的掃描鍵盤的時間,以提升鍵盤的反應速度,進而提升便利性。Next, in step 212, it is detected whether there is an interrupt flag (ie, a second interrupt flag) that is not cleared in the plurality of interrupt flags. If any, it indicates that the interrupt signal generated by the input component and the corresponding interrupt flag have not been processed. In step 212, the scan code of its corresponding input component is transmitted to the computer system according to the interrupt flag that has not been cleared. For example, if the address register 106 is a stack register, the number of addresses that can be stored is three. The interrupt signals INT_A, INT_B, INT_C, and INT_D and the interrupt flags INT_A flag, INT_B flag, INT_C flag, and INT_D flag are generated when the letter buttons A to D of the input device 10 are simultaneously tapped. As shown in Figure 3, if the scan codes for letter buttons A, B, and C have been provided to the computer system. Furthermore, according to step 210, the interrupt flags INT_A flag, INT_B flag, and INT_C flag have also been cleared. In this case, the interrupt flag INT_D flag is not cleared because it still exists. In step 212, as shown in FIG. 4, the input device 10 can detect that the interrupt flag INT_D flag has not been cleared. The processor of the computer system stores the address (e.g., 0xFFA0) currently executed by the main program in the address register 106. Next, the controller 102 obtains an address of the interrupt service routine (for example, 0xA0FF) corresponding to the letter button D of the interrupt flag INT_D according to the interrupt flag INT_D flag. Then, jump to the address of the interrupt service routine of the letter D of the interrupt flag INT_D flag (for example, 0xA0FF), and execute the interrupt service routine corresponding to the letter button D of the interrupt flag INT_C flag to transmit the corresponding INT_D. The letter of the letter of the button D is scanned to the computer system. In this way, the scan codes of the letter buttons A to D of the input device 10 are all transmitted to the computer system without a situation in which the key drop and the key position conflict. Furthermore, the input device of the present invention detects the state of the button by a one-to-one architecture, thereby effectively eliminating the lengthy time of scanning the keyboard, thereby improving the response speed of the keyboard, thereby improving convenience.

另一方面,於步驟212中,於相應於該些第二中斷旗標之輸入元件之掃描碼被傳送至電腦系統後,清除該些第二中斷旗標。此外,若是所偵測出尚未被清除之中斷旗標(第二中斷旗標)數量大於位址暫存器106所能儲存位址之數量時,可依據於步驟208及210的操作,因應位址暫存器106所能儲存位址之數量逐步處理未被清除之中斷旗標,以將相應之輸入元件的掃描碼傳送給電腦系統。On the other hand, in step 212, after the scan codes corresponding to the input elements of the second interrupt flags are transmitted to the computer system, the second interrupt flags are cleared. In addition, if the number of interrupt flags (second interrupt flags) detected to be uncleared is greater than the number of addresses that can be stored by the address register 106, the operations may be performed according to the operations of steps 208 and 210. The address register 106 can store the number of addresses to gradually process the un-cleared interrupt flag to transmit the scan code of the corresponding input component to the computer system.

請參考第5圖及第6圖,第5圖及第6圖分別為本發明實施例之一硬體架構之示意圖。在一實施例中,如第5圖所示,本發明採用一對一的對應架構來偵測按鍵的狀態,因此,輸入裝置10的控制器102可採用印刷電路板(Printed Circuit Board,PCB)來取代傳統的層板。然而,由於PCB走線的長度、複雜度以及中斷反應的時間較短,使得外部雜訊抑制的抗干擾能力降低。為解決上述問題,本發明於每個觸發的中斷訊號的輸入端加入數十至數百pf等級的陶瓷電容,用來對輸入的訊號進行去彈跳(Debounce)處理。也就是說,當一觸發訊號產生時,利用陶瓷電容將觸發訊號穩定後再進入控制器102。除此之外,如第6圖所示,為了有效阻擋控制器102的PCB印刷版外部的射頻雜訊(Radio Frequency Interference,RFI)進入內層的訊號線,本發明控制器102之PCB板將的表層以接地面(GND plane)環繞來實現最短的雜訊抑制路徑。如此一來,可以有效抑制外部突發的高頻雜訊(Anti-noise)。Please refer to FIG. 5 and FIG. 6 . FIG. 5 and FIG. 6 are respectively schematic diagrams of a hardware architecture according to an embodiment of the present invention. In one embodiment, as shown in FIG. 5, the present invention uses a one-to-one corresponding architecture to detect the state of the keys. Therefore, the controller 102 of the input device 10 can employ a Printed Circuit Board (PCB). To replace the traditional laminate. However, due to the length and complexity of the PCB traces and the short interruption of response time, the anti-interference ability of external noise suppression is reduced. In order to solve the above problem, the present invention adds a ceramic capacitor of tens to hundreds of pf levels to the input end of each triggered interrupt signal for debounce processing of the input signal. That is to say, when a trigger signal is generated, the trigger signal is stabilized by the ceramic capacitor and then enters the controller 102. In addition, as shown in FIG. 6, in order to effectively block the radio frequency interference (RFI) outside the PCB printing plate of the controller 102 from entering the inner layer signal line, the PCB board of the controller 102 of the present invention will The surface layer is surrounded by a GND plane to achieve the shortest noise suppression path. In this way, it is possible to effectively suppress external bursts of high-frequency noise (Anti-noise).

需注意的是,前述實施例係用以說明本發明之精神,本領域具通常知識者當可據以做適當之修飾,而不限於此。舉例來說,中斷的階層數量可根據硬體設備調整,而本發明之輸入裝置除了適用於鍵盤外,亦可使用於其他輸入裝置,例如,多按鍵搖桿或遙控等。此外,本發明之輸入裝置之狀態偵測方法亦可用於其他相關偵測裝置,以一對一的對應關係,提升反應速度或確保每一輸入訊號的皆能正確的送出。It is to be noted that the foregoing embodiments are intended to illustrate the spirit of the invention, and those of ordinary skill in the art may be modified as appropriate, and are not limited thereto. For example, the number of interrupted levels can be adjusted according to the hardware device, and the input device of the present invention can be used for other input devices, such as a multi-button rocker or a remote control, in addition to the keyboard. In addition, the state detecting method of the input device of the present invention can also be applied to other related detecting devices to improve the reaction speed or ensure that each input signal can be correctly sent out in a one-to-one correspondence.

綜上所述,本發明提供用於一對一的架構的輸入裝置的狀態偵測方法及相關裝置,不僅可省去冗長的掃描輸入裝置、避免鬼鍵、組合鍵或掉鍵等步驟,以提升鍵盤的反應速度,同時可解決鬼鍵以及鍵位衝突等問題,進而提升輸入裝置的正確性。   以上所述僅為本發明之較佳實施例,凡依本發明申請專利範圍所做之均等變化與修飾,皆應屬本發明之涵蓋範圍。In summary, the present invention provides a state detection method and related device for an input device of a one-to-one architecture, which not only eliminates redundant scanning input devices, avoids ghost keys, combination keys, or drop keys, etc., Improve the response speed of the keyboard, and solve problems such as ghost keys and key conflicts, thereby improving the correctness of the input device. The above are only the preferred embodiments of the present invention, and all changes and modifications made to the scope of the present invention should be within the scope of the present invention.

10‧‧‧輸入裝置10‧‧‧Input device

102‧‧‧控制器102‧‧‧ Controller

104‧‧‧輸入元件104‧‧‧ Input components

106‧‧‧位址暫存器106‧‧‧ address register

108‧‧‧資料暫存器 108‧‧‧data register

20‧‧‧偵測流程 20‧‧‧Detection process

202~214‧‧‧步驟 202~214‧‧‧Steps

INT_flag、INT_A flag、INT_B flag、INT_C flag、INT_D flag‧‧‧中斷旗標 INT_flag, INT_A flag, INT_B flag, INT_C flag, INT_D flag‧‧‧ interrupt flag

第1圖為本發明實施例之一輸入裝置之示意圖。 第2圖為本發明實施例之一偵測流程之示意圖。 第3圖及第4圖分別為本發明實施例偵測運作示意圖。 第5圖及第6圖分別為本發明實施例之硬體架構之示意圖。FIG. 1 is a schematic diagram of an input device according to an embodiment of the present invention. FIG. 2 is a schematic diagram of a detection process according to an embodiment of the present invention. FIG. 3 and FIG. 4 are respectively schematic diagrams of detecting operations according to an embodiment of the present invention. 5 and 6 are respectively schematic views of a hardware architecture of an embodiment of the present invention.

20‧‧‧偵測流程 20‧‧‧Detection process

202~214‧‧‧步驟 202~214‧‧‧Steps

Claims (13)

一種輸入裝置之狀態偵測方法,用於一電腦系統,包含有:當該輸入裝置之複數個輸入元件被觸發時,產生相應於該複數個輸入元件之複數個中斷訊號;根據該複數個中斷訊號,設立對應於該複數個輸入元件之複數個中斷旗標;根據該複數個中斷旗標中之複數個第一中斷旗標,傳送相應於該複數個第一中斷旗標之輸入元件之掃描碼至該電腦系統,其中該複數個第一中斷旗標之數量係相關於一位址暫存器之容量;清除該複數個中斷旗標中之該複數個第一中斷旗標;以及偵測該複數個中斷旗標中尚未被清除之至少一第二中斷旗標,並據以傳送相應於該至少一第二中斷旗標之輸入元件之掃描碼至該電腦系統;其中該複數個第一中斷旗標之數量等於該位址暫存器所能儲存位址之數量。 A state detecting method for an input device, comprising: a computer system, comprising: generating a plurality of interrupt signals corresponding to the plurality of input elements when a plurality of input elements of the input device are triggered; according to the plurality of interrupts a signal, a plurality of interrupt flags corresponding to the plurality of input elements are set; and a scan corresponding to the input elements of the plurality of first interrupt flags is transmitted according to the plurality of first interrupt flags in the plurality of interrupt flags Code to the computer system, wherein the number of the plurality of first interrupt flags is related to the capacity of the address buffer; clearing the plurality of first interrupt flags in the plurality of interrupt flags; and detecting At least one second interrupt flag of the plurality of interrupt flags that has not been cleared, and correspondingly transmitting a scan code corresponding to the input component of the at least one second interrupt flag to the computer system; wherein the plurality of first The number of interrupt flags is equal to the number of addresses that can be stored by the address register. 如請求項1所述之狀態偵測方法,其中根據該複數個中斷旗標中之該複數個第一中斷旗標傳送相應於該複數個第一中斷旗標之輸入元件之掃描碼至該電腦系統之步驟包含有根據該複數個中斷旗標中之複數個第一中斷旗標,取得並執行相應於該複數個第一中斷旗標之輸入元件的中斷服務常式,以傳送相應於該複數個第一中斷旗標之輸入元件之掃描碼至該電腦系統。 The state detecting method of claim 1, wherein the scan code corresponding to the input element of the plurality of first interrupt flags is transmitted to the computer according to the plurality of first interrupt flags in the plurality of interrupt flags The step of the system includes obtaining, according to the plurality of first interrupt flags in the plurality of interrupt flags, an interrupt service routine corresponding to the input elements of the plurality of first interrupt flags, to transmit corresponding to the complex number The scan code of the input component of the first interrupt flag is sent to the computer system. 如請求項1所述之狀態偵測方法,其中偵測該複數個中斷旗標中尚未被清除之該至少一第二中斷旗標並據以傳送相應於該至少一第二中斷旗標之之輸入元件之掃描碼至該電腦系統步驟包含:偵測出該複數個中斷旗標中尚未被清除之該至少一第二中斷旗標;以及 根據該至少一第二中斷旗標,取得並執行相應於該至少一第二中斷旗標之輸入元件的中斷服務常式,以傳送相應於該至少一第二中斷旗標之輸入元件之掃描碼至該電腦系統。 The state detecting method of claim 1, wherein the at least one second interrupt flag that has not been cleared in the plurality of interrupt flags is detected and transmitted according to the at least one second interrupt flag The step of inputting the scan code of the component to the computer system includes: detecting the at least one second interrupt flag of the plurality of interrupt flags that has not been cleared; Obtaining, according to the at least one second interrupt flag, an interrupt service routine corresponding to the input component of the at least one second interrupt flag, to transmit a scan code corresponding to the input component of the at least one second interrupt flag To the computer system. 如請求項1所述之狀態偵測方法,其另包含:清除該複數個中斷旗標中之該至少一第二中斷旗標。 The state detecting method of claim 1, further comprising: clearing the at least one second interrupt flag of the plurality of interrupt flags. 如請求項1所述之狀態偵測方法,其中該位址暫存器為一堆疊暫存器。 The state detecting method of claim 1, wherein the address register is a stack register. 一種輸入裝置,包含有:複數個輸入元件,其中每一輸入元件被觸發時產生相應之中斷訊號;一資料暫存器,用來儲存相應於該複數個輸入元件之複數個中斷服務常式;一位址暫存器;以及一控制器;其中,當該輸入裝置之複數個輸入元件被觸發時產生相應於該複數個輸入元件之複數個中斷訊號,該控制器根據該複數個中斷訊號設立對應於該複數個輸入元件之複數個中斷旗標並根據該複數個中斷旗標中之複數個第一中斷旗標傳送相應於該複數個第一中斷旗標之輸入元件之掃描碼至該電腦系統,其中該複數個第一中斷旗標之數量係相關於一位址暫存器之容量,該控制器清除該複數個中斷旗標中之該複數個第一中斷旗標;以及偵測該複數個中斷旗標中尚未被清除之至少一第二中斷旗標,並據以傳送相應於該至少一第二中斷旗標之輸入元件之掃描碼至該電腦系統;其中該複數個第一中斷旗標之數量等於該位址暫存器所能儲存位址之數量。 An input device includes: a plurality of input elements, wherein each input element is triggered to generate a corresponding interrupt signal; a data register for storing a plurality of interrupt service routines corresponding to the plurality of input elements; An address register; and a controller; wherein, when a plurality of input elements of the input device are triggered, generating a plurality of interrupt signals corresponding to the plurality of input elements, the controller is set according to the plurality of interrupt signals Corresponding to the plurality of interrupt flags of the plurality of input elements and transmitting scan codes corresponding to the input elements of the plurality of first interrupt flags to the computer according to the plurality of first interrupt flags in the plurality of interrupt flags a system, wherein the number of the plurality of first interrupt flags is related to a capacity of an address register, the controller clears the plurality of first interrupt flags in the plurality of interrupt flags; and detecting the At least one second interrupt flag of the plurality of interrupt flags that has not been cleared, and correspondingly transmitting a scan code corresponding to the input component of the at least one second interrupt flag to the Brain; wherein the plurality of first interrupt flag is equal to the number of the address register can store the address number. 如請求項6所述之輸入裝置,其另包含一資料暫存器,用來儲存相應於該複數個輸入元件之複數個中斷服務常式。 The input device of claim 6, further comprising a data register for storing a plurality of interrupt service routines corresponding to the plurality of input elements. 如請求項7所述之輸入裝置,其中該控制器根據該複數個中斷旗標中之複數個第一中斷旗標,並由該資料暫存器取得並執行相應於該複數個第一中斷旗標之輸入元件的中斷服務常式,以傳送相應於該複數個第一中斷旗標之輸入元件之掃描碼至該電腦系統。 The input device of claim 7, wherein the controller is based on the plurality of first interrupt flags in the plurality of interrupt flags, and is obtained by the data register and executed corresponding to the plurality of first interrupt flags The interrupt service routine of the input component is configured to transmit a scan code corresponding to the input component of the plurality of first interrupt flags to the computer system. 如請求項7所述之輸入裝置,其中該控制器偵測出該複數個中斷旗標中尚未被清除之該至少一第二中斷旗標以及根據該至少一第二中斷旗標由該資料暫存器取得並執行相應於該至少一第二中斷旗標之輸入元件的中斷服務常式,以傳送相應於該至少一第二中斷旗標之輸入元件之掃描碼至該電腦系統。 The input device of claim 7, wherein the controller detects the at least one second interrupt flag of the plurality of interrupt flags that has not been cleared, and temporarily delays the data according to the at least one second interrupt flag. The memory fetches and executes an interrupt service routine corresponding to the input component of the at least one second interrupt flag to transmit a scan code corresponding to the input component of the at least one second interrupt flag to the computer system. 如請求項6所述之輸入裝置,其中該控制器清除對應於該複數個中斷旗標中之該至少一第二中斷旗標。 The input device of claim 6, wherein the controller clears the at least one second interrupt flag corresponding to the plurality of interrupt flags. 如請求項6所述之輸入裝置,其中該位址暫存器為一堆疊暫存器。 The input device of claim 6, wherein the address register is a stack register. 如請求項6所述之輸入裝置,其中於該輸入裝置另包含至少一陶瓷電容,用來抑制外部突發的高頻雜訊。 The input device of claim 6, wherein the input device further comprises at least one ceramic capacitor for suppressing external burst high frequency noise. 如請求項6所述之輸入裝置,其中於該輸入裝置之一線路表層係以 接地面環繞的方式設置。 The input device of claim 6, wherein the line surface of one of the input devices is Set the ground plane to surround it.
TW105119872A 2016-06-24 2016-06-24 Input Device and Status Detecting Method Using the Same TWI590105B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW105119872A TWI590105B (en) 2016-06-24 2016-06-24 Input Device and Status Detecting Method Using the Same

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW105119872A TWI590105B (en) 2016-06-24 2016-06-24 Input Device and Status Detecting Method Using the Same

Publications (2)

Publication Number Publication Date
TWI590105B true TWI590105B (en) 2017-07-01
TW201800908A TW201800908A (en) 2018-01-01

Family

ID=60048562

Family Applications (1)

Application Number Title Priority Date Filing Date
TW105119872A TWI590105B (en) 2016-06-24 2016-06-24 Input Device and Status Detecting Method Using the Same

Country Status (1)

Country Link
TW (1) TWI590105B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109189649A (en) * 2018-08-15 2019-01-11 郑州云海信息技术有限公司 A kind of server contention states display system and method based on RGB LED

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109189649A (en) * 2018-08-15 2019-01-11 郑州云海信息技术有限公司 A kind of server contention states display system and method based on RGB LED

Also Published As

Publication number Publication date
TW201800908A (en) 2018-01-01

Similar Documents

Publication Publication Date Title
JP6219959B2 (en) Noise detection and correction routines
US9645675B2 (en) Touch control substrate, terminal and method for improving touch precision
JP2019133487A (en) Sensor system
TWI590105B (en) Input Device and Status Detecting Method Using the Same
JPH0997177A (en) Interrupt control system for computer system
US7375655B2 (en) Keyboard without ghost keys
TW201619835A (en) Keyboard-video-mouse switch and operating method thereof
WO2021036718A1 (en) Touch point determining method and device
US20200110724A1 (en) Usb detecting method and usb expansion device using same
CN107589854B (en) Input device and state detection method thereof
US20200162064A1 (en) Debounce circuit using d flip-flops
JP2018519591A (en) Intermediate module for controlling communication between data processing devices and peripheral devices
US20100185797A1 (en) Keyboard-mouse switch and switching method thereof
US10817075B2 (en) Keyboard control system and computer input system allowing a single pin to correspond to a single key when pressed on the keyboard key
CN107305442B (en) Input device and control method thereof
TWI710933B (en) Touch display system and operation method thereof
JP5005442B2 (en) Input device using rotary dip switch
TWI624772B (en) Input device and control method thereof
JP2010086387A (en) Keyboard device and control method thereof
CN116360616A (en) Detection method and control system
JP2009271569A (en) Semiconductor integrated circuit and electronic apparatus equipped with the same
JP2009026174A (en) Coordinate input device
JP2022066322A (en) Sensor system and method for detecting stylus
JPH03252750A (en) Interruption control circuit
JP2005122337A (en) Bus system, host bridge, on-line restarting method for bus system, and program