JPH0765664A - Switch control circuit - Google Patents

Switch control circuit

Info

Publication number
JPH0765664A
JPH0765664A JP5207697A JP20769793A JPH0765664A JP H0765664 A JPH0765664 A JP H0765664A JP 5207697 A JP5207697 A JP 5207697A JP 20769793 A JP20769793 A JP 20769793A JP H0765664 A JPH0765664 A JP H0765664A
Authority
JP
Japan
Prior art keywords
switch
state
output
counter
state machine
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
JP5207697A
Other languages
Japanese (ja)
Inventor
Katsuyoshi Doi
克良 土居
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.)
Sharp Corp
Original Assignee
Sharp Corp
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 Sharp Corp filed Critical Sharp Corp
Priority to JP5207697A priority Critical patent/JPH0765664A/en
Publication of JPH0765664A publication Critical patent/JPH0765664A/en
Pending legal-status Critical Current

Links

Landscapes

  • Input From Keyboards Or The Like (AREA)
  • Keying Circuit Devices (AREA)

Abstract

PURPOSE:To prevent chattering and erroneous operation of a switch. CONSTITUTION:The state of a switch 1 is read out by a digital circuit to control the operation of the digital circuit or operation of a computer. A state machine 2 detects that the switch 1 is turned on or off for a set period or longer and sends out the on/off state of the switch 1. In this way, as compared with the case of manufacture of the integration circuits in which parameters become uneven due to CR, in manufacture of digital circuits, setting of the threshold values can be set precisely and unevenness in the manufacture does not occur.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、スイッチ制御回路に関
し、より詳細には、ステートマシンを使用してスイッチ
の入力の検知を行うことで、スイッチ操作の操作余裕と
チャタリング防止を行うようにしたスイッチ制御回路に
関する。例えば、スイッチを有するディジタル制御機器
全般に適用されるものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a switch control circuit, and more specifically, it detects a switch input by using a state machine to prevent a switch operation and prevent chattering. The present invention relates to a switch control circuit. For example, it is applied to all digital control devices having a switch.

【0002】[0002]

【従来の技術】図6は、従来のTTLレベルコンバータに
おけるスイッチ回路を示す図で、図中、11はスイッ
チ、12は入力バッファ(Input Buffer)である。従来の
スイッチの状態をセンスする回路は、図6に示すよう
に、スイッチをディジタル的に読み出すためのバッファ
ゲートを使ってTTL論理出力に変換していた。しかし、
図6に示す構成ではスイッチがチャタリングを起こすた
め、そのTTL出力は、図7(a),(b)に示すように、
チャタリングを反映していた。そこで、図8に示すよう
に、チャタリングを抑制する回路としてキャパシタンス
Cと抵抗Rによる積分回路が広く知られている。
2. Description of the Related Art FIG. 6 is a diagram showing a switch circuit in a conventional TTL level converter. In the figure, 11 is a switch and 12 is an input buffer. As shown in FIG. 6, a conventional circuit for sensing the state of a switch uses a buffer gate for digitally reading the switch to convert it into a TTL logic output. But,
Since the switch causes chattering in the configuration shown in FIG. 6, its TTL output is as shown in FIGS. 7 (a) and 7 (b).
It reflected chattering. Therefore, as shown in FIG. 8, an integrating circuit including a capacitance C and a resistance R is widely known as a circuit for suppressing chattering.

【0003】[0003]

【発明が解決しようとする課題】前述のように、従来の
CRによる積分回路では、図9(a)〜(c)に示すよう
に、時定数CR(秒)程度の時間遅れで、バッファゲート
のしきい値で決まる時間程度遅れてゲートの出力にスイ
ッチの状態が現われるので、スイッチオンあるいはオフ
の直後にCR秒時間以内にスイッチを元に戻せば、結局、
論理出力はスイッチを操作しなかったことと同じになる
効果がある。しかし、回路定数のバラツキやスイッチの
信号線に載ったノイズの影響あるいはゲート回路のしき
い値のバラツキなどで正確なチャタリング抑制回路を実
現することには困難があった。
As mentioned above, the conventional
In the CR integration circuit, as shown in FIGS. 9A to 9C, there is a delay of time constant CR (seconds), and a delay of about the time determined by the threshold value of the buffer gate. The status will appear, so if you turn the switch back on within CR seconds after turning it on or off,
The logic output has the effect of being the same as not operating the switch. However, it has been difficult to realize an accurate chattering suppressing circuit due to variations in circuit constants, influence of noise on the switch signal line, variations in threshold value of the gate circuit, and the like.

【0004】本発明は、このような実情に鑑みてなされ
たもので、パラメータのばらつきがちなCRによる積分回
路に比べて、閾値の設定を厳密にできるようにし、回路
の定数である閾値の値を変えることにより、自由に時定
数を変えられるようにしたスイッチ制御回路を提供する
ことを目的としている。
The present invention has been made in view of such a situation, and enables the threshold value to be set more strictly as compared with the CR integrator circuit which tends to have parameter variations, and the threshold value which is a constant of the circuit. The purpose of the present invention is to provide a switch control circuit in which the time constant can be freely changed by changing.

【0005】[0005]

【課題を解決するための手段】本発明は、上記目的を達
成するために、投入あるいは解除を行うスイッチと、該
スイッチの出力信号を読み出し、一定時間以上スイッチ
が投入あるいは解除されていることを検知し、前記スイ
ッチのオン/オフの状態を出力するステートマシンとか
ら成り、前記スイッチのチャタリングやスイッチ誤操作
を抑制するようにしたことを特徴としたものである。
SUMMARY OF THE INVENTION In order to achieve the above object, the present invention provides a switch which is turned on or off, and an output signal of the switch is read, and the switch is turned on or released for a certain time or longer. A state machine for detecting and outputting the on / off state of the switch is provided, and chattering of the switch and erroneous operation of the switch are suppressed.

【0006】[0006]

【作用】スイッチの状態をディジタル回路にて読み出す
方式において、デイジタル回路の動作あるいはコンピュ
ータの動作を制御する目的に使用する場合において、ス
イッチの出力をセンスする回路により、一定時間以上ス
イッチが投入あるいは解除されていることを検知してス
イッチのオン/オフの状態を出力する。これを使用する
ことでスイッチのチャタリングやスイッチ操作のミスを
抑制し、スイッチ操作に一定の時間的余裕をおくことが
できる。
In the method of reading the state of the switch by the digital circuit, when the switch is used for the purpose of controlling the operation of the digital circuit or the operation of the computer, the circuit for sensing the output of the switch turns the switch on or off for a predetermined time or longer. It detects that the switch is on and outputs the on / off state of the switch. By using this, it is possible to suppress switch chattering and switch operation mistakes, and to leave a certain time margin for switch operation.

【0007】[0007]

【実施例】実施例について、図面を参照して以下に説明
する。図1は、本発明によるスイッチ制御回路の一実施
例を説明するための構成図で、図中、1はスイッチ、2
はステートマシンである。ステートマシン2は、入力端
子(Input)と、出力端子(Output)と、クロック信号
入力端子(CLK)と、リセット端子(Reset)とを有して
おり、スイッチ1からの信号は入力端子に入力される。
Embodiments will be described below with reference to the drawings. FIG. 1 is a block diagram for explaining an embodiment of a switch control circuit according to the present invention, in which 1 is a switch and 2 is a switch.
Is a state machine. The state machine 2 has an input terminal (Input), an output terminal (Output), a clock signal input terminal (CLK), and a reset terminal (Reset), and the signal from the switch 1 is input to the input terminal. To be done.

【0008】本発明では、CRによる積分回路の代わり
に、図1に示すようなブロックで表現されるステートマ
シンを使用して論理出力に変換する。このステートマシ
ンの状態図は、図2のようになる。このときステートマ
シンを駆動するクロック周波数をCLK(Hz)とし、ステ
ートマシンの内部カウンタはMbitであるとする。すなわ
ち、2のM乗数値がカウントできるものとする。ステー
トマシンは、入力が一定サイクル(N)の間連続してHig
h(Low)でなければ出力(Output)をLow(High)にしないよ
うな論理である。このときのステートマシンは、N/CLK
(秒)の時定数を持った積分回路として振舞うのでCRに
よる積分回路と同様な動作が得られる。
In the present invention, a state machine represented by a block as shown in FIG. 1 is used instead of the CR integrating circuit to convert to a logical output. The state diagram of this state machine is shown in FIG. At this time, the clock frequency that drives the state machine is CLK (Hz), and the internal counter of the state machine is Mbit. That is, it is assumed that the M-th power of 2 can be counted. The state machine has a Hig input continuously for a fixed number of cycles (N).
It is a logic that does not set the output to Low (High) unless it is h (Low). The state machine at this time is N / CLK
Since it behaves as an integrating circuit with a time constant of (seconds), the same operation as the integrating circuit by CR can be obtained.

【0009】図3(a)〜(c)は、動作例の説明図
で、チャタリングを伴う入力がどのように出力されるか
を示している。入力状態はswitchで1か0,出力状態は
outputで1か0,カウンタ(counter)は初期値が0であ
る。クロックが入るごとに論理に基づいて以下の3つの
状態を遷移する。 CHECK;LOWからHIGHへの移行またはHIGHからLOWへ
の移行をチェックする状態(CHECK) LOWTOHIGH;LOWからHIGHへの移行を実行する
状態(LOWTOHIGH) HIGHTOLOW;HIGHからLOWへの移行を実行する
状態(HIGHTOLOW)
FIGS. 3A to 3C are explanatory views of an operation example and show how an input accompanied by chattering is output. Input state is 1 or 0 with switch, output state is
The output is 1 or 0, and the initial value of the counter is 0. Every time a clock is input, the following three states are transited based on the logic. CHECK; state to check transition from LOW to HIGH or transition from HIGH to LOW (CHECK) LOWTOHIGH; state to execute transition from LOW to HIGH (LOWTOHIGH) HIGHTOLOW; state to execute transition from HIGH to LOW ( HIGHTOLOW)

【0010】DATA I/O社のAbel言語で動作を記述するな
らば、以下のようになる。また、このステートマシンに
はリセット入力があり、リセット終了後、ただちにCHEC
K状態から動作を開始する。ここではM=8 bit,N=10(=cm
ax)にしている。なお、入力状態switchは一旦内部のフ
リップフロップでラッチしたlswitchという変数に変換
している。
If the operation is described in the Abel language of DATA I / O Company, it will be as follows. In addition, this state machine has a reset input, and immediately after the reset, CHEC
Start operation from K state. Here M = 8 bit, N = 10 (= cm
ax). The input state switch is converted into a variable called lswitch which is latched by an internal flip-flop.

【0011】 module integral declarations integral device ‘MACH130A'; “inputs switch pin ; CLK pin ;“clock _RESET pin ;“reset signal “outputs output pin ; “hidden nodes s7,s6,s5,s4,s3,s2,s1,s0 node istype ‘ reg_d' ; st1,st0,node istype‘reg_d'; lswitch pin istype‘reg_d'; H,L,X,C,Z,P=1,0,.X.,.C.,.Z.,.P.; counter=[s7,s6,s5,s4,s3,s2,s1,s0]; cmax =10 ; integra= [st1,st0]; CHECK=[0,0]; HIGHTOLOW=[1,0]; LOWTOHIGH=[0,1]; equations output.clk=CLK; output.re =!_RESET; counter.clk :=CLK; counter.re =!_RESET; lswitch :=switch; lswitch.clk =CLK; Integra.re=!_RESET; Integra.clk =CLK; when(lswitch&(counter<(cmax+1))&(integra==CHECK))then counter := counter + 1 ; else when((!lswitch&(counter>0)&(integra==CHECK))then counter := counter - 1 ; else counter := counter; state_diagram Integra state CHECK: output :=output; if((output==0)&(counter>cmax))then goto LOWTOHGH; else if((output==1)&(counter==0))then goto HIGHTOLOW; else goto CHECK; state LOWTOHIGH: output :=1; goto CHECK; state HIGHTOLOW: output :=0; goto CHECK; end integral;Module integral declarations integral device 'MACH130A'; "inputs switch pin; CLK pin;" clock _RESET pin; "reset signal" outputs output pin; "hidden nodes s7, s6, s5, s4, s3, s2, s1, s0 node istype 'reg_d'; st1, st0, node istype'reg_d '; lswitch pin istype'reg_d'; H, L, X, C, Z, P = 1,0, .X.,. C.,. Z .,. P .; counter = [s7, s6, s5, s4, s3, s2, s1, s0]; cmax = 10; integra = [st1, st0]; CHECK = [0,0]; HIGHTOLOW = [1 , 0]; LOWTOHIGH = [0,1]; equations output.clk = CLK; output.re =! _ RESET; counter.clk: = CLK; counter.re =! _ RESET; lswitch: = switch; lswitch.clk = CLK Integra.re =! _ RESET; Integra.clk = CLK; when (lswitch & (counter <(cmax + 1)) & (integra == CHECK)) then counter: = counter + 1; else when ((! Lswitch & (counter > 0) & (integra == CHECK)) then counter: = counter-1; else counter: = counter; state_diagram Integra state CHECK: output: = output; if ((output == 0) & (counter> cmax)) then goto LOWTOHGH; else if ((output == 1) & (counter == 0)) then goto HIGHTOLOW; else goto CHECK; state LOWTOHIGH: output: = 1; goto CHECK ; state HIGHTOLOW: output: = 0; goto CHECK; end integral;

【0012】次に、図2に示すステートマシンの状態図
と前述のAbelソースをもとに説明する。カウンタが+1
加算されるのは、次の条件の時である。すなわち、入力
swichが1であり、かつステートマシンがCHECKであり、
counterが閾値N(cmax)以下である場合である。カウン
タが1減算されるのは、次の条件の時である。すなわ
ち、入力lswichが0であり、かつステートマシンがCHEC
Kであり、counterが0よりも大きい場合である。また、
出力outputが0から1へ変化する条件は、outputが0で
counterが閾値cmaxより大きい時である。また、出力ou
tputが1から0へ変化する条件は、outputが1でcounte
rが0になった時である。以上のような条件の論理回路
ブロックは、ヒステリシスを持つため、一定サイクルcm
ax以上連続して入力論理がHIGHまたはLOWになったとき
のみ、出力がHIGHまたは、LOWになる。
Next, the state machine of the state machine shown in FIG. 2 and the above-mentioned Abel source will be described. Counter is +1
It is added under the following conditions. Ie input
swich is 1, and the state machine is CHECK,
This is the case where the counter is less than or equal to the threshold value N (cmax). The counter is decremented by 1 under the following conditions. That is, the input lswich is 0 and the state machine is CHEC
K and counter is greater than zero. Also,
The condition that the output output changes from 0 to 1 is that output is 0
This is when the counter is larger than the threshold value cmax. Also output ou
The condition that tput changes from 1 to 0 is that output is 1 and counte
It is when r becomes 0. Since the logic circuit block under the above conditions has hysteresis, a constant cycle cm
The output becomes HIGH or LOW only when the input logic becomes HIGH or LOW continuously for ax or more.

【0013】次に、本発明によるスイッチ制御回路をコ
ンピュータのソフト電源スイッチに応用した場合につい
て説明する。前述のAbel 言語ソースは、AMD社のMACH13
0A FPGA(Field Programmable Gate array)を前提に記述
したもので実際に動作する。ソフト電源スイッチとは、
コンピュータのソフトウエアによりこのスイッチの状態
をセンスし、電源断を検知することにより終了処理を開
始する目的で使うものである。本発明によるスイッチ制
御回路のステートマシンへの供給クロックは10Hzとす
ると、また閾値N=100であるから、時定数は 100×1/10Hz=1秒 である。
Next, a case where the switch control circuit according to the present invention is applied to a soft power switch of a computer will be described. The above Abel language source is AMD's MACH13
0A FPGA (Field Programmable Gate array) is written on the assumption that it actually works. What is a soft power switch?
It is used for the purpose of starting the termination process by sensing the state of this switch by the software of the computer and detecting the power failure. If the clock supplied to the state machine of the switch control circuit according to the present invention is 10 Hz, and the threshold value N = 100, the time constant is 100 × 1/10 Hz = 1 second.

【0014】図3(a)〜(c)と図4(a)〜(c)
と図5(a)〜(c)は、動作例の説明図で、各々図
(a)が入力、図(b)が内部カウンタの値、図(c)
が出力の例である。誤ってこのスイッチを切っても、時
定数の時間内であればただちにこのスイッチをもとに戻
すことによりスイッチ断にならなかったことになる。ス
イッチがプッシュボタンであれば、1秒以上の時間を押
すことで初めてスイッチを押したことが検知できること
になる。またチャタリングの影響を防ぐことが出来る。
3A to 3C and 4A to 4C.
5A to 5C are explanatory diagrams of the operation example, in which FIG. 5A is input, FIG. 5B is an internal counter value, and FIG.
Is an example of the output. Even if this switch is accidentally turned off, if it is within the time of the time constant, it will not be cut off by immediately returning this switch. If the switch is a push button, it is possible to detect that the switch is pressed for the first time by pressing the switch for 1 second or longer. Moreover, the influence of chattering can be prevented.

【0015】[0015]

【発明の効果】以上の説明から明らかなように、本発明
によると、スイッチのチャタリングを防止する方法とし
て利用でき、また、スイッチを操作するものが人間であ
る場合は、誤った操作でスイッチを投入/解除した場合
でも、一定時間であればもとに戻すことによってスイッ
チの投入/解除をキャンセルでき、操作に慎重さが求め
られるコンピュータの電源制御スイッチとしての応用が
できる。さらに、パラメータのばらつきがちな従来のCR
による積分回路に比べて、閾値の設定が厳密にできるの
で、製造上のバラツキが起こり得ない。また、回路の定
数である閾値の値を変えることで、自由に時定数が変え
られる。
As is apparent from the above description, according to the present invention, it can be used as a method for preventing chattering of a switch, and when a person who operates the switch is a human, the switch is operated by an incorrect operation. Even when the switch is turned on / off, the switch can be turned on / off by returning it to the original state for a certain period of time, and it can be applied as a power control switch for a computer that requires careful operation. In addition, conventional CR that tends to have parameter variations
Since the threshold value can be set more rigorously than in the integration circuit according to (3), there will be no manufacturing variation. Further, the time constant can be freely changed by changing the value of the threshold value which is the constant of the circuit.

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

【図1】本発明によるスイッチ制御回路の一実施例を説
明するための構成図である。
FIG. 1 is a configuration diagram for explaining an embodiment of a switch control circuit according to the present invention.

【図2】本発明におけるステートマシンの状態図であ
る。
FIG. 2 is a state diagram of a state machine according to the present invention.

【図3】本発明によるスイッチ制御回路の応用例の動作
説明図(その1)である。
FIG. 3 is an operation explanatory diagram (1) of an application example of the switch control circuit according to the present invention.

【図4】本発明によるスイッチ制御回路の応用例の動作
説明図(その2)である。
FIG. 4 is an operation explanatory diagram (2) of an application example of the switch control circuit according to the present invention.

【図5】本発明によるスイッチ制御回路の応用例の動作
説明図(その3)である。
FIG. 5 is an operation explanatory diagram (3) of an application example of the switch control circuit according to the present invention.

【図6】従来のTTLレベルコンバータのスイッチ回路を
示す図である。
FIG. 6 is a diagram showing a switch circuit of a conventional TTL level converter.

【図7】従来例における入力バッファの入出力信号を示
す図である。
FIG. 7 is a diagram showing input / output signals of an input buffer in a conventional example.

【図8】従来例であるCR積分回路を示す図である。FIG. 8 is a diagram showing a CR integrator circuit as a conventional example.

【図9】従来例におけるCRフィルタの動作説明図であ
る。
FIG. 9 is an operation explanatory diagram of a CR filter in a conventional example.

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

1…スイッチ、2…ステートマシン。 1 ... switch, 2 ... state machine.

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 投入あるいは解除を行うスイッチと、該
スイッチの出力信号を読み出し、一定時間以上スイッチ
が投入あるいは解除されていることを検知し、前記スイ
ッチのオン/オフの状態を出力するステートマシンとか
ら成り、前記スイッチのチャタリングやスイッチ誤操作
を抑制するようにしたことを特徴とするスイッチ制御回
路。
1. A state machine for turning on or off, and a state machine for reading an output signal of the switch, detecting that the switch has been turned on or off for a certain period of time, and outputting an on / off state of the switch. And a switch control circuit configured to suppress chattering of the switch and erroneous operation of the switch.
JP5207697A 1993-08-23 1993-08-23 Switch control circuit Pending JPH0765664A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP5207697A JPH0765664A (en) 1993-08-23 1993-08-23 Switch control circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP5207697A JPH0765664A (en) 1993-08-23 1993-08-23 Switch control circuit

Publications (1)

Publication Number Publication Date
JPH0765664A true JPH0765664A (en) 1995-03-10

Family

ID=16544076

Family Applications (1)

Application Number Title Priority Date Filing Date
JP5207697A Pending JPH0765664A (en) 1993-08-23 1993-08-23 Switch control circuit

Country Status (1)

Country Link
JP (1) JPH0765664A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6530634B1 (en) 1998-09-16 2003-03-11 Seiko Epson Corporation Ink jet recording apparatus
JP2011049070A (en) * 2009-08-27 2011-03-10 Fujitsu Component Ltd Control device
WO2023188139A1 (en) * 2022-03-30 2023-10-05 三菱自動車工業株式会社 Power source management device for electric vehicle

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6530634B1 (en) 1998-09-16 2003-03-11 Seiko Epson Corporation Ink jet recording apparatus
JP2011049070A (en) * 2009-08-27 2011-03-10 Fujitsu Component Ltd Control device
WO2023188139A1 (en) * 2022-03-30 2023-10-05 三菱自動車工業株式会社 Power source management device for electric vehicle

Similar Documents

Publication Publication Date Title
JPH04248475A (en) Measuring circuit for waveform width of remote control signal
JPH0765664A (en) Switch control circuit
JPH08139575A (en) Pulse output circuit
JP3584821B2 (en) Microcomputer with built-in CR oscillation clock
JP3201445B2 (en) Chattering prevention circuit
JP2002043902A (en) Chattering elimination circuit
JP3258789B2 (en) Volume control circuit
KR0131431Y1 (en) Signal debounce circuit
JPH0553703A (en) Chattering eliminating circuit
JP2687793B2 (en) Error rate alarm circuit with hysteresis
JPH09146980A (en) Logical delay simulation method
JP2973613B2 (en) Programmable counter
JPH05268020A (en) Clock switching circuit
JPH09198367A (en) Microcomputer
JPH0366855B2 (en)
JP2512993B2 (en) Reset circuit
JP2522312Y2 (en) Temperature detection circuit
JPH0450657Y2 (en)
JPS62239258A (en) Microcomputer
JPS6335465Y2 (en)
JPH04347925A (en) Power-on reset circuit
JPH0353342A (en) Test mode setting circuit
JPH07152815A (en) Logic circuit
JPH0618024B2 (en) Contact encoder encoder reading method
JPS6167119A (en) Microcomputer