JP4592280B2 - Data storage - Google Patents

Data storage Download PDF

Info

Publication number
JP4592280B2
JP4592280B2 JP2003408964A JP2003408964A JP4592280B2 JP 4592280 B2 JP4592280 B2 JP 4592280B2 JP 2003408964 A JP2003408964 A JP 2003408964A JP 2003408964 A JP2003408964 A JP 2003408964A JP 4592280 B2 JP4592280 B2 JP 4592280B2
Authority
JP
Japan
Prior art keywords
value
byte
stored
area
data
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 - Fee Related
Application number
JP2003408964A
Other languages
Japanese (ja)
Other versions
JP2005173699A (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.)
Denso Ten Ltd
Original Assignee
Denso Ten 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 Denso Ten Ltd filed Critical Denso Ten Ltd
Priority to JP2003408964A priority Critical patent/JP4592280B2/en
Publication of JP2005173699A publication Critical patent/JP2005173699A/en
Application granted granted Critical
Publication of JP4592280B2 publication Critical patent/JP4592280B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

本発明は、連続してカウントされるデータをバックアップメモリに精度良く記憶しかつ読み出すことができる、データ記憶装置に関する。   The present invention relates to a data storage device capable of accurately storing and reading data counted continuously in a backup memory.

寿命管理のために動作時間を記憶する必要がある機器や、何らかのイベントの発生頻度、例えばスイッチの操作回数を記憶する必要がある機器では、動作時間、発生頻度等のカウントデータをバックアップメモリに記憶しておくことが行われている。記憶されたデータは、機器が動作を停止した後、再び動作を開始した時点でバックアップメモリから読み出され、読出し値を初期値として次のカウントが開始される。したがって、カウントデータはバックアップメモリに精度良く記憶されかつ精度良く読み出される必要がある。   For devices that need to store the operating time for life management, or devices that need to store the frequency of occurrence of some event, such as the number of switch operations, store count data such as the operating time and frequency of occurrence in the backup memory. It has been done. The stored data is read from the backup memory when the operation is restarted after the device stops operating, and the next count is started with the read value as an initial value. Therefore, the count data needs to be stored in the backup memory with high accuracy and read out with high accuracy.

一般的な記憶用メモリ、例えばEEPROMなどでは、1バイト単位のアクセスであるため、2バイト以上のデータを記憶する際には、複数回にわけてアクセスを行う必要がある。ところが、例えば1バイト記憶後、何らかの要因で機器への供給電源が遮断されると、次のバイト以降のデータは記憶することができない。そのため、このような状態で次の電源オン時にバックアップメモリの記憶値を読み出すと、正しくない値を読み出すことがある。   In a general storage memory, for example, an EEPROM or the like, access is performed in units of 1 byte. Therefore, when data of 2 bytes or more is stored, it is necessary to perform access several times. However, for example, if the power supply to the device is interrupted for some reason after storing 1 byte, data after the next byte cannot be stored. Therefore, if the stored value of the backup memory is read at the next power-on in such a state, an incorrect value may be read.

図1は、2バイトのデータを記憶する場合の書込み処理及び読出し処理を示す図である。図1の例は、16ビットマシンによって0〜255の値をカウントする場合を想定しているので、各ビットは0〜9、A〜Fの16個の数値を取る。図の「処理サイクル」はマイコン等からデータをバックアップメモリに書き込むための書込みのサイクルを示し、「記憶したい値」はマイコン等がカウントしバックアップが必要な値を示す。さらに、「書き込み値」は、各処理サイクルにおいて、マイコン等からバックアップメモリに送信されるデータを示し、「記憶値」はバックアップメモリに記憶された値を示す。   FIG. 1 is a diagram showing a writing process and a reading process in the case of storing 2-byte data. Since the example of FIG. 1 assumes a case where a value of 0 to 255 is counted by a 16-bit machine, each bit takes 16 numerical values of 0 to 9 and A to F. “Processing cycle” in the figure indicates a write cycle for writing data from a microcomputer or the like to a backup memory, and “value to be stored” indicates a value that the microcomputer or the like counts and needs to be backed up. Furthermore, “write value” indicates data transmitted from the microcomputer or the like to the backup memory in each processing cycle, and “stored value” indicates a value stored in the backup memory.

今、図示するように、マイコン等において記憶したい値として5AFEという数値がカウントされている場合を考えると、処理サイクル1でその数値の上位バイト値5Aをバックアップメモリに送信し、書き込む。このとき、バックアップメモリ内には、前回の記憶値として5AFEの一つ前の値、5AFDが記憶されているので、処理サイクル1では、バックアップメモリの上位バイトを記憶する領域に数値5Aを上書きする。   Now, as shown in the figure, when a numerical value of 5AFE is counted as a value to be stored in the microcomputer or the like, the upper byte value 5A of the numerical value is transmitted to the backup memory and written in the processing cycle 1. At this time, since the value 5AFD immediately before 5AFE is stored in the backup memory as the previous stored value, in the processing cycle 1, the numerical value 5A is overwritten in the area storing the upper byte of the backup memory. .

処理サイクル2では、記憶したい値5AFEの下位バイトをバックアップメモリの下位バイト領域に書き込む。これによって、記憶したい値5AFEの書込みが終了する。同様の書込み処理を行うことによって、カウントアップが進んで記憶したい値が5B00となると、処理サイクル6で、バックアップメモリに数値5B00が書き込まれる。   In process cycle 2, the lower byte of the value 5AFE to be stored is written into the lower byte area of the backup memory. This completes the writing of the value 5AFE to be stored. By performing the same writing process, when the count-up progresses and the value to be stored reaches 5B00, the value 5B00 is written to the backup memory in the processing cycle 6.

図1の処理サイクルに従ってカウント値の書込みが行われている状態で、通常の操作により機器の操作が終了し電源が遮断される場合は、バックアップメモリは、記憶したい値を完全に書き込んだ状態、即ち図1の偶数サイクルの状態で維持される。そのため、機器への次の電源の投入時には、バックアップメモリから正しい数値データを読み出し、これをカウントの初期値とすることができる。   In the state where the count value is written according to the processing cycle of FIG. 1, when the operation of the device is terminated by the normal operation and the power is shut off, the backup memory is in a state where the value to be stored is completely written, That is, the state is maintained in the even cycle state of FIG. Therefore, when the next power supply to the device is turned on, correct numerical data can be read from the backup memory and used as the initial count value.

ところが、何らかの要因で機器の供給電源が正常ではない方法で遮断された場合、例えば記憶したい値の上位バイトの書込みが終了した時点で電源が遮断されると、次の電源投入時における記憶データの読出しは、図1の奇数サイクルの状態のデータを読み出すことになる。例えば、処理サイクル5の終了時点で電源が遮断されると、バックアップメモリには、記憶したい値5B00の上位バイト5Bが書き込まれ、一方その下位バイトには前回の記憶したい値5AFFの下位バイトの値FFが保持された状態となる。   However, if the power supply of the device is shut down in an abnormal way due to some reason, for example, if the power is shut down at the end of writing the upper byte of the value to be stored, the stored data at the next power on For reading, the data in the odd-numbered cycle state of FIG. 1 is read. For example, when the power is turned off at the end of the processing cycle 5, the upper byte 5B of the value 5B00 to be stored is written to the backup memory, while the lower byte of the value 5AFF to be stored last time is written in the lower byte. The FF is held.

この状態で、電源を再投入すると、処理サイクル5においてバックアップメモリに記憶された値5BFFが読み出される。本来読み出されるべき値は、記憶したい値5B00であるので、全く異なった値が読み出されることになる。このように、異常な電源遮断が発生した場合の読出し値は信頼性のない値となる。   When the power is turned on again in this state, the value 5BFF stored in the backup memory in the processing cycle 5 is read out. Since the value that should be read out is the value 5B00 to be stored, a completely different value is read out. Thus, the read value when an abnormal power interruption occurs is an unreliable value.

従来では、このような事態に対処するために、バックアップメモリへの書込み処理中に異常な電源遮断等による書込みの中断が起こった場合、その事態の発生を記憶しておき、読出し時に記憶値を強制的にクリアする等の処置を取っていた。   Conventionally, in order to cope with such a situation, when writing interruption occurs due to abnormal power interruption or the like during the writing process to the backup memory, the occurrence of the situation is stored, and the stored value at the time of reading is stored. I was taking measures such as forcibly clearing it.

なお、本発明の技術一般に関する先行技術として、特開2000−222290号公報に、電源オフ時にあっても記憶中のデータを記憶保持可能なバックアップメモリに記憶保持する技術が開示されているが、この技術ではデータの書込み中に電源がオフされたか否かをフラグにより記憶するようにしている。   As a prior art related to the general technology of the present invention, Japanese Patent Application Laid-Open No. 2000-222290 discloses a technology for storing and holding data stored in a backup memory even when the power is turned off. In this technique, whether or not the power is turned off during data writing is stored by a flag.

また、電源遮断などの障害の影響を受けずに検品作業を効率よく実施できるようにした商品検査装置を開示する特開平6−162054号公報、データバックアップ式コンピュータシステムを開示した特開平6−83720号公報、及びシステムが電源遮断した場合に電源復旧後、補助記憶装置間でデータをコピーする方式を開示した特開平6−12191号公報等がある。   Further, Japanese Patent Laid-Open No. 6-162054 discloses a product inspection apparatus capable of efficiently performing inspection work without being affected by a failure such as a power shutdown, and Japanese Patent Laid-Open No. 6-83720 which discloses a data backup type computer system. Japanese Patent Laid-Open No. 6-12191 discloses a method for copying data between auxiliary storage devices after power is restored when the system is powered off.

特開2000−222290号JP 2000-222290 A

特開平6−162054号JP-A-6-162054

特開平6−83720号JP-A-6-83720

特開平6−12191号JP-A-6-12191

上述したように、従来では、バックアップメモリに書込み中に異常な電源遮断等が発生すると、次の読出しの時点で読み出し値が不明となるため、これを強制的にクリアする等の処置を取っていたが、この方法ではこれまでのデータが全て失われ、新たに寿命管理等のためのカウントを始めなければならない。   As described above, conventionally, when an abnormal power interruption occurs during writing to the backup memory, the read value becomes unknown at the time of the next read, and thus measures such as forcibly clearing this are taken. However, with this method, all of the previous data is lost and a new count for life management must be started.

本発明は、かかる点に関して成されたもので、バックアップメモリへの書込み処理が強制的に中断された場合であっても、このような事態の発生を検出し記憶する特別な手段を必要とせずに、しかも最小の誤差で記憶データを読み出すことが可能な、データの記憶装置を得ることを目的として為されたものである。   The present invention has been made with respect to this point, and even when the writing process to the backup memory is forcibly interrupted, no special means for detecting and storing the occurrence of such a situation is required. In addition, the present invention was made for the purpose of obtaining a data storage device that can read stored data with a minimum error.

本発明のデータ記憶装置は、上記課題を解決するために、連続してカウントアップまたはカウントダウンされる2バイト以上の値を記憶したい値として保持する揮発性のメモリと、前記記憶したい値が書き込まれるバックアップメモリと、前記揮発性のメモリと前記バックアップメモリ間でのバイト単位のデータ書込み及び読出しを制御するデータ処理部とを備えるデータ記憶装置において、前記バックアップメモリは、前記記憶したい値をバイト単位で記憶するバイト記憶領域と、前記記憶したい値の前回値における最下位バイトの次のバイト位置の値を記憶する前回値領域とを備え、前記データ処理部は、前記記憶したい値と前記前回値とを前回の記憶処理時に記憶した領域と同一の領域に上書きしていくものであり、
前記バックアップメモリにデータを書き込むにあたって、前記前回値領域に前記記憶したい値の前回値を書き込み、その後、前記記憶したい値を、前記バイト記憶領域における最下位バイトの次のバイト位置に書き込んだ後に、前記バイト記憶領域における最下位バイト位置に書き込む処理を行い、前記バックアップメモリからデータを読み出すにあたって、前記バックアップメモリにおけるバイト記憶領域に記憶された、最下位バイトの値がカウント最終値であった場合には、前記最下位バイトの次のバイト位置の値に前記前回値領域に記憶された値を採用することを特徴とする。
In order to solve the above problems, the data storage device of the present invention is written with a volatile memory that holds a value of 2 bytes or more that are continuously counted up or down as a value to be stored, and the value to be stored. In a data storage device comprising a backup memory, and a volatile memory and a data processing unit that controls data writing and reading in bytes between the backup memories, the backup memory stores the value to be stored in bytes. A byte storage area for storing, and a previous value area for storing the value of the byte position next to the least significant byte in the previous value of the value to be stored, wherein the data processing unit includes the value to be stored, the previous value, Is overwritten in the same area as the area stored during the previous storage process,
When writing data to the backup memory, write the previous value of the value to be stored in the previous value area, and then write the value to be stored in the byte position next to the least significant byte in the byte storage area. When performing processing to write to the least significant byte position in the byte storage area and reading the data from the backup memory, when the value of the least significant byte stored in the byte storage area in the backup memory is the final count value Adopts the value stored in the previous value area as the value of the byte position next to the least significant byte.

また、本発明のデータ記憶装置は、上記課題を解決するために、連続してカウントアップまたはカウントダウンされる2バイト以上の値を記憶したい値として保持する揮発性のメモリと、前記記憶したい値が書き込まれるバックアップメモリと、前記揮発性のメモリと前記バックアップメモリ間でのバイト単位のデータ書込み及び読出しを制御するデータ処理部とを備えるデータ記憶装置において、前記バックアップメモリは、前記記憶したい値をバイト単位で記憶するバイト記憶領域と、前記記憶したい値の前回値における最下位バイトの次のバイト位置の値を記憶する前回値領域とを備え、前記データ処理部は、前記記憶したい値と前記前回値とを前回の記憶処理時に記憶した領域と同一の領域に上書きしていくものであり、前記バックアップメモリにデータを書き込むにあたって、前記前回値領域に前記記憶したい値の前回値を書き込み、その後、前記記憶したい値を、前記バイト記憶領域における最下位バイト位置に書き込んだ後に、前記バイト記憶領域における最下位バイトの次のバイト位置に書き込む処理を行い、前記バックアップメモリからデータを読み出すにあたって、前記バックアップメモリにおけるバイト記憶領域に記憶された、最下位バイトの値がカウント開始値であり、かつ、前記バイト記憶領域における最下位バイトの次のバイト位置の値が前記前回値領域に記憶した値と同じであった場合には、前記最下位バイトの値にカウント最終値を採用することを特徴とする。 In order to solve the above-described problem, the data storage device of the present invention includes a volatile memory that holds a value of 2 bytes or more that are continuously counted up or down as a value to be stored, and a value to be stored. In a data storage device comprising: a backup memory to be written; and a data processing unit that controls writing and reading of data in units of bytes between the volatile memory and the backup memory, the backup memory stores the value to be stored in bytes A byte storage area for storing in units, and a previous value area for storing the value of the byte position next to the least significant byte in the previous value of the value to be stored, and the data processing unit includes the value to be stored and the previous value Value is overwritten in the same area as the area stored in the previous storage process. When writing data to the memory, the previous value of the value to be stored is written to the previous value area, and then the value to be stored is written to the least significant byte position in the byte storage area. When performing processing to write to the byte position next to the lower byte and reading data from the backup memory, the value of the least significant byte stored in the byte storage area in the backup memory is the count start value, and the byte When the value of the byte position next to the least significant byte in the storage area is the same as the value stored in the previous value area, the final count value is adopted as the value of the least significant byte.

図1から明らかなように、バックアップメモリの読出し値が実際の値と大きく異なる場合は、読出し値の最下位バイトの値がFF、即ちカウント可能な最終値である場合に発生する。これは、最下位バイトの値がFFであると、このバイトの次の位置の値が書き換えられている可能性が大きいためである。従って本発明では、バックアップメモリにデータを書き込むに当たって、記憶したい値の前回値における最下位バイトの次の位置の値をバックアップメモリの前回値領域に同様に書き込んでおく。これによって、読出し時に最下位バイトの値がFFであれば、最下位バイトの次の値として前回値領域に書き込まれた値を採用することで、読出し値と本来の値との差を最小とすることができる。   As can be seen from FIG. 1, when the read value of the backup memory is significantly different from the actual value, it occurs when the value of the least significant byte of the read value is FF, that is, the final value that can be counted. This is because if the value of the least significant byte is FF, the value at the next position of this byte is likely to be rewritten. Therefore, in the present invention, when writing data to the backup memory, the value at the position next to the least significant byte in the previous value of the value to be stored is similarly written in the previous value area of the backup memory. Thus, if the value of the least significant byte is FF at the time of reading, adopting the value written in the previous value area as the next value of the least significant byte minimizes the difference between the read value and the original value. can do.

また、上記装置において、前記データ処理部は、前記バックアップメモリからデータを読み出すにあたって、前記バイト記憶領域に記憶された最下位バイトの値及び前回値領域に記憶された値に基づいて、データ書き込み中に異常処理が発生した可能性のある前記バックアップメモリの記憶値を補正するようにされている。 Further, in the above device, the data processing unit is writing data based on the value of the least significant byte stored in the byte storage area and the value stored in the previous value area when reading data from the backup memory. The stored value of the backup memory in which an abnormal process may have occurred is corrected.

また、上記装置において、前記揮発性のメモリは前記記憶したい値を記憶する第1の領域と前記記憶したい値の前回値を記憶する第2の領域を備え、前記データ処理部は前記バックアップメモリに前記記憶したい値をバイト単位で書き込むに当たって、前記第1の領域と第2の領域の値をバイト単位で比較し、異なっている場合に前記第1の領域に記憶された値を前記バックアップメモリに書き込むようにされている。   In the above apparatus, the volatile memory includes a first area for storing the value to be stored and a second area for storing the previous value of the value to be stored, and the data processing unit is stored in the backup memory. In writing the value to be stored in bytes, the values in the first area and the second area are compared in bytes. If they are different, the value stored in the first area is stored in the backup memory. It is supposed to write.

この結果、書込み処理の回数を大幅に削減することができるので、全体システムの設計の自由度が向上し、さらにバックアップメモリの耐久性が向上する。   As a result, the number of write processes can be greatly reduced, so that the degree of freedom in designing the entire system is improved and the durability of the backup memory is improved.

さらに、上記装置において、前記記憶したい値が3バイト以上の値である場合、前記前回値領域には、前記前回値における最下位バイト値の更新によってその値が更新される全てのバイト位置の値が記憶されるようにされている。これにより、記憶したい値が3バイト以上の値であっても、異常な電源遮断に拘わらず最小の誤差範囲でデータを読み出すことが可能となる。   Further, in the above device, when the value to be stored is a value of 3 bytes or more, the previous value area includes all byte position values that are updated by updating the least significant byte value in the previous value. Is memorized. As a result, even if the value to be stored is 3 bytes or more, data can be read out with a minimum error range regardless of abnormal power interruption.

さらに、上記装置において、データ処理部が前記バックアップメモリに下位バイトから上位バイトの順でデータの書き換えを行うものである場合、バックアップメモリからデータを読み出すにあたって、バックアップメモリに記憶された最下位バイトの値が00で、かつ前回値と最下位バイトの次のバイト位置の値とが等しい場合、読み出された最下位バイトの値(00)に代わってカウント可能な最終値を用いるようにされている。これにより、バックアップメモリへのデータの書込みが、下位バイトから上位バイトへの順で行われる装置であっても、最小の誤差範囲でデータを読み出すことが可能となる。   Further, in the above apparatus, when the data processing unit rewrites data in the order from the lower byte to the upper byte in the backup memory, when reading the data from the backup memory, the least significant byte stored in the backup memory When the value is 00 and the previous value is equal to the value of the byte position next to the least significant byte, the last value that can be counted is used instead of the read value of the least significant byte (00). Yes. As a result, even in a device in which data is written to the backup memory in order from the lower byte to the upper byte, the data can be read with a minimum error range.

図2は、本発明にかかるデータ記憶装置の一実施形態を示すブロック図である。図において、1はマイコン等のメインCPUであり、データ処理部2と通常は揮発性であるメモリ3を有している。データ処理部2はROM等に予め記憶されたプログラムに従ってデータを処理し、メモリ3は機器への一定のアクセス時間によってカウントアップされる数値データ、あるいはスイッチの操作回数等を記憶する。本実施形態では、メモリ3はカウントデータの内容の上位バイト値を記憶する領域31、下位バイト値を記憶する領域32及び前回のカウント値の上位バイト値(以下、前回値)を記憶する領域33を備えている。   FIG. 2 is a block diagram showing an embodiment of a data storage device according to the present invention. In the figure, reference numeral 1 denotes a main CPU such as a microcomputer having a data processing unit 2 and a memory 3 which is usually volatile. The data processing unit 2 processes data according to a program stored in advance in a ROM or the like, and the memory 3 stores numerical data counted up by a certain access time to the device, the number of switch operations, or the like. In the present embodiment, the memory 3 stores an area 31 for storing the upper byte value of the count data, an area 32 for storing the lower byte value, and an area 33 for storing the upper byte value of the previous count value (hereinafter referred to as the previous value). It has.

5はバックアップのための外部メモリであり、例えばEEPROM等の不揮発性メモリで構成される。バックアップメモリ5は、マイコン1との間のデータ通信6によって、メモリ3の内容を記憶する領域51、52、53を備えている。   Reference numeral 5 denotes an external memory for backup, and is composed of a nonvolatile memory such as an EEPROM. The backup memory 5 includes areas 51, 52, and 53 for storing the contents of the memory 3 through data communication 6 with the microcomputer 1.

図2の装置において、機器の電源がオフとなると、メモリ3中のデータは消失する。従って再び機器の電源をオンとした場合、バックアップメモリ5に保存されているデータを読出し、この読出し値を基に動作時間等のカウントアップを再開する。また、カウントアップによってメモリ3の内容が変わると、その値をバックアップメモリ5に書き込む。なお、本実施形態では、データが2バイトの値でありさらに前回の値の上位バイト値を記憶する必要があるので、データの書込み及び読出しには3回の処理サイクルを要する。   In the apparatus of FIG. 2, when the device is turned off, the data in the memory 3 is lost. Therefore, when the power of the device is turned on again, the data stored in the backup memory 5 is read, and the counting up of the operation time and the like is restarted based on the read value. When the contents of the memory 3 change due to counting up, the value is written in the backup memory 5. In this embodiment, since the data is a 2-byte value and it is necessary to store the upper byte value of the previous value, three processing cycles are required for writing and reading data.

図3は、図2に示す装置を長時間の動作が保証されている電子機器等の寿命管理に適用した場合の動作フローを示す図である。本装置では、該電子機器が10分間動作した場合に1をカウントアップすることにより、動作時間を管理している。まず、該電子機器の電源オンによってマイコン1が動作を開始する(ステップS1)と、データ処理部2はバックアップメモリ5の記憶内容をメモリ3内に読み出す処理を行う(ステップS2)。この読出し処理の詳細については図4を参照して後述する。   FIG. 3 is a diagram showing an operation flow when the apparatus shown in FIG. 2 is applied to life management of an electronic device or the like that is guaranteed to operate for a long time. In this apparatus, the operation time is managed by counting up 1 when the electronic apparatus operates for 10 minutes. First, when the microcomputer 1 starts operating by turning on the power of the electronic device (step S1), the data processing unit 2 performs a process of reading the storage contents of the backup memory 5 into the memory 3 (step S2). Details of this read processing will be described later with reference to FIG.

読出し処理が終了すると、次に、タイマをスタートさせ(ステップS3)、動作時間の管理を開始する。ステップS4において、タイマが10分経過したか否かを判定し、10分経過するとメモリ3の内容を1だけ更新する(ステップS5)。このとき、前回値を記憶する領域33の値も、更新前の値の上位バイト値に更新される。   When the reading process is completed, the timer is then started (step S3), and the operation time management is started. In step S4, it is determined whether or not the timer has passed 10 minutes. When 10 minutes have passed, the contents of the memory 3 are updated by 1 (step S5). At this time, the value in the area 33 storing the previous value is also updated to the upper byte value of the value before the update.

次にステップS6において、更新されたメモリ3の内容をバックアップメモリ5内に書き込み(ステップS6)、ステップS7で電源がオフとなっていないことを確認した後(ステップS7のNO)、タイマによってさらに次の10分の経過を監視する。ステップS7で電源がオフであれば、処理を終了する。   Next, in step S6, the updated contents of the memory 3 are written into the backup memory 5 (step S6). After confirming that the power is not turned off in step S7 (NO in step S7), the timer further Monitor the next 10 minutes. If the power is off in step S7, the process ends.

図4は、図3の読出し処理ルーチンの詳細を示す図である。まず、機器の電源オンによってマイコン1はバックアップメモリ5の内容を読み出す(ステップS10)が、このとき読み出した下位バイト値がFFであれば(ステップS11のYES)、読み出した前回値を読出し値の上位バイト値として採用し(ステップS12)、メモリ3を書き換える(ステップS13)。一方、ステップS11で下位バイトの値がFFでないと判定されると(ステップS11のNO)、読み出した値がメモリ3の値としてそのまま採用される(ステップS13)。   FIG. 4 is a diagram showing details of the read processing routine of FIG. First, when the device is turned on, the microcomputer 1 reads the contents of the backup memory 5 (step S10). If the lower byte value read at this time is FF (YES in step S11), the previous value read is read as the read value. The higher byte value is adopted (step S12), and the memory 3 is rewritten (step S13). On the other hand, if it is determined in step S11 that the value of the lower byte is not FF (NO in step S11), the read value is adopted as it is as the value of the memory 3 (step S13).

図5は、図4に示す読出し処理の効果を示す図である。なお、図5の各項目及び数値データは、図1に示すものと同じであるので繰り返して説明しないが、「記憶する前回値」及び「前回値」は、前回の記憶したい値における上位バイト値を示す。また、「記憶したい値」、「記憶する前回値」はメモリ3に記憶された値であり、「記憶値」はバックアップメモリ5に記憶された値を示し、さらに「読出し値」は図4に示す処理手順に従ってバックアップメモリより読み出され、メモリ3中に書き込まれる値を示す。   FIG. 5 is a diagram showing the effect of the reading process shown in FIG. The items and numerical data in FIG. 5 are the same as those shown in FIG. 1 and will not be described repeatedly. However, “previous value to be stored” and “previous value” are the upper byte values in the previous value to be stored. Indicates. Further, “value to be stored” and “previous value to be stored” are values stored in the memory 3, “stored value” indicates a value stored in the backup memory 5, and “read value” is shown in FIG. The values read from the backup memory and written into the memory 3 in accordance with the processing procedure shown are shown.

本実施形態の処理では2バイトのデータに対して1バイトの前回値を記憶する必要があるので、1個のデータの書込み及び読出しには3回の処理サイクルを要する。   In the processing of this embodiment, since it is necessary to store the previous value of 1 byte for 2 bytes of data, writing and reading of one data requires three processing cycles.

図5の処理サイクル6〜8において、バックアップメモリ5の領域52に保持される値はFFである。サイクル9の書込みの途中で電源が強制的にオフとなった場合、バックアップメモリ5にはサイクル8で書込みが完了した値5A(領域53)、5B(領域51)、FF(領域52)が保持されている。図4に示す読出し処理に従えば、バックアップメモリ5の下位バイト値がFFであるので、上位バイト値としては領域53に保持された前回値5Aが採用される。   In the processing cycles 6 to 8 in FIG. 5, the value held in the area 52 of the backup memory 5 is FF. When the power is forcibly turned off during writing in cycle 9, the values 5A (region 53), 5B (region 51), and FF (region 52) that have been written in cycle 8 are stored in backup memory 5. Has been. According to the reading process shown in FIG. 4, since the lower byte value of the backup memory 5 is FF, the previous value 5A held in the area 53 is adopted as the upper byte value.

これによってマイコン1のメモリ3には、前回値として5A、上位バイト値として5A、下位バイト値としてFFが書き込まれるので、マイコン1は数値データ5AFFを初期値として機器の動作時間の管理を再開する。   As a result, the memory 3 of the microcomputer 1 is written with 5A as the previous value, 5A as the upper byte value, and FF as the lower byte value. Therefore, the microcomputer 1 resumes management of the operation time of the device using the numerical data 5AFF as the initial value. .

図6は、本発明の第2の実施形態にかかるデータ記憶装置を示す図である。図2に示した実施形態では、図5に示すように、バックアップメモリ5へのデータの書込みに当たって全てのバイトについて書込みを行っており、メモリ5内に記憶されている値と同じ値であっても上書きがなされる。本第2の実施形態では、書込み値とメモリ5内に記憶されている値が同じ場合は書込み処理をスキップすることにより、処理サイクルの削減を図ったものである。このような処理方法を取ることによって、マイコン内の処理時間が多少増加するが、外部メモリへの書込み時間に比べてその増加ははるかに小さいので、結果として処理時間が大幅に短縮される。   FIG. 6 is a diagram showing a data storage device according to the second embodiment of the present invention. In the embodiment shown in FIG. 2, as shown in FIG. 5, all bytes are written when data is written to the backup memory 5, and the values are the same as the values stored in the memory 5. Will also be overwritten. In the second embodiment, when the written value and the value stored in the memory 5 are the same, the write process is skipped to reduce the processing cycle. By adopting such a processing method, the processing time in the microcomputer is somewhat increased, but the increase is much smaller than the writing time to the external memory, and as a result, the processing time is greatly shortened.

図6に示すように、本実施形態の装置では、不要な書込みサイクルを省略するために、マイコン1内に読出し値を記憶する第2のメモリ4を設ける。第2のメモリ4は、第1のメモリ3と同様に前回値を記憶する領域43、上位バイト値を記憶する領域41、下位バイト値を記憶する領域42を有している。なお、機器の電源がオンした時点では、第2のメモリ4には第1のメモリ3と同様にバックアップメモリ5の内容が書き込まれるが、動作を継続している状態では、第1のメモリ3の内容がバックアップメモリ5に書き込まれた後、あるいは書き込まれる時点で、第1のメモリの内容が第2のメモリに書き込まれる。   As shown in FIG. 6, the apparatus according to the present embodiment includes a second memory 4 that stores a read value in the microcomputer 1 in order to omit unnecessary write cycles. Similar to the first memory 3, the second memory 4 has an area 43 for storing the previous value, an area 41 for storing the upper byte value, and an area 42 for storing the lower byte value. Note that when the power of the device is turned on, the contents of the backup memory 5 are written in the second memory 4 in the same manner as the first memory 3, but in the state where the operation continues, the first memory 3 Is written into the backup memory 5 or at the time of writing, the contents of the first memory are written into the second memory.

図7は、図6に示す装置を用いた場合の書込み処理(図3のステップS6)の詳細を示す図であり、図8はその場合の効果を示す図である。図7に示すフローチャートは、基本的に第1のメモリ3に記憶された記憶したい値と、第2のメモリに記憶された読出し値とを各バイトにおいて比較し、変更のあったバイトの値のみに対して書込み処理(更新処理)を行うためのものである。   FIG. 7 is a diagram showing details of the writing process (step S6 in FIG. 3) when the apparatus shown in FIG. 6 is used, and FIG. 8 is a diagram showing the effect in that case. The flowchart shown in FIG. 7 basically compares the value to be stored stored in the first memory 3 and the read value stored in the second memory in each byte, and only the value of the byte that has been changed. Is for performing write processing (update processing).

なお、前回の記憶したい値の書込み終了の時点では、第1及び第2のメモリ3、4の内容は同じであるが、次の10分の経過後は第1のメモリ3の内容が図3のステップS5において1だけカウントアップされるので、書込み処理6のスタートの段階では両者の値は異なっている。   Note that the contents of the first and second memories 3 and 4 are the same at the end of writing of the value to be stored last time, but after the next 10 minutes, the contents of the first memory 3 are not changed. In step S5, the value is counted up by 1, so that both values are different at the start of the writing process 6.

図7に従って本実施形態における読出し処理を説明すると、まず、ステップS20で読出し値と記憶したい値とにおける前回値の比較をする。即ち図6の領域33に記憶された値と領域43に記憶された値が比較され、変更の有無が判定される。ステップS20でYESの場合、前回値に変更があったことを示すので、第1のメモリの領域33内の値がバックアップメモリ5の領域53に書き込まれる。ステップS20でNOの場合、即ち前回値に変更がない場合書込み処理はスキップされる。   The reading process in the present embodiment will be described with reference to FIG. 7. First, in step S20, the read value is compared with the previous value in the value to be stored. That is, the value stored in the area 33 in FIG. 6 is compared with the value stored in the area 43 to determine whether or not there is a change. If “YES” in the step S 20, it indicates that the previous value has been changed, and thus the value in the first memory area 33 is written in the backup memory 5 area 53. If NO in step S20, that is, if there is no change in the previous value, the writing process is skipped.

次に、ステップS22で上位バイトに変更があったか否かが判定される。変更があれば(ステップS22のYES)、第1のメモリ内の領域31に記憶された値がバックアップメモリ5の領域51に書き込まれる。変更がないと(ステップS22のNO)、書込み処理はスキップされる。さらにステップS24で下位バイトに変更があるか否かが判断される。変更がある場合(ステップS24のYES)、ステップS25で第1のメモリの領域32内の値がバックアップメモリ5の領域52内に書き込まれる。変更がないと(ステップS24のNO)、書込み処理はスキップされる。   Next, in step S22, it is determined whether or not the upper byte has been changed. If there is a change (YES in step S22), the value stored in the area 31 in the first memory is written in the area 51 of the backup memory 5. If there is no change (NO in step S22), the writing process is skipped. In step S24, it is determined whether or not there is a change in the lower byte. If there is a change (YES in step S24), the value in the first memory area 32 is written in the backup memory 5 area 52 in step S25. If there is no change (NO in step S24), the writing process is skipped.

このようにして書込み処理が終了すると、第1のメモリ3内の記憶したい値を第2のメモリ4の読出し値として書き込んで(ステップS26)、書込み処理を終える。この結果、図8に示すように、書込み処理として処理サイクル3、6、8、9及び12が必要であるが、その他の処理サイクルを省略することができる。   When the writing process is completed in this way, the value to be stored in the first memory 3 is written as the read value of the second memory 4 (step S26), and the writing process is completed. As a result, as shown in FIG. 8, processing cycles 3, 6, 8, 9 and 12 are necessary as the writing process, but other processing cycles can be omitted.

上記第1及び第2の実施形態は、本発明をミリ波レーダの動作時間管理に応用したものであるが、本発明は必ずしもこのような場合に限定されない。例えば、何らかのイベントの発生回数を記憶する必要がある機器において、同様に適用可能である。   In the first and second embodiments, the present invention is applied to operation time management of millimeter wave radar, but the present invention is not necessarily limited to such a case. For example, the present invention can be similarly applied to a device that needs to store the number of occurrences of some event.

図9は、本発明をスイッチの操作回数を記憶する必要のある機器に適用した場合の動作フローを示す図である。この実施形態では、ステップS30において、上記第1及び第2の実施形態の場合と同様にしてバックアップ値の読出し処理を行った後、ステップS31でスイッチ操作があったか否かを判定する。スイッチ操作があると(ステップS31のYES)、ステップS32で記憶したい値を1だけ進め、さらに第1、第2の実施形態の場合と同様にして書込み処理を行う(ステップS33)。   FIG. 9 is a diagram showing an operation flow when the present invention is applied to a device that needs to store the number of switch operations. In this embodiment, in step S30, a backup value reading process is performed in the same manner as in the first and second embodiments, and then it is determined whether or not a switch operation has been performed in step S31. When there is a switch operation (YES in step S31), the value to be stored is advanced by 1 in step S32, and a writing process is performed in the same manner as in the first and second embodiments (step S33).

この後、ステップS34で電源がオフとされたか否かを判定し、オフでない場合(ステップS34のNO)は、再びステップS31に戻って再度のスイッチ操作の有無を判断する。なお、ステップS31でNOの場合は、スイッチ操作があるまで待機する。   Thereafter, it is determined whether or not the power is turned off in step S34. If not (NO in step S34), the process returns to step S31 again to determine whether or not the switch is operated again. If NO in step S31, the process waits until there is a switch operation.

上記各実施形態は、記憶したい数値が2バイトのデータで構成されている場合を示しているが、本発明は3バイト以上のデータの場合でも適用可能である。この場合、前回値として記憶される値を前回の記憶したい値の上位2バイトの値とすることにより、さらに精度良くデータを記憶しかつ読み出すことができる。   Each of the above embodiments shows the case where the numerical value to be stored is composed of data of 2 bytes, but the present invention can be applied to the case of data of 3 bytes or more. In this case, by setting the value stored as the previous value to the value of the upper 2 bytes of the previous value to be stored, the data can be stored and read with higher accuracy.

図10は、3バイトデータの書込み処理の手順を示す。この図から明らかなように、処理サイクル7ではバックアップメモリに01FFFFの値が保持されており、従って処理サイクル8の途中で電源が遮断された場合、従来の装置では、バックアップメモリからの読出しは01FFFFとなる。これは本来の記憶したい値010000あるいは前回の値00FFFFとは大きく異なっている。   FIG. 10 shows the procedure of a 3-byte data write process. As is apparent from this figure, the value 01FFFF is held in the backup memory in the processing cycle 7, and therefore when the power is cut off in the middle of the processing cycle 8, in the conventional apparatus, reading from the backup memory is 01FFFF. It becomes. This is significantly different from the original value 010000 to be stored or the previous value 00FFFF.

従って本実施形態では、前回値として、前回の記憶したい値の上位2バイトの値を記憶しておき、読出しに当たって最下位バイトの値がFFである場合は、読み出した上位2バイトの値に代わって前回値を使用することで、データの読出し誤差を最小限に抑える。例えば、図10の処理サイクル7で書込みが終了した場合、読出し時に上位2バイトの値01FFに変えて前回値00FFを使用し、読出し値を00FFFFとすることにより、実際の値との誤差を最小とすることができる。   Therefore, in the present embodiment, as the previous value, the value of the upper 2 bytes of the previous value to be stored is stored, and when the value of the lowest byte is FF upon reading, the value of the upper 2 bytes read is replaced. By using the previous value, data reading errors are minimized. For example, when writing is completed in processing cycle 7 of FIG. 10, the previous value 00FF is used instead of the upper 2 bytes value 01FF at the time of reading, and the read value is set to 00FFFF, thereby minimizing the error from the actual value. It can be.

上記した各実施形態はいずれも、バックアップメモリ5へのデータの書き換えに当たって、上位バイトから下位バイトの順にデータの書き換えを行っていく書込み方式を採用したものであるが、データの書込みは、下位バイトから上位バイトの順で行っても良いことは勿論である。その場合の本発明の実施形態を以下に示す。   Each of the above-described embodiments employs a writing method in which data is rewritten in order from the upper byte to the lower byte when rewriting data to the backup memory 5. Of course, it may be performed in order of the upper byte. An embodiment of the present invention in that case is shown below.

図11は、図6に示したマイコン1のデータ処理部2が、前回値、下位バイト値、上位バイト値の順でメモリの書込み制御を行う場合の、読出し処理ルーチンを示す図であり、図12は図11に示す読出し処理の動作説明のための図である。本実施形態では、図11に示すように、機器の電源オンによってマイコン1はバックアップメモリ5の内容を読み出し(ステップS40)、読み出した下位バイト値が00であるか否かをステップS41で判定する。   FIG. 11 is a diagram showing a read processing routine when the data processing unit 2 of the microcomputer 1 shown in FIG. 6 performs memory write control in the order of the previous value, the lower byte value, and the upper byte value. 12 is a diagram for explaining the operation of the reading process shown in FIG. In the present embodiment, as shown in FIG. 11, when the device is turned on, the microcomputer 1 reads the contents of the backup memory 5 (step S40), and determines whether or not the read lower byte value is 00 in step S41. .

図12の処理サイクル8を参照することによって理解されるように、記憶したい値が5B00であり、前回値5Aに続いて下位バイト値00が書き込まれた状態では、バックアップメモリ5内には、前回値として5A、上位バイト値として5A、下位バイト値として00が保持されている。したがって、処理サイクル9の途中で電源がオフとなった場合、従来の装置では、電源再投入時のバックアップメモリ6の読出し値は処理サイクル8のメモリの状態、即ち5A00となって、実際の記憶したい値5B00とも、処理サイクル7の値5AFFとも大きく異なった値が読み出されることになる。   As can be understood by referring to the processing cycle 8 in FIG. 12, when the value to be stored is 5B00 and the lower byte value 00 is written after the previous value 5A, the backup memory 5 stores the previous value. The value is 5A, the upper byte value is 5A, and the lower byte value is 00. Therefore, when the power is turned off during the processing cycle 9, in the conventional apparatus, the read value of the backup memory 6 when the power is turned on again becomes the memory state of the processing cycle 8, that is, 5A00, and the actual storage. A value that is significantly different from the desired value 5B00 and the value 5AFF of the processing cycle 7 is read out.

本実施形態では、このような事態を回避するために、図11のステップS41で読み出した下位バイト値が00であるか否かを判定する。ステップS41でYESの場合、ステップS42で上位バイト値が前回値であるか否かを判定する。ステップS42でYESの場合、即ち上位バイト値が前回値と同じである場合には、次のステップS43で下位バイト値をFFに置き換える処理を行う。この処理により、図12の処理サイクル8の終了時では、電源再投入時の読出しにあたって、一つ前の処理サイクルの値、5AFFが読み出される。   In the present embodiment, in order to avoid such a situation, it is determined whether or not the lower byte value read in step S41 in FIG. If YES in step S41, it is determined in step S42 whether the upper byte value is the previous value. If YES in step S42, that is, if the upper byte value is the same as the previous value, in the next step S43, processing for replacing the lower byte value with FF is performed. With this process, at the end of the process cycle 8 in FIG. 12, the value 5AFF of the previous process cycle is read when reading when the power is turned on again.

ステップS43で読み出された値は、ステップS44で記憶したい値としてメモリ3に書き込まれる。これによって、処理サイクル8で記憶された値5A00に代わって、前回の記憶したい値5AFFがメモリ3に書き込まれることになり、最小の誤差でデータを読み出すことができる。   The value read in step S43 is written in the memory 3 as a value to be stored in step S44. As a result, instead of the value 5A00 stored in the processing cycle 8, the previous value 5AFF to be stored is written in the memory 3, and the data can be read with a minimum error.

ステップS41でNOの場合、即ち下位バイトの値が00でない場合は、バックアップメモリに記憶された値をそのまま読み出しても問題が生じないので、ステップS44で読出し値を記憶したい値としてメモリ3に書き込む。同様に、ステップS42でNOの場合、即ち読み出した値の下位バイト値が00であっても、上位バイト値が前回値とは異なる場合は、すでに上位バイト値の書き換えが終っていることを示すので、読出し値を記憶したい値としてそのまま採用しても不都合ではない。したがって、この値をステップS44でメモリ3に書き込む。ステップS42でNOの場合は、図12の処理サイクル9の状態が該当する。   If NO in step S41, that is, if the value of the lower byte is not 00, there is no problem even if the value stored in the backup memory is read as it is, so that the read value is written in the memory 3 as a value to be stored in step S44. . Similarly, if NO in step S42, that is, even if the lower byte value of the read value is 00, if the upper byte value is different from the previous value, it indicates that the upper byte value has already been rewritten. Therefore, it is not inconvenient to adopt the read value as it is as a value to be stored. Therefore, this value is written in the memory 3 in step S44. In the case of NO at step S42, the state of the processing cycle 9 in FIG.

なお、本実施形態では、装置の初期状態においてはメモリの記憶値が全て00(初期状態)となっているため、装置を初めて動作させた時に図11のフローにおいて、「下位バイトが00」かつ「前回値(00)と上位バイト値(00)が等しい」と言う条件に当てはまってしまい、装置を初めて動作させたにもかかわらず下位バイト値がFFから始まってしまうという問題が発生する。よって、装置の初期状態において、メモリの前回値にFFを、あるいは下位バイト値として01を予め設定しておく等の処理が必要である。   In the present embodiment, since all the stored values of the memory are 00 (initial state) in the initial state of the device, when the device is operated for the first time, in the flow of FIG. The condition that “the previous value (00) is equal to the upper byte value (00)” is applied, and there arises a problem that the lower byte value starts from FF even though the apparatus is operated for the first time. Therefore, in the initial state of the apparatus, processing such as setting FF as the previous value of the memory or 01 as the lower byte value is necessary.

上記各実施形態は、記憶したい値がカウントアップされる値である場合を示しているが、本発明では、記憶したい値がカウントダウンされる値であっても良いことは勿論である。記憶したい値がカウントダウンされる値である場合は、上位バイトから書き換えを行うメモリにおいては、最下位バイトが00(即ちカウント可能な最終値)である場合に、前回値領域に記憶された値を読み出して上位バイトとして採用するようにすれば良く、下位バイトから書き換えを行うメモリにおいては、最下位バイトがFF(即ちカウント開始値)である場合に上位バイトが前回値と同じであれば、最下位バイトに00(即ちカウント可能な最終値)を採用するようにすればよい。   Each of the above embodiments shows a case where the value to be stored is a value to be counted up. However, in the present invention, it is needless to say that the value to be stored may be a value to be counted down. When the value to be stored is a value to be counted down, in the memory in which rewriting is performed from the upper byte, when the lowest byte is 00 (that is, the final value that can be counted), the value stored in the previous value area is It can be read and used as the upper byte. In a memory that is rewritten from the lower byte, if the lower byte is FF (that is, the count start value) and the upper byte is the same as the previous value, the highest byte is used. What is necessary is just to employ | adopt 00 (namely, the last value which can be counted) to a low-order byte.

また、上記各実施形態では、バックアップメモリに記憶されたカウント値及び前回値からデータ書込み途中の異常終了の可能性が疑われた場合に、カウントアップ前もしくはカウントダウン前のカウント値を読出し値として採用するようにしたが、これに代えて、カウントアップ後若しくはカウントダウン後のカウント値を読出し値として採用するようにしても良い。   In each of the above embodiments, when the possibility of abnormal termination during data writing is suspected from the count value stored in the backup memory and the previous value, the count value before counting up or before counting down is adopted as the read value. However, instead of this, the count value after counting up or after counting down may be adopted as the read value.

以上、それぞれの実施形態を示して説明したように、本発明の装置によれば、バックアップメモリへの書込みが強制的に中断された場合でも、最小の誤差でデータを読み出すことができるので、従来装置のように異常な電源遮断によってそれまで継続していた計数作業をクリアする必要はなく、継続した作業が可能となる。   As described above, according to the embodiments, according to the apparatus of the present invention, data can be read with a minimum error even when writing to the backup memory is forcibly interrupted. There is no need to clear the counting work that has been continued until then due to an abnormal power interruption as in the apparatus, and the continuous work can be performed.

従来のデータ記憶方法の説明に供する図。The figure which uses for description of the conventional data storage method. 本発明の第1の実施形態にかかるデータ記憶装置を示すブロック図。1 is a block diagram showing a data storage device according to a first embodiment of the present invention. 図2に示す装置の動作フローを示す図。The figure which shows the operation | movement flow of the apparatus shown in FIG. 図3に示す読出し処理の詳細なフローを示す図。The figure which shows the detailed flow of the read-out process shown in FIG. 図2に示す装置の効果を示す図。The figure which shows the effect of the apparatus shown in FIG. 本発明の第2の実施形態にかかるデータ記憶装置を示すブロック図。The block diagram which shows the data storage device concerning the 2nd Embodiment of this invention. 図3に示す書込み処理の詳細なフローを示す図。The figure which shows the detailed flow of the write-in process shown in FIG. 図6に示す装置の効果を示す図。The figure which shows the effect of the apparatus shown in FIG. 本発明の第3の実施形態にかかる装置の動作フローを示す図。The figure which shows the operation | movement flow of the apparatus concerning the 3rd Embodiment of this invention. 本発明の第4の実施形態の説明に供する図。The figure which uses for description of the 4th Embodiment of this invention. 本発明の第5の実施形態にかかる装置の読出しフローを示す図。The figure which shows the read-out flow of the apparatus concerning the 5th Embodiment of this invention. 図11に示す実施形態の効果を示す図。The figure which shows the effect of embodiment shown in FIG.

符号の説明Explanation of symbols

1…マイコン
2…データ処理部
3…第1のメモリ
4…第2のメモリ
5…バックアップメモリ
31、32、33、41、42、43、51、52、53…記憶領域
DESCRIPTION OF SYMBOLS 1 ... Microcomputer 2 ... Data processing part 3 ... 1st memory 4 ... 2nd memory 5 ... Backup memory 31, 32, 33, 41, 42, 43, 51, 52, 53 ... Storage area

Claims (4)

連続してカウントアップまたはカウントダウンされる2バイト以上の値を記憶したい値として保持する揮発性のメモリと、前記記憶したい値が書き込まれるバックアップメモリと、前記揮発性のメモリと前記バックアップメモリ間でのバイト単位のデータ書込み及び読出しを制御するデータ処理部とを備えるデータ記憶装置において、
前記バックアップメモリは、前記記憶したい値をバイト単位で記憶するバイト記憶領域と、前記記憶したい値の前回値における最下位バイトの次のバイト位置の値を記憶する前回値領域とを備え、
前記データ処理部は、前記記憶したい値と前記前回値とを前回の記憶処理時に記憶した領域と同一の領域に上書きしていくものであり、
前記バックアップメモリにデータを書き込むにあたって、前記前回値領域に前記記憶したい値の前回値を書き込み、その後、前記記憶したい値を、前記バイト記憶領域における最下位バイトの次のバイト位置に書き込んだ後に、前記バイト記憶領域における最下位バイト位置に書き込む処理を行い、
前記バックアップメモリからデータを読み出すにあたって、前記バックアップメモリにおけるバイト記憶領域に記憶された、最下位バイトの値がカウント最終値であった場合には、前記最下位バイトの次のバイト位置の値に前記前回値領域に記憶された値を採用することを特徴とする、データ記憶装置。
A volatile memory that holds a value of 2 bytes or more that is continuously counted up or down as a value to be stored, a backup memory to which the value to be stored is written, and between the volatile memory and the backup memory In a data storage device comprising a data processing unit that controls data writing and reading in byte units,
The backup memory includes a byte storage area for storing the value to be stored in byte units, and a previous value area for storing a value of a byte position next to the least significant byte in the previous value of the value to be stored,
The data processing unit overwrites the same area as the area stored during the previous storage process with the value to be stored and the previous value.
When writing data to the backup memory, write the previous value of the value to be stored in the previous value area, and then write the value to be stored in the byte position next to the least significant byte in the byte storage area. Perform processing to write to the least significant byte position in the byte storage area,
When reading data from the backup memory, if the value of the least significant byte stored in the byte storage area in the backup memory is the final count value, the value of the byte position next to the least significant byte is set to the value. A data storage device employing a value stored in the previous value area.
連続してカウントアップまたはカウントダウンされる2バイト以上の値を記憶したい値として保持する揮発性のメモリと、前記記憶したい値が書き込まれるバックアップメモリと、前記揮発性のメモリと前記バックアップメモリ間でのバイト単位のデータ書込み及び読出しを制御するデータ処理部とを備えるデータ記憶装置において、
前記バックアップメモリは、前記記憶したい値をバイト単位で記憶するバイト記憶領域と、前記記憶したい値の前回値における最下位バイトの次のバイト位置の値を記憶する前回値領域とを備え、
前記データ処理部は、前記記憶したい値と前記前回値とを前回の記憶処理時に記憶した領域と同一の領域に上書きしていくものであり、
前記バックアップメモリにデータを書き込むにあたって、前記前回値領域に前記記憶したい値の前回値を書き込み、その後、前記記憶したい値を、前記バイト記憶領域における最下位バイト位置に書き込んだ後に、前記バイト記憶領域における最下位バイトの次のバイト位置に書き込む処理を行い、
前記バックアップメモリからデータを読み出すにあたって、前記バックアップメモリにおけるバイト記憶領域に記憶された、最下位バイトの値がカウント開始値であり、かつ、前記バイト記憶領域における最下位バイトの次のバイト位置の値が前記前回値領域に記憶した値と同じであった場合には、前記最下位バイトの値にカウント最終値を採用することを特徴とする、データ記憶装置。
A volatile memory that holds a value of 2 bytes or more that is continuously counted up or down as a value to be stored, a backup memory to which the value to be stored is written, and between the volatile memory and the backup memory In a data storage device comprising a data processing unit that controls data writing and reading in byte units,
The backup memory includes a byte storage area for storing the value to be stored in byte units, and a previous value area for storing a value of a byte position next to the least significant byte in the previous value of the value to be stored,
The data processing unit overwrites the same area as the area stored during the previous storage process with the value to be stored and the previous value.
When writing data to the backup memory, write the previous value of the value to be stored in the previous value area, and then write the value to be stored in the least significant byte position in the byte storage area. Write to the byte position next to the least significant byte in
When reading data from the backup memory, the value of the least significant byte stored in the byte storage area in the backup memory is the count start value, and the value of the byte position next to the least significant byte in the byte storage area Is the same as the value stored in the previous value area, the final count value is adopted as the value of the least significant byte.
請求項1または2に記載のデータ記憶装置において、前記揮発性のメモリは前記バイト記憶領域をそれぞれ有する第1の領域と第2の領域を備え、前記データ処理部は前記バックアップメモリからのデータ読み出し時に、前記バックアップメモリから読み出したバイト記憶領域の値を前記第2の領域におけるバイト記憶領域に記憶しておき、前記バックアップメモリの前記バイト記憶領域に前記記憶したい値をバイト単位で書き込むに当たって、前記第1の領域と第2の領域の値をバイト単位で比較し、同じである場合には、前記第1の領域に記憶された値の前記バックアップメモリの前記バイト記憶領域への書き込みを行わないことを特徴とする、データ記憶装置。 3. The data storage device according to claim 1, wherein the volatile memory includes a first area and a second area each having the byte storage area, and the data processing unit reads data from the backup memory. Sometimes, the value of the byte storage area read from the backup memory is stored in the byte storage area in the second area, and the value to be stored in the byte storage area of the backup memory is written in bytes. When the values of the first area and the second area are compared in byte units and the values are the same, the value stored in the first area is not written to the byte storage area of the backup memory. A data storage device. 請求項1または2に記載のデータ記憶装置において、前記記憶したい値が3バイト以上の値である場合、前記前回値領域には、少なくとも前記前回値における最下位バイト値の更新によってその値が更新される全てのバイト位置の値を記憶することを特徴とする、データ記憶装置。   3. The data storage device according to claim 1, wherein when the value to be stored is a value of 3 bytes or more, the value is updated in the previous value area by at least updating the least significant byte value in the previous value. A data storage device, characterized in that it stores the values of all byte positions to be processed.
JP2003408964A 2003-12-08 2003-12-08 Data storage Expired - Fee Related JP4592280B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003408964A JP4592280B2 (en) 2003-12-08 2003-12-08 Data storage

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003408964A JP4592280B2 (en) 2003-12-08 2003-12-08 Data storage

Publications (2)

Publication Number Publication Date
JP2005173699A JP2005173699A (en) 2005-06-30
JP4592280B2 true JP4592280B2 (en) 2010-12-01

Family

ID=34730497

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003408964A Expired - Fee Related JP4592280B2 (en) 2003-12-08 2003-12-08 Data storage

Country Status (1)

Country Link
JP (1) JP4592280B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5643171B2 (en) * 2011-10-14 2014-12-17 株式会社東海理化電機製作所 Electronic key

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6059454A (en) * 1983-09-13 1985-04-05 Koito Mfg Co Ltd Count data storing method to eeprom
JPH04293139A (en) * 1991-03-20 1992-10-16 Fujitsu Ltd Data holding method
JPH0548061U (en) * 1991-11-29 1993-06-25 矢崎総業株式会社 Vehicle mileage accumulator

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6059454A (en) * 1983-09-13 1985-04-05 Koito Mfg Co Ltd Count data storing method to eeprom
JPH04293139A (en) * 1991-03-20 1992-10-16 Fujitsu Ltd Data holding method
JPH0548061U (en) * 1991-11-29 1993-06-25 矢崎総業株式会社 Vehicle mileage accumulator

Also Published As

Publication number Publication date
JP2005173699A (en) 2005-06-30

Similar Documents

Publication Publication Date Title
US6058047A (en) Semiconductor memory device having error detection and correction
US6601132B2 (en) Nonvolatile memory and method of writing data thereto
JP4722839B2 (en) MEMORY CONTROL CIRCUIT, NONVOLATILE MEMORY DEVICE, AND MEMORY CONTROL METHOD
US7925843B2 (en) Memory controller having a plurality of memory regions for protection against power failure
JP5045584B2 (en) Program rewriting device
JP5167936B2 (en) Information processing device
US7716555B2 (en) Data backup method and memory device
JPH09282237A (en) Storage device using eeprom
JP4592280B2 (en) Data storage
JP5660521B2 (en) Nonvolatile semiconductor memory device and memory management method
JP4802339B2 (en) Nonvolatile memory update method
JP6636930B2 (en) Microcomputer with built-in flash memory, method of writing data to flash memory built in microcontroller, and program for writing data to flash memory
JP2009116521A (en) Data rewriting method for memory
JP2010079382A (en) Software update method
JP7007223B2 (en) Control device and abnormality detection method
JP2002334586A (en) Information storing method using flash memory and information storing program
JP2008182327A (en) Programmable device controller, and method thereof
JPH0784894A (en) Method for writing nonvolatile memory
JP6996342B2 (en) Information processing equipment and information processing method
JP2008040939A (en) Data write failure detecting method and data write failure detection system of nonvolatile memory
JP5413809B2 (en) Data processing apparatus and data processing method
JP2022166869A (en) monitoring device
JP2005332228A (en) Program switching controller
US20090198878A1 (en) Information processing system and information processing method
JP2013008078A (en) Field device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20061117

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20090410

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20090421

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20090622

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20100601

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100726

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20100817

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20100914

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130924

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140924

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees