[go: up one dir, main page]

JPH05210440A - Key input method for key input device - Google Patents

Key input method for key input device

Info

Publication number
JPH05210440A
JPH05210440A JP4017089A JP1708992A JPH05210440A JP H05210440 A JPH05210440 A JP H05210440A JP 4017089 A JP4017089 A JP 4017089A JP 1708992 A JP1708992 A JP 1708992A JP H05210440 A JPH05210440 A JP H05210440A
Authority
JP
Japan
Prior art keywords
key
state
storage area
scan
detected
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.)
Pending
Application number
JP4017089A
Other languages
Japanese (ja)
Inventor
Yasuo Togashi
靖夫 富樫
Tomonari Otani
友成 大谷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mitsumi Electric Co Ltd
Original Assignee
Mitsumi Electric Co Ltd
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 Mitsumi Electric Co Ltd filed Critical Mitsumi Electric Co Ltd
Priority to JP4017089A priority Critical patent/JPH05210440A/en
Publication of JPH05210440A publication Critical patent/JPH05210440A/en
Pending legal-status Critical Current

Links

Landscapes

  • Input From Keyboards Or The Like (AREA)

Abstract

PURPOSE:To improve efficiency for using a RAM and to realize the method with the simple circuit, with respect to the key input method for a key input device, which detects valid keys by repeatedly scanning a keyboard. CONSTITUTION:In a first process, the state of keys last time is compared with the state of keys this time, and the key counter value of a key changing the state of the key is stored in a first storage region 21 of a RAM 17. In the next second process, a value stored in a second storage region 22 is updated into a value corresponding to the state last time and this time. Further in the third process, the valid key state of the key changing the state is detected from the key counter value stored in the first storage region 21 and the value stored in the second storage region 22.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明はキー入力装置のキー入力
方法に係り、特にキーボードを繰り返し走査して有効キ
ーを検出するキー入力装置のキー入力方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a key input method for a key input device, and more particularly to a key input method for a key input device for repeatedly scanning a keyboard to detect an effective key.

【0002】[0002]

【従来の技術】従来より、パーソナルコンピュータ、ワ
ードプロセッサ、キャッシュレジスタ等の様々な機器に
マトリクスキーボードを有するキー入力装置が使用され
ている。これらのキー入力装置では、複数のキーが多重
押しされた時の新規有効キー入力の検出、またチャタリ
ング発生時の有効キー入力の検出を概略以下の方法でお
こなっている。
2. Description of the Related Art Conventionally, a key input device having a matrix keyboard has been used in various devices such as a personal computer, a word processor, and a cash register. In these key input devices, detection of a new effective key input when a plurality of keys are pressed multiple times and detection of an effective key input when chattering occurs are roughly performed by the following method.

【0003】図10は従来のキー入力装置のメモリマッ
プの一例、図11は従来のキー入力装置のキー入力方法
の一例の要部を概略示すフローチャートである。
FIG. 10 is a flow chart showing an example of a memory map of a conventional key input device, and FIG. 11 is a flow chart showing an essential part of an example of a key input method of the conventional key input device.

【0004】8×16のマトリクスキーボードを有する
従来のキー入力装置の場合、図10に示すようなキーマ
トリクスに対応した8×16の記憶領域からなる記憶領
域101、および8×16の記憶領域からなる記憶領域
102をRAM( RandomAccess Memory )上にデータ
メモリとして有している。
In the case of a conventional key input device having an 8 × 16 matrix keyboard, a storage area 101 consisting of 8 × 16 storage areas corresponding to a key matrix as shown in FIG. Has a storage area 102 as a data memory on a RAM (Random Access Memory).

【0005】図11において、記憶領域101および記
憶領域のデータを初期化(ステップ103)した後、ス
テップ104においてキーマトリクスをスキャン(走
査)し、各キーの状態をキーマトリクスに対応した記憶
領域101の各番地に書き込む(ステップ105)。
In FIG. 11, after the storage area 101 and the data in the storage area are initialized (step 103), the key matrix is scanned (scanned) in step 104, and the state of each key corresponds to the storage area 101. Is written in each address (step 105).

【0006】つぎに、各キーの状態が新規なキー入力で
あるかを判断し(ステップ106)、新規なキー入力で
あればそのキーに対応したコードを出力し(ステップ1
07)、新規なキー入力でなければ記憶領域101に格
納されているデータを現在のキーの状態としてキーマト
リクスに対応した記憶領域102の各番地に書き込む
(ステップ108)。以下、ステップ104以降の処理
を繰り返し実行する。ここで、ステップ106の処理は
次のとおりに行う。
Next, it is judged whether or not the state of each key is a new key input (step 106), and if it is a new key input, the code corresponding to the key is output (step 1).
07) If it is not a new key input, the data stored in the storage area 101 is written in each address of the storage area 102 corresponding to the key matrix as the current key state (step 108). After that, the processing from step 104 onward is repeatedly executed. Here, the process of step 106 is performed as follows.

【0007】まず、キーマトリクスに対応した記憶領域
101,102夫々の各番地のデータの排他的論理和を
とることにより、前回のスキャンによるデータと今回の
スキャンによるデータとを比較する。排他的論理和が0
となればそのキーの状態は変化していないので次の番地
のデータを比較する。排他的論理和が1となれば前回の
スキャンデータと今回のスキャンデータが異なり、その
キーの状態が変化したことを示している。このとき今回
のスキャンデータが新規キー入力となるので、今回のス
キャンデータと排他的論理和1との論理積(すなわち今
回のスキャンデータ)を求めてこれを新規キー入力とす
る。
First, the data of the previous scan and the data of the current scan are compared by taking the exclusive OR of the data at the respective addresses of the storage areas 101 and 102 corresponding to the key matrix. Exclusive OR is 0
If so, the state of the key has not changed, so the data at the next address is compared. If the exclusive OR becomes 1, it indicates that the previous scan data and the current scan data are different, and the state of the key has changed. At this time, since the current scan data becomes a new key input, the logical product of the current scan data and the exclusive OR 1 (that is, the current scan data) is obtained and used as the new key input.

【0008】[0008]

【発明が解決しようとする課題】しかしながら、上記の
方法によりキー入力を行うためにはデータメモリの記憶
領域としてキーマトリクスに対応した記憶容量の2倍の
記憶容量が必要であり、さらにまた、これらのキーマト
リクスに対応したデータの排他的論理和を求める演算回
路と論理積を求める演算回路とが夫々必要である。たと
えば8×16マトリクスのキーボードの場合には128
ビット(16バイト)の記憶容量が必要となり、キー数が
増える程RAMの使用効率が悪くなり、回路も複雑にな
る欠点があった。
However, in order to perform the key input by the above method, the storage area of the data memory needs to have a storage capacity twice as large as the storage capacity corresponding to the key matrix. An arithmetic circuit for obtaining an exclusive OR of data corresponding to the key matrix and an arithmetic circuit for obtaining a logical product are required respectively. For example, 128 for an 8x16 matrix keyboard
A bit (16 bytes) storage capacity is required, and as the number of keys increases, the RAM usage efficiency deteriorates and the circuit becomes complicated.

【0009】上記の点に鑑み本発明では、RAMの使用
効率が高く、簡単な回路で実現出来るキー入力装置のキ
ー入力方法を提供することを目的とする。
In view of the above points, it is an object of the present invention to provide a key input method of a key input device which has a high RAM utilization efficiency and can be realized by a simple circuit.

【0010】[0010]

【課題を解決するための手段】上記の問題は図1の原理
工程図のとおり構成することにより解決される。
The above problems can be solved by constructing according to the principle process chart of FIG.

【0011】すなわち、キーボードの複数のキーを走査
して複数のキー夫々の前回のキーの状態と今回のキーの
状態とを比較して状態に変化のあったキーのキーカウン
タ値を第1の記憶領域に格納する第1の工程1と、第2
の記憶領域に記憶されている値を状態に変化のあったキ
ーの前回の状態と今回の状態に応じた値に更新する第2
の工程と、第1の記憶領域に格納されたキーカウンタ値
と更新された第2の記憶領域に記憶されている値とから
状態に変化のあったキーの有効キー状態を検出する第3
の工程3とを含んで構成した。
That is, by scanning a plurality of keys on the keyboard and comparing the state of the previous key and the state of the present key of each of the plurality of keys, the key counter value of the key whose state has changed is set to the first value. The first step 1 of storing in the storage area, and the second step
The value stored in the storage area of is updated to a value according to the previous state and the current state of the key whose state has changed.
And the third step of detecting the valid key state of the key whose state has changed from the key counter value stored in the first storage area and the updated value stored in the second storage area.
And the process 3 of 3).

【0012】[0012]

【作用】上記構成の本発明によれば、第1の工程1にお
いてキーの状態に変化のあったキーのキーカウンタ値が
第1の記憶領域に格納され、つぎに第2の工程2におい
て第2の記憶領域に記憶されている値が状態に変化のあ
ったキーの前回の状態と今回の状態に応じた値に更新さ
れ、さらに第3の工程3において第1の記憶領域に格納
されたキーカウンタ値と第2の記憶領域に記憶されてい
る値とから新たに入力された有効キーが検出されように
作用する。
According to the present invention having the above-described structure, the key counter value of the key whose key state has changed in the first step 1 is stored in the first storage area, and then in the second step 2, The value stored in the second storage area is updated to a value according to the previous state and the current state of the key whose state has changed, and further stored in the first storage area in the third step 3. A newly input valid key is detected from the key counter value and the value stored in the second storage area.

【0013】[0013]

【実施例】図2は本発明の一実施例に適用されるキー入
力装置のブロック図である。同図において、キー入力装
置6はマイクロコンピュータ7、キーボード8、バッフ
ァ回路9より構成されており、バッファ回路9には外部
よりワードプロセッサ、パーソナルコンピュータ等の装
置本体(図示せず)が接続される。
FIG. 2 is a block diagram of a key input device applied to an embodiment of the present invention. In the figure, the key input device 6 is composed of a microcomputer 7, a keyboard 8 and a buffer circuit 9. To the buffer circuit 9, a device main body (not shown) such as a word processor or a personal computer is connected from the outside.

【0014】マイクロコンピュータ7は、図2に示すと
おり発振器13、割り込み制御部14、CPU(Central
Processing Unit)15、読み出し専用メモリROM(Rea
d Only Memory)16、読み書き可能なメモリRAM1
7、タイマ18、バスライン19、バス制御部10、入
出力ポート11、シリアルポート12等からなる周知の
構成であり、後述するフローチャートにしたがってCP
U15により論理演算処理が実行される。
As shown in FIG. 2, the microcomputer 7 includes an oscillator 13, an interrupt controller 14, and a CPU (Central Processing Unit).
Processing Unit) 15, read-only memory ROM (Rea
d Only Memory) 16, readable / writable memory RAM 1
7, a timer 18, a bus line 19, a bus control unit 10, an input / output port 11, a serial port 12 and the like, which are well-known configurations, and a CP according to a flowchart described later.
A logical operation process is executed by U15.

【0015】マイクロコンピュータ7は、ROM16に
格納されたプログラムにしたがって入出力ポート11を
介してキーボード8に走査信号を出力することにより各
キーのオンオフを示す信号を入力する。これらの信号か
ら、後述する方法によって有効キー入力を検出し、この
有効キー入力に対応したコードをバッファ回路9を介し
て外部の装置に出力するよう制御する。
The microcomputer 7 outputs a scanning signal to the keyboard 8 via the input / output port 11 according to a program stored in the ROM 16 to input a signal indicating ON / OFF of each key. From these signals, a valid key input is detected by a method described later, and a code corresponding to the valid key input is controlled to be output to an external device via the buffer circuit 9.

【0016】図3は図2に示したキーボード8のキーマ
トリクスを示す図である。キーボード8は8×16のキ
ーマトリクスにより構成されており、スキャンラインI,
II,〜VIIIには入出力ポート11よりスキャン信号が付
与され、検出ライン(1),(2),〜(16)から入出力ポート1
1には各キーの状態を示す検出信号が出力される。同図
に示すとおり、各キーには1から128までのキーカウ
ンタ値が夫々割り当てられている。
FIG. 3 is a diagram showing a key matrix of the keyboard 8 shown in FIG. The keyboard 8 is composed of an 8 × 16 key matrix, and scan line I,
A scan signal is applied to II and VIII from the input / output port 11, and the detection lines (1), (2), to (16) are used to input / output port 1.
A detection signal indicating the state of each key is output to 1. As shown in the figure, each key is assigned a key counter value of 1 to 128.

【0017】たとえば、「A」のキーのキーカウンタ値
は1、「C」のキーのキーカウンタ値は15、「H」の
キーのキーカウンタ値は32、「Y」のキーのキーカウ
ンタ値は127である。これらのキーカウンタ値は、R
AM17内に構成されるキーカウンタによりキーマトリ
クスの各キーをカウントすることにより付与される。
For example, the key counter value of the "A" key is 1, the key counter value of the "C" key is 15, the key counter value of the "H" key is 32, and the key counter value of the "Y" key. Is 127. These key counter values are R
It is given by counting each key of the key matrix by the key counter configured in the AM 17.

【0018】図4は図2に示したキー入力装置の要部で
あるRAM17の構成図である。RAM17は、同図に
示すとおり、夫々 B0,B1,B2,B3,B4,B5,B6,B7で構成され
る8ビットのメモリnバイトからなっている。同図中、
3バイト目はキーカウンタ20、(n−2)バイト目は
出力バッファ23として割り当てられている。出力バッ
ファ23には、検出された有効キー入力のコードが入力
される。
FIG. 4 is a block diagram of the RAM 17 which is a main part of the key input device shown in FIG. As shown in the figure, the RAM 17 is composed of an 8-bit memory n bytes composed of B0, B1, B2, B3, B4, B5, B6 and B7, respectively. In the figure,
The third byte is assigned as the key counter 20, and the (n-2) th byte is assigned as the output buffer 23. The detected valid key input code is input to the output buffer 23.

【0019】また、RAM17のaバイト目から(a+
9)バイト目までの10バイトは第1の記憶領域21と
され、これらの各1バイトにはキーマトリクスをスキャ
ンした結果キーデータの変化が検出されたキーのキーカ
ウンタ値が記憶される。bバイト目から(b+9)バイ
ト目までの10バイトは第2の記憶領域22とされ、こ
れらの各1バイトの値はキーデータの変化が検出される
とその変化の仕方に応じた値に更新される。a、bは整
数であり、(a+9)<bである。なお、キー入力装置
のオペレータが同時に押すことのできる最大限のキー数
を10個と考えて、各記憶領域の容量を10バイトとし
た。
From the a-th byte of RAM 17, (a +
9) The 10 bytes up to the byte are used as the first storage area 21, and the key counter value of the key in which the change in the key data is detected as a result of scanning the key matrix is stored in each of these 1 bytes. The 10 bytes from the bth byte to the (b + 9) th byte are set as the second storage area 22, and when a change in the key data is detected, the value of each 1 byte is updated to a value according to the way of the change. To be done. a and b are integers, and (a + 9) <b. Note that the maximum number of keys that can be simultaneously pressed by the operator of the key input device is 10, and the capacity of each storage area is set to 10 bytes.

【0020】図5は本発明の一実施例の概略を示すフロ
ーチャートである。図5において、ワードプロセッサ等
の装置本体の電源がオンされるとともにキー入力装置の
電源がオンされる(ステップ31)と、まず、RAM1
7の内容をすべて「0」として初期状態を設定する(ス
テップ32)。
FIG. 5 is a flow chart showing the outline of one embodiment of the present invention. In FIG. 5, when the power of the main body of the device such as the word processor is turned on and the power of the key input device is turned on (step 31), first, the RAM 1
The initial state is set by setting all the contents of 7 to "0" (step 32).

【0021】つぎに、キースキャンルーチン(ステップ
33)を実行してキーボード8のキーマトリクスを1通
りスキャンする。そして、RAM17の出力バッファ2
3に格納されているコード、すなわち検出された有効キ
ーのコードを入出力ポート11、バッファ回路9を介し
装置本体に出力(ステップ34)し、ステップ35によ
り一定時間(約10mSEC)待機した後ステップ33以下
を実行し、繰り返しキースキャンと検出された有効キー
のコード出力を行う。
Next, the key scan routine (step 33) is executed to scan the key matrix of the keyboard 8 once. And the output buffer 2 of the RAM 17
The code stored in No. 3, that is, the code of the detected valid key is output to the apparatus main body through the input / output port 11 and the buffer circuit 9 (step 34), and after waiting for a certain time (about 10 mSEC) in step 35, the step 33 and subsequent steps are executed, and the code of the effective key detected as the repeated key scan is output.

【0022】上記の概略フローチャートにおいて、本発
明はキースキャンルーチン(ステップ33)に顕著な特
徴を有するものであり、以下、図6に示したキースキャ
ンルーチンの具体的なフローチャートについて説明す
る。
In the above-mentioned schematic flow chart, the present invention has a salient feature in the key scan routine (step 33), and a specific flow chart of the key scan routine shown in FIG. 6 will be described below.

【0023】図6において、まずキーカウンタ20の値
を「0」に設定する等キースキャンの初期状態を設定す
る(ステップ41)。そして、スキャンラインにスキャ
ン信号を出力し(ステップ42)、スキャンラインのオ
ンオフを示すキーデータを入力する(ステップ43)。
In FIG. 6, first, the initial state of the key scan is set by setting the value of the key counter 20 to "0" (step 41). Then, a scan signal is output to the scan line (step 42) and key data indicating ON / OFF of the scan line is input (step 43).

【0024】このとき、1本のスキャンラインにスキャ
ン信号が出力されるが、初期設定により初めはスキャン
ラインIにスキャン信号が出力されてスキャンラインI
の各キー「A」、…「D」のキーデータが入力される。
キーの出力はオンのときローレベル、オフのときハイレ
ベルとなるようキーボード8は構成されているが、これ
らのキーデータは反転されてオンのときハイレベル、す
なわち「1」として入力される。
At this time, the scan signal is output to one scan line, but initially the scan signal is output to the scan line I by the initial setting and then the scan line I is output.
The key data of each key “A”, ..., “D” is input.
The keyboard 8 is configured so that the output of the key is low level when it is on and high level when it is off, but these key data are inverted and input as high level when it is on, that is, "1".

【0025】つぎに、第1の工程であるステップ44に
おいて、第1の記憶領域21にキーデータの変化のあっ
たキーのキーカウンタ値をセットする。第1の記憶領域
21の各10バイトの値はすべて初期値「0」に設定さ
れているが、各キーは装置の電源がオンされた状態では
オフされており、初めはキーがオンされることによりキ
ーデータが変化する。
Next, in step 44 which is the first step, the key counter value of the key whose key data has changed is set in the first storage area 21. The values of each 10 bytes in the first storage area 21 are all set to the initial value "0", but each key is turned off when the device is powered on, and the key is turned on at first. As a result, the key data changes.

【0026】すなわち、初めにキーがオンされると、そ
のオンされたキーのキーカウンタ値を第1の記憶領域2
1の各10バイトの値と参照してキーデータの変化があ
ったかを判断する。たとえば初めに「A」のキーがオン
されると、「A」のキーのキーカウンタ値「1」が2進
数とされて第1の記憶領域21の1バイト目(RAM1
7のaバイト目)に格納される。
That is, when the key is first turned on, the key counter value of the turned-on key is stored in the first storage area 2
It is determined whether there is a change in the key data by referring to each 10-byte value of 1. For example, when the "A" key is first turned on, the key counter value "1" of the "A" key is converted into a binary number and the first byte of the first storage area 21 (RAM1
Stored in the 7th a-byte).

【0027】つぎに、第2の工程であるステップ45に
おいて、第2の記憶領域22に記憶されている値を、キ
ーデータの変化の仕方に応じた値に更新する。前記のと
おり、第2の記憶領域22は B0,B1,B2,B3,B4,B5,B6,B7
で構成される8ビットのメモリ10バイトからなってお
り、ステップ45においてこれらの各バイトのうちB0,B
1,B4の各ビットがキーデータの変化の仕方に応じて更新
される。
Next, in step 45, which is the second step, the value stored in the second storage area 22 is updated to a value according to the way of changing the key data. As described above, the second storage area 22 is B0, B1, B2, B3, B4, B5, B6, B7.
It consists of 10 bytes of 8-bit memory consisting of B0, B in each of these bytes in step 45.
Bits 1 and B4 are updated according to how the key data changes.

【0028】これらのビットB0,B1,B4に記憶される情報
を、以下、ステイタス情報と称する。本実施例では第2
の記憶領域22のその他のビットは使用しておらず、そ
の他のビットの値は「0」から変わることはない。ま
た、ステイタス情報として8ビットのうちのどの3ビッ
トを使用しても良い。
The information stored in these bits B0, B1 and B4 is hereinafter referred to as status information. In the present embodiment, the second
The other bits of the storage area 22 are not used, and the value of the other bits does not change from "0". Further, any 3 bits of 8 bits may be used as the status information.

【0029】第2の記憶領域22の各10バイトのうち
のB0,B1,B4の値はすべて初期値「0」に設定されている
が、B4のビットの値はキースキャン時にキーがオンした
時に「1」にセットし、キーがオフした時に「0」にセ
ットするものとする。また、B0,B1 の値はキーデータの
変化の仕方に応じて夫々図7のとおりに更新させるもの
と決めておく。
The values of B0, B1 and B4 of each 10 bytes of the second storage area 22 are set to the initial value "0", but the value of the bit of B4 is turned on at the time of key scanning. It shall be set to "1" at times and to "0" when the key is turned off. Further, it is determined that the values of B0 and B1 are updated as shown in FIG. 7 according to the way the key data changes.

【0030】図7(A)は本発明の一実施例のキースキ
ャンルーチンにおけるキーのステイタス情報の更新方法
を示す図、同図(B)は図7(A)を説明する図であ
る。
FIG. 7A is a diagram showing a method of updating key status information in the key scan routine of the embodiment of the present invention, and FIG. 7B is a diagram explaining FIG. 7A.

【0031】図7(A),(B)において、に示すとお
り、キーデータ変化検出前がキーオフであり1回目のキ
ースキャンにおいてキーオンが検出された時には、B0は
「0」のままB1に「1」をたてる。に示すとおり、キ
ーデータ変化検出前がキーオフであり1回目のキースキ
ャンにおいてキーオンが検出され、2回目のキースキャ
ンにおいてキーオンの時には、B1は「1」のままB0にも
「1」をたてる。
As shown in FIGS. 7A and 7B, when the key-off is detected before the key data change is detected and the key-on is detected in the first key scan, B0 remains "0" and B1 is set to "1". Make 1 ". As shown in, when the key-off is detected before the key data change is detected, the key-on is detected in the first key scan, and the key-on is detected in the second key scan, B1 remains "1" and B1 is also set to "1". ..

【0032】また、に示すとおり、キーデータ変化検
出前がキーオフであり1回目のキースキャンにおいてキ
ーオンが検出され、2回目のキースキャンにおいてキー
オフの時には、B1をB0とともに「0」とする。はキー
オンが有効、はキーオンが無効とされる場合である。
As indicated by, when the key data is detected before the key data change is detected, the key-on is detected in the first key scan, and the key-off is detected in the second key scan, B1 is set to "0" together with B0. The key-on is valid and the key-on is invalid.

【0033】なお、キーデータ変化検出前がキーオンで
あった場合は、B0,B1 の値はに示す結果夫々「1」と
されている。そして、に示すとおり、キーデータ変化
検出前がキーオンであり1回目のキースキャンにおいて
キーオフが検出された時には、B0は「1」のままB1を
「0」とする。
When the key data is not detected before the key data change is detected, the values of B0 and B1 are "1" as shown in the result. Then, as shown in, when the key-on is detected before the key data change is detected and the key-off is detected in the first key scan, B0 remains "1" and B1 is set to "0".

【0034】また、に示すとおり、キーデータ変化検
出前がキーオンであり1回目のキースキャンにおいてキ
ーオフが検出され、2回目のキースキャンにおいてもキ
ーオフの時には、B1は「0」のままB0も「0」とする。
さらに、に示すとおり、キーデータ変化検出前がキー
オンであり1回目のキースキャンにおいてキーオフが検
出され、2回目のキースキャンにおいてキーオンとなっ
た時には、B0を「0」としたままB1に「1」をたてる。
はキーオフが有効、はキーオフが無効とされる場合
である。
As shown in, when the key-on is detected before the key data change is detected, the key-off is detected in the first key scan, and the key-off is detected in the second key scan, B1 remains "0" and B0 remains "0". 0 ”.
Further, as shown in, when the key-on is detected before the key data change is detected, the key-off is detected in the first key scan, and the key-on is detected in the second key scan, B0 is set to “0” and B1 is set to “1”. "
The key-off is valid and the key-off is invalid.

【0035】図8は、図6のフローチャートにしたがっ
てステイタス情報が更新される様子を説明する図であ
る。図8(A)は図7においてに示したキーオンが有
効とされる場合、同図(B)は図7においてに示した
キーオンが無効とされる場合、同図(C)は図7におい
てに示したキーオフが有効とされる場合、同図(D)
は図7においてに示したキーオフが無効とされる場合
を夫々示している。
FIG. 8 is a diagram for explaining how the status information is updated according to the flowchart of FIG. 8A shows the case where the key-on shown in FIG. 7 is valid, FIG. 8B shows the case where the key-on shown in FIG. 7 is invalid, and FIG. When the key-off shown is valid, the same figure (D)
Shows the case where the key-off shown in FIG. 7 is invalid.

【0036】図6のフローチャートに戻って図8ととも
に説明するに、ステップ44において、「A」のキーオ
ンが検出されると第1の記憶領域21の1バイト目(R
AM17のaバイト目)に「A」のキーのキーカウンタ
値「1」が格納される。これは、キーデータ変化検出前
がキーオフであり1回目のキースキャンにおいてキーオ
ンが検出されるの場合に相当する。
Returning to the flow chart of FIG. 6, which will be described with reference to FIG. 8, when the key-on of “A” is detected in step 44, the first byte (R) of the first storage area 21 is detected.
The key counter value "1" of the key "A" is stored in the a-th byte of AM17). This corresponds to the case where the key-off is detected before the key data change is detected and the key-on is detected in the first key scan.

【0037】よってステップ45が実行され、図8
(A),(B)に示すとおり、キーがオンしたことによっ
てまず第2の記憶領域22の1バイト目(RAM17の
bバイト目)のB4に「1」をたて(図8(A)b, 図8
(B)b )た後、B0は「0」としたままB1に「1」をたて
る(図8(A)c, 図8(B)c )。このようにステイタス
情報B0,B1の値を更新した後、B4をリセットして「0」
とする(図8(A)d, 図8(B)d )。
Therefore, step 45 is executed, and as shown in FIG.
As shown in (A) and (B), when the key is turned on, first, "1" is set in B4 of the first byte of the second storage area 22 (the b byte of RAM 17) (Fig. 8 (A)). b, Fig. 8
After (B) b), B1 is set to "1" while keeping B0 at "0" (Fig. 8 (A) c, Fig. 8 (B) c). After updating the values of status information B0 and B1 in this way, B4 is reset to "0".
(FIG. 8 (A) d, FIG. 8 (B) d).

【0038】つぎに、第3の工程であるステップ46に
おいて、有効キーが検出されたかをチェックする。この
とき、B0は「0」、B1は「1」であり有効キーは検出さ
れていないのでステップ47を飛ばしてステップ48を
実行し、キーカウンタ値を1つ進める。
Next, in step 46 which is the third step, it is checked whether a valid key has been detected. At this time, since B0 is "0" and B1 is "1" and no valid key has been detected, step 47 is skipped and step 48 is executed to increment the key counter value by one.

【0039】そしてつぎに、ステップ49において、ス
キャンラインの各キーの状態をすべてチッックし終えた
かを調べるが、初めはスキャンラインIの「A」のキー
の状態しかチェックしていないのでステップ44に戻
る。
Then, in step 49, it is checked whether all the states of the respective keys of the scan line have been ticked. Initially, since only the state of the "A" key of the scan line I is checked, the step 44 is entered. Return.

【0040】このとき、キーカウンタ値は1つ進められ
ているので、このキーカウンタ値に応じた次のキー、す
なわち「B」のキーについてステップ49までの処理が
実行される。以下同様に、キーカウンタ値が1つずつ進
められてステップ44からステップ49までの処理が繰
り返し実行されることにより、スキャンラインIの各キ
ーの状態が判定される。
At this time, since the key counter value is advanced by one, the processing up to step 49 is executed for the next key corresponding to this key counter value, that is, the "B" key. Similarly, the state of each key of the scan line I is determined by advancing the key counter value one by one and repeatedly executing the processing from step 44 to step 49.

【0041】そして、「D」のキーについてステップ4
9までの処理が実行された結果スキャンラインIのすべ
てのキーの状態のチッックが終了するので、ステップ4
9につづいてステップ50を実行して次のスキャンライ
ンであるスキャンラインIIの出力信号がセットされる。
つづいて、ステップ51においてすべてのスキャンライ
ンについてのスキャンが終了したかが調べられる。この
とき、初めはスキャンラインIのスキャンしか終了して
いないのでステップ42に戻り、次のスキャンラインで
あるスキャンラインIIにスキャン信号が出力され、スキ
ャンラインIIの各キーの状態が判定される。
Then, regarding the key of "D", step 4
As a result of executing the processes up to 9, the ticks of the states of all the keys of the scan line I are completed, so that step 4
After step 9, step 50 is executed to set the output signal of the next scan line, scan line II.
Subsequently, in step 51, it is checked whether or not the scan has been completed for all the scan lines. At this time, since only the scan of the scan line I is completed at first, the process returns to step 42, and the scan signal is output to the scan line II which is the next scan line, and the state of each key of the scan line II is determined.

【0042】さらに、ステップ42からステップ51ま
で同様の処理が繰り返し実行されることにより、各スキ
ャンラインの各キーの状態が判定される。そして、スキ
ャンラインVIIIについてのステップ42からステップ5
0まで実行された後、次のステップ51においてすべて
のスキャンラインについてのスキャンが終了したと判断
され。これにより、キーボード8の8×16のキーマト
リクスすべてについての1回のスキャンが終了している
ので、図5に示すメインルーチンに戻る。そしてステッ
プ34に進み、前述のとおりに有効キーが検出されてい
る場合はその有効キーのコードを出力する。
Further, by repeating the same processing from step 42 to step 51, the state of each key of each scan line is determined. And steps 42 to 5 for scanline VIII
After the execution up to 0, it is determined in the next step 51 that the scanning for all the scan lines is completed. As a result, one scan of all the 8 × 16 key matrix of the keyboard 8 is completed, and the process returns to the main routine shown in FIG. Then, the process proceeds to step 34, and when the valid key is detected as described above, the code of the valid key is output.

【0043】この時点で、第1の記憶領域にはキーデー
タ変化があったキーのキーカウンタ値が各バイトに格納
され、第2の記憶領域の各バイトのB0,B1 のステイタス
情報はキーマトリクスを1通りスキャンした時点での各
キーの変化に応じた値に更新されて格納されている。
At this point, the key counter value of the key whose key data has changed is stored in each byte in the first storage area, and the status information of B0 and B1 of each byte in the second storage area is the key matrix. Is updated and stored with a value according to the change of each key at the time of scanning once.

【0044】更に、メインルーチンのステップ35を介
してキースキャンルーチン(ステップ33)が実行され
る。前述のとおり、ここではステップ48においてキー
カウンタ値を1ずつ進めることにより、スキャンライン
IからスキャンラインVIIIまでのすべてのキーについて
夫々のキーのキーカウンタ値に応じた所定の順序で2回
目のスキャンが行われる。
Further, the key scan routine (step 33) is executed through step 35 of the main routine. As described above, in this step, the key counter value is incremented by one, so that the second scan is performed in a predetermined order according to the key counter value of each key from scan line I to scan line VIII. Is done.

【0045】つぎに、この時のスキャンラインIの
「A」のキーの状態の検出について説明する。前述のと
おりにステップ41〜43まで実行された結果キーがオ
ンの場合は「A」のキーのキーデータはオンのまま変化
していないので、ステップ44においてキーカウンタ値
はセットされずにステップ45を実行する。
Next, the detection of the state of the "A" key of the scan line I at this time will be described. As described above, when the result key executed in steps 41 to 43 is on, the key data of the key of "A" remains on and remains unchanged, so the key counter value is not set in step 44 and step 45 is executed. To execute.

【0046】そして、B4に「1」をたて(図8(A)e )
た後、図7を用いて説明したとおりにB1を「1」とした
ままにBOにも「1」をたて(図8(A)f )、つづいてB4
をリセットして「0」とする(図8(A)g )。
Then, add "1" to B4 (Fig. 8 (A) e).
After that, as described with reference to FIG. 7, while keeping B1 at “1”, set “1” to BO (FIG. 8 (A) f), and continue to B4.
Is reset to "0" (Fig. 8 (A) g).

【0047】この結果、ステップ46において、第1の
記憶領域に記憶されている「A」のキーのキーカウンタ
値と第2の記憶領域に記憶されているステイタス情報 B
0,B1の値「1」,「1」とから「A」のキーの「オン」
が有効であることが検出され、つづいてステップ47が
実行されて「A」のキーの「オン」を表すコードがRA
M17の出力バッファ23にセットされる。
As a result, in step 46, the key counter value of the key "A" stored in the first storage area and the status information B stored in the second storage area.
0, B1 value "1", "1" to "A" key "ON"
Is found to be valid, then step 47 is executed and the code representing the "on" of the "A" key is RA.
It is set in the output buffer 23 of M17.

【0048】2回目のスキャンにおいて「A」のキーが
オフとなった場合は、ステップ45においてB4が「0」
のままであり、またステイタス情報 B4,B1がそれぞれ
「0」,「1」であることから、1回目のスキャンの時
のオンは無効であることが検出される。したがって、ス
テイタス情報は図8(8) e のようになり「A」のキー
のオンは無効であると検出される。
If the "A" key is turned off in the second scan, B4 is "0" in step 45.
Since the status information B4 and B1 are "0" and "1", respectively, it is detected that the ON state during the first scan is invalid. Therefore, the status information becomes as shown in FIG. 8 (8) e, and it is detected that the key of "A" is on.

【0049】また、図8(C)に示した1回目のスキャ
ンでキーオフが検出され2回目のスキャンでもキーオフ
となった場合、図7で説明したように第2の記憶領域の
ステイタス情報は1回目にステップ45を実行して図8
(C)bのようになり、2回目にステップ45を実行し
た結果同図cのようになってキーの「オフ」が有効であ
ることが検出される。
When the key-off is detected in the first scan shown in FIG. 8C and the key-off is also detected in the second scan, the status information of the second storage area is 1 as described in FIG. Step 45 is executed for the second time, and then FIG.
As shown in (C) b, as a result of executing step 45 the second time, as shown in c in the same figure, it is detected that the key "OFF" is valid.

【0050】さらにまた、図8(D)に示した1回目の
スキャンでキーオフが検出され2回目のスキャンでキー
オンとなった場合、図7で説明したように第2の記憶領
域のステイタス情報は1回目にステップ45を実行して
図8(D)bのようになり、2回目にステップ45を実
行した結果同図cのようになってキーの「オフ」が無効
であることが検出される。
Furthermore, when the key-off is detected in the first scan and the key-on is detected in the second scan shown in FIG. 8D, the status information of the second storage area is as shown in FIG. As shown in FIG. 8D by executing step 45 for the first time, and as a result of executing step 45 for the second time, as shown in FIG. 8C, it is detected that the key “OFF” is invalid. It

【0051】以上のようにして検出され出力バッファ2
3にセットされた有効キーを表すコードは、バスライン
19、入出力ポート11を介してマイクロコンピュータ
7より出力されるようCPU15により制御される。さ
らに、有効キーを表すコードはバッファ回路9を介して
図示しないワードプロセッサ等の装置本体に供給され
る。
The output buffer 2 detected as described above
The code representing the valid key set to 3 is controlled by the CPU 15 so as to be output from the microcomputer 7 via the bus line 19 and the input / output port 11. Further, the code representing the valid key is supplied to the apparatus main body such as a word processor (not shown) via the buffer circuit 9.

【0052】上記の実施例によれば、第1の記憶領域、
第2の記憶領域夫々の記憶容量は、キーマトリクスの大
きさに係わらずオペレータがキーマトリクスが1回スキ
ャンされる間にオペレータが操作可能なキーの数と同じ
バイト数で構成することができRAMの使用効率が高
い。本実施例ではオペレータの両手の指の本数と同じ数
のバイト数(10バイト)で各記憶領域を構成したが、
さらに少ない記憶容量とすることも可能である。
According to the above embodiment, the first storage area,
The storage capacity of each of the second storage areas can be configured with the same number of bytes as the number of keys that the operator can operate while the operator scans the key matrix once, regardless of the size of the key matrix. The usage efficiency of is high. In this embodiment, each storage area is configured with the same number of bytes (10 bytes) as the number of fingers of both hands of the operator.
A smaller storage capacity is possible.

【0053】また、従来のキー入力装置のように排他的
論理和を求める演算回路、論理積を求める演算回路等の
複雑な回路を必要とせずに、マイクロコンピュータによ
り簡単な構成とすることができてそのコストを低減する
ことが可能である。
Further, a simple structure can be realized by a microcomputer without requiring a complicated circuit such as an arithmetic circuit for obtaining an exclusive OR or an arithmetic circuit for obtaining a logical product as in the conventional key input device. It is possible to reduce the cost.

【0054】なお、図6に示したフローチャートのステ
ップ47において、有効キーに相当するコードを出力バ
ッファにセットしているが、本実施例では説明の便宜
上、出力バッファは1つとして説明してある。出力バッ
ファが1つだと上記フローチャートの動作上では有効キ
ーのコードを1つしか入れることが出来ず、もし有効キ
ーが2つ以上発生した場合は、はじめに有効キーとして
検出されたコードが次に有効キーとして検出されたコー
ドに書換えられてしまったり、2番目以降に有効キーと
して検出されたコードが出力バッファに入らなかったり
して有効キーが無視されることになる。
In step 47 of the flow chart shown in FIG. 6, the code corresponding to the valid key is set in the output buffer. However, in this embodiment, for the sake of convenience of explanation, the number of output buffers is one. .. If there is only one output buffer, only one valid key code can be inserted in the operation of the above flow chart. If two or more valid keys occur, the code detected as the valid key first appears next. The valid key is ignored because the code detected as the valid key is rewritten, or the code detected as the valid key after the second key does not enter the output buffer.

【0055】これを防止するために、実際には出力バッ
ファとして通常16バイト位の領域を設けている。それ
でも有効キーのコードが出力バッファに入りきらない時
は、記憶領域2のステイタス情報は変化させずに、有効
キーの検出をキャンセルすることで対応する処理をして
いる。
In order to prevent this, actually, an area of about 16 bytes is usually provided as an output buffer. If the valid key code still does not fit into the output buffer, the status information in the storage area 2 is not changed and the corresponding process is performed by canceling the detection of the valid key.

【0056】またマイクロコンピュータによらずとも、
図9に示すように、第1のキー走査信号発生回路61,
第1のキー情報記憶回路62,第1のキーステイタス情
報記憶回路63,第2のキー走査信号発生回路64,第
2のキー情報記憶回路65,第2のキーステイタス情報
記憶回路66,キーステイタス情報更新回路67,新規
入力キー検出回路68,キーコード出力回路69により
構成したキー入力装置70によっても、上記実施例と同
様記憶容量を節約することができる。しかし、この場合
は回路構成が複雑で高価なものになることが考えられ
る。
Further, without depending on the microcomputer,
As shown in FIG. 9, the first key scan signal generation circuit 61,
First key information storage circuit 62, first key status information storage circuit 63, second key scanning signal generation circuit 64, second key information storage circuit 65, second key status information storage circuit 66, key status The key input device 70 including the information updating circuit 67, the new input key detecting circuit 68, and the key code outputting circuit 69 can also save the storage capacity as in the above embodiment. However, in this case, the circuit configuration may be complicated and expensive.

【0057】[0057]

【発明の効果】上述の如く本発明によれば、第1の工程
において第1の記憶領域に格納されたキーカウンタ値と
第2の工程において更新された第2の記憶領域に記憶さ
れている値とから、新たに入力された有効キーが第3の
工程において検出されるため、第1の記憶領域と第2の
記憶領域の記憶容量はキーボードを走査する間にキー入
力可能なキーの数に相当するだけ設ければよく、各記憶
領域の記憶容量を低減出来るとともにキー入力装置を安
価に構成できる特長がある。
As described above, according to the present invention, the key counter value stored in the first memory area in the first step and the second memory area updated in the second step are stored. Since the newly input effective key is detected in the third step from the value, the storage capacities of the first storage area and the second storage area are the number of keys that can be keyed in while scanning the keyboard. The key input device has the features that the storage capacity of each storage area can be reduced and the key input device can be configured at low cost.

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明の原理工程図である。FIG. 1 is a principle process chart of the present invention.

【図2】本発明の一実施例に適用されるキー入力装置の
ブロック図である。
FIG. 2 is a block diagram of a key input device applied to one embodiment of the present invention.

【図3】図2に示したキーボードのキーマトリクスを示
す図である。
FIG. 3 is a diagram showing a key matrix of the keyboard shown in FIG.

【図4】本発明の一実施例に適用されるキー入力装置の
要部であるRAMの構成図である。
FIG. 4 is a configuration diagram of a RAM which is a main part of a key input device applied to an embodiment of the present invention.

【図5】本発明の一実施例の概略を示すフローチャート
である。
FIG. 5 is a flowchart showing an outline of an embodiment of the present invention.

【図6】本発明の一実施例のキースキャンルーチンの具
体的なフローチャートである。
FIG. 6 is a detailed flowchart of a key scan routine according to an embodiment of the present invention.

【図7】本発明の一実施例のキースキャンルーチンにお
けるキーのステイタス情報の更新方法を示す図、および
更新方法を説明する図である。
FIG. 7 is a diagram showing a method for updating key status information in a key scan routine according to an embodiment of the present invention, and a diagram for explaining the updating method.

【図8】本発明の一実施例のキースキャンルーチンの具
体的なフローチャートに従ってステイタイス情報が更新
される様子を説明する図である。
FIG. 8 is a diagram illustrating how the status information is updated according to a specific flowchart of a key scan routine according to an embodiment of the present invention.

【図9】本発明の他の実施例のブロック図である。FIG. 9 is a block diagram of another embodiment of the present invention.

【図10】従来のキー入力装置のメモリマップの一例を
示す図である。
FIG. 10 is a diagram showing an example of a memory map of a conventional key input device.

【図11】従来のキー入力装置のキー入力方法の一例の
要部を示すフローチャートである。
FIG. 11 is a flowchart showing a main part of an example of a key input method of a conventional key input device.

【符号の説明】[Explanation of symbols]

1,44 第1の工程 2,45 第2の工程 3,46 第3の工程 6 キー入力装置 8 キーボード 11 入出力ポート 15 CPU(Central Processing Unit) 16 R0M(Read Only Memory) 17 RAM(Random Access Memory) 20 キーカウンタ 21 第1の記憶領域 22 第2の記憶領域 23 出力バッファ 33 キースキャンルーチン 1,44 First step 2,45 Second step 3,46 Third step 6 Key input device 8 Keyboard 11 Input / output port 15 CPU (Central Processing Unit) 16 R0M (Read Only Memory) 17 RAM (Random Access) Memory) 20 key counter 21 first storage area 22 second storage area 23 output buffer 33 key scan routine

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 キーボードの複数のキーを繰り返し走査
して該キーボードの有効キー入力を検出するキー入力装
置のキー入力方法であって、 該キーボードの複数のキーを走査して該複数のキー夫々
の前回のキーの状態と今回のキーの状態とを比較して状
態に変化のあったキーのキーカウンタ値を第1の記憶領
域に格納する第1の工程と、 第2の記憶領域に記憶されている値を該状態に変化のあ
ったキーの前回の状態と今回の状態に応じた値に更新す
る第2の工程と、 該第1の記憶領域に格納された前記キーカウンタ値と該
更新された第2の記憶領域に記憶されている値とから該
状態に変化のあったキーの有効キー状態を検出する第3
の工程とを含むことを特徴とするキー入力装置のキー入
力方法。
1. A key input method for a key input device for repeatedly scanning a plurality of keys of a keyboard to detect an effective key input of the keyboard, wherein the plurality of keys of the keyboard are scanned and each of the plurality of keys is scanned. The first step of storing the key counter value of the key whose state has changed by comparing the previous key state with the current key state in the first storage area, and storing in the second storage area A second step of updating the stored value to a value according to the previous state and the current state of the key whose state has changed, the key counter value stored in the first storage area, and the Thirdly detecting the valid key state of the key whose state has changed from the updated value stored in the second storage area
And a key input method for a key input device.
JP4017089A 1992-01-31 1992-01-31 Key input method for key input device Pending JPH05210440A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4017089A JPH05210440A (en) 1992-01-31 1992-01-31 Key input method for key input device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4017089A JPH05210440A (en) 1992-01-31 1992-01-31 Key input method for key input device

Publications (1)

Publication Number Publication Date
JPH05210440A true JPH05210440A (en) 1993-08-20

Family

ID=11934263

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4017089A Pending JPH05210440A (en) 1992-01-31 1992-01-31 Key input method for key input device

Country Status (1)

Country Link
JP (1) JPH05210440A (en)

Similar Documents

Publication Publication Date Title
JP3676882B2 (en) Microprocessor and its peripheral devices
JP2501874B2 (en) IC card
JPH05210440A (en) Key input method for key input device
JPH01255035A (en) Processor
JP2616628B2 (en) Key input device
JP2817267B2 (en) Break address detector
JP3091382B2 (en) Keyboard input reading method
JP3490781B2 (en) Storage device
JP3190861B2 (en) Pseudo N-key rollover keyboard input device and processing method
KR920006970B1 (en) Programmable logic controller
JPS6327746B2 (en)
KR100217376B1 (en) Method for extending size of promgram area in electronic cash register
JP2752220B2 (en) String processing unit
JPS61275959A (en) Graph display control device and graph display control method
JP2001160025A (en) Data transfer device
JP2707256B2 (en) Micro computer
JPH1139159A (en) Computer system
JPH07152630A (en) Digital signal processor
JPH06161624A (en) Interruption controlling method
JPH09160786A (en) Microprocessor
JPH0564374B2 (en)
JP2001166964A (en) Microcomputer and its activating method
JPH01136255A (en) Address conversion device
JPH026995A (en) Display device
JPH1165620A (en) Programmable controller having pulse output instruction