JPH0334111B2 - - Google Patents

Info

Publication number
JPH0334111B2
JPH0334111B2 JP59036682A JP3668284A JPH0334111B2 JP H0334111 B2 JPH0334111 B2 JP H0334111B2 JP 59036682 A JP59036682 A JP 59036682A JP 3668284 A JP3668284 A JP 3668284A JP H0334111 B2 JPH0334111 B2 JP H0334111B2
Authority
JP
Japan
Prior art keywords
program
stop
interrupt
address
instruction
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.)
Expired - Lifetime
Application number
JP59036682A
Other languages
Japanese (ja)
Other versions
JPS59182389A (en
Inventor
Hiroshi Koyama
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.)
Sanyo Electric Co Ltd
Original Assignee
Sanyo 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 Sanyo Electric Co Ltd filed Critical Sanyo Electric Co Ltd
Priority to JP59036682A priority Critical patent/JPS59182389A/en
Publication of JPS59182389A publication Critical patent/JPS59182389A/en
Publication of JPH0334111B2 publication Critical patent/JPH0334111B2/ja
Granted legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G04HOROLOGY
    • G04GELECTRONIC TIME-PIECES
    • G04G99/00Subject matter not provided for in other groups of this subclass
    • G04G99/006Electronic time-pieces using a microcomputer, e.g. for multi-function clocks

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Electric Clocks (AREA)
  • Power Sources (AREA)
  • Microcomputers (AREA)

Description

【発明の詳細な説明】 (イ) 産業上の利用分野 本発明はマイクロコンピユータの動作方法に関
し、特に、電子時計用に好都合な4ビツトマイク
ロコンピユータに関する。
DETAILED DESCRIPTION OF THE INVENTION (a) Field of Industrial Application The present invention relates to a method of operating a microcomputer, and particularly to a 4-bit microcomputer that is convenient for use in electronic watches.

(ロ) 従来技術 従来電子時計の回路はカウンタ構成に依る分周
方式であつたが、仕様変更の際には初めから設計
をやり直さなければならない不都合があつた。そ
こでマイクロコンピユータを用いたCPU方式の
電子時計が実用化されている。
(b) Prior Art Conventional electronic clock circuits have been based on a frequency division method based on the counter configuration, but this has had the inconvenience of requiring the design to be redone from the beginning when specifications are changed. Therefore, CPU-based electronic clocks using microcomputers have been put into practical use.

一般にCPU方式の電子時計は仕様変更の際に
プログラムを記憶するROMのマスクを変えるの
みで行なえ得る利点を有しているが、計時動作は
1プログラムの処理時間を基準としてプログラム
のステツプ数を数えて加算処理を行なうためプロ
グラムが複雑となり、更にCPUが高速で常時動
作しているため消費電流が従来の分周方式による
電子時計より大幅に増加し電池寿命を大幅に短縮
してしまう不都合があり、電池を電源として用い
るクロツクあるいは腕時計等には不適当であつ
た。
In general, CPU-type electronic clocks have the advantage of being able to change specifications by simply changing the mask of the ROM that stores the program, but the timekeeping operation counts the number of program steps based on the processing time of one program. The program is complicated because it performs addition processing, and since the CPU is constantly operating at high speed, the current consumption is significantly higher than that of conventional frequency division electronic clocks, which significantly shortens battery life. However, it was unsuitable for clocks, wristwatches, etc. that use batteries as a power source.

従来、消費電流を減少するために、動作を停止
するマイクロコンピユータが考案されている。こ
のようなシステムでは、システムクロツクの発生
が停止された後に、再度動作が開始されるまでは
割り込みを禁止したり、あるいは、動作停止中に
割り込みが発生した場合には、プログラムカウン
タをリセツトし、プログラムの先頭アドレスから
動作を開始するようになつている。従つて、プロ
グラムの途中で動作を停止し、その停止状態で割
り込みを受付たり、プログラムを先に進めたりす
ることができず、プログラム作成上の制約が多く
なる欠点があつた。
Conventionally, microcomputers that stop operating have been devised in order to reduce current consumption. In such systems, after system clock generation is stopped, interrupts are disabled until operation is restarted, or if an interrupt occurs while operation is stopped, the program counter is reset. , the operation starts from the first address of the program. Therefore, the operation of the program stops in the middle of the program, and it is not possible to accept an interrupt or proceed with the program in the stopped state, resulting in a drawback that there are many restrictions on program creation.

(ハ) 発明の目的 本発明は上述した点に鑑みて為されたものであ
り、動作停止中における割り込み発生時には、ス
タツクにその動作停止の原因となつた停止命令の
アドレスを保持させることにより、通常動作時の
割り込み、動作停止時の割り込み、及び、動作開
始時の次プログラムの実行再開を可能とすること
により、停止命令を含めたプログラム作成を簡単
にするとともに消費電流を最小限に押さえること
のできるマイクロコンピユータを提供するもので
ある。
(c) Purpose of the Invention The present invention has been made in view of the above points, and when an interrupt occurs while the operation is stopped, the stack retains the address of the stop instruction that caused the operation to stop. By enabling interrupts during normal operation, interrupts when operation is stopped, and restarting execution of the next program when operation starts, it is possible to simplify the creation of programs including stop instructions and to minimize current consumption. The purpose is to provide a microcomputer that can perform the following functions.

(ニ) 発明の構成 本発明は、基準信号発生回路と、該基準信号発
生回路の出力によりシステムの動作を制御するク
ロツク信号を発生する動作の停止が停止信号によ
つて制御され、前記動作の開始が割り込み信号、
及び、内部要因あるいは外部要因に基づいて発生
する動作開始信号によつて制御されるクロツクジ
エネレータと、プログラムを構成する命令が書き
込まれたROMと、該ROMに書き込まれた命令
を取り出すため前記ROMのアドレスを指定する
プログラムカウンタと、割り込み処理後の戻り先
アドレスを保持するために、割り込み発生時に実
行された命令を読み出した前記プログラムカウン
タのインクリメントされたアドレスを記憶するス
タツクと、前記ROMから読み出された命令を解
読し、該命令を実行するための制御信号を発生す
る制御回路と、動作停止命令が印加された前記制
御回路からの信号によつて制御され、前記クロツ
クジエネレータの動作を停止させる停止信号を前
記クロツクジエネレータに出力する状態制御回路
とを備えたマイクロコンピユータに於て、動作中
に発生した割り込みに対して、前記制御回路は、
前記プログラムカウンタのインクリメントされた
アドレスを前記スタツクに保持させ、前記割り込
み処理終了後前記スタツクに保持されたアドレス
を前記プログラムカウンタにセツトすることによ
りプログラムを先に進め、動作停止中に発生した
割り込みに対して、前記制御回路は、動作停止の
原因となつた停止命令を読み出した前記プログラ
ムカウンタのアドレスをインクリメントせずに前
記スタツクに保持させ、前記割り込み終了後前記
スタツクに保持されたアドレスを前記プログラム
カウンタにセツトすることにより、動作停止の原
因となつた停止命令を再度実行させて動作を停止
させ、前記動作停止後発生する前記動作開始信号
によつて動作開始したときは、前記プログラムカ
ウンタはインクリメントされたアドレスからプロ
グラムを先に進めることを特徴とするものであ
る。
(d) Structure of the Invention The present invention provides a reference signal generation circuit and a stop signal that controls the stop of the operation of generating a clock signal for controlling the operation of the system using the output of the reference signal generation circuit. The start is an interrupt signal,
and a clock generator controlled by an operation start signal generated based on internal or external factors, a ROM in which instructions constituting the program are written, and the above-mentioned clock generator for retrieving the instructions written in the ROM. a program counter that specifies the address of the ROM; a stack that stores the incremented address of the program counter from which the instruction executed at the time of the interrupt was read to hold the return address after interrupt processing; The clock generator is controlled by a control circuit that decodes the read instruction and generates a control signal for executing the instruction, and a signal from the control circuit to which the operation stop instruction is applied. In a microcomputer equipped with a state control circuit that outputs a stop signal to the clock generator to stop its operation, the control circuit performs the following in response to an interrupt that occurs during operation.
The incremented address of the program counter is held in the stack, and after the interrupt processing is completed, the address held in the stack is set in the program counter to advance the program and respond to an interrupt that occurs while the operation is stopped. On the other hand, the control circuit causes the address of the program counter that read the stop instruction that caused the operation to stop to be held in the stack without incrementing it, and after the interrupt ends, the address held in the stack is transferred to the program counter. By setting the counter, the stop command that caused the operation to stop is executed again to stop the operation, and when the operation is started by the operation start signal generated after the operation is stopped, the program counter is incremented. The feature is that the program proceeds from the specified address.

(ホ) 実施例 第1図は本発明の実施例を示すブロツク図であ
り、基準信号発生回路1、クロツクジエネレータ
2、スイツチ入力回路3、状態制御回路4、タイ
マーカウンタ5、クロノグラフカウンタ6、
ROM7、プログラムカウンタ8、スタツク9、
インストラクシヨンレジスタ10、制御回路1
1、ALU12、ACC13、RAM14、デコー
ダ15及びラツチ回路16とから構成された電子
時計用のマイクロコンピユータである。
(E) Embodiment FIG. 1 is a block diagram showing an embodiment of the present invention, which includes a reference signal generation circuit 1, a clock generator 2, a switch input circuit 3, a state control circuit 4, a timer counter 5, and a chronograph counter. 6,
ROM7, program counter 8, stack 9,
Instruction register 10, control circuit 1
1. This is a microcomputer for an electronic watch, which is composed of an ALU 12, an ACC 13, a RAM 14, a decoder 15, and a latch circuit 16.

基準信号発生回路1は外部端子に接続された水
晶振動子17で決定される周波数の信号を、後述
するシステムの動作中及び動作停止中に係わら
ず、発振し更にその信号を分周して、所定の分周
信号をクロツクジエネレータ2、スイツチ入力回
路3、タイマーカウンタ5及びクロノグラフカウ
ンタ6等に供給している。更に基準周波数発生回
路1からは一定時間、例えば0.5秒毎に時刻計数
動作を行なわせるための割り込み信号INT2がシ
ステムの動作中及び動作停止中に係わらず出力さ
れる。
The reference signal generation circuit 1 oscillates a signal with a frequency determined by a crystal oscillator 17 connected to an external terminal, regardless of whether the system is in operation or not, which will be described later, and further divides the frequency of the signal. A predetermined frequency-divided signal is supplied to a clock generator 2, a switch input circuit 3, a timer counter 5, a chronograph counter 6, and the like. Further, the reference frequency generating circuit 1 outputs an interrupt signal INT2 for performing a time counting operation every fixed period of time, for example, every 0.5 seconds, regardless of whether the system is operating or not.

クロツクジエネレータ2は基準周波数発生回路
1から印加された分周信号に依りCPU動作を行
なうためのシステムクロツク信号を作成し各部に
供給する。このクロツクジエネレータ2には状態
制御回路4からクロツク信号作成動作を停止させ
る停止信号CLKSTOPが印加されると共に割り
込み信号INT0、1、2、3及びタイマー出力
TIMEROUTさらには動作開始信号
CLKSTARTが印加されこれらの信号に依り停
止した動作が再開される。
The clock generator 2 generates a system clock signal for operating the CPU based on the divided signal applied from the reference frequency generating circuit 1 and supplies it to each section. A stop signal CLKSTOP for stopping the clock signal generation operation is applied from the state control circuit 4 to the clock generator 2, and interrupt signals INT0, 1, 2, 3 and a timer are output.
TIMEROUT and operation start signal
CLKSTART is applied and these signals restart the stopped operation.

スイツチ入力回路3は外部端子M1〜M4及びS1
〜S4を有し、各外部端子に接続されたスイツチの
チヤタリング防止及びスイツチの開閉データの取
り込みを行なうものであり、そのデータは各々デ
ータバスDBに送出される。特に外部端子S1〜S4
に接続されたスイツチの開閉は状態制御回路4の
スイツチ制御信号SWCONで指定することがで
き、指定されたスイツチの開閉に依り動作開始信
号CLKSTATを出力することができる。更に外
部端子S1〜S4に接続されたスイツチの閉成に依り
割り込み信号INT3を出力することもできる。ま
たクロノグラフモードに於いては端子S1及びS2
接続されたスイツチの開閉に依りクロノグラフカ
ウンタ6のスタート、ラツプ及びストツプを制御
するクロノグラフ制御信号CHRCONを出力す
る。
Switch input circuit 3 has external terminals M 1 to M 4 and S 1
~ S4 , which prevents the switches connected to each external terminal from chattering and captures switch opening/closing data, and the data is sent to each data bus DB. Especially external terminals S 1 ~ S 4
The opening/closing of the switch connected to can be specified by the switch control signal SWCON of the state control circuit 4, and the operation start signal CLKSTAT can be output depending on the opening/closing of the specified switch. Furthermore, an interrupt signal INT3 can be output by closing a switch connected to external terminals S1 to S4 . In the chronograph mode, a chronograph control signal CHRCON is output which controls the start, lap and stop of the chronograph counter 6 by opening and closing the switches connected to terminals S1 and S2 .

状態制御回路4はインストラクシヨンバスIB
に送出されるプログラムに依つて制御され、各種
モードに於ける各部回路の状態を制御するもので
あり、スイツチ入力回路3を制御するスイツチ制
御信号SWCON、タイマーカウンタ5のリセツ
ト、スタート及びタイマー時間の選択等を行なう
タイマー制御信号TIMCON及びクロツクジエネ
レータ2の動作も停止させる停止信号
CLKSTOP等を出力する。更にランプを接続す
るための外部端子LAMP及びアラーム音発生装
置に接続される外部端子ALMが設けられている。
State control circuit 4 is instruction bus IB
It controls the state of each circuit in various modes, and controls the switch control signal SWCON that controls the switch input circuit 3, the reset and start of the timer counter 5, and the timer time. A stop signal that also stops the timer control signal TIMCON, which performs selection, etc., and the operation of the clock generator 2.
Output CLKSTOP etc. Furthermore, an external terminal LAMP for connecting a lamp and an external terminal ALM for connecting to an alarm sound generator are provided.

タイマーカウンタ5はインストラクシヨンバス
IBに送出されたプログラムに依つてタイマー時
間を設定することができ、状態制御回路4によつ
てタイマーのスタートが指示されている場合は、
システムの動作中及び動作停止中に係わらず基準
信号発生回路1から出力される基準の周波数信号
を計数し、設定されたタイマー時間が経過すると
信号TIMEROUTを出力する。更に、割り込み
INT0の発生が設定された状態でタイマーのスタ
ートが指示されると、定期的に割り込み信号
INT0を出力する。
Timer counter 5 is the instruction bus
The timer time can be set depending on the program sent to the IB, and if the state control circuit 4 instructs to start the timer,
The reference frequency signal output from the reference signal generation circuit 1 is counted regardless of whether the system is in operation or stopped, and when the set timer time elapses, the signal TIMEROUT is output. Furthermore, interrupt
When the timer is instructed to start with INT0 generation set, an interrupt signal is periodically generated.
Output INT0.

クロノグラフカウンター6は1/100秒のパルス
を計数するカウンタであり、クロノグラフのスタ
ート中は、システムの動作中及び動作停止中に係
わらず、1/10秒毎に割り込み信号INT1を出力す
る。またクロノグラフカウンタ6のカウント内容
はクロノデータバスCDBを介してデコーダ15
に印加される。
The chronograph counter 6 is a counter that counts pulses of 1/100 seconds, and while the chronograph is starting, it outputs an interrupt signal INT1 every 1/10 second, regardless of whether the system is in operation or stopped. In addition, the count contents of the chronograph counter 6 are sent to the decoder 15 via the chronograph data bus CDB.
is applied to

ROM7は1392×14ビツトから成り、計時動作
及び各部制御等を行なうためのプログラムが固定
的に書き込まれたものであり、11ビツトのプログ
ラムカウンタ8に依つて指定されるアドレスに書
き込まれた14ビツトから成る命令コードをインス
トラクシヨンレジスタ10に出力する。インスト
ラクシヨンレジスタ10はROM7から出力され
た命令コードを記憶しインストラクシヨンバス
IBに出力する。プログラムカウンタ8は1命令
の処理が済むと次のアドレスあるいはジヤンプ制
御信号を受けてジヤンプ先のアドレス信号を
ROM7に出力する。スタツク9は8レベルの容
量を有し、割り込み処理あるいはサブルーチンへ
移行する場合にプログラムカウンタ8の内容に1
が加算されたものを記憶する。しかしクロツクジ
エネレータ2の動作を停止するための命令
“SCP”が実行された後、割り込み処理を行なう
場合にはプログラムカウンタ8の内容はそのまま
スタツク9に記憶され、割り込み処理終了後は再
びクロツクの停止命令“SCP”が実行される。
The ROM 7 consists of 1392 x 14 bits, in which programs for timekeeping operations and control of various parts are written in a fixed manner. An instruction code consisting of the following is output to the instruction register 10. The instruction register 10 stores the instruction code output from the ROM 7 and is connected to the instruction bus.
Output to IB. After processing one instruction, the program counter 8 receives the next address or jump control signal and outputs the jump destination address signal.
Output to ROM7. Stack 9 has a capacity of 8 levels, and when proceeding to interrupt processing or a subroutine, the contents of program counter 8 are set to 1.
The added value is memorized. However, after the instruction "SCP" to stop the operation of the clock generator 2 is executed, when interrupt processing is performed, the contents of the program counter 8 are stored as they are in the stack 9, and after the interrupt processing is completed, the clock is restarted. The stop command “SCP” is executed.

RAM14は84×4ビツトから成り、現在時
刻、アラーム時刻、タイマー時刻等のデータが所
定の領域に記憶される。RAM14のアドレスは
インストラクシヨンに依つて指定され、送出命令
あるいは書き込み命令に依り、指定されたアドレ
スに記憶されたデータをデータバスDBに送出
し、あるいはデータバスDBに送出されたデータ
を指定されたアドレスに記憶する。ALU12は
データバスDBに送出されたデータを入力し、加
減算等の処理を行ないその結果をACC13に記
憶させ、再びデータバスDBに送出する。
The RAM 14 consists of 84×4 bits, and data such as current time, alarm time, timer time, etc. is stored in a predetermined area. The address of the RAM 14 is specified by an instruction, and the data stored at the specified address is sent to the data bus DB, or the data sent to the data bus DB is specified by a send command or a write command. The address is saved. The ALU 12 inputs the data sent to the data bus DB, performs processing such as addition and subtraction, stores the results in the ACC 13, and sends the data to the data bus DB again.

デコーダ15及びラツチ回路16は表示回路を
構成し、デコーダ15は印加された4ビツトのデ
ータを表示のための7個のセグメント信号に変換
しセグメントバスSBに出力する。ラツチ回路1
6はセグメントバスSBに出力されたセグメント
信号を記憶保持し外部端子a〜gに出力するもの
であり、表示要素の数だけ設けられている。変換
されたセグメント信号をどのラツチ回路16に記
憶させるかはプログラムに依つて指定されるもの
であり、例えば現在時刻の秒の第1桁目のデータ
を変換した場合には、その秒の第1桁目を表示す
べき表示素子に対応するラツチ回路16をプログ
ラムで指定する。一方デコーダ15にはデータバ
スDBの他にクロノグラフカウンタ6からの出力
クロノデータバスCDBが印加されており、プロ
グラムに依つてデータバスDBあるいはクロノデ
ータバスCDBのいずれかを切り換え選択できる。
The decoder 15 and the latch circuit 16 constitute a display circuit, and the decoder 15 converts the applied 4-bit data into 7 segment signals for display and outputs them to the segment bus SB. Latch circuit 1
Reference numeral 6 stores and holds the segment signals output to the segment bus SB and outputs them to external terminals a to g, and there are as many as the number of display elements. Which latch circuit 16 is to store the converted segment signal is specified by the program. For example, when converting the data of the first digit of the second of the current time, the latch circuit 16 stores the converted segment signal. The latch circuit 16 corresponding to the display element on which the digit is to be displayed is specified by the program. On the other hand, in addition to the data bus DB, the output chronograph data bus CDB from the chronograph counter 6 is applied to the decoder 15, and either the data bus DB or the chronograph data bus CDB can be switched and selected depending on the program.

制御回路11はインストラクシヨンバスIBに
送出されたROM7の命令を解読し、その命令に
相当する動作を行なわせるために各回路をクロツ
クジエネレータ2から出力されるシステムクロツ
クで制御するものであり、更に割り込み信号
INT0、1、2、3が出力された時その割り込み
に対応した処理を行なう様プログラムカウンタ8
及びROM7を制御する。即ち、制御回路11
は、通常の動作状態に於いては、プログラムカウ
ンタ8の内容に順次1を加算してプログラムを先
に進め、また、動作状態に於いて割り込みが発生
した場合には、そのときのプログラムカウンタ8
の内容に1を加算した値をスタツク9に記憶さ
せ、割り込み信号INT0、1、2、3に対応する
アドレスをプログラムカウンタ8にセツトし、割
り込み処理が終了すると、スタツク9に記憶され
た値を再びプログラムカウンタ8にセツトするこ
とによつてプログラムが順次先に進む様に制御す
る。一方、クロツク停止命令“SCP”が実行され
てクロツクジエネレータ2が動作を停止している
状態に於いて、割り込み以外の要因でクロツクジ
エネレータ2の動作が再開した場合には、そのと
きプログラムカウンタ8に保持されている内容、
即ち、動作の停止の原因となつたクロツク停止命
令“SCP”が記憶されているアドレスを指定する
値、に1を加算し、プログラムを先に進めるが、
割り込みが発生した場合には、そのときのプログ
ラムカウンタ8の内容をそのままスタツク9に記
憶させ、割り込み信号INT0、1、2、3に対応
するアドレスをプログラムカウンタ8にセツト
し、割り込み処理の終了後にスタツク9に記憶さ
れた値をプログラムカウンタ8にセツトすること
により、再び、クロツク停止命令“SCP”が実行
され、クロツクジエネレータ2の動作が停止する
様プログラムカウンタ8を制御する。
The control circuit 11 decodes the instructions from the ROM 7 sent to the instruction bus IB and controls each circuit using the system clock output from the clock generator 2 in order to perform the operation corresponding to the instruction. and further interrupt signal
Program counter 8 performs processing corresponding to the interrupt when INT0, 1, 2, or 3 is output.
and controls ROM7. That is, the control circuit 11
In the normal operating state, the program advances the program by sequentially adding 1 to the contents of the program counter 8, and if an interrupt occurs in the operating state, the program counter 8 at that time is
The value obtained by adding 1 to the contents of is stored in stack 9, and the addresses corresponding to interrupt signals INT0, 1, 2, and 3 are set in program counter 8. When the interrupt processing is completed, the value stored in stack 9 is stored. By setting the program counter 8 again, the program is controlled to advance in sequence. On the other hand, if the clock generator 2 restarts due to a factor other than an interrupt while the clock generator 2 has stopped operating due to the execution of the clock stop instruction "SCP", then The contents held in the program counter 8,
In other words, 1 is added to the value specifying the address where the clock stop instruction "SCP" that caused the operation to stop is stored, and the program proceeds.
When an interrupt occurs, the contents of the program counter 8 at that time are stored as they are in the stack 9, the addresses corresponding to the interrupt signals INT0, 1, 2, and 3 are set in the program counter 8, and the contents are stored after the interrupt processing is completed. By setting the value stored in the stack 9 in the program counter 8, the clock stop command "SCP" is executed again, and the program counter 8 is controlled so that the operation of the clock generator 2 is stopped.

第2図は第1図に示されたクロツクジエネレー
タ2の回路図である。カウンタ18はフリツプフ
ロツプが3段接続された構成であり、各段の出力
T1、T22、T33が取り出され、適宜NOR
ゲート19〜22に接続されている。またカウン
タ18の入力端子INには基準信号発生回路1か
らの分周出力φ1がNORゲート23を介して印加
される一方のNORゲート24,25がフリツプ
フロツプを構成し、NORゲート24の出力は
NORゲート23及びORゲート26に印加され、
ORゲート26の出力はカウンタ18のリセツト
端子Rに印加されている。NORゲート25には
状態制御回路4から出力される停止信号
CLKSTOPが印加され、NORゲート24には割
り込み信号INT0、1、2、3及び動作開始信号
CLKSTART、タイマー出力TIMEROUT更に
は電源印加時出力されるイニシヤル信号MRが印
加される。イニシヤル信号MRはORゲート26
にも印加されている。NORゲート23の出力、
カウンタ18の出力T1及びNORゲート19〜2
2の出力はシステムを動作させるためのクロツク
CLK1〜6として出力される。
FIG. 2 is a circuit diagram of clock generator 2 shown in FIG. The counter 18 has a configuration in which three stages of flip-flops are connected, and the output of each stage is
T 1 , T 2 , 2 , T 3 , 3 are taken out and NORed accordingly
Connected to gates 19-22. Further, the divided output φ1 from the reference signal generation circuit 1 is applied to the input terminal IN of the counter 18 via the NOR gate 23.NOR gates 24 and 25 constitute a flip-flop, and the output of the NOR gate 24 is
applied to the NOR gate 23 and the OR gate 26,
The output of OR gate 26 is applied to reset terminal R of counter 18. The NOR gate 25 receives a stop signal output from the state control circuit 4.
CLKSTOP is applied, and the NOR gate 24 receives interrupt signals INT0, 1, 2, 3 and an operation start signal.
CLKSTART, timer output TIMEROUT, and an initial signal MR that is output when power is applied are applied. Initial signal MR is OR gate 26
is also applied. The output of NOR gate 23,
Output T1 of counter 18 and NOR gates 19-2
The output of 2 is the clock to operate the system.
Output as CLK1-6.

電源印加時イニシヤル信号MRが印加されると
カウンタ18及びフリツプフロツプがリセツトさ
れる。よつてNORゲート24の出力は“0”と
なり、分周信号φ1はNORゲート23を介してカ
ウンタ18に印加され、カウンタ18が動作を開
始し、システムクロツクCLK1〜6が出力され
る。一方動作停止命令“SCP”が実行されると状
態制御回路4より出力される停止信号
CLKSTOPに依りフリツプフロツプはセツトさ
れ、NORゲート24の出力は“1”となるので
カウンタ18はリセツトされ、NORゲート23
は分周出力φ1を遮断する。よつてシステムクロ
ツクCLK1〜6は出力されなくなり、システム
の動作が停止される。そしてシステムの動作が停
止している状態でも基準信号発生回路1が動作す
ることによつて発生する割り込み信号INT0、
INT1、INT2、及び、タイマー出力
TIMEROUT、あるいは、外部から入力される
キースイツチ信号に従つて発生する割り込み信号
INT3及び動作開始信号CLKSTARTのいずれか
の出力によりフリツプフロツプはリセツトされ、
NORゲート24の出力は“0”となる。従つて
カウンタ18は再び動作を開始し、システムクロ
ツクCLK1〜6が出力されシステムが動作し始
める。しかし割り込み信号INT0、1、2、3で
動作が開始した場合には、割り込み処理終了後に
再び停止命令“SCP”が実行され、停止信号
CLKSTOPが出力されるため動作は再び停止す
る。よつて必要な動作のみが行なわれその他の場
合には動作が停止している。
When the initial signal MR is applied when power is applied, the counter 18 and the flip-flop are reset. Therefore, the output of the NOR gate 24 becomes "0", the divided signal .phi.1 is applied to the counter 18 via the NOR gate 23, the counter 18 starts operating, and the system clocks CLK1-6 are output. On the other hand, when the operation stop command “SCP” is executed, a stop signal is output from the state control circuit 4.
The flip-flop is set by CLKSTOP, and the output of NOR gate 24 becomes "1", so counter 18 is reset, and NOR gate 23
cuts off the divided output φ1. Therefore, system clocks CLK1 to CLK6 are no longer output, and the system operation is stopped. An interrupt signal INT0 is generated when the reference signal generation circuit 1 operates even when the system operation is stopped.
INT1, INT2 and timer output
Interrupt signal generated according to TIMEROUT or key switch signal input externally
The flip-flop is reset by the output of either INT3 or operation start signal CLKSTART.
The output of the NOR gate 24 becomes "0". Therefore, the counter 18 starts operating again, system clocks CLK1-6 are outputted, and the system starts operating. However, if the operation starts with interrupt signals INT0, 1, 2, and 3, the stop command "SCP" is executed again after the interrupt processing is completed, and the stop signal
Operation stops again because CLKSTOP is output. Therefore, only necessary operations are performed, and operations are stopped in other cases.

第3図及び第4図はROM7に書き込まれるプ
ログラムの例を示すフローチヤートであり、第2
図はメインプログラム、第3図は割り込み処理の
プログラムを示す。第3図及び第4図を用いて動
作を説明する。
3 and 4 are flowcharts showing examples of programs written to the ROM 7, and the second
The figure shows the main program, and FIG. 3 shows the interrupt processing program. The operation will be explained using FIGS. 3 and 4.

先ず電源が印加されるとイニシヤルクリアが働
き各回路はリセツトされ、プログラムカウンタ8
はROM7の0番地を指定する。0番地からは初
期設定のためのプログラムが書き込まれており、
このプログラムの実行に依りRAM14内には
“0”あるいは所定のデータが記憶され初期設定
がされる。次にモードチエンジのプログラムが実
行される。このプログラムはスイツチ入力回路3
からスイツチの開閉を示すデータをデータバス
DBを介して入力し、そのデータの内容に依り現
在時刻モード、アラームモード、タイマーモード
あるいはクロノグラフモード更に他に機能が設け
られていればそのモードのいずれが選択されてい
るのかを判定すると共に各モードに於いて修正モ
ードであるか判定し、各モードに対応するRAM
14内のフラツグをセツトする。そして選択され
たプログラムが書き込まれたROM7の所定アド
レスを指定し、そこへプログラムはジヤンプす
る。本実施例ではモード選択を外部端子M1〜M4
及びS4に接続されたスイツチ(このスイツチを
各々MS1〜MS4及びSW4とする)で行ない、また
外部端子S1〜S3に接続されたスイツチ(このスイ
ツチを各々SW1〜SW3とする)で修正の実行、ラ
ンプ点灯及びアラームを音停止を行なう様プログ
ラムされている。しかし2個〜4個程度の任意の
スイツチを用いてモード選択あるいはその他の動
作を行なわせる様にすることはプログラムの変更
で容易に出来る。
First, when power is applied, initial clear is activated, each circuit is reset, and the program counter 8 is reset.
specifies address 0 of ROM7. Starting from address 0, a program for initial settings is written.
By executing this program, "0" or predetermined data is stored in the RAM 14 and initial settings are made. Next, a mode change program is executed. This program is switch input circuit 3
Data indicating whether the switch is open or closed is transferred from the data bus.
Input via DB, and depending on the content of the data, determine whether current time mode, alarm mode, timer mode or chronograph mode is selected, and if other functions are provided, which mode is selected. Determine whether each mode is a correction mode and check the RAM corresponding to each mode.
Set the flag in 14. Then, a predetermined address of the ROM 7 in which the selected program is written is specified, and the program jumps there. In this example, mode selection is performed using external terminals M1 to M4.
and the switches connected to the external terminals S 1 to S 4 (these switches are referred to as MS 1 to MS 4 and SW 4 , respectively), and the switches connected to the external terminals S 1 to S 3 (these switches are referred to as SW 1 to SW 3 , respectively). It is programmed to perform corrections, turn on lamps, and silence alarms. However, by changing the program, it is possible to use two to four arbitrary switches to select a mode or perform other operations.

現在時刻モードの場合、先ず現在時刻表示が行
なわれる。これはRAM14のアドレス指定が行
なえる表示命令に依つて、RAM14内の所定ア
ドレスに各桁毎に記憶された秒、分、時、月、
日、曜日を順次アドレス指定し、そのデータがデ
ータバスDBに送出される。そしてデコーダ15
で変換されたセグメント信号を表示すべきラツチ
回路16に記憶させる。この時デコーダ15には
予めデータバスDBが接続される様に命令で制御
しておく。特に時の表示の場合には12時間制表示
あるいは24時間制表示のいずれが選択されている
かを判定し、その表示に合つた処理をプログラム
に依つてALU12で行ないその結果をデコーダ
15に印加して表示する。一方曜日表示の場合に
はデコーダ15の機能を曜日変換用に命令に依つ
て切り換えてから曜日のデータを印加する。ラツ
チ回路16は記憶されセグメント信号を次に新し
いセグメントデータが書き変えられるまで外部端
子a〜gに出力し続けるので、クロツクジエネレ
ータ2の動作が停止しても表示は為される。
In the current time mode, the current time is first displayed. This displays the seconds, minutes, hours, months, etc. stored in each digit at a predetermined address in the RAM 14, depending on the display command that allows address specification of the RAM 14.
The day and day of the week are sequentially addressed and the data is sent to the data bus DB. and decoder 15
The converted segment signal is stored in the latch circuit 16 to be displayed. At this time, the decoder 15 is controlled in advance by a command so that the data bus DB is connected. In particular, in the case of hour display, it is determined whether 12-hour display or 24-hour display is selected, the ALU 12 performs processing appropriate for the display according to the program, and the result is applied to the decoder 15. to be displayed. On the other hand, in the case of displaying the day of the week, the function of the decoder 15 is switched according to a command for converting the day of the week, and then data on the day of the week is applied. Since the latch circuit 16 continues to output the stored segment signal to the external terminals a to g until the next new segment data is rewritten, a display is made even if the clock generator 2 stops operating.

上述の様に表示が行なわれると、次にRAM1
4内の修正モードであるか否かを示すフラツグの
判定を行ない、通常表示モードであればスイツチ
SW1の閉成、修正モードであればスイツチSW1
の閉成を設定する。即ちこの命令の実行に依り
状態制御回路4はスイツチ制御信号SWCONを出
力しスイツチ入力回路3を制御して指定されたス
イツチの指定された動作、即ちスイツチSW1の閉
成あるいはスイツチSW13の閉成が為されたと
きだけ動作開始信号CLKSTARTが出力される
様に制御する。スイツチの設定が完了すると次に
クロツクジエネレータ2の動作を停止させるため
の命令“SCP”が実行される。この命令コードが
インストラクシヨンバスIBに送出され状態制御
回路4に印加されると状態制御回路4は停止信号
CLKSTOPを出力し、クロツクジエネレータ2
内のフリツプフロツプをセツトする。このフリツ
プフロツプのセツトに依り基準信号発生回路1か
らの分周信号を遮断しシステムクロツクの発生が
停止される。従つてプログラムの実行は停止命令
“SCP”のまま次に進まず、プログラムに依る動
作はすべて停止している。よつてこの間はシステ
ムに流れる電流は激減する。
After the display is performed as described above, RAM1
4, which indicates whether the mode is in correction mode or not, and if it is in normal display mode, the switch is turned on.
Closing SW 1 , if in correction mode, switch SW 1 ~
Set the closure of 3 . That is, upon execution of this command, the state control circuit 4 outputs the switch control signal SWCON, controls the switch input circuit 3, and performs the specified operation of the specified switch, that is, closing switch SW 1 or switching switches SW 1 to 3. Control is performed so that the operation start signal CLKSTART is output only when the closing is performed. When the switch settings are completed, a command "SCP" for stopping the operation of the clock generator 2 is executed. When this instruction code is sent to the instruction bus IB and applied to the state control circuit 4, the state control circuit 4 sends a stop signal.
Output CLKSTOP and clock generator 2
Set the flip-flop inside. By setting this flip-flop, the divided signal from the reference signal generating circuit 1 is cut off, and generation of the system clock is stopped. Therefore, the execution of the program does not proceed to the next step with the stop command "SCP", and all operations based on the program are stopped. Therefore, during this time, the current flowing through the system is drastically reduced.

再びクロツクジエネレータ2の動作が開始され
るのは指定されたスイツチの動作が為された場
合、割り込み要求INT0、1、2、3があつた場
合及びタイマーカウンタ5がカウントアツプした
場合であり、クロツクジエネレータ2のフリツプ
フロツプはそれらの信号でリセツトされる。割り
込みの場合にはクロツクジエネレータ2の動作は
開始するが、プログラムカウンタ8の内容即ち停
止命令“SCP”をアドレスする内容がスタツク9
に退避し、第4図に示された割り込み処理プログ
ラムを示すアドレスがプログラムカウンタ8にセ
ツトされる。そして割り込み処理が終了するとス
タツク9に退避したアドレスがプログラムカウン
タ8にセツトされるため再び停止命令“SCP”が
実行され動作が停止する。一方指定されたスイツ
チの動作が為されるとスイツチ入力回路3は動作
開始信号CLKSTARTを出力し、またタイマー
カウンタ5はカウントアツプするとタイマー出力
TIMEROUTを出力する。これら出力に依りク
ロツクジエネレータ2のフリツプフロツプはリセ
ツトされ動作が再開し、プログラムは次に進む。
The clock generator 2 starts operating again when a specified switch is activated, when an interrupt request INT0, 1, 2, or 3 is received, or when the timer counter 5 counts up. , the flip-flops of clock generator 2 are reset by these signals. In the case of an interrupt, the operation of the clock generator 2 starts, but the contents of the program counter 8, that is, the contents that address the stop instruction "SCP" are stored in the stack 9.
The address indicating the interrupt processing program shown in FIG. 4 is set in the program counter 8. When the interrupt processing is completed, the address saved in the stack 9 is set in the program counter 8, so the stop instruction "SCP" is executed again and the operation is stopped. On the other hand, when the specified switch operation is performed, the switch input circuit 3 outputs the operation start signal CLKSTART, and when the timer counter 5 counts up, the timer output is output.
Output TIMEROUT. These outputs reset the flip-flop of clock generator 2 to resume operation and the program proceeds to the next step.

次のプログラムはRAM14内のモードチエン
ジフラツグを調べモードチエンジ要求があるか否
か判定する。モードチエンジ要求ならば前述した
モードチエンジのプログラムにジヤンプし、要求
がないならば次のプログラムに進む。モードチエ
ンジフラツグをセツトあるいはリセツトするのは
割り込み処理INT0で行なわれる。INT0は後述
するが、モードを選択するスイツチMS1〜MS4
びSW4の状態を定期的に調べモードチエンジなら
ばそのフラツグを“1”とし、タイマーカウンタ
5をスタートさせている。従つてモードチエンジ
要求のときにタイマー出力TIMEROUTを用い
てクロツクジエネレータ2を動作させモードチエ
ンジを行なうのである。
The next program checks the mode change flag in the RAM 14 and determines whether there is a mode change request. If a mode change is requested, the program jumps to the mode change program described above, and if there is no request, the program proceeds to the next program. The mode change flag is set or reset by interrupt processing INT0. As will be described later, INT0 periodically checks the states of switches MS 1 to MS 4 and SW 4 for selecting the mode, sets the flag to "1" and starts the timer counter 5 if the mode is to be changed. Therefore, when a mode change is requested, the timer output TIMEROUT is used to operate the clock generator 2 to perform the mode change.

一方モードチエンジ要求がない場合は指定され
たスイツチの動作が為された場合であり、次のプ
ログラムに依つて修正モードであるか否か、スイ
ツチSW1〜SW3のいずれが閉成されたかを判定
し、その操作に対応する処理を行なう。例えば通
常モードでスイツチSW1が閉成された場合にはラ
ンプ点灯の命令を実行し、状態制御回路11の外
部端子LAMPを“1”とし、次の命令でスイツ
チSW1の開成を指定しクロツクの停止命令
“SCP”を実行する。そしてスイツチSW1が開成
されると前述の如く動作が再び開始し、ランプ消
灯の命令が実行され、再びスイツチ設定のプログ
ラムにジヤンプする。また修正モードに於いてス
イツチSW1が閉成された場合にはRAM14内に
記憶された秒のデータを“0”に書き変える。こ
のとき29秒か30秒かを判定して30秒以上であれば
折上げ処理を行なう。スイツチSW2あるいはスイ
ツチSW3が閉成された場合にはRAM14内の時
あるいは分をALU12に転送し1を加算し再び
RAM14に書き込む。更にスイツチSW2あるい
はSW3が閉成され続けられている場合には早送り
修正とする。この場合にもスイツチ動作の指定と
クロツクの動作停止命令“SCP”を用いて行う。
即ち、タイマーカウンタ5を1秒に設定してスタ
ートさせ次にスイツチSW2及びSW3の開成を指定
した後停止命令“SCP”を実行する。従つてクロ
ツクジエネレータ2が動作開始するのはスイツチ
SW2あるいはSW3が開成された場合とタイマーカ
ウンタ5が1秒計数した場合であり、動作開始後
のプログラムでスイツチSW2あるいはSW3を判定
することに依り一定時間閉成されていたか否かが
判別でき、閉成の場合にはRAM14内の時ある
いは分に1を加算した後タイマーカウンタ5に
250msを設定し再びスイツチSW2及びSW3の開
成を指定するプログラムにジヤンプする。これに
依り250ms毎にスイツチSW2あるいはSW3が開
成されるまで加算され早送りされる。その修正の
プログラムに於いて秒のリセツト、分あるいは時
の加算処理が行なわれると表示命令に依つて修正
されたデータが直ちにデータバスDBに送出され
表示される。スイツチSW2及びSW3が開成される
と修正のプログラムから前述したスイツチ設定の
プログラムにジヤンプする。
On the other hand, if there is no mode change request, it means that the specified switch has been operated, and the next program will determine whether it is in the correction mode or not and which of switches SW 1 to SW 3 has been closed. It makes a judgment and performs the processing corresponding to the operation. For example, when switch SW 1 is closed in the normal mode, a command to turn on the lamp is executed, the external terminal LAMP of the state control circuit 11 is set to "1", and the next command specifies opening of switch SW 1 and the clock is turned on. Executes the stop command “SCP”. When the switch SW1 is opened, the operation starts again as described above, the command to turn off the lamp is executed, and the program jumps to the switch setting program again. Further, when the switch SW1 is closed in the correction mode, the second data stored in the RAM 14 is rewritten to "0". At this time, it is determined whether it is 29 seconds or 30 seconds, and if it is 30 seconds or more, the folding process is performed. When switch SW 2 or switch SW 3 is closed, the hour or minute in RAM 14 is transferred to ALU 12, incremented by 1, and again.
Write to RAM14. Furthermore, if switch SW 2 or SW 3 continues to be closed, fast forward correction is performed. In this case as well, the switch operation is designated and the clock operation stop command "SCP" is used.
That is, the timer counter 5 is set to 1 second and started, and after designating the opening of switches SW 2 and SW 3 , the stop command "SCP" is executed. Therefore, clock generator 2 starts operating at the switch.
This is the case when SW 2 or SW 3 is opened and the timer counter 5 counts 1 second, and it is determined whether switch SW 2 or SW 3 has been closed for a certain period of time by determining in the program after the operation starts. can be determined, and if it is closed, add 1 to the hour or minute in RAM 14 and then write it to timer counter 5.
Set 250ms and jump to the program that specifies opening of switches SW 2 and SW 3 again. As a result, the values are added and fast-forwarded every 250 ms until switch SW 2 or SW 3 is opened. When the correction program performs the process of resetting seconds and adding minutes or hours, the data corrected by the display command is immediately sent to the data bus DB and displayed. When switches SW 2 and SW 3 are opened, the program jumps from the modification program to the switch setting program described above.

アラームモード、タイマーモード及びクロノグ
ラフモードも前述の現在時刻モードと同様のパタ
ーンでプログラムされている。
Alarm mode, timer mode, and chronograph mode are also programmed in the same pattern as the current time mode described above.

アラームモードになると表示命令に依つて
RAM14のアラーム時刻の記憶されているアド
レスのデータを桁毎に順次指定し表示する。スイ
ツチの指定はアラーム設定モードではスイツチ
SW13の閉成を指定し、アラーム表示モードで
はスイツチSW1の閉成を指定し、動作停止命令
“SCP”を実行する。モードチエンジ要求がなく
指定されたスイツチの閉成が為されるとアラーム
時刻設定、表示及びランプ点滅プログラムに進
む。アラームモードの場合スイツチSW1が閉成さ
れるとアラーム設定モードであつてもランプ点灯
命令、スイツチSW1の開成指定及び動作停止命令
“SCP”が実行され、動作開始後ランプ消灯命令
を実行することに依りランプの点灯及び消灯が為
される。一方スイツチSW2又はSW3が閉成された
場合はアラーム時刻設定モードであり、アラーム
時刻の分又は時の設定が為される。このプログラ
ムは現在時刻の修正プログラムと同じものが用い
られ、加算処理を行なうプログラムをサブルーチ
ンとし、アラーム時刻の時又は分を記憶する
RAM14のアドレスを指定する様プログラムし
ておく。もちろん設定された内容は直ちに表示命
令で表示される。
When in alarm mode, depending on the display command
The data at the address where the alarm time is stored in the RAM 14 is sequentially designated and displayed digit by digit. The switch can be specified in alarm setting mode.
Specify the closing of SW 1 to 3 , specify the closing of switch SW 1 in alarm display mode, and execute the operation stop command “SCP”. If there is no mode change request and the specified switch is closed, the program proceeds to alarm time setting, display and lamp blinking programs. In the alarm mode, when switch SW 1 is closed, the lamp lighting command, switch SW 1 open designation, and operation stop command "SCP" are executed even in the alarm setting mode, and after the operation starts, the lamp extinguishing command is executed. Depending on the situation, the lamp is turned on and off. On the other hand, when the switch SW 2 or SW 3 is closed, the mode is the alarm time setting mode, and the minute or hour of the alarm time is set. This program uses the same program as the current time correction program, and uses the addition process as a subroutine to memorize the hour or minute of the alarm time.
Program it to specify the address of RAM14. Of course, the set contents are immediately displayed by a display command.

タイマーモードの場合も同様にタイマー時間表
示プログラム、スイツチ設定プログラム及び動作
停止命令“SCP”が順次実行される。この場合の
タイマーはタイマーカウンタ5ではなく、RAM
14内に記憶された秒、分、時のタイマーであ
る。従つて表示命令はRAM14内のタイマーを
アドレスする。タイマーモードの場合には修正モ
ードは無く、スイツチ設定のときにはアラーム音
発生を行なうか否かを判定し、アラーム音を発生
するときはスイツチSW1〜SW3の閉成を設定し、
アラーム音の発生しないときはスイツチSW1の閉
成のみを設定する。動作が再開してモードチエン
ジがなければプログラムはタイマー時間設定、表
示、スタート、ストツプ及びランプ点滅プログラ
ムに進む。スイツチSW1が閉成されたときアラー
ム音を発生しないモードであればランプの点灯及
び消灯を現在時刻モード、アラームモードの場合
と同様にランプ点滅プログラムで行なう。一方ア
ラーム音を発生するモードでスイツチSW2又は
SW3が閉成されると分又は時が修正プログラムに
依つて修正される。またアラーム音を発生するモ
ードでスイツチSW1が閉成されると、タイマーが
セツトされている場合にはタイマースタート用の
フラツグをRAM14内にセツトし、タイマーが
セツトされていない場合には何も行なわずにスイ
ツチ設定にジヤンプする。
In the timer mode, the timer time display program, switch setting program, and operation stop command "SCP" are similarly executed in sequence. In this case, the timer is not timer counter 5, but RAM
It is a timer with seconds, minutes, and hours stored in 14. The display command therefore addresses a timer in RAM 14. In the timer mode, there is no correction mode, and when setting the switch, it is determined whether or not to generate an alarm sound, and when the alarm sound is to be generated, switches SW 1 to SW 3 are set to close.
When the alarm sound does not occur, only set switch SW 1 to close. If the operation resumes and there is no mode change, the program proceeds to the timer time setting, display, start, stop and lamp flashing programs. If the mode does not generate an alarm sound when the switch SW 1 is closed, the lamp is turned on and off using the lamp blinking program in the same way as in the current time mode and alarm mode. On the other hand, switch SW 2 or
When SW 3 is closed, the minutes or hours are corrected by the correction program. Also, when switch SW 1 is closed in a mode that generates an alarm sound, a flag for starting the timer is set in the RAM 14 if the timer is set, and nothing is done if the timer is not set. Jump to the switch setting without doing so.

クロノグラフモードの場合のクロノ表示は先ず
RAM14内のクロノグラフ時間の1/10秒、秒、
分、時を順次表示命令で表示し、更にデータバス
DBとクロノデータバスCDBの切ら換え命令でデ
コーダ15にクロノデータバスCDBを切り換え
ることに依り、クロノグラフカウンタ6の1/100
秒のデータが表示される。この様に直接1/100秒
のデーダをデコーダ15に印加するのはプログラ
ムで桁毎に表示を行なつていたのでは処理時間が
長く1/100秒のデータに追従することができず正
確な表示ができないからである。
The chronograph display in chronograph mode is
1/10 second of the chronograph time in RAM14, second,
The minutes and hours are displayed sequentially using the display command, and the data bus
1/100 of the chronograph counter 6 by switching the chronograph data bus CDB to the decoder 15 with a switching command between DB and the chronograph data bus CDB.
Second data is displayed. Directly applying 1/100 second data to the decoder 15 in this way would require a long processing time and would not be able to track 1/100 second data, which would result in inaccurate data display. This is because it cannot be displayed.

スイツチ設定ではスイツチSW1及び2の閉成が
設定される。スイツチSW1又は2が閉成されると
動作が開始してブログラムが先に進むが、クロノ
グラフモードの場合にはプログラムとは無関係に
スイツチ入力回路3からクロノグラフ制御信号
CHRCONが出力されクロノグラフカウンタ6を
制御する。即ちスイツチSW1の閉成で出力される
クロノグラフ制御信号CHRCONに依りクロノグ
ラフカウンタ6内のスタート及びストツプを生後
するフリツプフロツプがセツト又はリセツトさ
れ、スイツチSW2の閉成で出力されるクロノグラ
フ制御信号CHRCONは1/100秒のラツプを表示
させるためのラツプフラツグ用フリツプフロツプ
をセツトまたはリセツトする。
In the switch setting, switches SW 1 and 2 are set to close. When switch SW 1 or 2 is closed, the operation starts and the program advances, but in the case of chronograph mode, the chronograph control signal is sent from the switch input circuit 3 regardless of the program.
CHRCON is output and controls the chronograph counter 6. That is, the flip-flop that generates start and stop in the chronograph counter 6 is set or reset by the chronograph control signal CHRCON outputted when switch SW 1 is closed, and the chronograph control signal CHRCON outputted when switch SW 2 is closed. Signal CHRCON sets or resets the lap flag flip-flop for displaying 1/100 second laps.

一方プログラムはクロノグラフカウンタ6がス
タートしているか否か、またラツプ状態にあるか
否かをクロノグラフカウンタ6内のフリツプフロ
ツプ及びラツプフラツグ用のフリツプフロツプを
調べ、RAM14内のクロノストツプフラツグ及
びラツプフラツグをセツト又はリセツトする。更
にクロノグラフカウンタ6のリセツト状態に於い
てスイツチSW2が閉成されラツプフラツグがセツ
トされたときはRAM14内のクロノグラフのデ
ータをリセツトする。このプログラムの終りに
RAM14内のクロノグラフデータを表示命令で
表示し、スイツチ設定にジヤンプする。尚クロノ
グラフカウンタ6から1/100毎に出力される割り
込み信号INT1に依りRAM14内のクロノグラ
フデータに加算処理が為される。
On the other hand, the program checks the flip-flops in the chronograph counter 6 and the flip-flops for the wrap flag to see if the chronograph counter 6 has started or is in the wrap state, and sets the chrono stop flag and wrap flag in the RAM 14. Or reset. Further, when the switch SW 2 is closed and the wrap flag is set while the chronograph counter 6 is in the reset state, the chronograph data in the RAM 14 is reset. At the end of this program
Display the chronograph data in RAM14 using the display command and jump to the switch setting. Incidentally, addition processing is performed on the chronograph data in the RAM 14 according to the interrupt signal INT1 output from the chronograph counter 6 every 1/100.

第4図に示された割り込み処理INT0は一定時
間例えば62.5ms毎にかかるものであり、スイツ
チMS1〜MS4及びSW4のサンプリングを行なう。
即ちスイツチMS1〜MS4及びSW4のデータをスイ
ツチ入力回路3から入力してRAM14内に記憶
させ、前回にサンプリングしたデータと比較す
る。その結果変化が無い場合はRAM14内のモ
ードチエンジフラツグをリセツトしてメインプロ
グラムにリターンし、変化がある場合にはモード
チエンジフラツグをセツトし且つタイマーカウン
タ5を32msにセツトしスタートさせてリターン
する。
The interrupt processing INT0 shown in FIG. 4 takes a certain period of time, for example, every 62.5 ms, and samples the switches MS 1 to MS 4 and SW 4 .
That is, the data of the switches MS 1 to MS 4 and SW 4 are inputted from the switch input circuit 3, stored in the RAM 14, and compared with the data sampled last time. If there is no change as a result, reset the mode change flag in RAM 14 and return to the main program; if there is a change, set the mode change flag and timer counter 5 to 32ms, start it, and return. do.

割り込み処理INT1はクロノグラフカウンタ6
がスタートしているとき1/10秒毎にかかるもので
ある。この処理はRAM14内のクロノグラフデ
ータの1/10秒データに1を加算し、キヤリーがあ
ればクロノグラフの秒データに桁上げし更にキヤ
リーがあればその上位桁にと順次桁上げ処理を行
なう。次にクロノモードで且つラツプ状態でなけ
ればクロノグラフのデータを表示命令で表示しメ
インプログラムにリターンする。
Interrupt processing INT1 is chronograph counter 6
It takes every 1/10 second when is starting. This process adds 1 to the 1/10 second data of the chronograph data in RAM 14, and if there is a carry, it is carried to the chronograph second data, and if there is a carry, it is carried to the upper digit, and so on. . Next, if the chronograph mode is not in the lap state, the chronograph data is displayed using a display command and the process returns to the main program.

割り込み処理INT2は1/2秒毎に基準信号発生
回路1からかかるものであり、計時処理等を行な
う。先ずRAM14内の1/2秒フラツグのデータ
をALU12に取り込み1を加算し、その結果
“1”であるか“2”であるか判定する。“1”で
あるばメインプログラムにリターンする。“2”
のときは1/2秒フラツグに“0”を入れ、タイマ
ー処理を行なう。タイマー処理はタイマーがスタ
ートしている場合のみ実行され、スタートしてい
る場合にはRAM14内のタイマーデータの秒か
ら1を減算し、ボローがあれば更に上位桁から1
を減算してボロー処理を行なう。またその結果、
秒、分、時がすべて“0”になつたか判定し
“0”であればアラーム発音命令を実行し、タイ
マ用のアラーム音を外部端子ALMに出力する。
次に現在時刻の秒データに1を加算しキヤリーが
あれば桁上げ処理を行なう。この桁上げ処理で分
桁への桁上げがあるとアラーム処理及びスヌーズ
処理を行なう。アラーム処理はRAM14内に記
憶された時及び分データと桁上げ処理後の現在時
刻の時及び分データを各桁毎にALU12に取り
出し一致しているか否か判定する。一致していれ
ばアラーム音発生命令及び割り込みINT3のセツ
ト命令を実行し、スイツチ入力回路3からの割り
込みを可能とする。スヌーズ処理はスヌーズ要求
があるか否か判定し、スヌーズ要求の場合には
RAM14内のスヌーズ分データに1を加算し、
その結果が所定の時間例えば5分になつたならば
アラーム音発生命令及び割り込みINT3のセツト
命令を再び実行する。次にRAM14内のモード
フラツグが現在時刻モードであるか判定し、現在
時刻モードであれば桁上げされた新しい現在時刻
データを表示し他のモードであればそのままメイ
ンプログラムにリターンする。
Interrupt processing INT2 is generated from the reference signal generation circuit 1 every 1/2 second, and performs timekeeping processing and the like. First, the data of the 1/2 second flag in the RAM 14 is taken into the ALU 12 and 1 is added to it, and it is determined whether the result is "1" or "2". If it is "1", it returns to the main program. “2”
In this case, set "0" to the 1/2 second flag and perform timer processing. Timer processing is executed only when the timer has started. If it has started, 1 is subtracted from the seconds of the timer data in RAM 14, and if there is a borrow, 1 is further added from the upper digit.
Perform borrow processing by subtracting . Also, as a result,
It is determined whether the seconds, minutes, and hours have all become "0", and if they are "0", an alarm sound command is executed and an alarm sound for the timer is output to the external terminal ALM.
Next, 1 is added to the second data of the current time, and if there is a carry, carry processing is performed. If there is a carry to the minute digit in this carry process, alarm processing and snooze processing are performed. In the alarm process, the hour and minute data stored in the RAM 14 and the hour and minute data of the current time after the carry process are extracted for each digit into the ALU 12 and it is determined whether they match. If they match, an alarm sound generation command and an interrupt INT3 set command are executed to enable interrupts from the switch input circuit 3. Snooze processing determines whether there is a snooze request, and if there is a snooze request,
Add 1 to the snooze data in RAM14,
When the result is a predetermined time, for example, 5 minutes, the alarm sound generation command and interrupt INT3 set command are executed again. Next, it is determined whether the mode flag in the RAM 14 is the current time mode, and if the mode is the current time mode, the new carried current time data is displayed, and if it is another mode, the program returns to the main program.

割り込み処理INT3はアラーム音の発生時にス
イツチ入力回路3にセツトされスイツチSW1
SW4のいずれかを閉成したときに要求される。こ
の処理は状態制御回路4の外部端子ALMから出
力されているアラーム信号をアラーム音停止命令
で停止させ、スヌーズ要求があればスヌーズフラ
ツグをセツトすると共にRAM14内のスヌーズ
分データをセツトしてリターンする。またスヌー
ズ要求がなけれはアラーム音マークの点滅表示を
ストツプしスヌーズフラツグをリセツトしてリタ
ーンする。割り込みINT3がセツトされている場
合にはスイツチ指定が為されたスイツチSW1
SW4のいずれを操作しても割り込み信号INT3の
みがスイツチ入力回路3から出力されるだけであ
り、スイツチ指定は無視される。
Interrupt processing INT3 is set to switch input circuit 3 when an alarm sound occurs and switches SW 1 to
Required when any SW 4 is closed. This process stops the alarm signal output from the external terminal ALM of the state control circuit 4 with an alarm sound stop command, sets the snooze flag if there is a snooze request, sets the snooze data in the RAM 14, and returns. do. If there is no snooze request, the flashing of the alarm sound mark is stopped, the snooze flag is reset, and the process returns. If interrupt INT3 is set, the specified switch SW 1 ~
No matter which SW 4 is operated, only the interrupt signal INT3 is output from the switch input circuit 3, and the switch designation is ignored.

割り込み処理の優先順位はINT0、1、2、3
の順番であり、これは制御回路11に依つて決定
されている。また割り込み信号INT0、1、2、
3は制御回路11のフリツプフロツプを各々セツ
トする様接続され、割り込み禁止の場合にはその
禁止が解除されてから割り込み処理がセツトされ
たフリツプフロツプに依つて行なわれる。更にシ
ステムクロツクが停止している場合に割り込みが
かかるとその処理後は再びシステムクロツクの停
止命令“SCP”が実行される。
The priority of interrupt processing is INT0, 1, 2, 3.
This order is determined by the control circuit 11. Also, interrupt signals INT0, 1, 2,
3 are connected to set the flip-flops of the control circuit 11, and when interrupts are disabled, the interrupt processing is performed by the set flip-flops after the inhibition is released. Furthermore, if an interrupt occurs while the system clock is stopped, the system clock stop instruction "SCP" is executed again after the interrupt is processed.

(ヘ) 発明の効果 上述の如く本発明に依れば、動作停止中におけ
る割り込み発生時には、スタツクにその動作停止
の原因となつた停止命令のアドレスを保持させる
ことにより、通常動作時の割り込み、動作停止時
の割り込み、及び、動作開始時の次プログラムの
実行再開を可能とすることにより、プログラムを
実行させるクロツクの作成動作をプログラム中の
所々に設けた停止命令を依つて停止させることが
でき、また動作停止中に要求された割り込み処理
実行後はその動作を停止させた命令にリターンし
て実行することに依り再び動作を停止させること
ができるものであり、不必要なシステムの動作が
完全に止められ消費電流が大幅に減少すると共に
プログラムも短かく簡単に組むことができる。よ
つて機能及び仕様の変更等もきわめて容易に行な
える利点を有する。
(F) Effects of the Invention As described above, according to the present invention, when an interrupt occurs while an operation is stopped, the stack retains the address of the stop instruction that caused the operation to stop, thereby preventing an interrupt during normal operation. By enabling an interrupt when an operation is stopped and restarting execution of the next program when an operation is started, the operation of creating the clock that executes the program can be stopped by using stop commands provided at various places in the program. In addition, after executing the interrupt processing requested while the system is stopped, the system can be stopped again by returning to and executing the instruction that stopped the system, thereby completely eliminating unnecessary system operations. As a result, current consumption is significantly reduced, and programs can be shortened and easily assembled. Therefore, it has the advantage that changes in functions and specifications can be made extremely easily.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は本発明の実施例を示すブロツク図、第
2図は第1図に示されたクロツクジエネレータの
回路図、第3図及び第4図はプログラム例を示す
フロー図である。 1……基準信号発生回路、2……クロツクジエ
ネレータ、3……スイツチ入力回路、4……状態
制御回路、5……タイマーカウンタ、6……クロ
ノグラフカウンタ、7……ROM、8……プログ
ラムカウンタ、9……スタツク、10……インス
トラクシヨンレジスタ、11……制御回路、12
……ALU、13……ACC、14……RAM、1
5……デコーダ、16……ラツチ回路。
FIG. 1 is a block diagram showing an embodiment of the present invention, FIG. 2 is a circuit diagram of the clock generator shown in FIG. 1, and FIGS. 3 and 4 are flow diagrams showing example programs. DESCRIPTION OF SYMBOLS 1... Reference signal generation circuit, 2... Clock generator, 3... Switch input circuit, 4... State control circuit, 5... Timer counter, 6... Chronograph counter, 7... ROM, 8... ...Program counter, 9...Stack, 10...Instruction register, 11...Control circuit, 12
...ALU, 13...ACC, 14...RAM, 1
5...Decoder, 16...Latch circuit.

Claims (1)

【特許請求の範囲】 1 基準信号発生回路と、 該基準信号発生回路の出力によりシステムの動
作を制御するクロツク信号を発生する動作の停止
が停止信号によつて制御され、前記動作の開始が
割り込み信号、及び、内部要因あるいは外部要因
に基づいて発生する動作開始信号によつて制御さ
れるクロツクジエネレータと、 プログラムを構成する命令が書き込まれた
ROMと、 該ROMに書き込まれた命令を取り出すため前
記ROMのアドレスを指定するプログラムカウン
タと、 割り込み処理後の戻り先アドレスを保持するた
めに、割り込み発生時に実行された命令を読み出
した前記プログラムカウンタのインクリメントさ
れたアドレスを記憶するスタツクと、 前記ROMから読み出された命令を解読し、該
命令を実行するための制御信号を発生する制御回
路と、 動作停止命令が印加された前記制御回路からの
信号によつて制御され、前記クロツクジエネレー
タの動作を停止させる停止信号を前記クロツクジ
エネレータに出力する状態制御回路と、 を備えたマイクロコンピユータに於て、 動作中に発生した割り込みに対して、前記制御
回路は、前記プログラムカウンタのインクリメン
トされたアドレスを前記スタツクに保持させ、前
記割り込み処理終了後前記スタツクに保持された
アドレスを前記プログラムカウンタにセツトする
ことによりプログラムを先に進め、 動作停止中に発生した割り込みに対して、前記
制御回路は、動作停止の原因となつた停止命令を
読み出した前記プログラムカウンタのアドレスを
インクリメントせずに前記スタツクに保持させ、
前記割り込み終了後前記スタツクに保持されたア
ドレスを前記プログラムカウンタにセツトするこ
とにより、動作停止の原因となつた停止命令を再
度実行させて動作を停止させ、 前記動作停止後発生する前記動作開始信号によ
る動作開始に対して、前記プログラムカウンタは
インクリメントされたアドレスからプログラムを
先に進めることを特徴とするマイクロコンピユー
タ。
[Scope of Claims] 1. A reference signal generation circuit, and the stop of the operation of generating a clock signal that controls the operation of the system by the output of the reference signal generation circuit is controlled by a stop signal, and the start of the operation is controlled by an interrupt. A clock generator that is controlled by signals and operation start signals generated based on internal or external factors, and a clock generator in which the instructions that make up the program are written.
a ROM, a program counter that specifies the address of the ROM in order to retrieve an instruction written in the ROM, and a program counter that reads an instruction executed when an interrupt occurs in order to hold a return address after interrupt processing. a stack for storing incremented addresses of the ROM; a control circuit for decoding the instruction read from the ROM and generating a control signal for executing the instruction; and a control circuit to which an operation stop instruction is applied. a state control circuit that outputs a stop signal to the clock generator to stop the operation of the clock generator; On the other hand, the control circuit causes the stack to hold the incremented address of the program counter, and advances the program by setting the address held in the stack in the program counter after the interrupt processing is completed; In response to an interrupt that occurs while the operation is stopped, the control circuit causes the address of the program counter that read the stop instruction that caused the operation to stop to be held in the stack without incrementing it;
After the interrupt ends, the address held in the stack is set in the program counter to cause the stop instruction that caused the stoppage of the operation to be executed again to stop the operation, and the operation start signal generated after the stoppage of the operation is performed. The microcomputer is characterized in that the program counter advances the program from an incremented address when the operation starts.
JP59036682A 1984-02-27 1984-02-27 Operating method of microcomputer Granted JPS59182389A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP59036682A JPS59182389A (en) 1984-02-27 1984-02-27 Operating method of microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP59036682A JPS59182389A (en) 1984-02-27 1984-02-27 Operating method of microcomputer

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP56137947A Division JPS5838883A (en) 1981-09-01 1981-09-01 Electronic timepiece

Publications (2)

Publication Number Publication Date
JPS59182389A JPS59182389A (en) 1984-10-17
JPH0334111B2 true JPH0334111B2 (en) 1991-05-21

Family

ID=12476609

Family Applications (1)

Application Number Title Priority Date Filing Date
JP59036682A Granted JPS59182389A (en) 1984-02-27 1984-02-27 Operating method of microcomputer

Country Status (1)

Country Link
JP (1) JPS59182389A (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62191910A (en) * 1986-02-18 1987-08-22 Nec Corp Clock control system
US5291604A (en) * 1991-08-30 1994-03-01 Intel Corporation Transparent system interrupts with automated halt state restart
WO2017090558A1 (en) * 2015-11-25 2017-06-01 三菱日立パワーシステムズ株式会社 Moisture separator/heater

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS53146666A (en) * 1977-05-26 1978-12-20 Seiko Instr & Electronics Ltd Watch logic circuit
JPS55156886A (en) * 1979-05-25 1980-12-06 Hitachi Ltd Electronic digital watch

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS53146666A (en) * 1977-05-26 1978-12-20 Seiko Instr & Electronics Ltd Watch logic circuit
JPS55156886A (en) * 1979-05-25 1980-12-06 Hitachi Ltd Electronic digital watch

Also Published As

Publication number Publication date
JPS59182389A (en) 1984-10-17

Similar Documents

Publication Publication Date Title
US5140563A (en) Multimode electronic timepiece having a mutually exclusive submode display
US5113381A (en) Multifunction electronic analog timepiece
US5289452A (en) Multifunction electronic analog timepiece
KR940009375B1 (en) Electronically corrected electronic timepiece
JPH0346078B2 (en)
JPH05256958A (en) Electronic clock
JPH0334111B2 (en)
JPS634675B2 (en)
US4384790A (en) Alarm device for electronic watches
US4370066A (en) Correction signal input system for electronic timepiece
US5063544A (en) Program to alter alarm setting in a multimode alarm timepiece
GB2107494A (en) Electronic timepiece with microprocessor
JPS6045388B2 (en) Electronic equipment with notification function
JPS625677Y2 (en)
JPS5838883A (en) Electronic timepiece
JPS6128319B2 (en)
JPS6032148B2 (en) alarm electronic clock
JPH0447277B2 (en)
JPS6233554B2 (en)
JPS5916868Y2 (en) Calendar display electronic clock
JPS6045389B2 (en) electronic digital clock
JPS6249595B2 (en)
JPS6232428B2 (en)
JPS63749B2 (en)
JPH0515118Y2 (en)