JPH05225361A - Register rewriting system - Google Patents

Register rewriting system

Info

Publication number
JPH05225361A
JPH05225361A JP4057057A JP5705792A JPH05225361A JP H05225361 A JPH05225361 A JP H05225361A JP 4057057 A JP4057057 A JP 4057057A JP 5705792 A JP5705792 A JP 5705792A JP H05225361 A JPH05225361 A JP H05225361A
Authority
JP
Japan
Prior art keywords
register
contents
instruction
memory
specific address
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
JP4057057A
Other languages
Japanese (ja)
Inventor
Toshihiro Abe
俊広 阿部
Tsunenori Umeki
恒憲 梅木
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric 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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP4057057A priority Critical patent/JPH05225361A/en
Priority to DE19934303406 priority patent/DE4303406C2/en
Publication of JPH05225361A publication Critical patent/JPH05225361A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1497Details of time redundant execution on a single processing unit
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/28Error detection; Error correction; Monitoring by checking the correct order of processing

Abstract

PURPOSE:To prevent the contents of a register from being carelessly rewritten and failed into a serious trouble by changing the read out from contents of the register based upon an instruction read out from a specific address of a memory. CONSTITUTION:The memory 2 is provided with an SFR area 7 arranging a register relating to the control of peripheral devices such as an I/O port and a timer in a microcomputer, a RAM area 9, a mode register area R1 arranged in a specific memory space and storing contents especially relating to the control of the operation mode of the micro-computer, and a change instruction storing area R1a including a change instruction for changing the contents of the mode register R1. The area R1a is stored in a specific address PO in the memory 2. The instruction for changing the contents of the register R1 is stored in the specific address PO of the memory 2, and after reading out the instruction from the specific address PO, the contents of the register R1 are changed based upon the instruction.

Description

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

【0001】[0001]

【産業上の利用分野】この発明はマイクロコンピュータ
に備えられるレジスタの内容の書換え方式に関し、特に
ソフトウェアのミスやプログラムの暴走等による誤書換
えと、それに伴って起こるかもしれないトラブルの発生
を防止するためのレジスタ書換え方式に関するものであ
る。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method of rewriting the contents of registers provided in a microcomputer, and particularly prevents erroneous rewriting due to software mistakes, program runaway, etc., and troubles that may occur therewith. The present invention relates to a register rewriting method for.

【0002】[0002]

【従来の技術】マイクロコンピュータは、図8に示すよ
うにCPU1、メモリ2、タイマ等の周辺装置3、I/
Oポート(入出力ポート)4、これらをそれぞれ接続す
るアドレスバス5及びデータバス6を備えている。この
場合、図8及び図7に示すようにメモリ2は、アドレス
指定で記憶内容を読出せるもので、このメモリ2のメモ
リ空間にROM(領域)8及びRAM(領域)9が含ま
れ、さらにI/Oポート4や周辺装置3等の制御に関す
るレジスタが配置されているSFR(Special
Function Resister)領域7を持って
いる。上記レジスタにはマイクロコンピュータのポート
を入力モードで使用するか又は出力モードで使用するか
を決める方向レジスタR2や、I/Oポート4を使用し
て外部とのデータのやり取りを行うポートレジスタR
3、A−D変換器に対する各種制御を行うA−D制御レ
ジスタR4、UART(入出力制御回路)や各種タイマ
を制御するレジスタR5などがあるが、特にマイクロコ
ンピュータの動作モードの制御に関するレジスタとして
のモードレジスタR1があり、このモードレジスタR1
の内容を変更することによりソフトウェアで各種動作モ
ードを選択することができる。
2. Description of the Related Art As shown in FIG. 8, a microcomputer includes a CPU 1, a memory 2, a peripheral device 3 such as a timer, and an I / O.
It is provided with an O port (input / output port) 4, an address bus 5 and a data bus 6 which respectively connect these. In this case, as shown in FIGS. 8 and 7, the memory 2 can read the stored contents by addressing, and the memory space of the memory 2 includes a ROM (area) 8 and a RAM (area) 9, and further, SFR (Special) in which registers related to control of the I / O port 4 and the peripheral device 3 are arranged
It has a function register area 7. The register is a direction register R2 that determines whether the microcomputer port is used in input mode or output mode, and a port register R that exchanges data with the outside using the I / O port 4.
3. There are an AD control register R4 for performing various controls on the AD converter, a UART (input / output control circuit), a register R5 for controlling various timers, etc., but especially as a register relating to control of the operation mode of the microcomputer. There is a mode register R1 of
Various operation modes can be selected by software by changing the contents of.

【0003】上記各種動作モードには、ポートがすべて
プログラマブル入出力端子として機能するシングルチッ
プモードや、内蔵のメモリ2、I/Oポート4だけでは
不足する場合にアドレス空間の任意の領域にメモリ2や
周辺装置3等を拡張することができるメモリ拡張モー
ド、上記メモリ拡張モードにおいてさらに内部ROMへ
のアクセスを強制的に禁止されるようにしたマイクロプ
ロセッサモード等がある。これらのモードはそれぞれ一
部の端子の機能、メモリ配置、及びアドレス空間が異な
るため、SFR領域7内に配置されている様々なレジス
タの中でも、特に上記モードレジスタR1はマイクロコ
ンピュータの動作に大きく影響を及ぼす。
The various operation modes described above include a single chip mode in which all ports function as programmable input / output terminals, or a memory 2 in an arbitrary area of the address space when the built-in memory 2 and the I / O port 4 are insufficient. There are a memory expansion mode in which the peripheral device 3 and the like can be expanded, and a microprocessor mode in which access to the internal ROM is forcibly prohibited in the memory expansion mode. Among these various modes arranged in the SFR area 7, the mode register R1 in particular has a great influence on the operation of the microcomputer because the functions of some terminals, the memory arrangement, and the address space are different in these modes. Exert.

【0004】[0004]

【発明が解決しようとする課題】従来のマイクロコンピ
ュータでは、SFRがRAM等と同様に、ソフトウェア
により簡単にアクセスでき、SFRの内容を保護する機
能を有していないため、ソフトウェアのミスやプログラ
ム暴走等により、SFRの内容が不用意に変更される場
合がある。この時、特に上記モードレジスタ等のマイク
ロコンピュータの動作モードの制御に関するレジスタの
内容が書き換えられると、マイクロコンピュータは重大
なトラブルを引き起こす危険性があるなどの問題点があ
った。例えば、マイクロコンピュータがシングルチップ
モードで動作し、入出力ポートの一部が入力端子として
働き、外部のICからの信号が入力されている時に、ソ
フトウェアのミスやプログラムの暴走等によりモードレ
ジスタ等のマイクロコンピュータの動作モードの制御に
関わるレジスタの内容が変更され、シングルチップモー
ドで動作していたものがマイクロプロセッサモードに変
わってしまうことがある。この場合、上記入出力ポート
は入力ポートとして働いていたものから、アドレス出力
ポートとして機能するようになる。このようになると、
上記入出力ポートには外部ICからの出力に内部からの
出力が加わり、端子に過負荷が生じてチップを破壊する
等の重大なトラブルの発生する場合がある。
In the conventional microcomputer, the SFR, like the RAM, can be easily accessed by software and does not have the function of protecting the contents of the SFR. In some cases, the contents of the SFR may be changed carelessly. At this time, in particular, if the contents of the register relating to the control of the operation mode of the microcomputer such as the above mode register are rewritten, there is a problem that the microcomputer may cause a serious trouble. For example, when the microcomputer operates in the single chip mode, a part of the input / output port functions as an input terminal, and a signal from an external IC is input, a software mistake, program runaway, etc. The contents of the registers relating to the control of the operation mode of the microcomputer may be changed, and the operation in the single chip mode may be changed to the microprocessor mode. In this case, the input / output port functions as an input port, and then functions as an address output port. When this happens,
There is a case where an output from the external IC is added to the output from the external IC to the input / output port, an overload is generated at the terminal, and a serious trouble such as damage to the chip occurs.

【0005】この発明は上記のような問題点を解消する
ためになされたもので、マイクロコンピュータの動作モ
ードの制御に関するレジスタの内容が、ソフトウェアの
ミスやプログラム暴走などで不用意に書換えられて重大
なトラブルに陥いることを防止できるマイクロコンピュ
ータを得るためのレジスタ書換え方式を提供することを
目的とする。
The present invention has been made in order to solve the above problems, and the contents of a register relating to the control of the operation mode of a microcomputer are inadvertently rewritten due to a software mistake or a program runaway, which is serious. It is an object of the present invention to provide a register rewriting method for obtaining a microcomputer capable of preventing a trouble.

【0006】[0006]

【課題を解決するための手段】請求項1の発明に係るレ
ジスタ書換え方式は、メモリ2内の特定番地POにレジ
スタR1の内容を変更するための命令を格納しておき、
上記特定番地POの命令を読出した後、この命令に基づ
き上記レジスタR1の内容を変更するようにしたもので
ある。
According to the register rewriting method of the present invention, an instruction for changing the contents of the register R1 is stored in a specific address PO in the memory 2,
After reading the instruction of the specific address PO, the content of the register R1 is changed based on this instruction.

【0007】請求項2の発明に係るレジスタ書換え方式
は、レジスタR1に書込むべき同一のデータが複数回入
力されてきたときに上記レジスタR1の内容を書換える
ようにしたものである。
According to the register rewriting method of the second aspect of the present invention, the contents of the register R1 are rewritten when the same data to be written in the register R1 is input a plurality of times.

【0008】請求項3の発明に係るレジスタ書換え方式
は、メモリ2内の特定番地POにレジスタR1の内容を
変更するための命令を格納しておき、上記レジスタR1
に書込むべき同一のデータが複数回入力されてきたとき
に、上記特定番地POの命令を読出した後、この命令に
基づき上記レジスタR1の内容を書換えるようにしたも
のである。
In the register rewriting method according to the third aspect of the present invention, an instruction for changing the contents of the register R1 is stored in a specific address PO in the memory 2, and the register R1 is stored.
When the same data to be written into is input a plurality of times, after the instruction of the specific address PO is read, the content of the register R1 is rewritten based on this instruction.

【0009】請求項4の発明に係るレジスタ書換え方式
は、当該リセット信号で初期化される単安定フリップフ
ロップ20からの有効出力が存在するときのみ、レジス
タR1に書込むべきデータが入力されてきたときに上記
レジスタR1の内容を書換えるようにしたものである。
In the register rewriting method according to the invention of claim 4, the data to be written in the register R1 is input only when the valid output from the monostable flip-flop 20 initialized by the reset signal exists. The contents of the register R1 are sometimes rewritten.

【0010】[0010]

【作用】請求項1の発明において、レジスタR1の内容
はメモリ2内の特定番地POから読み出された命令に基
づき変更される。
In the invention of claim 1, the content of the register R1 is changed based on the instruction read from the specific address PO in the memory 2.

【0011】請求項2の発明において、レジスタR1の
内容は、このレジスタR1に書込むべき同一のデータが
複数回入力されてきたときに書換えられる。
In the invention of claim 2, the content of the register R1 is rewritten when the same data to be written in the register R1 is input a plurality of times.

【0012】請求項3の発明において、レジスタR1に
書込むべき同一のデータが複数回入力されてきたとき、
メモリ2内の特定番地POから読み出された命令に基づ
き上記レジスタR1の内容が書換えられる。
In the invention of claim 3, when the same data to be written to the register R1 is input a plurality of times,
The contents of the register R1 are rewritten based on the instruction read from the specific address PO in the memory 2.

【0013】請求項4の発明において、単安定フリップ
フロップ20からの有効出力が存在するときのみ、レジ
スタR1に書込むべきデータが入力されてきたときに上
記レジスタR1の内容が書換えられる。
In the fourth aspect of the invention, the contents of the register R1 are rewritten only when the valid output from the monostable flip-flop 20 is present and when the data to be written to the register R1 is input.

【0014】[0014]

【実施例】【Example】

実施例1.図1はこの発明の一実施例に係るレジスタ書
換え方式を採用したマイクロコンピュータに備えられる
メモリ2のメモリ空間を示す図である。このメモリ2に
おいて、7はマイクロコンピュータ内の入出力ポートや
タイマ等の周辺装置等の制御に関するレジスタが配置さ
れているSFR(領域)、9はRAM(領域)、R1は
特定のメモリ空間に配置され特にマイクロコンピュータ
の動作モードの制御に関するモードレジスタ領域、R1
aはモードレジスタR1の内容を変更するための変更命
令を含む変更命令格納領域である。この変更命令格納領
域R1aは、図2に示すようにメモリ2の特定番地PO
内に設けられる。
Example 1. FIG. 1 is a diagram showing a memory space of a memory 2 provided in a microcomputer adopting a register rewriting method according to an embodiment of the present invention. In this memory 2, 7 is an SFR (area) in which registers relating to control of peripheral devices such as input / output ports and timers in a microcomputer are arranged, 9 is a RAM (area), and R1 is arranged in a specific memory space. In particular, a mode register area for controlling the operation mode of the microcomputer, R1
Reference numeral a is a change instruction storage area including a change instruction for changing the contents of the mode register R1. The change command storage area R1a is stored in the specific address PO of the memory 2 as shown in FIG.
It is provided inside.

【0015】図3はCPU1(図8参照)の機能(モー
ドレジスタの内容を変更する機能)を示すブロック図で
あり、図中13は上記特定番地PO(3)をチェックす
るプログラムカウンタ、14はアンド回路、R1aは変
更命令格納領域、R1はモードレジスタである。
FIG. 3 is a block diagram showing the function of the CPU 1 (see FIG. 8) (function of changing the contents of the mode register). In the figure, 13 is a program counter for checking the specific address PO (3), and 14 is a program counter. An AND circuit, R1a is a change instruction storage area, and R1 is a mode register.

【0016】次にこの実施例の動作について説明する。
動作モードの制御に関するモードレジスタR1の内容を
変更する際に、他の目的のレジスタやRAMとは異なる
方法を用いるようにする。すなわち、図2に示すように
動作モードの制御に関するモードレジスタR1の内容を
書き換える命令を特定番地PO内に格納しておき、動作
モードの制御に関するモードレジスタR1の内容を変更
する場合は、必ず特定番地PO内の変更命令格納領域R
1aに格納された変更命令を用いなければならないよう
にしている。そして図3に示すようにモードレジスタR
1への書込み信号がアンド回路14に入った場合に、モ
ードレジスタR1の内容を変更しようとする命令がある
特定番地POに配置されているかどうかをCPU1から
の指示で、プログラムカウンタ13によりチェックさ
せ、変更命令がこの特定番地POの範囲の領域、変更命
令格納領域R1a内にあれば、この領域R1a内の命令
をアクセスして読出し、この命令を用いて動作モードの
制御に関するモードレジスタR1の内容を変更する。特
定番地POに配置された命令のみが動作モードの制御に
関するモードレジスタR1の内容を変更するようになっ
ているため、ソフトウェアのミスやプログラム暴走によ
るSFR7の内容の書き換えが起こった場合でも、動作
モードの制御に関するモードレジスタR1だけはその他
の目的のレジスタやRAM等と同様に簡単に内容を書換
えられるようなことはない。
Next, the operation of this embodiment will be described.
When changing the contents of the mode register R1 relating to the control of the operation mode, a method different from that for other purpose registers or RAM is used. That is, as shown in FIG. 2, when an instruction for rewriting the contents of the mode register R1 relating to the control of the operation mode is stored in the specific address PO and the contents of the mode register R1 relating to the control of the operation mode are changed, the instruction must be specified. Change command storage area R in address PO
The change instruction stored in 1a must be used. Then, as shown in FIG.
When a write signal for 1 enters the AND circuit 14, the CPU 1 instructs the program counter 13 to check whether or not an instruction for changing the contents of the mode register R1 is arranged at a specific address PO. If the change instruction is in the area within the range of this specific address PO, that is, the change instruction storage area R1a, the instruction in this area R1a is accessed and read, and the content of the mode register R1 relating to the control of the operation mode is used. To change. Only the instruction located at the specific address PO changes the contents of the mode register R1 relating to the control of the operation mode, so that even if the contents of the SFR7 are rewritten due to a software mistake or a program runaway, the operation mode is changed. Only the mode register R1 relating to the control of (1) cannot be easily rewritten like other registers or RAM for other purposes.

【0017】換言すると、CPU1に動作モードの制御
に関するレジスタR1の内容を書換える命令が入ると、
CPU1はその命令がある特定番地PO(図2の斜線部
分)に配置されているかどうかをプログラムカウンタ1
3によりチェックする。変更命令が特定番地PO内にな
ければ、CPU1は該レジスタR1の変更命令を実行し
ない。もし変更命令が特定番地PO内にあれば、CPU
1はその命令の格納されているメモリ2の番地をアドレ
スバス5を介してメモリ2へ送る。そして、図2の斜線
部分の中にある変更命令格納領域R1aの内容を変更す
る命令がデータバス6を介してCPU1に送られる。C
PU1はこの命令に従って、変更命令格納領域R1aの
番地と、該領域R1aの変更内容をそれぞれアドレスバ
ス5、データバス6を介してメモリ2に送る。このよう
にして、動作モードの制御に関するモードレジスタR1
の内容を書換える。このようにして、モードレジスタR
1の内容を変更する命令が特定番地POに入っているか
否かのチェックが行われ、さらにこのチェックの結果、
変更命令格納領域R1aより読出された変更命令に基づ
いてモードレジスタR1の内容が変更され、二重の書込
みミスの防止処理がなされる。
In other words, when the CPU 1 receives an instruction to rewrite the contents of the register R1 relating to the control of the operation mode,
The CPU 1 determines whether or not the instruction is placed at a specific address PO (hatched portion in FIG. 2).
Check with 3. If the change instruction is not in the specific address PO, the CPU 1 does not execute the change instruction of the register R1. If the change command is in the specific address PO, the CPU
1 sends the address of the memory 2 in which the instruction is stored to the memory 2 via the address bus 5. Then, an instruction to change the contents of the change instruction storage area R1a in the shaded portion of FIG. 2 is sent to the CPU 1 via the data bus 6. C
In accordance with this instruction, the PU 1 sends the address of the change instruction storage area R1a and the change contents of the area R1a to the memory 2 via the address bus 5 and the data bus 6, respectively. In this way, the mode register R1 relating to the control of the operation mode
Rewrite the contents of. In this way, the mode register R
It is checked whether or not an instruction to change the contents of 1 is contained in the specific address PO, and as a result of this check,
The contents of the mode register R1 are changed based on the change instruction read from the change instruction storage area R1a, and a double write error prevention process is performed.

【0018】実施例2.なお、上記実施例1では動作モ
ードの制御に関するモードレジスタR1の内容を変更す
る際に、ある特定番地POの領域である変更命令格納領
域R1aに配置された命令のみでそのモードレジスタR
1の内容を変更するようにした場合について説明した
が、そのモードレジスタR1の内容を変更する他の方法
としては、連続でモードレジスタR1に同じ値を2度書
込むことにより初めてモードレジスタR1の内容を変更
できるようにしてもよく、この場合も上記実施例1と同
様の効果を奏する。
Example 2. In the first embodiment, when the contents of the mode register R1 relating to the control of the operation mode are changed, only the instruction arranged in the change instruction storage area R1a which is an area of a specific address PO is used to change the mode register R1.
Although the case where the contents of 1 is changed has been described, another method of changing the contents of the mode register R1 is to write the same value to the mode register R1 twice in succession for the first time. The contents may be changed, and in this case, the same effect as that of the first embodiment can be obtained.

【0019】図4はこの実施例2を説明するためのCP
Uの機能を示すブロック図であり、図中15は同じデー
タが2回連続して入力されるのを判別する判定手段であ
る。図4において、まずモードレジスタR1の番地を示
すデータとその番地に書込むデータ151が送られてく
ると、この1回目のデータ151を特定のレジスタ領域
15a(メモリ内に予め設定された領域)に格納する。
続いてモードレジスタR1の番地を示すデータとその番
地に書き込む2回目のデータ152が送られてきた場
合、上記特定のレジスタ領域15aに格納されている最
初の内容(データ151)と、2回目の内容(データ1
52)とを判定手段15で比較し、これらの内容が全く
同じであった場合のみ動作モードの制御に関するモード
レジスタR1にその内容が書込まれる。1回目のデータ
と2回目のデータの内容が異なる場合、2回目のデータ
の内容が特定のレジスタ領域15aの1回目の内容に代
わって書込まれ、次に送られてくるデータの内容と比較
されるようになっている。つまり、同じ内容が2回しか
も連続して送られて来ない限り、動作モードの制御に関
するモードレジスタR1の内容を変更することはできな
いようになっている。
FIG. 4 is a CP for explaining the second embodiment.
It is a block diagram showing the function of U, and reference numeral 15 in the figure is a judging means for judging that the same data is continuously input twice. In FIG. 4, first, when the data indicating the address of the mode register R1 and the data 151 to be written to that address are sent, the data 151 for the first time is transferred to the specific register area 15a (area preset in the memory). To store.
Then, when the data indicating the address of the mode register R1 and the second data 152 to be written in that address are sent, the first contents (data 151) stored in the specific register area 15a and the second data Content (Data 1
52) is compared by the judging means 15, and only when the contents are exactly the same, the contents are written in the mode register R1 relating to the control of the operation mode. When the contents of the first data and the contents of the second data are different, the contents of the second data are written in place of the contents of the first time of the specific register area 15a and compared with the contents of the data sent next. It is supposed to be done. That is, the contents of the mode register R1 relating to the control of the operation mode cannot be changed unless the same contents are sent twice and continuously.

【0020】実施例3.上記実施例2では連続で同一レ
ジスタに同じ値を2度書き込むことにより初めて動作モ
ードの制御に関するモードレジスタR1の内容を変更で
きる場合を示したが、上記モードレジスタR1の内容を
変更するためだけに新たに専用の命令を設定し、この専
用の命令を使用しない限り、上記モードレジスタR1の
内容を変更することができないようにしてもよい。つま
り図5に示す如く判定手段15の出力で図1のメモリ2
内の変更命令格納領域R1a内の専用の命令を読出し
て、この命令でモードレジスタR1の内容を書換えても
よい。
Example 3. In the second embodiment, the case where the contents of the mode register R1 relating to the control of the operation mode can be changed for the first time by continuously writing the same value to the same register twice has been described, but only for changing the contents of the mode register R1. The contents of the mode register R1 may not be changed unless a new dedicated instruction is set and the dedicated instruction is used. That is, as shown in FIG. 5, the output of the determination means 15 is used to output the memory 2 of FIG.
Alternatively, a dedicated instruction in the change instruction storage area R1a therein may be read and the content of the mode register R1 may be rewritten by this instruction.

【0021】実施例4.上記実施例3では動作モードの
制御に関するモードレジスタR1への書き込み専用の命
令で内容を変更するようにしたが、図6に示すようにリ
セット動作以外では初期化できない単安定フリップフロ
ップ20の有効出力と、書換えデータ153とのアンド
をアンド回路21でとって上記モードレジスタR1への
書込みを許可するようにしてもよい。上記単安定フリッ
プフロップ20は一度書込みを完了するとリセット動作
以外で初期化できない。つまり上記モードレジスタR1
の番地と、その内容を示すデータ153が送られてきた
時に、書込み信号によって単安定フリップフロップ20
がリセット状態になり初期化され、上記モードレジスタ
R1への書き込みが許可される。そして、上記単安定フ
リップフロップ20は、上記モードレジスタR1への書
き込みを一度完了するとリセット以外では初期化できな
いため、ソフトウェアのミスやプログラム暴走があって
も上記モードレジスタR1の内容が変更されることはな
い。
Example 4. In the third embodiment, the content is changed by the write-only instruction to the mode register R1 relating to the control of the operation mode. However, as shown in FIG. 6, the effective output of the monostable flip-flop 20 that cannot be initialized except by the reset operation. Then, AND with the rewrite data 153 may be taken by the AND circuit 21 to permit writing to the mode register R1. The monostable flip-flop 20 cannot be initialized except for the reset operation once the writing is completed. That is, the mode register R1
Of the address of the monostable flip-flop 20 when a data 153 indicating the address of the
Is reset and initialized, and writing to the mode register R1 is permitted. Since the monostable flip-flop 20 cannot be initialized except by reset once the writing to the mode register R1 is completed, the contents of the mode register R1 are changed even if there is a software mistake or a program runaway. There is no.

【0022】実施例5.なお、上記実施例1〜4ではモ
ードレジスタを例にとって説明したが、他の重要な機能
を課すレジスタについても本発明を適用できることは言
うまでもない。
Embodiment 5. In addition, although the mode register has been described as an example in the first to fourth embodiments, it goes without saying that the present invention can be applied to a register which imposes another important function.

【0023】[0023]

【発明の効果】以上のように本発明によれば、メモリ内
の特定番地にレジスタの内容を変更するための命令を格
納しておき、その特定番地の命令を読出した後、その命
令に基づき上記レジスタの内容を変更するようにしたの
で、マイクロコンピュータの動作モードの制御に関する
レジスタの内容がソフトウェアのミスやプログラムの暴
走などで不用意に書換えられて重大なトラブルに陥いる
ことを防止できるマイクロコンピュータを提供できると
いう効果が得られる。
As described above, according to the present invention, an instruction for changing the contents of a register is stored in a specific address in a memory, the instruction at the specific address is read out, and then the instruction is based on the instruction. Since the contents of the above registers are changed, it is possible to prevent the contents of the registers related to the control of the operation mode of the microcomputer from being inadvertently rewritten due to software mistakes or program runaway, resulting in a serious trouble. The effect that a computer can be provided is obtained.

【0024】また、上記レジスタに書込むべき同一のデ
ータが複数回入力されてきたときに上記レジスタの内容
を書換えるようにしたので、同じ内容のデータが2回連
続して送られてこない限り、上記レジスタの内容は変更
されず、これにより上記と同様な効果が得られる。
Further, since the contents of the register are rewritten when the same data to be written in the register is input a plurality of times, unless the data of the same contents are sent twice in succession. The contents of the register are not changed, and the same effect as described above can be obtained.

【0025】また、メモリ内の特定番地に上記レジスタ
の内容を変更するための命令を格納しておき、上記レジ
スタに書込むべき同一のデータが複数回入力されてきた
ときに、上記特定番地の命令を読出した後、この命令に
基づき上記レジスタの内容を書換えるようにしたので、
上記と同様な効果が得られる。
An instruction for changing the contents of the register is stored in a specific address in the memory, and when the same data to be written in the register is input a plurality of times, the specific address of the specific address is written. After reading the instruction, the contents of the above registers are rewritten based on this instruction.
The same effect as above can be obtained.

【0026】また、リセット信号で初期化される単安定
フリップフロップからの有効出力が存在するときのみ、
上記レジスタに書込むべきデータが入力されてきたとき
にレジスタの内容を書換えるようにしたので、上記レジ
スタへの書込みを一度完了するとリセット以外では上記
単安定フリップフロップを初期化できないため、ソフト
ウェアのミスやプログラムの暴走があっても上記レジス
タの内容が変更されることはなく、したがって上記と同
様な効果が得られる。
Also, only when there is a valid output from the monostable flip-flop initialized by the reset signal,
Since the contents of the register are rewritten when the data to be written to the register is input, once the writing to the register is completed, the monostable flip-flop cannot be initialized except by resetting. Even if there is a mistake or a program runaway, the contents of the register are not changed, and therefore the same effect as above can be obtained.

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

【図1】この発明の一実施例に係るレジスタ書換え方式
を採用したマイクロコンピュータに備えられるメモリの
メモリ空間を示す図である。
FIG. 1 is a diagram showing a memory space of a memory provided in a microcomputer adopting a register rewriting method according to an embodiment of the present invention.

【図2】この実施例において変更命令格納領域がメモリ
の特定番地に設けられていることを示す図である。
FIG. 2 is a diagram showing that a change instruction storage area is provided at a specific address of a memory in this embodiment.

【図3】この実施例(実施例1)においてモードレジス
タの内容を変更するCPUの機能を示すブロック図であ
る。
FIG. 3 is a block diagram showing the function of the CPU that changes the contents of the mode register in this embodiment (embodiment 1).

【図4】他の実施例(実施例2)においてモードレジス
タの内容を変更するCPUの機能を示すブロック図であ
る。
FIG. 4 is a block diagram showing the function of a CPU that changes the contents of a mode register in another embodiment (embodiment 2).

【図5】他の実施例(実施例3)においてモードレジス
タの内容を変更するCPUの機能を示すブロック図であ
る。
FIG. 5 is a block diagram showing a function of a CPU for changing contents of a mode register in another embodiment (third embodiment).

【図6】他の実施例(実施例4)においてモードレジス
タの内容を変更するCPUの機能を示すブロック図であ
る。
FIG. 6 is a block diagram showing a function of a CPU for changing the contents of a mode register in another embodiment (embodiment 4).

【図7】従来のマイクロコンピュータのメモリのメモリ
空間を示す図である。
FIG. 7 is a diagram showing a memory space of a memory of a conventional microcomputer.

【図8】マイクロコンピュータの構成を示すブロック図
である。
FIG. 8 is a block diagram showing a configuration of a microcomputer.

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

1 CPU 2 メモリ 4 入出力ポート R1 モードレジスタ PO 特定番地 1 CPU 2 Memory 4 I / O port R1 Mode register PO Specific address

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】 アドレス指定によりデータを読出すこと
が可能なメモリの特定番地領域に設けられたレジスタ
と、CPU及び入出力ポートを備えたマイクロコンピュ
ータにおいて、上記メモリ内の特定番地に上記レジスタ
の内容を変更するための命令を格納しておき、上記特定
番地の命令を読出した後、この命令にもとづき上記レジ
スタの内容を変更するようにしたことを特徴とするレジ
スタ書換え方式。
1. In a microcomputer provided with a register provided in a specific address area of a memory from which data can be read by addressing, a CPU and an input / output port, the register of the register is stored in the specific address in the memory. A register rewriting method characterized in that an instruction for changing the content is stored, the instruction at the specific address is read, and then the content of the register is changed based on the instruction.
【請求項2】 アドレス指定によりデータを読出すこと
が可能なメモリの特定番地領域に設けられたレジスタ
と、CPU及び入出力ポートを備えたマイクロコンピュ
ータにおいて、上記レジスタに書込むべき同一のデータ
が、複数回入力されてきたときに、上記レジスタの内容
を書換えるようにしたことを特徴とするレジスタ書換え
方式。
2. A register provided in a specific address area of a memory from which data can be read by addressing, and the same data to be written in the register in a microcomputer including a CPU and an input / output port. A register rewriting method characterized in that the contents of the above register are rewritten when input is made a plurality of times.
【請求項3】 アドレス指定によりデータを読出すこと
が可能なメモリの特定番地領域に設けられたレジスタ
と、CPU及び入出力ポートを備えたマイクロコンピュ
ータにおいて、上記メモリ内の特定番地に上記レジスタ
の内容を変更するための命令を格納しておき、上記レジ
スタに書込むべき同一のデータが、複数回入力されてき
たときに、上記特定番地の命令を読出した後、この命令
にもとづき上記レジスタの内容を書換えるようにしたこ
とを特徴とするレジスタ書換え方式。
3. A microcomputer provided with a register provided in a specific address area of a memory from which data can be read by addressing, a CPU and an input / output port, and the register of the register being stored at the specific address in the memory. When the same data to be written in the above register is input multiple times, the instruction for changing the contents is stored, after reading the instruction at the above specified address, the register of the above is registered based on this instruction. A register rewriting method characterized in that the contents are rewritten.
【請求項4】 アドレス指定によりデータを読出すこと
が可能なメモリの特定番地領域に設けられたレジスタ
と、CPU及び入出力ポートを備えたマイクロコンピュ
ータにおいて、当該リセット信号で初期化される単安定
フリップフロップからの有効出力が存在するときのみ、
上記レジスタに書込むべきデータが入力されてきたとき
に上記レジスタの内容を書換えるようにしたことを特徴
とするレジスタ書換え方式。
4. A monostable initialized by a reset signal in a microcomputer provided with a register provided in a specific address area of a memory capable of reading data by addressing, a CPU and an input / output port. Only when there is a valid output from the flip-flop,
A register rewriting method characterized in that the contents of the register are rewritten when data to be written to the register is input.
JP4057057A 1992-02-07 1992-02-07 Register rewriting system Pending JPH05225361A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP4057057A JPH05225361A (en) 1992-02-07 1992-02-07 Register rewriting system
DE19934303406 DE4303406C2 (en) 1992-02-07 1993-02-05 Method for changing the content of a register of a microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4057057A JPH05225361A (en) 1992-02-07 1992-02-07 Register rewriting system

Publications (1)

Publication Number Publication Date
JPH05225361A true JPH05225361A (en) 1993-09-03

Family

ID=13044820

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4057057A Pending JPH05225361A (en) 1992-02-07 1992-02-07 Register rewriting system

Country Status (2)

Country Link
JP (1) JPH05225361A (en)
DE (1) DE4303406C2 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE4341887C2 (en) * 1993-12-08 1996-12-19 Siemens Ag Method for preventing an unauthorized data change in a device with a non-volatile memory
JPH08129507A (en) * 1994-10-31 1996-05-21 Ricoh Co Ltd Information storage management system
DE19709975C2 (en) * 1997-03-11 1999-04-22 Siemens Ag Microcomputer
DE102008048066B4 (en) 2008-09-19 2018-02-01 Texas Instruments Deutschland Gmbh An access control circuit for use with supervisory logic circuitry in a method of protecting software for embedded applications from unauthorized access

Also Published As

Publication number Publication date
DE4303406A1 (en) 1993-08-12
DE4303406C2 (en) 1996-06-05

Similar Documents

Publication Publication Date Title
JP2682700B2 (en) IC card
US5991858A (en) Multi-user data processing system with storage protection
JPH05173890A (en) Data protecting microprocessor circuit for portable data carrier
JPH03266051A (en) Security system for software
US7260690B2 (en) Microprocessor circuit for data carriers and method for organizing access to data stored in a memory
JPH01219982A (en) Ic card
JPS6237419B2 (en)
JPH05225361A (en) Register rewriting system
US20010049794A1 (en) Write protection software for programmable chip
JP3032207B2 (en) Micro computer
US7340575B2 (en) Method and a circuit for controlling access to the content of a memory integrated with a microprocessor
JP2597409B2 (en) Microcomputer
GB2304209A (en) Starting up a processor system
JP2581057B2 (en) Evaluation microcomputer
JPS62160555A (en) Storage protecting device of storage circuit
JPH03208158A (en) Electronic controller
JPH06231072A (en) Microcomputer
JPS62251833A (en) Computer system
JPH06309236A (en) Illegal write detecting circuit for memory
JP2602909B2 (en) Write-protection method during CPU runaway
JPS6393059A (en) Memory card
JPS63250753A (en) Memory access checking system
JP3293144B2 (en) Peripheral control device
JPH0716190Y2 (en) Vending machine controller
JPS6091464A (en) Microcomputer