JPH0814780B2 - Microcomputer - Google Patents

Microcomputer

Info

Publication number
JPH0814780B2
JPH0814780B2 JP63315283A JP31528388A JPH0814780B2 JP H0814780 B2 JPH0814780 B2 JP H0814780B2 JP 63315283 A JP63315283 A JP 63315283A JP 31528388 A JP31528388 A JP 31528388A JP H0814780 B2 JPH0814780 B2 JP H0814780B2
Authority
JP
Japan
Prior art keywords
microcomputer
interrupt
program
initial value
user
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
JP63315283A
Other languages
Japanese (ja)
Other versions
JPH02159613A (en
Inventor
勝己 三浦
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.)
NEC Corp
Original Assignee
NEC 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 NEC Corp filed Critical NEC Corp
Priority to JP63315283A priority Critical patent/JPH0814780B2/en
Publication of JPH02159613A publication Critical patent/JPH02159613A/en
Publication of JPH0814780B2 publication Critical patent/JPH0814780B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明はマイクロコンピュータに関し、特にROMを内
蔵するマイクロコンピュータに関する。
The present invention relates to a microcomputer, and more particularly to a microcomputer including a ROM.

〔従来の技術〕[Conventional technology]

従来、マイクロコンピュータ(以下、マイコンと称
す)にはROM(読み出し専用メモリ)を内蔵するものが
ある。この内蔵されたROMには外付けメモリの省略化な
どの目的でユーザのプログラムの全部あるいは一部が格
納され、システムの省スペース化や低消費電力化などが
図られている。なお、このROMはいわゆるマイクロ・プ
ログラムのROMとは構成上区別されている。
2. Description of the Related Art Conventionally, some microcomputers (hereinafter referred to as microcomputers) have a built-in ROM (read-only memory). This built-in ROM stores all or part of the user's program for the purpose of omitting the external memory, etc., so that the system space is saved and the power consumption is reduced. This ROM is distinguished from the so-called micro program ROM in terms of configuration.

一方、かかるマイコンの初期動作、すなわちリセット
信号入力の後のマイコンの初期動作(以下、リセット動
作と称す)では、内部の種々のハードウェアの初期化が
行なわれる。この内部のハードウェアの初期化の内容は
個々のマイコンで決められて(固定されて)おり、ユー
ザの任意の設定はできない。
On the other hand, in the initial operation of the microcomputer, that is, the initial operation of the microcomputer after the reset signal is input (hereinafter, referred to as reset operation), various internal hardware is initialized. The contents of the initialization of the internal hardware are determined (fixed) by individual microcomputers, and cannot be set arbitrarily by the user.

以下、このROMを内蔵する従来のマイコンの例および
マイコンのリセット動作中に有効な割込みが入力された
場合の動作を説明する。
Hereinafter, an example of a conventional microcomputer incorporating this ROM and the operation when a valid interrupt is input during the reset operation of the microcomputer will be described.

第5図は従来の一例を示すマイコンのブロック図であ
る。
FIG. 5 is a block diagram of a conventional microcomputer.

第5図に示すように、ここではROM8Aを内蔵するマイ
コン1Aに外部RAMをバス接続した例を示す。このマイコ
ン1Aは説明に必要な機能要素のみを示しており、特にマ
イコン1Aの全体を制御する制御部2Aと、プログラム・カ
ウンタ(PC)4,プログラム・ステータス・ワード(PS
W)5,スタック・ポインタ(SP)6と、内部バス7と、
ユーザのプログラムの一部が格納された内蔵ROM8Aと、
リセット信号入力端子(▲▼)11,NMI(ノン
・マスカブル・インタラプト)入力端子12とを有してい
る。また、マイコン1Aの外部には外部バス13を介して接
続された外部RAM14がある。
As shown in FIG. 5, here is shown an example in which an external RAM is bus-connected to a microcomputer 1A incorporating a ROM8A. This microcomputer 1A shows only the functional elements necessary for the explanation, especially the control unit 2A that controls the entire microcomputer 1A, the program counter (PC) 4, the program status word (PS
W) 5, stack pointer (SP) 6, internal bus 7,
Built-in ROM8A in which a part of user's program is stored,
It has a reset signal input terminal (▲ ▼) 11 and an NMI (non-maskable interrupt) input terminal 12. An external RAM 14 connected via an external bus 13 is provided outside the microcomputer 1A.

次に、リセット端子11にリセット信号が入力された後
のマイコン1Aの動作を第6図を用いて説明する。
Next, the operation of the microcomputer 1A after the reset signal is input to the reset terminal 11 will be described with reference to FIG.

第6図は第5図におけるマイコンのタイミング図であ
る。
FIG. 6 is a timing chart of the microcomputer shown in FIG.

第6図に示すように、まず、リセット端子11にリセッ
ト信号が入力され開放されると、制御部2Aはマイコン1A
全体を制御し、ハードウェアの初期化(a)を行う。こ
の初期化を中にはPC4の初期値設定も含まれ、且つこの
ハードウェアの初期化(a)の後半でマイコン1Aに内蔵
された割込みコントローラ(図示省略)も初期化され、
割込み受付け可能状態とする。以上の動作がマイコン1A
のリセット動作である。なお、SP6の初期値やNMI割込み
のベクタ値は個々のユーザの初期情報であるので、マイ
コン1Aのリセット動作ではセットしない。
As shown in FIG. 6, first, when a reset signal is input to the reset terminal 11 and opened, the control unit 2A causes the microcomputer 1A to open.
The whole is controlled and the hardware is initialized (a). Initialization of the PC4 is included in this initialization, and the interrupt controller (not shown) built into the microcomputer 1A is also initialized in the latter half of the initialization (a) of this hardware.
Enable interrupt acceptance. The above operation is microcomputer 1A
Is the reset operation. Since the initial value of SP6 and the vector value of NMI interrupt are initial information of each user, they are not set in the reset operation of the microcomputer 1A.

次に、ここで、ハードウェアの初期化(a)の処理中
に外部からNMI入力端子12へNMI信号が入力され、マイコ
ン1A内の割込みコントローラ(図示省略)によりNMI割
込み要求フラグがセットされたものとする。すると、制
御部2Aが初期化(a)の処理に続いて行なう割込み要求
サンプリング(b)の制御により、NMIの割込みフラグ
がセットされていることを確認するので、NMI割込みを
受付け、割込みフラグをリセットする。
Next, an NMI signal is input to the NMI input terminal 12 from the outside during the process of hardware initialization (a), and the NMI interrupt request flag is set by the interrupt controller (not shown) in the microcomputer 1A. I shall. Then, the control unit 2A confirms that the NMI interrupt flag is set by the control of the interrupt request sampling (b) performed after the initialization (a) process. Therefore, the NMI interrupt is accepted and the interrupt flag is set. Reset.

続いて、制御部2Aは割込みベクタへの分岐(c)の処
理を行なうため、PC4とPSW5の内容をSP6の指す外部RAM1
4内のスタック・エリアに退避(格納)した後、外部RAM
14内のNMI割込みに対応する割込みベクタの格納された
アドレスからベクタ値を読み出し、これをPC4にセット
することによりベクタ・アドレス(NMI用の割込みルー
チンの入口)への分岐を実行するよう制御する。ところ
が、SP6にはまだ初期値が設定されていないため、PC4と
PSW5の内容が退避されるスタックのアドレスは不定とな
る。さらに、外部RAM14にはまだベクタ値がセットされ
ていないため、ここでは読出されるベクタ値は不定とな
る。すなわち、不定とは、例えば電源の投下時にたまた
まセットされる無意味な値であるとか、あるいはリセッ
ト前までに走行していたプログラムの操作による値のま
まになっていることである。
Subsequently, since the control unit 2A performs a branch (c) process to the interrupt vector, the contents of PC4 and PSW5 are stored in the external RAM 1 pointed to by SP6.
After saving (storing) to the stack area in 4, external RAM
Controls to execute a branch to the vector address (entry of the interrupt routine for NMI) by reading the vector value from the address where the interrupt vector corresponding to the NMI interrupt in 14 is stored and setting it in PC4. . However, since the initial value has not been set in SP6 yet,
The stack address where the contents of PSW5 is saved is undefined. Furthermore, since the vector value has not been set in the external RAM 14, the vector value read here is undefined. That is, indefinite means, for example, a meaningless value that happens to be set when the power is turned on, or that the value remains as it is due to the operation of the program running before the reset.

かくして分岐処理(c)が行なわれると、制御部2Aの
制御により、プログラムの不定のアドレスから実行して
いき、結果としてマイコン1Aは暴走(d)することにな
る。
When the branching process (c) is thus performed, the control unit 2A controls the program to be executed from an undefined address, resulting in the microcomputer 1A running out of control (d).

〔発明が解決しようとする課題〕[Problems to be Solved by the Invention]

上述した従来のマイコンのリセット動作ではユーザ個
々の初期情報をセットしない。また、内蔵ROMはマイコ
ン内にあるもののプログラムの格納に使用されているの
みであり、ユーザ個々の初期情報源として利用されてい
ない。
In the reset operation of the conventional microcomputer described above, initial information for each user is not set. Moreover, the built-in ROM is used only for storing programs although it is in the microcomputer, and is not used as an initial information source for each user.

従って、従来のマイコンは次の様な解決されるべき問
題点を有する。
Therefore, the conventional microcomputer has the following problems to be solved.

まず、従来のマイコンにおけるユーザの個々の初期情
報はマイコンにリセット動作が終わり、続いて実行され
るユーザのプログラムによってはじめて設定される。従
って、従来例に示したNMIのベクタ値のように、ユーザ
個々の初期設定情報ではあるが、ユーザのプログラムに
制御が渡る前に、すなわちベクタ値の設定が完了する前
に用いられるもののような例では、プログラムの暴走を
招くという欠点がある。
First, the individual initial information of the user in the conventional microcomputer is set for the first time by the user's program executed after the reset operation is completed in the microcomputer. Therefore, like the NMI vector value shown in the conventional example, although it is the initial setting information for each user, it is used before the control of the user program, that is, before the vector value setting is completed. The example has the drawback of causing a runaway program.

また、種々の内蔵周辺ハードウェアを備えた従来のシ
ングルチップ・マイコンにおいては、これらの内蔵周辺
ハードウェアの制御レジスタにもユーザのプログラムに
よって、ユーザの個々の初期情報が設定される。このた
めのプログラムの実行時間は、マイコンのリセット動作
で(いわゆる、ハードウェアで)等価の処理を行なう場
合と比較すると、多大にかかるという欠点があり、この
傾向は、より多くの周辺ハードウェアを内蔵する上位の
シングルチップ・マイコンほど顕著になる。
Further, in the conventional single-chip microcomputer provided with various built-in peripheral hardware, the user's program sets the individual initial information of the user in the control registers of these built-in peripheral hardware. The execution time of the program for this has a drawback that it takes much time as compared with the case where equivalent processing is performed by the reset operation of the microcomputer (so-called hardware), and this tendency requires more peripheral hardware. The higher the embedded single-chip microcomputer, the more prominent it becomes.

本発明の目的は、かかるプログラムの暴走の抑制やプ
ログラム処理時間を短縮することのできるマイコンを提
供することにある。
It is an object of the present invention to provide a microcomputer capable of suppressing such program runaway and shortening program processing time.

〔課題を解決するための手段〕[Means for solving the problem]

本発明のマイコンは、ユーザのプログラムを格納する
ためのROMを内蔵しスタック・ポインタおよびRAMを備え
たマイクロコンピュータにおいて、前記ユーザのプログ
ラムの他に、前記スタック・ポインタの初期値を格納し
たROMと、リセット信号の入力により前記ROM内の設定ス
タック・ポインタの初期値を前記スタック・ポインタに
設定する設定部を有するとともに、前記スタック・ポイ
ンタへの設定に続いて前記ユーザのプログラムを起動す
る制御部とを備えるように構成される。
The microcomputer of the present invention is a microcomputer including a ROM for storing a user's program and having a stack pointer and a RAM, and a ROM storing an initial value of the stack pointer in addition to the user's program. A control unit having a setting unit for setting an initial value of a set stack pointer in the ROM to the stack pointer by inputting a reset signal, and for activating the user's program following the setting to the stack pointer And.

また、本発明のマイコンにおけるROMは、前記スタッ
ク・ポインタの初期値およびノン・マスカブル割込みの
割込みベクタ値を格納し、前記設定部が前記ノン・マス
カブル割込みの割込みベクタ値を前記RAMの所定のアド
レスへ転送するとともに、前記スタック・ポインタの初
期値を前記スタック・ポインタに設定する。
Further, the ROM in the microcomputer of the present invention stores the initial value of the stack pointer and the interrupt vector value of the non-maskable interrupt, and the setting unit sets the interrupt vector value of the non-maskable interrupt to a predetermined address of the RAM. And the initial value of the stack pointer is set in the stack pointer.

〔実施例〕〔Example〕

次に、本発明の実施例について図面を参照して説明す
る。
Next, embodiments of the present invention will be described with reference to the drawings.

第1図は本発明の第一の実施例を示すマイコンのブロ
ック図である。
FIG. 1 is a block diagram of a microcomputer showing a first embodiment of the present invention.

第1図に示すように、本実施例はマイコン1に外部RA
M14を接続した例である。このマイコン1内は本実施例
の説明に必要な機能要素のみを示しており、その主要部
はマイコン1全体を制御する制御部2と、プログラム・
カウンタ(PC)4,プログラム・ステータス・ワード(PS
W)5,スタック・ポインタ(SP)6と、内部バス7と、R
OM8と、リセット入力端子(▲▼)11,MNI
(ノン・マスカブル・インタラプト)入力端子12とを有
している。尚、マイコン1の外部には外部RAM14が外部
バス13を通して接続されている。
As shown in FIG. 1, this embodiment uses an external RA for the microcomputer 1.
This is an example of connecting M14. Only the functional elements necessary for the description of this embodiment are shown in the microcomputer 1, and the main parts thereof are a control unit 2 for controlling the entire microcomputer 1 and a program
Counter (PC) 4, Program status word (PS
W) 5, stack pointer (SP) 6, internal bus 7, R
OM8 and reset input terminal (▲ ▼) 11, MNI
It has a (non-maskable interrupt) input terminal 12. An external RAM 14 is connected to the outside of the microcomputer 1 through an external bus 13.

かかるマイコン1におけるROM8はユーザプログラムエ
リア9とハードウェア初期値エリア10とに分割されてい
る。このハードウェア初期値エリア10には割込みベクタ
へセットする複数の(ベクタ値)及びSP6の初期値が格
納されている。マイコン1の一連のリセット動作の中
で、制御部2中に設けられたハードウェア初期値設定部
3により自動的にベクタ値は外部RAM14へ、またSP6の初
期値はSP6へロードされる。なお、このベクタ値はユー
ザのプログラム内の割込みルーチンの入口アドレスであ
り、ユーザにより任意に決定される。また、SP6の初期
値はプログラムのスタックの使用開始アドレスであり、
同じくユーザにより任意に決定される。ユーザはあらか
じめこれらのベクタ値とSP6の初期値をROM8に書込んで
おく、尚、ROM8のハードウェア初期値エリア10に格納さ
れているベクタ値の数,配列形式,外部RAM14へのロー
ド・アドレス及びSP6の初期値の配列形式は、説明を簡
単にするために、マイコン1の仕様として(つまり、固
定されて)いるものとし、マイコン1はこの仕様に基づ
いてベクタとSP6の初期値のロードを行なうものとす
る。
The ROM 8 in the microcomputer 1 is divided into a user program area 9 and a hardware initial value area 10. The hardware initial value area 10 stores a plurality of (vector values) to be set in the interrupt vector and the initial value of SP6. During a series of reset operations of the microcomputer 1, the hardware initial value setting unit 3 provided in the control unit 2 automatically loads the vector value into the external RAM 14 and the initial value of SP6 into SP6. This vector value is the entrance address of the interrupt routine in the user's program and is arbitrarily determined by the user. The initial value of SP6 is the start address of the program stack,
Similarly, it is arbitrarily determined by the user. The user writes these vector values and SP6 initial values in ROM8 in advance. Note that the number of vector values stored in the hardware initial value area 10 of ROM8, the array format, and the load address to external RAM14 The array format of the initial value of SP6 and SP6 is assumed to be the specification (that is, fixed) of the microcomputer 1 for the sake of simplicity of explanation, and the microcomputer 1 loads the vector and the initial value of SP6 based on this specification. Shall be performed.

次に、▲▼端子11にリセット信号が入力さ
れた後のマイコン1の動作を第2図を用いて説明する。
Next, the operation of the microcomputer 1 after the reset signal is input to the terminal 11 will be described with reference to FIG.

第2図は第1図におけるマイコンのタイミング図であ
る。
FIG. 2 is a timing chart of the microcomputer shown in FIG.

第2図に示すように、まず▲▼端子11にリ
セット信号が入力され開放されると、制御部2はマイコ
ン1の全体を制御し、ハードウェアの初期化(a)を行
う。この制御部2による初期化(a)は内部ハードウェ
アの種々の初期化であり、この初期化の中にはPC4の初
期値設定も含まれる。また、このハードウェア初期化
(a)の後半でマイコン1に内蔵された割込みコントロ
ーラ(図示省略)も初期化され、割込み受付け可能状態
とする。
As shown in FIG. 2, first, when a reset signal is input to the terminal 11 and opened, the control section 2 controls the entire microcomputer 1 and initializes the hardware (a). The initialization (a) by the control unit 2 is various initialization of the internal hardware, and the initialization includes the setting of the initial value of the PC 4. Further, in the latter half of the hardware initialization (a), the interrupt controller (not shown) built in the microcomputer 1 is also initialized, and the interrupt accepting state is set.

次に、制御部2の中のハードウェア初期値設定部3
は、制御内容が割込みベクタのロードおよびSP6の設定
を行なうように制御(b)を実行する。このベクタのロ
ードとSP6の設定の処理(b)は初めROM8からベクタ値
を内部バス7へ読み出し、外部バス13を介して外部RAM1
4の所定のアドレスに書込む。これを所定のベクタの数
だけ繰り返す。つぎに、ROM8内にベクタ列に続いて格納
されているSP6の初期値を内部バス7へ読み出し、SP6へ
の書込みを実行する。
Next, the hardware initial value setting unit 3 in the control unit 2
Executes control (b) so that the control contents load the interrupt vector and set SP6. The process (b) of loading this vector and setting SP6 first reads the vector value from the ROM 8 to the internal bus 7 and then to the external RAM 1 via the external bus 13.
Write to the given address of 4. This is repeated for a predetermined number of vectors. Next, the initial value of SP6, which is stored in the ROM 8 following the vector sequence, is read to the internal bus 7, and writing to SP6 is executed.

以上の動作がマイコン1のリセット動作である。 The above operation is the reset operation of the microcomputer 1.

次に、ここで、前述したハードウェアの初期化(a)
の処理中に外部からNMI入力端子12へNMI信号が入力さ
れ、マイコン1内の割込みコントローラ(図示省略)に
よりNMI割込み要求フラグがセットされたものとする。
すると、制御部2がベクタのロードとSP6の設定処理
(b)に続いて行なう割込み要求サンプリングの制御
(c)により、NMIの割込みフラグがセットされている
ことを認識するので、NMI割込みを受付け、割込みフラ
グをリセットする。
Next, here, the above-mentioned hardware initialization (a)
It is assumed that an NMI signal is externally input to the NMI input terminal 12 during the processing of (1) and an NMI interrupt request flag is set by an interrupt controller (not shown) in the microcomputer 1.
Then, the control unit 2 recognizes that the NMI interrupt flag is set by the control (c) of the interrupt request sampling performed after the vector loading and the SP6 setting process (b), so that the NMI interrupt is accepted. , Reset the interrupt flag.

続いて、制御部2は割込みベクタへの分岐の処理
(d)を行うため、PC4とPSW5の内容をSP6の指す外部RA
M14内のスタック・エリアに退避(格納)した後、外部R
AM14内のNMI割込みに対応する割込みベクタの格納され
たアドレスからベクタ値を読み出し、これをPC4にセッ
トすることによりベクタ・アドレス(NMI用の割込みル
ーチンの入口)への分岐を実行するよう制御する。つい
で、分岐処理(d)が行われると、制御部2はNMI用の
割込みルーチン処理(e)を実行するように制御する。
Subsequently, the control unit 2 performs the process (d) of branching to the interrupt vector, so that the contents of PC4 and PSW5 are external RA pointed to by SP6.
After saving (storing) to the stack area in M14, external R
A vector value is read from the address where the interrupt vector corresponding to the NMI interrupt in AM14 is stored, and this is set in PC4 to control branching to the vector address (entrance of the interrupt routine for NMI). . Next, when the branch process (d) is performed, the control unit 2 controls to execute the NMI interrupt routine process (e).

このように、本実施例によると、マイコン1のリセッ
ト動作中にNMI割込みが起きてもマイコン1が暴走する
ことなく正常にNMIの割込みルーチンへ分岐することが
できる。
As described above, according to the present embodiment, even if an NMI interrupt occurs during the reset operation of the microcomputer 1, the microcomputer 1 can normally branch to the NMI interrupt routine without running away.

第3図は本発明の第二の実施例を示すマイコンのブロ
ック図である。
FIG. 3 is a block diagram of a microcomputer showing a second embodiment of the present invention.

第3図に示すように、本実施例も前述した第一の実施
例と同様にマイコン1内には説明に必要な機能要素のみ
を示しており、異なる点はNMI(ノン・マスカブル・イ
ンタラプト)入力端子が省略されていることと、内蔵周
辺ハードウェアの一つとしてシリアル・インタフェース
17が追加されていることである。また、前述した第一の
実施例にあった外部RAM14と外部バス13も省略してい
る。
As shown in FIG. 3, this embodiment also shows only the functional elements necessary for the explanation in the microcomputer 1 as in the first embodiment described above, except for the NMI (non-maskable interrupt). The omission of input pins and serial interface as one of the built-in peripheral hardware
17 is added. Further, the external RAM 14 and the external bus 13 in the above-described first embodiment are also omitted.

かかるマイコン1におけるROM8はユーザプログラムエ
リア9とシリアル制御レジスタ初期値エリア16とに分割
されている。このシリアル制御レジスタ初期値エリア16
にはシリアル・インタフェース17の制御レジスタへセッ
トする初期値が格納されており、マイコン1の一連のリ
セット動作の中で制御部2のシリアル制御レジスタ初期
値設定部15により自動的にシリアル・インタフェース17
の制御レジスタへロードされる。なお、この初期値はユ
ーザのプログラムで個々に異なるものであり、ユーザに
より任意に決定される。ユーザはあらかじめこの初期値
をROM8の中でシリアル制御レジスタ初期値エリア16に書
込んでおく。この初期値エリア16に格納されているシリ
アル・インタフェース17の制御レジスタの初期値の設定
形式は、説明を簡単にするために、マイコン1の仕様と
して(つまり、固定されて)いるものとし、マイコン1
はこの仕様に基づいてシリアル・インタフェース17の制
御レジスタの初期値のロードを行なうものとする。
The ROM 8 in the microcomputer 1 is divided into a user program area 9 and a serial control register initial value area 16. This serial control register initial value area 16
The initial value to be set in the control register of the serial interface 17 is stored in the serial interface 17 is automatically stored in the serial control register initial value setting unit 15 of the control unit 2 during the series of reset operations of the microcomputer 1.
Is loaded into the control register of. It should be noted that this initial value is different for each user program and is arbitrarily determined by the user. The user writes this initial value in the ROM 8 in the serial control register initial value area 16 in advance. For simplifying the explanation, the setting format of the initial value of the control register of the serial interface 17 stored in the initial value area 16 is assumed to be the specification of the microcomputer 1 (that is, fixed), 1
Shall load the initial value of the control register of serial interface 17 based on this specification.

次に、▲▼端子11にリセット信号が入力さ
れた後のマイコン1の動作を第4図を用いて説明する。
Next, the operation of the microcomputer 1 after the reset signal is input to the terminal 11 will be described with reference to FIG.

第4図は第3図におけるマイコンのタイミング図であ
る。
FIG. 4 is a timing chart of the microcomputer shown in FIG.

第4図に示すように、まず▲▼端子11にリ
セット信号が入力され開放されると、マイコン1が以下
の動作を行なうように制御部2はマイコン1の全体を制
御し、ハードウェアの初期化(a)を実行する。この制
御部2による初期化(a)は内部ハードウェアの種々の
初期化であり、この初期化の中にはPC4の初期値設定も
含まれる。
As shown in FIG. 4, when a reset signal is first input to the ▲ ▼ terminal 11 and opened, the control unit 2 controls the entire microcomputer 1 so that the microcomputer 1 performs the following operation, and the initial hardware operation is performed. (A) is executed. The initialization (a) by the control unit 2 is various initialization of the internal hardware, and the initialization includes the setting of the initial value of the PC 4.

次に、制御部2におけるシリアル制御レジスタ初期値
設定部15は初期化(a)が終了すると、制御レジスタの
設定処理(b)を行なうため、ROM8のシリアル制御レジ
スタ初期値エリア16から初期値を内部バス7へ読み出
し、シリアル・インタフェース17の制御レジスタへロー
ドを行なうよう制御する。
Next, when the initialization (a) is completed, the serial control register initial value setting unit 15 in the control unit 2 performs the setting process (b) of the control register. The internal bus 7 is read and the control register of the serial interface 17 is loaded.

以上の動作がマイコン1のリセット動作である。 The above operation is the reset operation of the microcomputer 1.

続いて、制御部2の制御により、割込み要求のサンプ
リング処理(c)を行なうが、前述した第一の実施例と
異なり、割込みフラグがセットされていないことから割
込み要求が発生していないことを認識する。従って、制
御部2はプログラムの実行(d)を行うため、ハードウ
ェアの初期設定(a)でセットされたPC4の示すアドレ
スに分岐して、ユーザのプログラムの先頭アドレスから
実行するように制御する。
Subsequently, the sampling processing (c) of the interrupt request is performed under the control of the control unit 2. However, unlike the above-described first embodiment, it is confirmed that the interrupt request is not generated because the interrupt flag is not set. recognize. Therefore, in order to execute the program (d), the control unit 2 branches to the address indicated by PC4 set in the hardware initial setting (a), and controls to execute from the top address of the user's program. .

このように、本実施例によると、マイコン1のリセッ
ト動作中にシリアル・インタフェース17の制御レジスタ
が初期化され、ユーザのプログラムでの初期化は不要と
なる。
As described above, according to the present embodiment, the control register of the serial interface 17 is initialized during the reset operation of the microcomputer 1, and the initialization by the user's program is unnecessary.

なお、上述した実施例において、内蔵ROMにマスクROM
等いづれであってもよく、またかかる内蔵ROMはベクタ
値や周辺ハードウェアの制御レジスタへの初期設定値だ
けでなく、あらゆるユーザの個々の初期値情報を設定す
ることも容易に実現できる。
In addition, in the above-described embodiment, the mask ROM is used as the built-in
The built-in ROM can easily set not only vector values and initial setting values for control registers of peripheral hardware, but also individual initial value information of all users.

〔発明の効果〕〔The invention's effect〕

以上説明したように、本発明のマイコンは、内蔵ROM
をユーザの個々の初期情報を格納することに使用し、且
つこの初期情報をマイコンのリセット動作の中で設定す
ることにより、プログラムの暴走を抑制することができ
るという効果がある。すなわち、NMIのベクタ値のよう
に、ユーザの個々の初期情報の設定をマイコンのリセッ
ト動作の中で完了することにより、ユーザのプログラム
に制御が渡る前にNMI割込みが起きてもプログラムは暴
走することなく正常に動作する。
As described above, the microcomputer of the present invention has a built-in ROM
Is used to store the individual initial information of the user, and the initial information is set during the reset operation of the microcomputer, which has the effect of suppressing runaway of the program. That is, like the NMI vector value, by setting the individual initial information of the user during the reset operation of the microcomputer, the program will run out of control even if an NMI interrupt occurs before control is passed to the user's program. Works fine without.

また、本発明のマイコンは、シリアル・インタフェー
スの例のように、シングルチップ・マイコンに内蔵され
る種々の周辺ハードウェアの制御レジスタへの初期設定
をマイコンのリセット動作で(いわゆる、ハードウェア
で)行なうことにより、ユーザのプログラムで行なう場
合と比較すると、処理時間が多大に減少する。この傾向
は、より多くの周辺ハードウェアを内蔵する上位のシン
グルチップ・マイコンほど顕著になる。
Further, in the microcomputer of the present invention, like the example of the serial interface, the initialization of the control registers of various peripheral hardware built into the single-chip microcomputer is performed by the reset operation of the microcomputer (so-called hardware). By doing so, the processing time is greatly reduced as compared with the case where it is done by the program of the user. This tendency becomes more remarkable in higher-order single-chip microcomputers that incorporate more peripheral hardware.

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

第1図は本発明の第一の実施例を示すマイコンのブロッ
ク図、第2図は第1図におけるマイコンのタイミング
図、第3図は本発明の第二の実施例を示すマイコンのブ
ロック図、第4図は第3図におけるマイコンのタイミン
グ図、第5図は従来の一例を示すマイコンのブロック
図、第6図は第5図におけるマイコンのタイミング図で
ある。 1……マイクロコンピュータ(マイコン)、2……制御
部、3……ハードウェア初期値設定部、4……プログラ
ム・カウンタ、5……プログラム・ステータス・ワー
ド、6……スタック・ポインタ、7……内部バス、8…
…ROM、9……ユーザプログラムエリア、10……ハード
ウェア初期エリア、11……リセット信号入力端子、12…
…NMI割込み入力端子、13……外部バス、14……外部RA
M、15……シリアル制御レジスタ初期値設定部、16……
シリアル制御レジスタ初期値エリア、17……シリアル・
インタフェース。
1 is a block diagram of a microcomputer showing a first embodiment of the present invention, FIG. 2 is a timing diagram of the microcomputer shown in FIG. 1, and FIG. 3 is a block diagram of a microcomputer showing a second embodiment of the present invention. 4, FIG. 4 is a timing chart of the microcomputer in FIG. 3, FIG. 5 is a block diagram of the conventional microcomputer, and FIG. 6 is a timing chart of the microcomputer in FIG. 1 ... Microcomputer (microcomputer), 2 ... Control unit, 3 ... Hardware initial value setting unit, 4 ... Program counter, 5 ... Program status word, 6 ... Stack pointer, 7 ... … Internal bus, 8…
... ROM, 9 ... User program area, 10 ... Hardware initial area, 11 ... Reset signal input terminal, 12 ...
… NMI interrupt input terminal, 13 …… External bus, 14 …… External RA
M, 15 ... Serial control register initial value setting section, 16 ...
Serial control register initial value area, 17 ... Serial
interface.

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】ユーザのプログラムを格納するためのROM
を内蔵しスタック・ポインタ及びRAMを備えたマイクロ
コンピュータにおいて、 前記ユーザのプログラムの他に、ノン・マスカブル割り
込みの割り込みベクタ値と、前記スタック・ポインタの
初期値を格納したROMと、 リセット信号の入力により前記ROM内の前記ノン・マス
カブル割り込みの割り込みベクタ値を前記RAMの所定の
アドレスへ転送するとともに、前記スタックポインタの
初期値を前記スタックポインタに設定する設定部と、 前記設定部の動作に続いて前記ユーザのプログラムを起
動する制御部と、 を備えることを特徴とするマイクロコンピュータ。
1. A ROM for storing a user program
In a microcomputer including a built-in stack pointer and RAM, in addition to the user program, an interrupt vector value of a non-maskable interrupt, a ROM storing the initial value of the stack pointer, and a reset signal input And a setting unit that transfers the interrupt vector value of the non-maskable interrupt in the ROM to a predetermined address of the RAM and sets the initial value of the stack pointer to the stack pointer, following the operation of the setting unit. And a control unit for activating the user's program.
JP63315283A 1988-12-13 1988-12-13 Microcomputer Expired - Lifetime JPH0814780B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63315283A JPH0814780B2 (en) 1988-12-13 1988-12-13 Microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63315283A JPH0814780B2 (en) 1988-12-13 1988-12-13 Microcomputer

Publications (2)

Publication Number Publication Date
JPH02159613A JPH02159613A (en) 1990-06-19
JPH0814780B2 true JPH0814780B2 (en) 1996-02-14

Family

ID=18063538

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63315283A Expired - Lifetime JPH0814780B2 (en) 1988-12-13 1988-12-13 Microcomputer

Country Status (1)

Country Link
JP (1) JPH0814780B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3355879B2 (en) * 1995-08-01 2002-12-09 株式会社デンソー Control circuit

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62171020A (en) * 1986-01-23 1987-07-28 Nec Ic Microcomput Syst Ltd Microcomputer
JPS62201859U (en) * 1986-06-16 1987-12-23

Also Published As

Publication number Publication date
JPH02159613A (en) 1990-06-19

Similar Documents

Publication Publication Date Title
US7793075B2 (en) Active memory command engine and method
JPS6298437A (en) Microcomputer
EP0267613B1 (en) Micro processor capable of being connected with coprocessor
JPH0814780B2 (en) Microcomputer
US20020004877A1 (en) Method and system for updating user memory in emulator systems
JPH04280334A (en) One chip microcomputer
KR100264758B1 (en) Microcomputer
JP3139310B2 (en) Digital signal processor
JP2731618B2 (en) emulator
JP2883489B2 (en) Instruction processing unit
JPH10312307A (en) Emulator for computer system
JPH0667896A (en) Single chip microcomputer
JPS58176761A (en) Starting circuit of multi-processor system
JP2743947B2 (en) Micro program control method
JP2604203B2 (en) Debug device for one-chip digital signal processor
US20030154369A1 (en) Single chip microcomputer
JPH0212426A (en) Central arithmetic processing device
JPS62274455A (en) Multiprocessor system
JP2002132499A (en) Data processing apparatus and recording medium
JPS6029131B2 (en) Diagnostic method
JPH03257572A (en) Multiprocessor system
JPH04181321A (en) Microprogram loading system
JPH07113900B2 (en) Emulation chip
JPS62271143A (en) Coprocessor
JPH07191844A (en) Microprocessor with programmable logic