JPH11282761A - Microcomputer - Google Patents

Microcomputer

Info

Publication number
JPH11282761A
JPH11282761A JP10085563A JP8556398A JPH11282761A JP H11282761 A JPH11282761 A JP H11282761A JP 10085563 A JP10085563 A JP 10085563A JP 8556398 A JP8556398 A JP 8556398A JP H11282761 A JPH11282761 A JP H11282761A
Authority
JP
Japan
Prior art keywords
data
address
nonvolatile memory
ram
register
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
JP10085563A
Other languages
Japanese (ja)
Inventor
Tsunehiko Tanitsu
常彦 谷津
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 JP10085563A priority Critical patent/JPH11282761A/en
Publication of JPH11282761A publication Critical patent/JPH11282761A/en
Pending legal-status Critical Current

Links

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

PROBLEM TO BE SOLVED: To save data in a nonvolatile memory which has a long wire time and are electrically erasable en bloc by writing data that is the same as data in the nonvolatile memory whenever the data is written to a RAM or a register. SOLUTION: An address signal AD4 for a nonvolatile memory 2 is inputted to an address controlling part 2b of the memory 2 from a CPU 1 through selectors 12 and 13 in response to writing data to a RAM 5 and the address of the memory 2 is designated. And, after the data of the designated address are erased, input data DA1 are inputted to a data inputting part 2d through selectors 17 and 18. And, a write signal WR2 is inputted to a read/write controlling part 9a through an OR gate 10, write control of the data is performed and data that are the same as the data written in the RAM 5 are stored in a specified address area of the memory 2.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、電源遮断などの緊
急時にデータの退避可能なマイクロコンピュータに関す
る。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microcomputer capable of saving data in an emergency such as power-off.

【0002】[0002]

【従来の技術】一般に、マイクロコンピュータには、図
2に示すように少なくとも動作制御用のプログラムが記
憶されるマスクROMやROMのプログラムを読み出す
ためにアドレス制御するプログラムカウンタPC、マス
クROM内のデータをプログラム命令にデコードするイ
ンストラクションデコーダが内蔵されている。さらに、
マイクロコンピュータには、演算結果によって得られた
データを記憶しておくRAMやレジスタも備えている。
2. Description of the Related Art Generally, as shown in FIG. 2, a microcomputer includes a mask ROM in which at least an operation control program is stored, a program counter PC for performing address control for reading a ROM program, and data in the mask ROM. An instruction decoder that decodes the program instruction into a program instruction is built in. further,
The microcomputer also includes a RAM and a register for storing data obtained as a result of the operation.

【0003】[0003]

【発明が解決しようとする課題】ところで、マイクロコ
ンピュータの電源電圧VDDが遮断された時、RAMやレ
ジスタ中のデータが失われないように、例えばEPRO
MやEEPROMなどの不揮発性メモリに記憶するよう
にしている。従来、マイクロコンピュータの電源電圧V
DDの外付け端子にはコンデンサーが接続されているの
で、電源が遮断されても電源電圧VDDは徐々に低下す
る。電源電圧VDDの低下する期間に、RAMやレジスタ
のデータを不揮発性メモリに退避させている。
By the way, when the power supply voltage VDD of the microcomputer is cut off, for example, an EPRO is used so that data in the RAM and the register is not lost.
The data is stored in a nonvolatile memory such as M or EEPROM. Conventionally, the power supply voltage V of the microcomputer
Since a capacitor is connected to the external terminal of DD, the power supply voltage VDD gradually decreases even if the power is cut off. During the period when the power supply voltage VDD decreases, the data of the RAM and the register is saved in the nonvolatile memory.

【0004】近年、不揮発性メモリの一つとして、図3
の示される構造の電気的に一括消去可能な不揮発性メモ
リ(フラッシュメモリ)がよく知られるようになってき
ている。しかしながら、このフラッシュメモリはデータ
を記憶する時、ソースからドレインに流れる電荷を、フ
ローティングゲートに高電圧を印加することによって、
電荷をフローティングゲートに引き上げ、電荷を蓄えて
いる。その為、フラッシュメモリではデータを記憶させ
る時間が長くなる。従って、マイクロコンピュータにお
いて、フラッシュメモリを緊急用の退避メモリとして使
用することが提案されているが、電源が遮断されてから
マイクロコンピュータが実際に不動作となる期間中にフ
ラッシュメモリにすべてのデータを退避させることは困
難であった。ここで、すべてのデータを退避させるに
は、電源が遮断されたからマイクロコンピュータが動作
しなくなるまでの時間を長くすれば良いが、これではコ
ンデンサーが大容量となるという欠点がある。
Recently, as one of nonvolatile memories, FIG.
Non-volatile memories (flash memories) having the structure shown in FIG. However, this flash memory uses a charge that flows from the source to the drain when storing data by applying a high voltage to the floating gate.
The charge is pulled up to the floating gate and stored. Therefore, the time for storing data in the flash memory becomes longer. Therefore, it has been proposed to use a flash memory as an emergency evacuation memory in a microcomputer, but all data is stored in the flash memory during a period in which the microcomputer is actually disabled after the power is turned off. It was difficult to evacuate. Here, in order to save all data, it is sufficient to extend the time from when the power is cut off to when the microcomputer does not operate. However, this has a disadvantage that the capacitor has a large capacity.

【0005】[0005]

【課題を解決するための手段】本発明によれば、演算時
データが保持される少なくともRAM及び/またはレジ
スタを有するマイクロコンピュータにおいて、プログラ
ムデータが書き込まれ、電気的に一括消去可能な不揮発
性メモリと、該不揮発性メモリのプログラムを書きかえ
るためのプログラムが書き込まれるとともに、前記不揮
発性メモリの特定アドレスと同一のアドレスが付された
ROMとを含み、前記RAM及び/またはレジスタへの
書き込み信号に応じて、前記RAM及び/またはレジス
タに記憶されるデータを、前記不揮発性メモリの特定ア
ドレス領域に記憶させる手段を備えることを特徴とす
る。
According to the present invention, in a microcomputer having at least a RAM and / or a register for storing data at the time of operation, a nonvolatile memory in which program data is written and which can be electrically erased collectively. And a ROM in which a program for rewriting the program in the nonvolatile memory is written, and a ROM assigned the same address as a specific address of the nonvolatile memory. Accordingly, there is provided a means for storing data stored in the RAM and / or the register in a specific address area of the nonvolatile memory.

【0006】また、前記不揮発性メモリ及びROMに付
された同一アドレスに対して、通常動作時前記ROMの
アドレスを選択し、書き込み時に前記不揮発性メモリの
アドレスを選択するセレクタ手段を備えることを特徴と
する。さらに、データ読み出し時、前記不揮発性メモリ
に記憶されたデータを読み出し、前記RAMやレジスタ
を転送する手段を備えることを特徴とする。
In addition, selector means for selecting an address of the ROM during normal operation and selecting an address of the nonvolatile memory at the time of writing for the same address assigned to the nonvolatile memory and the ROM are provided. And Further, when reading the data, a means for reading the data stored in the nonvolatile memory and transferring the data to the RAM or the register is provided.

【0007】またさらに、前記不揮発性メモリにおい
て、前記RAMまたはレジスタに応じたアドレス信号に
基づいてアドレスが指定され、前記データが前記RAM
またはレジスタに応じた書き込み信号により書き込まれ
ることを特徴とする。本発明によれば、RAM及び/ま
たはレジスタにデータが書き込まれると、前記データと
同一のデータが不揮発性メモリの特定アドレス領域に書
き込まれる。前記特定アドレス領域には最新のデータが
書き込まれたことになり、電源遮断時等の緊急時にはデ
ータが退避されていることになる。
Still further, in the nonvolatile memory, an address is specified based on an address signal corresponding to the RAM or a register, and the data is stored in the RAM.
Alternatively, writing is performed by a writing signal corresponding to a register. According to the present invention, when data is written to the RAM and / or the register, the same data as the data is written to a specific address area of the nonvolatile memory. The latest data has been written in the specific address area, and the data has been saved in an emergency such as when power is turned off.

【0008】[0008]

【発明の実施の形態】図1は本発明の実施の形態を示す
図である。1はマイクロコンピュータの動作を制御する
CPU、2はリード/ライト制御部2a、アドレス制御
部2b、データ出力部2c及びデータ入力部2dを含
み、プログラムデータを記憶する緊急退避用の電気的に
一括消去可能な不揮発性メモリ、3は不揮発性メモリ2
のアドレスを制御するプログラムカウンタPC、4は不
揮発性メモリ2のプログラムデータをデコードするイン
ストラクションデコーダ、5及び6はデータを記憶する
RAM及びレジスタ、7及び8はRAM5及びレジスタ
6に入力されるデータをそれぞれセレクトするセレク
タ、9はアドレス制御部9a及びデータ出力部9bを含
み、不揮発性メモリ2のプログラムデータを書き換える
ためのプログラムが記憶されるマスクROM、10はR
AM5及びレジスタ6のライト信号やCPU1からのラ
イト信号をリードライト制御部2aに入力させるオアゲ
ート、11はプログラムカウンタ3からのアドレス信号
を不揮発性メモリ2側またはマスクROM9にセレクト
して転送するセレクタ、12はRAM5及びレジスタ6
に対応したアドレス信号をセレクトするセレクタ、13
はセレクタ11または12のアドレス信号をセレクトし
てアドレス制御部2bに転送するセレクタ、14は不揮
発性メモリ2の出力データをセレクトするセレクタ、1
5はセレクタ14の出力データをセレクタ7または8に
セレクトして転送するセレクタ、16はマスクROM9
の出力データまたはセレクタ14の出力データをセレク
トするセレクタ、17はRAM5またはレジスタ6の入
力データをセレクトするセレクタ、18はセレクタ17
の出力データまたは他の入力データをセレクトするセレ
クタ、19は書き換え用のデータが記憶された外部RA
Mである。
FIG. 1 is a diagram showing an embodiment of the present invention. Reference numeral 1 denotes a CPU for controlling the operation of the microcomputer, and 2 denotes a read / write control unit 2a, an address control unit 2b, a data output unit 2c, and a data input unit 2d. Erasable nonvolatile memory, 3 is nonvolatile memory 2
Is an instruction decoder for decoding program data in the non-volatile memory 2, 5 and 6 are RAMs and registers for storing data, and 7 and 8 are data for input to the RAM 5 and the register 6. The selectors 9 for selecting each include an address control unit 9a and a data output unit 9b, and a mask ROM in which a program for rewriting the program data in the nonvolatile memory 2 is stored.
An OR gate for inputting a write signal of the AM 5 and the register 6 and a write signal from the CPU 1 to the read / write control unit 2a; a selector 11 for selecting and transferring an address signal from the program counter 3 to the nonvolatile memory 2 or the mask ROM 9; 12 is a RAM 5 and a register 6
Selector for selecting an address signal corresponding to.
Is a selector for selecting an address signal of the selector 11 or 12 and transferring it to the address control unit 2b; 14 is a selector for selecting output data of the nonvolatile memory 2;
5 is a selector for selecting and transferring output data of the selector 14 to the selector 7 or 8, and 16 is a mask ROM 9
Selector 17 for selecting the output data of the RAM 5 or the register 6, and 18 for selecting the input data of the RAM 5 or the register 6.
Selector 19 for selecting output data or other input data of the external RA.
M.

【0009】不揮発性メモリを内蔵するマイクロコンピ
ュータにおいては、このプログラム書換用のマスクRO
M9と不揮発性メモリ2とのアドレス番号は連続したア
ドレス番号で付されている。例えば、マスクROM1が
0000H〜0100Hのアドレスが付されるとする
と、不揮発性メモリ2には0101H〜FFFFHが付
される。
In a microcomputer having a built-in nonvolatile memory, a mask RO for rewriting the program is used.
The address numbers of M9 and the nonvolatile memory 2 are assigned consecutive address numbers. For example, assuming that addresses of 0000H to 0100H are assigned to the mask ROM 1, 0101H to FFFFH are assigned to the nonvolatile memory 2.

【0010】マスクROM9及び不揮発性メモリ2に書
き込まれたプログラムは動作制御用であるので、同一の
アドレッシング信号によって上記2つのメモリのアドレ
スを制御することが望ましく、加えて不揮発性メモリを
内蔵したマイクロコンピュータは、ROMやRAMを内
蔵するマイクロコンピュータのアドレス制御をそのまま
使用しているので、不揮発性メモリ2及びマスクROM
9には連続したアドレスが付されている。そうすると不
揮発性メモリ2にもアドレス0000H〜0100Hで
指定される領域が存在しており、従来では未使用領域で
あった。
Since the programs written in the mask ROM 9 and the non-volatile memory 2 are for operation control, it is desirable to control the addresses of the two memories by the same addressing signal. Since the computer uses the address control of a microcomputer having a built-in ROM or RAM as it is, the nonvolatile memory 2 and the mask ROM
9 are assigned consecutive addresses. Then, an area specified by addresses 0000H to 0100H also exists in the non-volatile memory 2, which has conventionally been an unused area.

【0011】まず、通常動作について説明する。通常動
作時、CPU1はHレベルのセレクト信号SEL1乃至
SEL4を出力する。その為、セレクタ11及び16は
不揮発性メモリ2側を選択し、セレクタ13はセレクタ
11の出力データを、セレクタ14はセレクタ16側を
選択する。さらに、セレクタ7及び8はバス側の入力デ
ータAD2及びAD3をそれぞれ選択する。
First, the normal operation will be described. During a normal operation, the CPU 1 outputs select signals SEL1 to SEL4 at H level. Therefore, the selectors 11 and 16 select the non-volatile memory 2 side, the selector 13 selects the output data of the selector 11, and the selector 14 selects the selector 16 side. Further, the selectors 7 and 8 select the input data AD2 and AD3 on the bus side, respectively.

【0012】この状態で、プログラムカウンタ3のカウ
ント値はインクリメントされ、カウント値に応じてアド
レス信号AD1が出力される。アドレス信号AD1はセ
レクタ11及び13を介して不揮発性メモリ2のアドレ
ス制御部2bに入力され、アドレス信号AD1により不
揮発性メモリ2のアドレスが指定され、プログラムデー
タが読み出される。プログラムデータはデータ出力部2
cからセレクタ14乃至16を介してインストラクショ
ンデコーダ4に入力され、インストラクションデコーダ
4でプログラム命令にデコードされ、各種動作が実行さ
れる。その後、プログラムカウンタ3のカウント値がイ
ンクリメントされ、不揮発性メモリ2において次のアド
レスが指定され、プログラムデータに応じて各種命令が
実行される。通常動作中、マイクロコンピュータは、上
記の動作を繰り返しながら、プログラムデータに従って
動作する。
In this state, the count value of the program counter 3 is incremented, and an address signal AD1 is output according to the count value. The address signal AD1 is input to the address controller 2b of the nonvolatile memory 2 via the selectors 11 and 13, and the address of the nonvolatile memory 2 is designated by the address signal AD1, and the program data is read. Program data is output to data output unit 2
The instruction is input to the instruction decoder 4 from c through the selectors 14 to 16 and is decoded into a program instruction by the instruction decoder 4 to execute various operations. Thereafter, the count value of the program counter 3 is incremented, the next address is specified in the nonvolatile memory 2, and various instructions are executed according to the program data. During normal operation, the microcomputer operates according to the program data while repeating the above operation.

【0013】通常動作中、プログラム動作中に得られた
データをRAM5に記憶させる場合、CPU1はセレク
ト信号SEL2をLレベルとし、セレクタ13にセレク
タ12の出力を選択させ、セレクタ18にセレクタ17
の出力を選択させる。さらに、セレクタ信号SEL3を
Hレベルとするので、セレクタ12及び17にアドレス
信号AD4及びRAM5への入力データDA2をそれぞ
れ選択させる。
When storing data obtained during a normal operation or a program operation in the RAM 5, the CPU 1 sets the select signal SEL2 to the L level, causes the selector 13 to select the output of the selector 12, and causes the selector 18 to select the output of the selector 17.
Select the output of Further, since the selector signal SEL3 is set to the H level, the selectors 12 and 17 are caused to select the address signal AD4 and the input data DA2 to the RAM 5, respectively.

【0014】そして、RAM5用のアドレス信号AD2
がRAM5に入力され、RAM5のアドレスが指定され
る。RAM5のアドレス指定後、マイクロコンピュータ
の動作により得られた入力データDA2がセレクタ7を
介してRAM5に入力され、ライト信号WR2がRAM
5に入力されることによって、入力データDA2がRA
M5に記憶される。
The address signal AD2 for the RAM 5
Is input to the RAM 5, and the address of the RAM 5 is designated. After addressing the RAM 5, the input data DA2 obtained by the operation of the microcomputer is input to the RAM 5 via the selector 7, and the write signal WR2 is output to the RAM 5.
5, the input data DA2 becomes RA
Stored in M5.

【0015】その一方で、RAM5にデータを書き込む
ことに応答して、CPU1から不揮発性メモリ2用のア
ドレス信号AD4がセレクタ12及び13を介して不揮
発性メモリ2のアドレス制御部2bに入力され、不揮発
性メモリ2のアドレスが指定される。この時のアドレス
信号AD4は不揮発性メモリ2の特定アドレス領域00
00H〜0100Hを指定するものであって、特にRA
M5用に割り当てられた領域を指定するものである。
On the other hand, in response to writing data to the RAM 5, an address signal AD4 for the nonvolatile memory 2 is input from the CPU 1 to the address control unit 2b of the nonvolatile memory 2 via the selectors 12 and 13, The address of the nonvolatile memory 2 is specified. At this time, the address signal AD4 is stored in the specific address area 00 of the nonvolatile memory 2.
00H to 0100H, especially RA
This specifies the area allocated for M5.

【0016】指定されたアドレスのデータを消去した
後、入力データDA1はセレクタ17及び18を介して
データ入力部2dに入力される。そして、ライト信号W
R2がオアゲート10を介してリード/ライト制御部9
aに入力され、データのライト制御が行われて、不揮発
性メモリ2の特定アドレス領域にRAM5に書き込まれ
たデータと同一のデータが記憶される。
After erasing the data at the designated address, the input data DA1 is input to the data input section 2d via the selectors 17 and 18. Then, the write signal W
R2 is connected via the OR gate 10 to the read / write controller 9
a, data write control is performed, and the same data as the data written to the RAM 5 is stored in a specific address area of the nonvolatile memory 2.

【0017】また、レジスタ6にデータを記憶させる場
合もRAM5と同様な動作が行われる。CPU1はセレ
クト信号SEL2をLレベルとし、セレクタ13にセレ
クタ12の出力を選択させ、セレクタ18にセレクタ1
7の出力を選択させる。さらに、セレクタ信号SEL3
をLレベルとするので、セレクタ12及び17にアドレ
ス信号AD5及びレジスタ6への入力データDA3を選
択させる。
When data is stored in the register 6, the same operation as that of the RAM 5 is performed. The CPU 1 sets the select signal SEL2 to L level, causes the selector 13 to select the output of the selector 12,
7 is selected. Further, the selector signal SEL3
Is set to the L level, the selectors 12 and 17 are caused to select the address signal AD5 and the input data DA3 to the register 6.

【0018】そして、レジスタ6用のアドレス信号AD
3がレジスタ6に入力され、レジスタ6のアドレスが指
定される。アドレス指定後、入力データDA3がセレク
タ8を介してレジスタ6に入力され、ライト信号WR3
がレジスタ6に入力されることによって、入力データD
A3がレジスタ6に保持される。その一方で、レジスタ
6にデータを書き込むことに応答して、CPU1から不
揮発性メモリ2用のアドレス信号AD5がセレクタ12
及び13を介して不揮発性メモリ2のアドレス制御部2
bに入力され、不揮発性メモリ2のアドレスが指定され
る。この時のアドレス信号AD5はアドレス信号AD4
と同様に不揮発性メモリ2の特定アドレス領域0000
H〜0100Hを指定するものであって、特にレジスタ
6用に割り当てられた領域を指定するものである。
The address signal AD for the register 6
3 is input to the register 6, and the address of the register 6 is designated. After the address is specified, the input data DA3 is input to the register 6 via the selector 8, and the write signal WR3
Is input to the register 6 so that the input data D
A3 is held in the register 6. On the other hand, in response to writing data to the register 6, the address signal AD 5 for the nonvolatile memory 2 is sent from the CPU 1 to the selector 12.
And the address control unit 2 of the nonvolatile memory 2
b, the address of the nonvolatile memory 2 is designated. At this time, the address signal AD5 becomes the address signal AD4.
Similarly, the specific address area 0000 of the nonvolatile memory 2
H to 0100H are specified, and in particular, an area allocated for the register 6 is specified.

【0019】指定されたアドレスのデータを消去した
後、入力データDA2はセレクタ17及び18を介して
データ入力部2dに入力される。そして、ライト信号W
R3がオアゲート10を介してリード/ライト制御部2
aに入力され、不揮発性メモリ2の特定アドレス領域に
レジスタ6に書き込まれたデータと同一のデータが記憶
される。
After erasing the data at the designated address, the input data DA2 is input to the data input section 2d via the selectors 17 and 18. Then, the write signal W
R3 is read / write control unit 2 via OR gate 10
a, and the same data as the data written to the register 6 is stored in the specific address area of the nonvolatile memory 2.

【0020】上記のように、RAM5及びレジスタ6に
対応するアドレス信号が不揮発性メモリ2のアドレス制
御部2bに入力され、それぞれのアドレス信号に応じて
アドレスが指定される。従って、RAM5またはレジス
タ6に対応する領域が不揮発性メモリ2に割り当てられ
ていることになる。割り当てられた領域に対応するRA
M5またはレジスタ6のデータと同一のデータが記憶さ
れる。
As described above, the address signals corresponding to the RAM 5 and the register 6 are input to the address control unit 2b of the nonvolatile memory 2, and an address is specified according to each address signal. Therefore, the area corresponding to the RAM 5 or the register 6 is allocated to the nonvolatile memory 2. RA corresponding to the allocated area
The same data as the data in M5 or the register 6 is stored.

【0021】ここで、電源が遮断されたとする。不揮発
性メモリ2にはRAM5またはレジスタ6のデータ書き
換え毎に最新のデータが書き込まれているので、不揮発
性メモリ2にはRAM5及びレジスタ6のデータが退避
されていることになる。電源が復帰すると、CPU1は
セレクト信号SEL2及びSEL4をLレベルとし、セ
レクタ14に対してセレクタ15にデータを転送するよ
うにセレクトさせるとともに、セレクタ7及び8に不揮
発性メモリ2からのデータを選択させる。この状態で、
CPU1は、セレクタ信号SEL3をHレベルとしてセ
レクタ12及び15にRAM5側を選択させ、アドレス
信号AD4及びAD2を不揮発性メモリ2及びRAM5
にそれぞれに出力する。アドレス信号AD1に応じて、
前記特定アドレス領域中の割り当て領域に対応するアド
レスが指定される。その後、CPU1からリード信号R
Eが出力され、RAM5の退避データが不揮発性メモリ
2から読み出される。読み出されたデータはセレクタ1
4,15及び7を介してRAM5に入力され、RAM5
に書き込まれる。
Here, it is assumed that the power supply is cut off. Since the latest data is written in the non-volatile memory 2 every time the data in the RAM 5 or the register 6 is rewritten, the data in the RAM 5 and the register 6 are saved in the non-volatile memory 2. When the power is restored, the CPU 1 sets the select signals SEL2 and SEL4 to the L level, causes the selector 14 to select the data to be transferred to the selector 15, and causes the selectors 7 and 8 to select the data from the nonvolatile memory 2. . In this state,
The CPU 1 sets the selector signal SEL3 to the H level and causes the selectors 12 and 15 to select the RAM5 side, and stores the address signals AD4 and AD2 in the nonvolatile memory 2 and the RAM5.
Output to each. According to the address signal AD1,
An address corresponding to the assigned area in the specific address area is designated. After that, the read signal R
E is output, and the save data in the RAM 5 is read from the nonvolatile memory 2. The read data is the selector 1
Input to the RAM 5 via the RAM 4, 5, and 7,
Is written to.

【0022】次に、セレクト信号SEL3がLレベルに
なり、レジスタ6側が選択される。CPU1は、アドレ
ス信号AD3及びAD5をレジスタ6及び不揮発性メモ
リ2にそれぞれ出力する。アドレス信号AD5に応じ
て、特定アドレス領域中の割り当て領域に対応するアド
レスが指定される。その後、CPU1からリード信号R
Eが出力され、レジスタ6の退避データが不揮発性メモ
リ2から読み出される。読み出されたデータはセレクタ
14、15及び8を介してレジスタ6に入力され、書き
込まれる。
Next, the select signal SEL3 goes low, and the register 6 is selected. The CPU 1 outputs the address signals AD3 and AD5 to the register 6 and the nonvolatile memory 2, respectively. In accordance with address signal AD5, an address corresponding to the assigned area in the specific address area is specified. After that, the read signal R
E is output, and the save data of the register 6 is read from the nonvolatile memory 2. The read data is input to the register 6 via the selectors 14, 15, and 8, and is written.

【0023】このようにして、電源が復帰すると、不揮
発性メモリ9に退避されてあったデータがRAM5及び
レジスタ6に戻され、データの消失を防止できる。尚、
図1では、RAM5及びレジスタ6のデータを不揮発性
メモリ2に記憶させているが、電源遮断時等にデータを
失いたくなく一時退避させておきたいデータであれば、
上記回路のデータだけでなく他の回路のデータを一時待
避させることも可能である。
In this way, when the power is restored, the data saved in the nonvolatile memory 9 is returned to the RAM 5 and the register 6, so that the data can be prevented from being lost. still,
In FIG. 1, the data of the RAM 5 and the register 6 are stored in the non-volatile memory 2. However, if the data does not want to be lost at the time of power-off or the like and should be temporarily saved,
It is possible to temporarily save not only the data of the above circuit but also the data of other circuits.

【0024】次に、通常動作中に外部割り込みによるデ
ータの書き換えを説明する。まずCPU1からセレクト
信号SL1がLレベルになり、セレクタ11はアドレス
信号AD1をマスクROM9の方へ出力させ、セレクタ
16はマスクROM9の出力データをセレクトする。そ
の後、プログラムカウンタ3の現在のカウント値がレジ
スタ(図示せず)に格納された後、プログラムカウンタ
3のカウント値を所定値に設定させる。これにより、マ
スクROM9用のアドレス0000H〜0100Hのい
ずれかを指定するアドレス信号AD1が出力される。ア
ドレス信号AD1は、セレクタ11を介してマスクRO
M9のアドレス制御部9aに入力される。そして、RO
M9のアドレスが指定されて、ROM9のプログラムデ
ータが読み出される。プログラムデータはセレクタ16
を介してインストラクションデコーダ4に入力され、プ
ログラム命令にデコードされる。さらに、プログラムカ
ウンタPCがインクリメントされ、ROM9内の次のア
ドレスが指定される。マスクROM9には不揮発性メモ
リ2のデータを書き換えるプログラムが書き込まれてお
り、このプログラムに従ってCPU1が動作する。ま
ず、外部RAM19から書き換えられるデータが読み出
される。読み出されたデータは図示されないCPU1の
レジスタに保持された後、不揮発性メモリ2のデータ入
力部2aに入力データDA1として転送される。データ
入力部2aのデータは不揮発性メモリ2に書き込まれ、
データ書換えが完了する。書換えが完了すると、図示さ
れないレジスタに格納されていた外部割込み直前のカウ
ント値がプログラムカウント3にセットされ、通常動作
に戻る。
Next, rewriting of data by an external interrupt during normal operation will be described. First, the select signal SL1 from the CPU 1 becomes L level, the selector 11 outputs the address signal AD1 to the mask ROM 9, and the selector 16 selects the output data of the mask ROM 9. Thereafter, after the current count value of the program counter 3 is stored in a register (not shown), the count value of the program counter 3 is set to a predetermined value. As a result, an address signal AD1 designating any one of the addresses 0000H to 0100H for the mask ROM 9 is output. The address signal AD1 is supplied to the mask RO via the selector 11.
It is input to the address control unit 9a of M9. And RO
The address of M9 is specified, and the program data in ROM 9 is read. The program data is stored in the selector 16
To the instruction decoder 4 and decoded into a program instruction. Further, the program counter PC is incremented, and the next address in the ROM 9 is designated. A program for rewriting data in the nonvolatile memory 2 is written in the mask ROM 9, and the CPU 1 operates according to the program. First, data to be rewritten is read from the external RAM 19. The read data is held in a register (not shown) of the CPU 1 and then transferred to the data input unit 2a of the nonvolatile memory 2 as input data DA1. Data of the data input unit 2a is written to the nonvolatile memory 2,
Data rewriting is completed. When the rewriting is completed, the count value immediately before the external interrupt stored in the register (not shown) is set to the program count 3 and the operation returns to the normal operation.

【0025】[0025]

【発明の効果】本発明によれば、RAMやレジスタにデ
ータを書き込む毎に、不揮発性メモリに前記データと同
一のデータを書き込むので、書き込み時間の長い不揮発
性メモリであってもデータを記憶させることができ、電
源遮断等の緊急時にデータの消失を防止することができ
る。その為、電源が遮断されたから実際にマイクロコン
ピュータが動作しなくなるまでの時間を短くすることが
可能となり、バックアップコンデンサーを大きくする必
要はない。特に、メモリとして電気的に一括消去可能な
不揮発性メモリを使用するので、電源が遮断された状態
でもデータを記憶することが可能である。
According to the present invention, every time data is written to the RAM or the register, the same data as the data is written to the nonvolatile memory, so that the data can be stored even in a nonvolatile memory having a long write time. Data can be prevented from being lost in an emergency such as power-off. Therefore, it is possible to shorten the time from when the power is cut off until the microcomputer actually stops operating, and it is not necessary to increase the size of the backup capacitor. In particular, since a non-volatile memory that can be electrically erased collectively is used as the memory, data can be stored even when the power is off.

【0026】また、従来では未使用状態であった不揮発
性メモリの一部領域にデータを退避させるので、不揮発
性メモリを有効に利用することができる。
Further, since data is saved in a part of the nonvolatile memory which has not been used in the related art, the nonvolatile memory can be effectively used.

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

【図1】本発明の実施の形態を示すブロック図である。FIG. 1 is a block diagram showing an embodiment of the present invention.

【図2】従来例を示すブロック図である。FIG. 2 is a block diagram showing a conventional example.

【図3】電気的に一括消去可能な不揮発性メモリの構造
を示す構造図である。
FIG. 3 is a structural diagram showing the structure of a nonvolatile memory that can be electrically erased in a batch.

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

1 CPU 2 不揮発性メモリ 3 プログラムカウンタ 4 インストラクションデコーダ 5 RAM 6 レジスタ 7、8、11〜18 セレクタ 9 ROM 10 オアゲート 19 外部RAM DESCRIPTION OF SYMBOLS 1 CPU 2 Non-volatile memory 3 Program counter 4 Instruction decoder 5 RAM 6 Registers 7, 8, 11-18 Selector 9 ROM 10 OR gate 19 External RAM

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】 演算時データが保持される少なくともR
AM及び/またはレジスタを有するマイクロコンピュー
タにおいて、 プログラムデータが書き込まれ、電気的に一括消去可能
な不揮発性メモリと、 該不揮発性メモリのプログラムを書きかえるためのプロ
グラムが書き込まれるとともに、前記不揮発性メモリの
特定アドレスと同一のアドレスが付されたROMとを含
み、 前記RAM及び/またはレジスタへの書き込み信号に応
じて、前記RAM及び/またはレジスタに記憶されるデ
ータを、前記不揮発性メモリの特定アドレス領域に記憶
させる手段を備えることを特徴とするマイクロコンピュ
ータ。
At least R at which data at the time of calculation is held
In a microcomputer having an AM and / or a register, a nonvolatile memory in which program data is written and electrically erasable collectively, and a program for rewriting a program in the nonvolatile memory are written and the nonvolatile memory And a ROM assigned the same address as the specified address of the nonvolatile memory, and stores data stored in the RAM and / or the register in response to a write signal to the RAM and / or the register. A microcomputer comprising means for storing data in an area.
【請求項2】 前記不揮発性メモリ及びROMに付され
た同一アドレスに対して、通常動作時前記ROMのアド
レスを選択し、書き込み時に前記不揮発性メモリのアド
レスを選択するセレクタ手段を備えることを特徴とする
請求項1記載のマイクロコンピュータ。
2. A selector for selecting an address of the ROM during normal operation and an address of the non-volatile memory during writing for the same address assigned to the nonvolatile memory and the ROM. The microcomputer according to claim 1, wherein
【請求項3】 データ読み出し時、前記不揮発性メモリ
に記憶されたデータを読み出し、前記RAMやレジスタ
を転送する手段を備えることを特徴とする請求項1記載
のマイクロコンピュータ。
3. The microcomputer according to claim 1, further comprising means for reading data stored in said nonvolatile memory and transferring said RAM and registers when reading data.
【請求項4】 前記不揮発性メモリにおいて、前記RA
Mまたはレジスタに応じたアドレス信号に基づいてアド
レスが指定され、前記データが前記RAMまたはレジス
タに応じた書き込み信号により書き込まれることを特徴
とする請求項1または2記載のマイクロコンピュータ。
4. The nonvolatile memory according to claim 3, wherein
3. The microcomputer according to claim 1, wherein an address is specified based on an address signal corresponding to M or a register, and the data is written by a write signal corresponding to the RAM or the register.
JP10085563A 1998-03-31 1998-03-31 Microcomputer Pending JPH11282761A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP10085563A JPH11282761A (en) 1998-03-31 1998-03-31 Microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP10085563A JPH11282761A (en) 1998-03-31 1998-03-31 Microcomputer

Publications (1)

Publication Number Publication Date
JPH11282761A true JPH11282761A (en) 1999-10-15

Family

ID=13862290

Family Applications (1)

Application Number Title Priority Date Filing Date
JP10085563A Pending JPH11282761A (en) 1998-03-31 1998-03-31 Microcomputer

Country Status (1)

Country Link
JP (1) JPH11282761A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150006094A1 (en) * 2013-06-28 2015-01-01 Solantro Semiconductor Corp. Inverter with extended endurance memory

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150006094A1 (en) * 2013-06-28 2015-01-01 Solantro Semiconductor Corp. Inverter with extended endurance memory
US9397500B2 (en) * 2013-06-28 2016-07-19 Solantro Semiconductor Corp. Inverter with extended endurance memory

Similar Documents

Publication Publication Date Title
CN100357883C (en) Microcontroller with a single memory block that has a data storage sector and a code storage sector and supports read/write access to both sectors
JPH0778766B2 (en) Method and apparatus for controlling direct execution of program in external storage device using randomly accessible and rewritable memory
JP3773607B2 (en) Microcomputer with built-in flash EEPROM
JPH03216745A (en) Microprocessor incorporating cache memory
US6792565B1 (en) Address conversion device for nonvolatile memory
KR100468635B1 (en) Non-volatile semiconductor memory device and information apparatus
JPH07302254A (en) Microcomputer system
JP2004013477A (en) Method for selecting and updating boot program and flash memory using the same
JP4491267B2 (en) Nonvolatile semiconductor memory device
US6898680B2 (en) Minimization of overhead of non-volatile memory operation
JPH11282586A (en) Microcomputer
JP3223160B2 (en) Microcomputer
EP0714060B1 (en) One chip microcomputer with built-in non-volatile memory
JPH11353153A (en) Register setting circuit
JP2000105701A (en) Data processing device
JP2012178099A (en) Control device and program changing method
JP2000276880A (en) Write-in circuit for non-volatile memory
JPH08161219A (en) Controller for flash memory device
JPH11353170A (en) Flash memory control device and memory access method of flash memory control device
JPH11282766A (en) Microcomputer
JPH1139222A (en) Microcomputer
JPS631623B2 (en)
JP2006190370A (en) Semiconductor device
JPH10240622A (en) Memory controller
JPS6037557B2 (en) Non-volatile memory refresh method