JP2007102643A - Key scanning circuit - Google Patents
Key scanning circuit Download PDFInfo
- Publication number
- JP2007102643A JP2007102643A JP2005294170A JP2005294170A JP2007102643A JP 2007102643 A JP2007102643 A JP 2007102643A JP 2005294170 A JP2005294170 A JP 2005294170A JP 2005294170 A JP2005294170 A JP 2005294170A JP 2007102643 A JP2007102643 A JP 2007102643A
- Authority
- JP
- Japan
- Prior art keywords
- circuit
- input
- key
- chattering removal
- signal
- Prior art date
- Legal status (The legal status 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 status listed.)
- Granted
Links
Images
Landscapes
- Input From Keyboards Or The Like (AREA)
Abstract
Description
本発明はキースキャン回路に関し、特に、ワンチップマイクロコンピュータを用いて構成する場合に好適なキースキャン回路に関するものである。 The present invention relates to a key scan circuit, and more particularly to a key scan circuit suitable for a configuration using a one-chip microcomputer.
各種コンピュータには、テン・キーを始めとして、種々の入力手段が付加されることが多いが、少ない信号ラインで効率よくキー操作信号をコンピュータに伝達するために、どのキーが操作されたかを検出するキースキャン処理を行う。また、機械的なスイッチを操作してON/OFFすると瞬間的に信号が立ち上がり、もしくは立ち下がるものの、実際には電位がmsオーダーの時間でばたつく。これをチャタリングと云い、計数回路等においてこのばたつきをカウントしてしまうと誤動作の原因となるので、チャタリング除去回路が付加される。従来、チャタリング除去回路の基本的な機能は、キースイッチが操作されたことを検出すると、チャタリングが発生する一定時間キー信号検出をマスキングした後、中央処理装置(Central Processing Unit:以下「CPU」と略す)に割り込み要求を発生するようにしていた。しかし、いずれかのキーが操作される毎に、全体のキー信号検出をマスキングする方法では、マスキング途中に操作された他のキーについても検出できなくなる。そこで、例えば、特開平2−170615「チャタリング防止装置」では、入力されるキーグループ信号夫々について、個別にマスキング手段を備えた方法が提案されている。
また一方、キースキャン回路を実現する方法としては、従来、キースキャン専用のマイクロコンピュータ(カスタムLSI)を使用していたが、近年、ワンチップマイクロコンピュータを用いたものが主流となった。ワンチップマイクロコンピュータ(以下「ワンチップマイコン」という)は、一つの集積回路(Large Scale Integrated Circuit:LSI)チップのなかに、メモリ、入出力インターフェース回路(I/O)、CPU等を構成し、単体でマイクロコンピュータとしての機能を備えたものである。これらワンチップマイコンは、キーボード等のコンピュータ周辺機器に搭載されてメインCPUに代わり夫々の周辺機器の制御を分担することによって、メインCPUの負担を軽減するといった使用方法の他、家電製品、自動車、産業機器、ゲーム機器等、あらゆる分野の装置の制御にも使用されている。
Various computers are often equipped with various input means, including numeric keys, but it is possible to detect which key has been operated in order to efficiently transmit key operation signals to the computer with fewer signal lines. Perform key scan processing. Further, when a mechanical switch is operated and turned on / off, the signal rises or falls momentarily, but in reality, the potential fluctuates in the order of ms. This is called chattering, and if this fluttering is counted in a counting circuit or the like, it causes a malfunction, so a chattering removal circuit is added. Conventionally, the basic function of the chattering removal circuit is that after detecting that a key switch is operated, the key signal detection for which a chattering occurs is masked for a certain period of time, and then a central processing unit (hereinafter referred to as “CPU”). An interrupt request was generated. However, with the method of masking the entire key signal detection every time any key is operated, it becomes impossible to detect other keys operated during masking. Therefore, for example, Japanese Patent Laid-Open No. 2-170615 “chattering prevention device” proposes a method in which masking means is individually provided for each input key group signal.
On the other hand, as a method for realizing a key scan circuit, a microcomputer (custom LSI) dedicated to key scan has been conventionally used, but in recent years, a one-chip microcomputer has become mainstream. A one-chip microcomputer (hereinafter referred to as “one-chip microcomputer”) includes a memory, an input / output interface circuit (I / O), a CPU, and the like in one integrated circuit (Large Scale Integrated Circuit: LSI) chip. It has a function as a microcomputer by itself. These one-chip microcomputers are mounted on computer peripheral devices such as a keyboard and share the control of each peripheral device instead of the main CPU, thereby reducing the burden on the main CPU, as well as home appliances, automobiles, It is also used to control devices in various fields such as industrial equipment and game machines.
図8は、ワンチップマイコンの一例を示すブロック構成図である。この例に示すワンチップマイコン100は、全体の制御を行うCPU101と、外部メモリ等に接続する外部パラレルコントローラ(EXT MEMORY INTERFACE:外部メモリインターフェース)102と、前記CPU101の制御を受けることなくデータの転送を行うDMA(Direct Memory Controller)103と、内部RAM(INTERNAL RAM)104と、内部ROM(INTERNAL ROM)105と、割り込みコントローラ(ICTL)106と、アナログ・デジタル変換回路(ADC)107と、デジタル・アナログ変換回路(DAC)108と、同期式シリアルインターフェース(SPI)109と、パラレル信号をシリアル信号に変換したり、逆にシリアルデバイスから送られるシリアル信号をパラレル信号に変換したりする調歩同期シリアルインターフェース(Universal Asynchronous Receiver Transmitter:UART)110と、汎用入出力ポートとしての機能を有するパラレルインターフェース(General Purpose Input Output Port:GPIO)111と、キースキャンの対象となる外部キーボード等のキーマトリクスを接続するキースキャン回路112と、カウンターを搭載し時間を計数するタイマ(TIMER)113と、低消費電力モードに移行する制御を行う電源管理部(POWER MANAGEMENT)114と、各クロック信号を発生し各機能ブロック回路にクロック信号の供給/停止を制御するクロック回路(CLKGEN)115とを備え、夫々は内部バスライン116で接続されている。
FIG. 8 is a block diagram showing an example of a one-chip microcomputer. A one-
図9は従来の、ワンチップマイコンのキースキャン回路112を使用したキースキャン回路であって、前記キースキャン回路112はターゲットとするキーボードのキーマトリクス117に合わせた専用のハードウエア構成を有している。図10は、通常ワンチップパソコンに搭載されているGPIO111を利用したキースキャン回路の例を示す概要構成図である。いずれの回路においても、キースキャン回路112やGPIO111の入出力ポートにキーマトリクス117の入出力端が接続され、夫々の出力ポートから順次所要信号が供給され、その間に入力ポートの電位を順次スキャンしてセンシングすることによって、キーマトリクス117のいずれかのキーが操作されると、割り込みコントローラ(ICTL)106を介してCPU101に割り込みを実行し、CPU101の制御によって操作されたキーを検出して、図示を省略したメインCPUに伝達するものである。
しかしながら、上述した従来技術によれば、夫々、次のような問題点があった。先ず、特許文献1に開示されたように全ての制御をソフトウエアによって実現すると、CPUの負担が増えて処理が遅くなる。公報に例示されたPCMレコーダのように家庭用電子機器の簡単な設定に使用するキーボードであれば処理負担も少ないが、パソコン等のキーボードのように短時間に多くのキー操作が行われるものにおいては、CPUの処理能力として高速のものが必要となる欠点があった。
また、ワンチップマイコンを使用すると、メインCPUの負担軽減が可能であるが、図9に示すように、キーボード等毎に合わせたキースキャン専用の回路(ハードウエア)を備えたものでは、入出力ポート数が固定されている他、チャタリング除去期間(時間的なタイミング)がある程度固定されているので、キーの数が異なる場合や種類の異なるキーボードに対しては、夫々に合わせた構成のハードウエアを用意する必要があり、設計の自由度が大幅に損なわれるものであった。
一方、図10に示したように、ワンチップマイコンのGPIOを利用するものにおいては、設計の自由度は向上するが、GPIOは基本的に入出力ポートの制御機能であることから、ソフトウエアによってチャタリング除去機能の全てを制御する必要があり、キースキャン制御に関わるソフトウエアの処理量が大幅に増えるという問題があった。
また一般に、コンピュータでは一定時間新たな操作をしない場合、省電力等の観点からCPUをスリープ状態にするが、スリープ状態から通常の起動状態に立ち上げる際には、僅かではあるが所要時間が必要となる。キースキャン操作において、関連するCPUがスリープ状態にある場合、キー操作が発生したとき、先ずCPUをスリープ状態から立ち上げるための時間が必要で、その次にチャタリング除去期間が必要となるので、両方の時間が時系列的に加算されたものとなり迅速な処理を妨げる原因となっていた。
本発明は、このような従来のキースキャン回路の諸問題に鑑みてなされたものであって、設計の自由度を確保しながら、ソフトウエア処理負担を軽減することができるキースキャン回路、更には、CPUがスリープ状態にある際にも、迅速な処理を可能とした、キースキャン回路を提供することを目的としている。
However, according to the above-described prior art, there are the following problems. First, if all the controls are realized by software as disclosed in
If a one-chip microcomputer is used, the burden on the main CPU can be reduced. However, as shown in FIG. In addition to the fixed number of ports, the chattering removal period (temporal timing) is fixed to some extent, so if the number of keys is different or different types of keyboards, the hardware is configured accordingly. Therefore, the degree of freedom of design is greatly impaired.
On the other hand, as shown in FIG. 10, in the case of using the one-chip microcomputer GPIO, the degree of freedom of design is improved, but the GPIO is basically a control function of the input / output port. There is a problem that it is necessary to control all of the chattering removal function, and the processing amount of software related to the key scan control is greatly increased.
In general, if the computer does not perform a new operation for a certain period of time, the CPU is put into the sleep state from the viewpoint of power saving, etc., but it takes a little time to start from the sleep state to the normal startup state. It becomes. In the key scan operation, if the related CPU is in the sleep state, when a key operation occurs, it takes time to first bring up the CPU from the sleep state, and then a chattering removal period is required. The time was added in time series, which hindered rapid processing.
The present invention has been made in view of such problems of the conventional key scan circuit, and is capable of reducing the software processing burden while ensuring the degree of freedom of design, and further, An object of the present invention is to provide a key scan circuit that enables quick processing even when the CPU is in a sleep state.
上記目的を達成するため、本発明の請求項1のキースキャン回路では、キースキャン等の制御を行う中央処理装置(CPU)と、プログラムや各種データを記憶しておくメモリ装置と、複数の入出力手段を有する入出力ポートと、前記CPUに対し割り込み処理を実行する割り込みコントローラとを備えたキースキャン回路において、前記入出力ポートの入力端に、チャタリング除去回路と、該チャタリング除去回路バイパス回路と、キースイッチ入力信号を前記チャタリング除去回路か前記バイパス回路かに切替える切替回路とを設け、前記切替回路をソフトウエアで制御するように構成したことを特徴としている。
請求項2記載のキースキャン回路では、請求項1において、前記チャタリング除去回路が、縦続接続した複数のフリップフロップ回路(FF回路)と、該フリップフロップ回路にクロック信号を供給する手段と、前記各フリップフロップ回路のQ出力信号を入力信号とする論理和回路とを備え、前記キースイッチ信号を最前段のフリップフロップ回路のD入力端に供給すると共に、他のフリップフロップ回路のD入力端には、その前段のフリップフロップ回路のQ端子出力を供給するように構成したことを特徴とする。
請求項3記載のキースキャン回路では、請求項1又は2において、前記チャタリング除去回路はクロック信号を分周する可変分周機能を備え、その分周比をソフトウエアでコントロールすることによって、チャタリング除去期間を制御できるように構成したことを特徴としている。
請求項4記載のキースキャン回路では、請求項1乃至3の何れか一項において、前記中央処理装置(CPU)がスリープ状態でキースイッチ信号が入力されたとき、前記チャタリング除去回路をバイパスしてキースイッチ信号を前記入力ポートに供給し、所要時間経過後に前記チャタリング除去回路側に切替えるように前記切替回路を制御する手段を備えたことを特徴としている。
In order to achieve the above object, in the key scan circuit according to
According to a second aspect of the present invention, there is provided the key scan circuit according to the first aspect, wherein the chattering removal circuit includes a plurality of cascade-connected flip-flop circuits (FF circuits), means for supplying a clock signal to the flip-flop circuits, An OR circuit using the Q output signal of the flip-flop circuit as an input signal, and supplying the key switch signal to the D input terminal of the flip-flop circuit in the foremost stage, and at the D input terminal of the other flip-flop circuit The Q terminal output of the preceding flip-flop circuit is supplied.
3. The key scan circuit according to
The key scan circuit according to
本発明の請求項1のキースキャン回路では、キースキャン等の制御を行う中央処理装置(CPU)と、プログラムや各種データを記憶しておくメモリ装置と、複数の入出力手段を有する入出力ポートと、前記CPUに対し割り込み処理を実行する割り込みコントローラとを備えた、例えばワンチップマイコンを使用したキースキャン回路において、前記入出力ポートの入力端に、チャタリング除去回路と、該チャタリング除去回路バイパス回路と、キースイッチ入力信号を前記チャタリング除去回路か前記バイパス回路かのどちらかに切替える切替回路とを設け、前記切替回路をソフトウエアで制御するように構成したので、必要に応じてチャタリング除去回路をバイパスし、直接キースイッチ信号を割り込みコントローラを介して前記CPUに供給することが可能となる。また、前記入出力ポートをワンチップマイコンに搭載された汎用入出力ポート(GPIO)を使用すれば、ターゲットとするキーボード等の種類に対応して、入力又は出力ポート数を変更することが、ソフトウエア制御によって可能となり、設計の自由度が大幅に向上する。
請求項2記載のキースキャン回路では、請求項1において、前記チャタリング除去回路が、縦続接続した複数のフリップフロップ回路(FF回路)と、該フリップフロップ回路にクロック信号を供給する手段と、前記各フリップフロップ回路のQ出力信号を入力信号とする論理和回路とを備え、前記キースイッチ信号を最前段のフリップフロップ回路のD入力端に供給すると共に、他の回路のD端子には、その前段回路のQ端子出力を供給するようにチャタリング除去回路をハードウエアで構成したので、CPUの負荷が軽減され、処理のスピードアップを図ることが可能となる。
In the key scan circuit according to the first aspect of the present invention, a central processing unit (CPU) for performing control such as key scan, a memory device for storing programs and various data, and an input / output port having a plurality of input / output means A key scan circuit using, for example, a one-chip microcomputer, and a chattering removal circuit and a chattering removal circuit bypass circuit at the input end of the input / output port. And a switching circuit for switching the key switch input signal to either the chattering removal circuit or the bypass circuit, and the switching circuit is configured to be controlled by software. Bypass the direct key switch signal through the interrupt controller with the CP It can be supplied to the. In addition, if a general-purpose input / output port (GPIO) mounted on a one-chip microcomputer is used as the input / output port, it is possible to change the number of input or output ports according to the type of the target keyboard or the like. This is made possible by wear control, which greatly improves the degree of freedom in design.
According to a second aspect of the present invention, there is provided the key scan circuit according to the first aspect, wherein the chattering removal circuit includes a plurality of cascade-connected flip-flop circuits (FF circuits), means for supplying a clock signal to the flip-flop circuits, A logical sum circuit that uses the Q output signal of the flip-flop circuit as an input signal, and supplies the key switch signal to the D input terminal of the flip-flop circuit in the forefront stage. Since the chattering removal circuit is configured by hardware so as to supply the Q terminal output of the circuit, the load on the CPU is reduced and the processing speed can be increased.
請求項3記載のキースキャン回路では、請求項1又は2において、前記チャタリング除去回路はクロック信号を分周する可変分周機能を備え、その分周比をソフトウエアでコントロールすることによってチャタリング除去期間を制御できるように構成したので、ターゲットとするキー入力装置のチャタリング発生時間に合わせて、チャタリング除去タイミング時間を変更することが可能となる。
請求項4記載のキースキャン回路では、請求項1乃至3において、前記中央処理装置(CPU)がスリープ状態でキースイッチ信号が入力されたとき、前記チャタリング除去回路をバイパスしてキースイッチ信号を前記入力ポートに供給し、所要時間経過後に前記チャタリング除去回路側に切替えるように前記切替回路を制御する手段を備えたので、CPUがスリープ状態にあるとき、キースイッチ入力発生に際して直ちにCPUを起動させ、その後にチャタリング除去回路を機能させるように制御することが可能となり、夫々に要する時間を一部並列にすることができるので処理の迅速化が可能となる。
4. The key scan circuit according to
A key scan circuit according to a fourth aspect of the present invention is the key scan circuit according to the first to third aspects, wherein when the central processing unit (CPU) is in a sleep state and a key switch signal is input, the chattering removal circuit is bypassed and the key switch signal is transmitted. Since it is provided with means for controlling the switching circuit to switch to the chattering removal circuit side after the required time has elapsed, when the CPU is in a sleep state, the CPU is immediately activated upon occurrence of a key switch, Thereafter, the chattering removal circuit can be controlled to function, and the time required for each can be partially parallelized, so that the processing can be speeded up.
以下、本発明を図に示した実施形態を用いて詳細に説明する。但し、この実施形態に記載される構成要素、種類、組み合わせ、形状、その相対配置などは特定的な記載がない限り、この発明の範囲をそれのみに限定する主旨ではなく単なる説明例に過ぎない。
図1は、本発明に係るキースキャン回路の一実施態様例を示すブロック構成図である。この例に示すキースキャン回路1は、キースキャン回路1の制御を行う中央処理装置(CPU)2と、キースイッチが操作されたとき前記CPUに割り込みを実行する割り込みコントローラ(ICTL)3と、キースキャン部4とを含み、これらは内部バスライン5で接続されている。更に、前記キースキャン部4は、汎用入出力ポートGPIO6が含まれており、その入力ポートのうち、外部のキーボード等のキーマトリクス7からキースイッチ信号が供給される第一入力ポートIN1、第二入力ポートIN2、第三入力ポートIN3夫々には、チャタリング除去回路ch1、ch2、ch3とそれをバイパスするバイパスルートBP1、BP2、BP3と両者を切替えるスイッチSW1、SW2、SW3とが付加されている。そして、制御のターゲットである外部キーボード等のキーマトリクス7(この例では3×3マトリクス)のY軸信号ライン(横ライン)Y1、Y2、Y3は、夫々、出力端子OUT1、OUT2、OUT3を介してGPIO6の三つの出力ポートOP1、OP2、OP3に直接接続するが、X軸信号ライン(縦ライン)X1、X2、X3は、端子I1、I2、I3に接続され、更に、前記切替スイッチSW1、SW2、SW3夫々のコモン端子を介して前記GPIO6の入力ポートIN1、IN2、IN3に接続するように構成されている。なお、入力端I1、I2、I3夫々と電源ラインVCCとの間に挿入されている抵抗器Rは、夫々に電圧を印可するためのプルアップ抵抗である。
Hereinafter, the present invention will be described in detail with reference to embodiments shown in the drawings. However, the components, types, combinations, shapes, relative arrangements, and the like described in this embodiment are merely illustrative examples and not intended to limit the scope of the present invention only unless otherwise specified. .
FIG. 1 is a block diagram showing an embodiment of a key scan circuit according to the present invention. The
また、図2に示すキースキャン回路は、構成は前記図1と全く同一であるが、前記切替スイッチSW1、SW2、SW3が前記チャタリング除去回路ch1、ch2、ch3をバイパスする側に設定されている部分が相違しており、その説明については後述する。
この構成において、先ず、キースキャン回路の基本的な動作について説明する。この回路において電源が投入されると、種々の制御方法があるが、例えば、GPIO6の出力ポートOP1、OP2、OP3を介してキーマトリクス7のY軸信号ラインY1、Y2、Y3を一定時間毎に低電位に切替えるスキャン制御を行う(具体的には、順次アースする)、その際一つのY軸信号ラインに低電位を与えている間に、GPIO6の入力ポートIN1、IN2、IN3を順次スキャンすることによって、各入力端子I1、I2、I3の電位、即ち、キーマトリクス7のX軸信号ラインX1、X2、X3の電位を監視する。このとき各入力端子I1、I2、I3には高電位がプルアップ抵抗Rを介して印可されているから、キーが押されていない場合は前記高電位が保持されているが、キーが操作されている(押されている)ものについてはY軸ラインと接続されるので、低電位となる。従って、前記CPU2は、出力ポート側のY軸信号ラインのスキャン情報と入力ポートのX軸信号ラインのスキャン情報及び各ポートの電位情報とから、押されたキーがどれであるかを判断することができる。
なお、電位の関係は、この例に限る必要はなく逆に出力ポートから高電位を供給し、入力ポートではスキャン操作によって高電位を検出する方式であってもかまわない。
The key scan circuit shown in FIG. 2 has the same configuration as that shown in FIG. 1, but the change-over switches SW1, SW2, and SW3 are set to bypass the chattering removal circuits ch1, ch2, and ch3. The parts are different, and the description thereof will be described later.
In this configuration, first, the basic operation of the key scan circuit will be described. When power is turned on in this circuit, there are various control methods. For example, the Y-axis signal lines Y1, Y2, and Y3 of the
Note that the potential relationship need not be limited to this example, and conversely, a high potential may be supplied from the output port, and a high potential may be detected by a scanning operation at the input port.
図3は、本発明において使用するチャタリング除去回路ch1、ch2、ch3の一例を示す構成図である。この例では、縦続接続した4つの遅延型フリップフロップ回路(Delay flip-flop:D−FF)8乃至11と、各フリップフロップ回路に供給するクロック信号を分周する分周回路(DIVIDER)12と、前記各フリップフロップ回路のQ出力信号を入力信号とする論理和回路13とを備え、外部からのキースイッチ信号を最前段のフリップフロップ回路8のD入力端に供給すると共に、他のフリップフロップ回路のD入力端には、その前段のフリップフロップ回路のQ端子出力を供給するように構成したものである。遅延型フリップフロップ回路(D−FF回路)は周知のとおりD端子に入力された状態が、クロック信号の供給に呼応してQ端子に伝達されるので、一つのフリップフロップ回路で一クロック分信号を遅延させることになる。この例では、4段縦続接続しているので、最前段のフリップフロップ回路8のD入力端子の高/低電位が順次伝達され、結果的に四クロック分遅延して第四のフリップフロップ11のQ端子に至る。また、論理和回路13は、入力信号の全てが低電位の時にのみ、その出力が低電位となるので、入力のいずれか一つでも高電位の場合出力は高電位となる。即ち、論理和回路13の入力の一つでも高電位であると、その出力は高電位となる。
FIG. 3 is a block diagram showing an example of chattering removal circuits ch1, ch2, and ch3 used in the present invention. In this example, four delay flip-flop circuits (Delay flip-flops: D-FF) 8 to 11 connected in cascade, and a frequency divider (DIVIDER) 12 that divides a clock signal supplied to each flip-flop circuit, A
図4及び図5は、前記図3に示したチャタリング除去回路の動作を説明するための図であって、図4はチャタリングが発生しない場合、図5はチャタリングが発生する場合の信号波形図である。以下、この信号波形図を参照しながら、本発明のスキャン回路の動作例を説明する。
同図(a)は前記フリップフロップ回路に供給されるクロック信号波形である。この図に示すチャタリング除去回路に属するキーが押されると、上述したように前記GPIO6の入力端子IN1、IN2、IN3のうち、その系統に属する入力端子は同図(b)に示すように低電位となる。この信号が第一段のフリップフロップ回路8のD端子に入力されると、次のクロック信号入力に呼応して、当該フリップフロップ回路8のQ出力端子に移行し、同図(c)に示すように出力Aとして低電位が伝達される。同様にして、この信号は順次後段のフリップフロップ回路9、10、11に伝達されて、図4(d)に示す出力B、同図(e)の出力C、同図(f)の出力Dとなる。このときチャタリングが発生しないものとすれば、押されたキーは、少なくともチャタリング除去期間は同一状態を保つので、各フリップフロップ回路8乃至11のQ出力端の信号A、B、C、Dは全て低電位となって、論理回路13に入力される。その結果、前記論理和回路13の出力は低電位となって、前記図1のGPIO6の該当する入力ポート(IN)に供給される。
4 and 5 are diagrams for explaining the operation of the chattering removal circuit shown in FIG. 3. FIG. 4 is a signal waveform diagram when chattering does not occur, and FIG. 5 is a signal waveform diagram when chattering occurs. is there. Hereinafter, an operation example of the scan circuit of the present invention will be described with reference to this signal waveform diagram.
FIG. 5A shows a clock signal waveform supplied to the flip-flop circuit. When a key belonging to the chattering removal circuit shown in this figure is pressed, the input terminals belonging to the system among the input terminals IN1, IN2, and IN3 of the
図4は、チャタリングが発生する場合の信号波形図であり、図4(b)に示すように、押されたキー信号入力が一旦低電位になった後、例えば三クロック後に再び高電位になった場合は、フリップフロップ回路8のD端子に入力した低電位が最後のフリップフロップ回路11のQ出力に伝達される時点では、初段フリップフロップ回路8のQ出力信号(出力A)の電位が高電位になっているので、結局、論理回路13の出力が低電位にならず、高電位がCPU2に伝達される。
このようにしてチャタリングが発生したことが判断できれば、その後の処理は種々の方法で対応可能である。例えば、チャタリング発生が検出されない場合は、直ちに検出されたキー信号が真のものとして処理を開始することもできるし、あるいはチャタリング発生が検出されたときは、一度だけキー操作が行われたものとして処理するか、又は、チャタリング除去期間経過後の入力検出信号のみを真のキー信号入力として処理する等の対応を行うことができる。上述したように、チャタリングが発生していないことが確認されたとき、直ちに真のキー入力として処理する方法は、チャタリング発生度合いの少ないキーボードを使用する場合、迅速で効率的な処理を実施し得る可能性がある。
FIG. 4 is a signal waveform diagram when chattering occurs. As shown in FIG. 4B, after the pressed key signal input once becomes low potential, it becomes high potential again after, for example, three clocks. In this case, when the low potential input to the D terminal of the flip-flop circuit 8 is transmitted to the Q output of the last flip-
If it can be determined that chattering has occurred in this way, the subsequent processing can be handled by various methods. For example, if chattering is not detected, processing can be started as soon as the detected key signal is true, or if chattering is detected, it is assumed that the key operation has been performed only once. It is possible to take measures such as processing or processing only the input detection signal after the chattering removal period has passed as a true key signal input. As described above, when it is confirmed that chattering does not occur, the method of processing as a true key input immediately can perform a quick and efficient process when using a keyboard with a low degree of chattering. there is a possibility.
図6は、本発明の他の実施態様例を説明するめのフローチャートであり、この例に示す処理手順は、前記CPU2がスリープ状態にあるときの処理に関するものである。即ち、処理がスタートすると、先ず、キースイッチの操作を待機し(S1)、キー操作が行われたことを検出すると(S1 Yes)CPU2がスリープ状態であるか否かを判断し、CPU2がスリープ状態である場合は(S2 Yes)、前記図1、2に示したチャタリング除去回路chのバイパスルートBPに前記スイッチSWを切替える(S3)。その後所定時間(チャタリング除去期間)が経過したか否かを判断し、その経過を待って(S4 Yes)前記スイッチSWをチャタリング除去回路ch側に切替え(S5)、チャタリング除去機能を経て、キースイッチ信号の処理をCPU2に伝達する(S6)。なお、前記S2において、CPU2がスリープ状態ではないと判断したときは(S2 No)、S5に移行して前記スイッチSWをチャタリング除去回路側に切替え(S5)、チャタリング機能を動作させてキースイッチ信号をCPU2に伝達する。この例によれば、スリープ状態にあるCPU2に直接キースキャン処理を行わせる場合に比べて処理を速くする効果がある。即ち、CPU2がスリープ状態である場合、前記図2に示したようにキースキャン部4のチャタリン部除去回路をバイパスするバイパスルートBP1乃至BP3のいずれかを介して、キースイッチ信号をGPIO6の入力ポートIN1乃至IN3のどれかに伝達するので、この信号が直ちにCPU2に供給され、あるいはCPU2のスリープを解除する制御を行う回路に伝達されるので、チャタリング除去期間を経過した後に、同様にCPU2のスリープを解除するよりCPU2の立ち上がりが早くなることは明らかである。そして、チャタリン部除去回路chをバイパスしてCPU2にスリープ状態解除トリガを供給したら、CPU2の立ち上がりを待つことなく直ちにチャタリング除去回路側に前記スイッチSWを切替える。この処理によればチャタリング除去時間経過中にCPU2が立ち上がり、チャタリング除去期間経過後には、直ちにキースキャン処理を開始することができるので、迅速な処理が可能となる。
FIG. 6 is a flowchart for explaining another embodiment of the present invention, and the processing procedure shown in this example relates to processing when the
図7は、本発明の更に他の変形実施態様例を示すブロック構成図であり、GPIO6の設計の自由度を利用して、制御対象のキーボードに対応してGPIO6の余剰ポートを他の機能制御に利用する場合を示している。即ち、この例では制御対象キーボードのキーマトリクス7の数が、2×3と、前記図1に示すものより少ないので、GPIO6の入力ポートが一つ余ることになる。そこで、このポートを第四の出力ポートOP4として制御し、その出力でインバータ回路14を介して発光ダイオード(LED)15の点灯を制御するものである。このようにGPIOは、ソフトウエアによって各ポートを入力として、あるいは出力として機能させることができるので、従来のように専用のキースキャン回路に代えて、GPIOによってキースキャン回路を構成すれば、装置毎に本来のGPIOの特徴を生かしたフレキシブルな利用方法を駆使することが可能となる。
なお、図示は省略するが、前記図3に示した分周回路では、供給されるクロック信号の周波数を種々分周可能である。そこで、複数の分周比にソフトウエアで設定できるように構成し、前記フリップフロップ回路D−FFに供給するクロック周波数を可変すれば、チャタリング除去期間を自由に変化させることができる。従って、対象とするキーボードの特性に応じて、最適な値に変えることが可能となる。例えば、供給されるクロック周波数が32.768kHzであり、前記分周回路(DIVIDER)の分周比が1/16、1/32、1/64、1/128、1/256である場合、夫々、分周後の周波数が、2.048kHz、1.02kHz、512Hz、256Hz、128Hzとなるので、これを時間に直せば1.46msec乃至23.44msecの範囲でチャタリング除去期間を調整することができることになる。このチャタリン部除去期間の調整は、前記図3に示した回路において、フリップフロップの段数を増加すれば細かい刻みでの調整が可能である。
FIG. 7 is a block diagram showing still another modified embodiment of the present invention, and controls the surplus ports of the
Although not shown, the frequency dividing circuit shown in FIG. 3 can divide the frequency of the supplied clock signal in various ways. Therefore, the chattering removal period can be freely changed by configuring the frequency division ratio so as to be set by software and changing the clock frequency supplied to the flip-flop circuit D-FF. Therefore, it is possible to change to an optimum value according to the characteristics of the target keyboard. For example, when the supplied clock frequency is 32.768 kHz and the division ratio of the divider circuit (DIVIDER) is 1/16, 1/32, 1/64, 1/128, 1/256, respectively. Since the frequency after frequency division is 2.048 kHz, 1.02 kHz, 512 Hz, 256 Hz, and 128 Hz, the chattering removal period can be adjusted in the range of 1.46 msec to 23.44 msec by adjusting this to time. become. The chattering portion removal period can be adjusted in fine steps by increasing the number of flip-flop stages in the circuit shown in FIG.
以上いくつかの実施態様例について説明したが、本発明の実施に際しては、これらの例に限定する必要は全くなく、種々変形が可能である。例えば、チャタリング除去回路とそのバイパスの切替を、CPUのスリープ状態時だけではなく通常のキー操作においても適用し、割り込み処理に要する時間をチャタリング除去期間に吸収する処理も可能である。即ち、CPUの割り込み制御を早めに行うために、通常はチャタリング除去回路バイパスルートに切替えておき、キー操作を検出したらCPUへの割り込み処理のための信号入力を行った後、直ちにチャタリング除去回路側に切替えるように制御すれば、CPUへの割り込みに要する時間中にチャタリング除去の時間が一部並列に経過するように制御できるので、処理の迅速化をもたらす上で有効である。
また、前記図8に示したワンチップマイコンの構成例では、キースキャンとGPIOとの両方を備えた場合を例示したが、本発明ではGPIOをキースキャンとして機能させているので、他の理由で専用のキースキャンが必要である場合を除き、これを削除することもできる。更に、本発明において使用するチャタリング除去回路は、図3に示したものに限る必要はなく、広く知られている種々のものが適用可能であることはいうまでもなく、なお更に、図4に示したブロック構成図における論理和回路ORは、これに限らず同様に機能するものであれば如何なる回路でも良い。
Although several embodiments have been described above, the present invention is not necessarily limited to these examples, and various modifications are possible. For example, switching of the chattering removal circuit and its bypass can be applied not only in the sleep state of the CPU but also in normal key operations, and processing for absorbing the time required for interrupt processing in the chattering removal period is also possible. That is, in order to perform CPU interrupt control early, the chattering elimination circuit is usually switched to the chattering elimination circuit bypass route, and when a key operation is detected, a signal is input for interrupt processing to the CPU, and then the chattering elimination circuit side immediately If the control is performed so that the chattering removal time partly passes in parallel during the time required for interrupting the CPU, it is effective in speeding up the processing.
In the configuration example of the one-chip microcomputer shown in FIG. 8, the case where both the key scan and the GPIO are provided is illustrated. However, in the present invention, the GPIO functions as the key scan. It can be deleted unless a dedicated key scan is required. Further, the chattering elimination circuit used in the present invention is not limited to the one shown in FIG. 3, and it is needless to say that various well-known ones can be applied. The OR circuit OR in the block configuration diagram shown is not limited to this, and any circuit may be used as long as it functions similarly.
1 キースキャン回路、2、101 中央処理装置(CPU)、3、106 割り込みコントローラ、4 キースキャン部、5、116 バスライン、6、111 汎用入出力ポート(GPIO)、7、117 キーマトリクス、8〜11 フリップフロップ回路、12 分周回路、13 論理和回路、14 インバータ回路、15 発光ダイオード(LED)、100 ワンチップマイクロコンピュータ、102 パラレルコントローラ、103 DMA、104 内部RAM、105 内部ROM、107 アナログ・デジタル変換回路(ADC)、108 デジタル・アナログ変換回路(DAC)、109 同期式シリアルインターフェース(SPI)、110 調歩同期シリアルインターフェース(UART)、111 汎用入出力ポート(GPIO)、112 キースキャン回路、113 タイマ(TIMER)、114 電源管理部、115 クロック回路(CLKGEN)、SW1、SW2、SW3 バイパス切替スイッチ。 1 key scan circuit, 2, 101 central processing unit (CPU), 3, 106 interrupt controller, 4 key scan unit, 5, 116 bus line, 6, 111 general-purpose input / output port (GPIO), 7, 117 key matrix, 8 -11 Flip-flop circuit, 12 divider circuit, 13 OR circuit, 14 inverter circuit, 15 light emitting diode (LED), 100 one-chip microcomputer, 102 parallel controller, 103 DMA, 104 internal RAM, 105 internal ROM, 107 analog -Digital conversion circuit (ADC), 108 Digital-analog conversion circuit (DAC), 109 Synchronous serial interface (SPI), 110 Asynchronous serial interface (UART), 111 General-purpose input / output port (GPI) ), 112 key scan circuit, 113 a timer (TIMER), 114 power management unit, 115 a clock circuit (CLKGEN), SW1, SW2, SW3 bypass-switching switch.
Claims (4)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2005294170A JP4670574B2 (en) | 2005-10-06 | 2005-10-06 | Key scan circuit |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2005294170A JP4670574B2 (en) | 2005-10-06 | 2005-10-06 | Key scan circuit |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2007102643A true JP2007102643A (en) | 2007-04-19 |
JP4670574B2 JP4670574B2 (en) | 2011-04-13 |
Family
ID=38029504
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2005294170A Active JP4670574B2 (en) | 2005-10-06 | 2005-10-06 | Key scan circuit |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4670574B2 (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2011193108A (en) * | 2010-03-12 | 2011-09-29 | Ricoh Co Ltd | Image processor |
JP2013013128A (en) * | 2007-08-16 | 2013-01-17 | Renesas Electronics Corp | Microcomputer system |
CN110879725A (en) * | 2019-10-17 | 2020-03-13 | 北京华北兴业技术有限公司 | Implementation method for timing closing of Bypass |
CN113391980A (en) * | 2021-06-25 | 2021-09-14 | 西安超越申泰信息科技有限公司 | Computer monitoring system based on single chip microcomputer |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH06259177A (en) * | 1993-03-10 | 1994-09-16 | Fujitsu Ltd | Data setting device |
JPH1165734A (en) * | 1997-08-19 | 1999-03-09 | Kansei Corp | Switching interface circuit |
JP2000259323A (en) * | 1999-03-05 | 2000-09-22 | Nec Eng Ltd | Input signal control circuit |
-
2005
- 2005-10-06 JP JP2005294170A patent/JP4670574B2/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH06259177A (en) * | 1993-03-10 | 1994-09-16 | Fujitsu Ltd | Data setting device |
JPH1165734A (en) * | 1997-08-19 | 1999-03-09 | Kansei Corp | Switching interface circuit |
JP2000259323A (en) * | 1999-03-05 | 2000-09-22 | Nec Eng Ltd | Input signal control circuit |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2013013128A (en) * | 2007-08-16 | 2013-01-17 | Renesas Electronics Corp | Microcomputer system |
US9083384B2 (en) | 2007-08-16 | 2015-07-14 | Renesas Electronics Corporation | Microcomputer system |
JP2011193108A (en) * | 2010-03-12 | 2011-09-29 | Ricoh Co Ltd | Image processor |
CN110879725A (en) * | 2019-10-17 | 2020-03-13 | 北京华北兴业技术有限公司 | Implementation method for timing closing of Bypass |
CN113391980A (en) * | 2021-06-25 | 2021-09-14 | 西安超越申泰信息科技有限公司 | Computer monitoring system based on single chip microcomputer |
CN113391980B (en) * | 2021-06-25 | 2024-04-05 | 超越科技股份有限公司 | Computer monitoring system based on singlechip |
Also Published As
Publication number | Publication date |
---|---|
JP4670574B2 (en) | 2011-04-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5025387A (en) | Power saving arrangement for a clocked digital circuit | |
JP4726337B2 (en) | One-chip microcomputer | |
US5551044A (en) | Method and apparatus for interrupt/SMI# ordering | |
JP5317356B2 (en) | Clock control signal generation circuit, clock selector, and information processing apparatus | |
KR20060119728A (en) | System lsi | |
JP4670574B2 (en) | Key scan circuit | |
EP1586979A2 (en) | Power reduction for unintentional activation of a wireless input device | |
JPH07281782A (en) | Clock control circuit | |
JP2011097138A (en) | Noise reduction circuit and semiconductor device provided with noise reduction circuit | |
JP2009205377A (en) | Integrated circuit device having reset control | |
US6823413B2 (en) | Interrupt signal processing apparatus | |
KR20180031151A (en) | Glitch-free clock multiplexer and selecting method of clock signal using the multiplexer | |
US6834339B2 (en) | Microprocessor | |
US6566906B1 (en) | Specialized programmable logic region with low-power mode | |
TWI655577B (en) | Operation speed compensation circuit and compensation method thereof | |
CN1332287C (en) | Frequency-voltage mechanism for power management and its control method | |
JPH076155A (en) | Single chip microcomputer | |
JP4750505B2 (en) | Clock switching circuit | |
US20060195714A1 (en) | Clock control device, microprocessor, electronic device, clock control method, and clock control program | |
JP2006201856A (en) | Semiconductor integrated circuit | |
KR100272531B1 (en) | Method for prohibitting exhaust of power source in electronic equipment | |
JP3652269B2 (en) | Signal processing device | |
JPH11305887A (en) | Method for controlling microcontroller and microcontroller | |
JP2000259323A (en) | Input signal control circuit | |
CN114117969A (en) | Chip circuit design of direct memory access channel chain supporting conditional branching |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20081002 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20100910 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20101221 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20110103 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 4670574 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20140128 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20140128 Year of fee payment: 3 |
|
S111 | Request for change of ownership or part of ownership |
Free format text: JAPANESE INTERMEDIATE CODE: R313111 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20140128 Year of fee payment: 3 |
|
R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |