JPH0766677B2 - Writing device using writable / erasable storage medium - Google Patents

Writing device using writable / erasable storage medium

Info

Publication number
JPH0766677B2
JPH0766677B2 JP31737787A JP31737787A JPH0766677B2 JP H0766677 B2 JPH0766677 B2 JP H0766677B2 JP 31737787 A JP31737787 A JP 31737787A JP 31737787 A JP31737787 A JP 31737787A JP H0766677 B2 JPH0766677 B2 JP H0766677B2
Authority
JP
Japan
Prior art keywords
data
address
erasing
writing
time
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
JP31737787A
Other languages
Japanese (ja)
Other versions
JPH01159894A (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.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP31737787A priority Critical patent/JPH0766677B2/en
Publication of JPH01159894A publication Critical patent/JPH01159894A/en
Publication of JPH0766677B2 publication Critical patent/JPH0766677B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

【発明の詳細な説明】 (発明の利用分野) 本発明は、カメラのフィルム枚数のように規則的に変化
するデータを書込む消去可能な記憶媒体に書き込む書込
み装置の改良に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an improvement of a writing device that writes data that changes regularly such as the number of films of a camera to an erasable storage medium that writes data.

(発明の背景) 近年、カメラの電子化に伴い、フィルム枚数等の種々の
データを電気的手段により記憶し、そのデータを制御、
計数、表示に用いることが行われている。前記データを
記憶する媒体としては、電気的書込み消去可能な半導体
不揮発性メモリ素子であるEEPROMがあり、これは電池等
により電源がバックアップされていなくても、記憶の持
続が可能であることから、非常に有効なものといえる。
(Background of the Invention) In recent years, along with the computerization of cameras, various data such as the number of films is stored by an electric means and the data is controlled.
It is used for counting and displaying. As a medium for storing the data, there is an electrically writable and erasable semiconductor non-volatile memory EEPROM, which is capable of sustaining storage even if the power source is not backed up by a battery or the like. It can be said to be very effective.

しかしながら、EEPROMは書込みや消去に必要な時間が比
較的長いため、万一データの書込みや消去の途中に、電
源供給が途絶えたり、中断したりすると、書込みデータ
や消去データのどちらでもない半端なデータが残ってし
まい、フィルム枚数のようなデータにおいては全く異な
る表示になるばかりでなく、システムそのものの制御に
まで影響を与えることにもなりかねない。
However, since the time required for writing and erasing the EEPROM is relatively long, if the power supply is interrupted or interrupted during the writing or erasing of data, it is neither write data nor erase data. The data remains, and not only the data such as the number of films is displayed completely differently, but also the control of the system itself may be affected.

EEPROMの書込み条件について、従来品を例にとって説明
する。例えば、モトローラ社のMC68HC11なるマイクロコ
ンピュータ内蔵のEEPROMにおいては、以下のような書込
み/消去の制約(規則)がある。
The writing condition of the EEPROM will be described by taking a conventional product as an example. For example, in the EEPROM of the Motorola MC68HC11 with a built-in microcomputer, there are the following write / erase restrictions (rules).

クリアされた状態は全てのビット(bit)が1(ハ
イレベル)である。
In the cleared state, all bits are 1 (high level).

書込みはEEPROMのセルに電荷をチャージすることを
意味し、書込みビットは1→0に変わる。
Writing means charging the cells of the EEPROM with electric charges, and the writing bit changes from 1 to 0.

書込みには約10msもの時間が必要である。 Writing takes about 10 ms.

書き込まれているビット、即ち0の値を持つビット
にさらに0を書き込むことは許されない。(オーバーチ
ャージ禁止) 消去は1バイト(BYTE)単位で行う必要がある。
It is not allowed to write a further 0 to the bit that is being written, i.e. the bit that has a value of 0. (Overcharge prohibited) Erasure must be performed in 1-byte (BYTE) units.

消去には約10msもの時間が必要である。 It takes about 10 ms to erase.

消去はEEPROMのセルから電荷をディスチャージする
ことを意味し、0→1に値が変わる。
Erasing means discharging electric charge from the cells of the EEPROM, and the value changes from 0 to 1.

消去されているビット、即ち1の値を持つビットを
さらに消去することは許されない。(オーバーディスチ
ャージ禁止) 以上のような制約条件のために、EEPROMの書込みは多少
複雑なアルゴリズムで行われる。但し、前記八つの条件
の中でEEPROMとしての本質は条件,のようにRAM等
に比べて比較的長い時間かからないとデータ書換えがで
きないということである。
Further erasure of bits that have been erased, i.e. bits having a value of 1, is not allowed. (Prohibition of over-discharging) Due to the above restrictions, writing to EEPROM is performed with a slightly complicated algorithm. However, among the above eight conditions, the essence of the EEPROM is that the data cannot be rewritten unless it takes a relatively long time as compared with the RAM like the condition.

前記制約条件に従った従来の書込み方法を説明する。A conventional writing method that complies with the above constraint conditions will be described.

第7図はEEPROMのメモリマップである。8ビット=1バ
イトのメモリが4バイトあり、そのアドレスはA0,A1,A
2,A3である。このアドレスは連続する4バイトとする。
MSBは最上位ビット、LSBは最下位ビットである。
FIG. 7 is a memory map of the EEPROM. There are 4 bytes of memory of 8 bits = 1 byte, and their addresses are A0, A1, A
2, A3. This address shall be 4 consecutive bytes.
MSB is the most significant bit and LSB is the least significant bit.

次に第8図に示される順序に従いフィルムカウント値を
$05から$06へ更新する場合を例にとって説明する。な
お$は16進数を意味する記号である。
Next, the case where the film count value is updated from $ 05 to $ 06 according to the order shown in FIG. 8 will be described as an example. The symbol $ means a hexadecimal number.

時刻T1においてアドレスA0には$05なるデータが書き込
まれており、アドレスA1〜A3のデータは消去されてい
る。制約条件によって、データの$05は時刻T3では$00
になり、時刻T5において$FFにクリアされた後、時刻T7
で$06に更新される。時刻T2,T4,T6は各々T1→T3,T3→T
5,T5→T7の遷移途中状態を示す。
At time T1, data of $ 05 is written in the address A0, and the data of the addresses A1 to A3 are erased. Due to the constraint conditions, $ 05 of data is $ 00 at time T3.
And is cleared to $ FF at time T5, then time T7
Will be updated to $ 06. Times T2, T4, T6 are T1 → T3, T3 → T respectively
5, Shows the transitional state of T5 → T7.

従来例を第9図に従ってビットレベルで説明する。時刻
T1から時刻T3において値を変える時には$05→$00にす
るためにビット0とビット2が1→0に変化する。この
プロセスは制約条件より$05のコンプリメントである
ところの$FAを書き込むことによって行われる。またそ
の時間を制約条件より約10msかかる。次に時刻T3から
時刻T5においては制約条件よりバイト消去を行う。こ
れにも制約条件より約10msかかる。時刻T5から時刻T7
においては$06を書き込む。これも制約条件より約10
msかかる。
A conventional example will be described at the bit level according to FIG. Times of Day
When changing the value from T1 to time T3, bit 0 and bit 2 are changed from 1 to 0 in order to change from $ 05 to $ 00. This process is done by writing $ FA, which is a $ 05 complement due to constraints. Also, it takes about 10 ms due to the constraint condition. Next, from time T3 to time T5, byte erase is performed according to the constraint condition. This also takes about 10ms due to the constraints. Time T5 to time T7
At, write $ 06. This is also about 10
It takes ms.

以上のように$05から$06に値を変更するために、前記
制約条件のオーバーチャージ禁止及びオーバーディスチ
ャージ禁止に従って合計約30msかけて三つのプロセスを
必要としていた。このような従来例では、時刻T2から時
刻T6の途中で、電源供給が途絶えたり、マイクロコンピ
ュータにリセットがかかったりして、書換えプロセスが
中断すると、??,00,FFという書込みデータや消去データ
のどちらでもない半端なデータが残ってしまう。
As described above, in order to change the value from $ 05 to $ 06, three processes were required over a total of about 30 ms in accordance with the above-mentioned constraint prohibition of overcharge and prohibition of overdischarge. In such a conventional example, in the middle of the time T2 to the time T6, if the power supply is interrupted or the microcomputer is reset and the rewriting process is interrupted, write data or erase data such as ??, 00, FF is written. I am left with odd data that is neither.

EEPROMは技術的に見てまだ改良途中であり、現時点では
書換え寿命は1万回程度、書込み時間は10msといったオ
ーダーであり、また、前記MC68HC11なるEEPROMにみられ
るようなオーバーチャージ禁止及びオーバーディスチャ
ージ禁止の制約も多い。従来例では書換え寿命の対策と
してEEPROMのメモリエリアを複数バイト使用することで
対応しており、例えばnバイトの領域を使用する場合、
最初の1バイトの領域を何回か使用したら、次のバイト
を使用するということを行ってストレスの均一化を図っ
ている。したがって、$05→$06のような例では、すべ
てのビットとも1回の書換え当たり3回のストレスを受
けるので、nバイトの領域を使用すると、x回書き換え
るのに、x×3/nのストレスがかかり、またその時の書
換え時間は約30msということになる。
The EEPROM is technically still in the process of being improved. At the present time, the rewriting life is about 10,000 times and the writing time is on the order of 10 ms. Also, overcharge prohibition and overdischarge prohibition as seen in the EEPROM of MC68HC11 are prohibited. There are also many restrictions. In the conventional example, as a measure for the rewriting life, it corresponds by using the memory area of the EEPROM by using multiple bytes. For example, when using an area of n bytes,
After the first 1-byte area is used several times, the next byte is used to equalize the stress. Therefore, in the case of $ 05 → $ 06, all bits are stressed 3 times per rewriting, so if you use the n-byte area, x times of rewriting x times 3 / n It takes stress, and the rewriting time at that time is about 30 ms.

(発明の目的) 本発明の目的は、データ書換え・消去の途中で電源供給
が中断される等によりデータ書換え・消去動作が完了す
る以前の状態で中断されてしまった際に、この中断状態
からデータ書換え・消去動作の完了状態へ移行すること
のできる書込み装置を提供することである。
(Object of the Invention) An object of the present invention is to change from the interrupted state when the data rewriting / erasing operation is interrupted in the state before the data rewriting / erasing operation is completed due to interruption of the power supply during the data rewriting / erasing. It is an object of the present invention to provide a writing device capable of shifting to a completed state of data rewriting / erasing operation.

(発明の特徴) 上記目的を達成するために、本発明は、複数のアドレス
を有する書込み消去可能な記憶媒体と、書込みアドレス
を所定の順番にしたがって指定すると共に、消去アドレ
スとして2以上の一定回数前にデータが書き込まれたア
ドレスを指定するアドレス指定手段と、指定された書込
みアドレスに対してのデータを予め決められた規則にし
たがって変遷させてデータを新たなデータに書き換える
と共に、指定された消去アドレスに対してのデータを予
め決められた規則にしたがって変遷させてデータ消去を
行うデータ書込み消去手段を有し、新たなデータの書込
みに際し、前記アドレス指定手段により指定された書込
みアドレス及び消去アドレスに対しての前記データ書込
み消去手段による前記データ変遷を行わせると共に、更
に前記指定された書込みアドレス及び消去アドレスのデ
ータに基づいて前記データ書込み消去手段によるデータ
の変遷状態を判定する判定手段を設け、前記データ書込
み消去手段によるデータ書換え・消去の実行途中にてデ
ータ書換え・消去が中断された際に、前記判定手段にて
判定された中断前のデータ変遷状態に応じて前記データ
書込み消去手段によるデータ書換え・消去を完了させる
ことを特徴とする。
(Characteristics of the Invention) In order to achieve the above object, the present invention specifies a writable and erasable storage medium having a plurality of addresses, a writable address specified in a predetermined order, and an erasing address of a predetermined number of 2 or more. Addressing means for designating an address to which data is previously written, and data for a designated write address are changed according to a predetermined rule to rewrite the data with new data, and designated erasure is performed. It has a data writing / erasing means for erasing data by changing the data for the address according to a predetermined rule, and when writing new data, the writing address and the erasing address designated by the address designating means are set. In addition to causing the data transition by the data write / erase means, A determination means for determining the transition state of the data by the data write / erase means is provided based on the data of the designated write address and erase address, and the data rewrite / erasure is performed during the data rewrite / erase by the data write / erase means. When the erasing is interrupted, the data rewriting / erasing by the data writing / erasing means is completed according to the data transition state before the interruption judged by the judging means.

(発明の実施例) 第1図は本発明の一実施例の基本的構成を示すブロック
図である。
(Embodiment of the Invention) FIG. 1 is a block diagram showing a basic configuration of an embodiment of the present invention.

データ入力手段1は、フィルムカウント値のような規則
的データを書込み消去手段2へ入力する。EEPROMのよう
な書込み消去可能な記憶媒体3は、複数のアドレス、例
えばA0〜A3を有する。アドレス指定手段4は、書込み時
には書込みアドレスを所定の順番にしたがって指定する
と共に、消去時には消去アドレスとして2以上の一定回
数前、例えば2回前にデータが書き込まれたアドレスを
指定する。
The data input unit 1 inputs regular data such as a film count value to the writing / erasing unit 2. A writable / erasable storage medium 3 such as an EEPROM has a plurality of addresses, for example, A0 to A3. The address designating unit 4 designates a write address in a predetermined order at the time of writing, and at the time of erasing, designates an address at which data is written a predetermined number of times 2 or more, for example, twice before as an erase address.

第2図の例によって書換えプロセスを説明する。第2図
はデータが$06に変化した時にそれをアドレスA3に書き
込む場合を示している。
The rewriting process will be described with reference to the example of FIG. FIG. 2 shows the case where the data changes to $ 06 and is written to address A3.

新しいデータ$06がデータ入力手段1より入力される
と、書込み消去手段2は、書換えプロセスを開始する。
この時、既に1回前の書込みによりアドレスA2には$05
が記憶され、2回前の書込みによりアドレスA1には$04
が記憶されている。今回の書込みに際して、アドレス指
定手段4は書込みアドレスとしてA3を指定する。書込み
消去手段2は、時刻T1から時刻T3へおいて指定されたア
ドレスA3には$06を書き込む。この書込みの後、アドレ
ス指定手段4は消去アドレスとして2回前に書き込まれ
たアドレスA1を指定し、書込み消去手段2は、時刻T3か
ら時刻T5においてアドレスA1に$04のコンプリメントを
書き込みことにより$04→$00の書換えを行う。次に時
刻T5から時刻T7においてアドレスA1のバイト消去を行
い、$FFにする。
When new data $ 06 is input from the data input means 1, the writing / erasing means 2 starts the rewriting process.
At this time, $ 05 has already been written to address A2 due to the previous write.
Is stored, and $ 04 is written in address A1 due to the writing two times before.
Is remembered. When writing this time, the address designating means 4 designates A3 as the writing address. The writing / erasing means 2 writes $ 06 in the designated address A3 from time T1 to time T3. After this writing, the address designating means 4 designates the address A1 written twice before as the erase address, and the writing and erasing means 2 writes the complement of $ 04 to the address A1 from the time T3 to the time T5. Rewrite from $ 04 to $ 00. Next, from time T5 to time T7, the byte of address A1 is erased to set it to $ FF.

以上のような書込みを行うことにより、時刻T1〜T7の何
時であっても、連続する少なくとも二つのアドレスに、
隣り合うデータが保持されるから、書込み動作中に書換
えプロセスが中断しても、隣り合うデータより、時刻T1
或いはT2で中断した場合には$05と判別することがで
き、時刻T3〜T7で中断した場合には$06と判別すること
ができる。
By performing the above-mentioned writing, at any two times from time T1 to T7, at least two consecutive addresses are
Since the adjacent data is retained, even if the rewriting process is interrupted during the write operation, the time T1
Alternatively, if it is interrupted at T2, it can be determined as $ 05, and if it is interrupted at times T3 to T7, it can be determined as $ 06.

第2図の書込み方式の場合、nバイトにx回のデータ更
新を行うと、x×3/nのストレスと、約30msの書換え時
間で済むので、第8図の従来例の場合と比較して、必要
な記憶領域、ストレスの量及び書換え時間は同等であ
る。
In the case of the writing method of FIG. 2, if the data is updated x times for n bytes, the stress of xx3 / n and the rewriting time of about 30 ms are enough. Compare with the case of the conventional example of FIG. Therefore, the required storage area, the amount of stress, and the rewriting time are the same.

第4図は本発明の一実施例をカメラのフィルムカウンタ
において実現する具体例を示し、第5図及び第6図はそ
の動作を示すフローチャートである。
FIG. 4 shows a specific example in which an embodiment of the present invention is realized in a film counter of a camera, and FIGS. 5 and 6 are flowcharts showing the operation.

電池Vbatに接続されている直流コンバータDC/DCは、測
光スイッチSW1のオンによりコントロール端子▲
▼がローレベルになると起動し、その出力端子OUTに
直流電源電圧Vccが発生する。この直流電源電圧Vccの印
加により、マイクロコンピュータμCOMは立ち上がる。
同時に、パワーアップクリア回路PUCによりリセット信
号がマイクロコンピュータμCOMの入力ポートRESETに与
えられ、マイクロコンピュータμCOMのプログラムはス
タートする。
The DC / DC converter connected to the battery Vbat is controlled by turning on the metering switch SW1.
When ▼ becomes low level, it starts up and DC power supply voltage Vcc is generated at its output terminal OUT. By applying this DC power supply voltage Vcc, the microcomputer μCOM starts up.
At the same time, the power-up clear circuit PUC applies a reset signal to the input port RESET of the microcomputer μCOM, and the microcomputer μCOM program starts.

ステップ1:直流コンバータDC/DCが立ち上がると、マイ
クロコンピュータμCOMは出力ポートOUT1をハイレベル
とすることによりトランジスタTR1をオンにさせ、直流
コンバータDC/DCのコントロール端子▲▼をロ
ーレベルに保持させる。
Step 1: When the DC converter DC / DC rises, the microcomputer μCOM turns on the transistor TR1 by setting the output port OUT1 to the high level and holds the control terminal ▲ ▼ of the DC converter DC / DC at the low level.

ステップ2:マイクロコンピュータμCOMはAD変換器AD、
演算ユニットCPU及び電気的書込み消去可能な記憶媒体
のEEPROMで構成され、フィルムカウンタ読出しサブルー
チンをコールすることによりEEPROM内のアドレスA0〜A3
の中から現在の正しいフィルムカウント値を取り込む。
正しいフィルムカウント値は演算ユニットCPUのレジス
タRDに、また、次の書込みアドレスはインデックスレジ
スタIXにそれぞれ入力されて、フィルムカウンタ読出し
サブルーチンより復帰する。
Step 2: Microcomputer μCOM is AD converter AD,
Comprised of an arithmetic unit CPU and an EEPROM that is an electrically writable and erasable storage medium. By calling a film counter read subroutine, addresses A0 to A3 in the EEPROM
Capture the current correct film count value from the.
The correct film count value is input to the register RD of the arithmetic unit CPU and the next write address is input to the index register IX, respectively, and the film counter read subroutine returns.

ステップ3:電池Vbatの抜き取り等の原因でシャッタチャ
ージやフィルム給送チャージが途中のままで終わってい
るかどうかを判別するために、マイクロコンピュータμ
COMの入力ポートIN3に接続されているチャージスイッチ
SWcgのオンオフ状態を取り込み、チャージ完か否かを判
別する。チャージスイッチSWcgは、シャッタの先幕走行
でオフになり、シャッタチャージやフィルム給送を行う
チャージモータMTRの回転の結果チャージが終了すると
オンになるスイッチである。このステップの条件判別の
結果、チャージ未完の時にはチャージするために、ステ
ップ4へ進む。チャージ完の時にはステップ9へ飛ぶ。
Step 3: The microcomputer μ is used to determine whether the shutter charge or film feed charge has been terminated halfway due to removal of the battery Vbat, etc.
Charge switch connected to COM input port IN3
Take in the on / off state of SWcg and determine whether or not charging is complete. The charge switch SWcg is a switch that is turned off when the front curtain of the shutter is running, and is turned on when charging is completed as a result of rotation of the charge motor MTR that performs shutter charging and film feeding. As a result of the condition determination in this step, if the charging is not completed, the process proceeds to step 4 in order to charge. When the charge is complete, jump to step 9.

ステップ9:レジスタRDに入っているフィルムカウント値
を出力ポートOUT4より表示装置DISPに出力し、フィルム
カウント表示を行わせる。
Step 9: The film count value stored in the register RD is output from the output port OUT4 to the display device DISP to display the film count.

ステップ10:測光センサSPCからの信号の対数圧縮及びIS
O補正を行う測光回路CKT1からアナログ信号をAD変換器A
Dに取り込み、ディジタル信号に変換する。
Step 10: Logarithmic compression and IS of the signal from the photometric sensor SPC
Analog signal from photometric circuit CKT1 for O correction is converted to AD converter A
Captured in D and converted to digital signal.

ステップ11:ステップ10で得られた測光値から露出演算
を行い、シャッタ秒時Tv及び絞り値Avを演算する。
Step 11: Exposure calculation is performed from the photometric value obtained in step 10, and shutter time Tv and aperture value Av are calculated.

ステップ12:レリーズスイッチSW2の状態を入力ポートIN
2を介して取り込み、レリーズスイッチSW2がオンの時は
ステップ13へ進み、オフの時はステップ14へ進む。
Step 12: Release switch SW2 status is input port IN
Take in via 2, and proceed to step 13 when the release switch SW2 is on, and proceed to step 14 when it is off.

ステップ14:測光スイッチSW1のオンオフを判別し、オフ
の時はステップ15へ進み、オンの時はステップ10〜12,1
4を繰り返す。
Step 14: Determine whether the metering switch SW1 is on or off.If it is off, proceed to step 15.If it is on, steps 10 to 12,1.
Repeat 4

ステップ15:出力ポートOUT1をローレベルにすることに
よりトランジスタTR1をオフにし、直流コンバータDC/DC
を立ち下げる。
Step 15: Turn off the transistor TR1 by setting the output port OUT1 to the low level, and turn on the DC / DC converter.
Down.

ステップ13:レリーズスイッチSW2のオンによりレリーズ
シーケンスに入り、露出制御回路CKT2によって絞りAXを
駆動させると共に、不図示のメインミラーをアップさせ
る。更に先幕マグネットMG1を励磁させ、シャッタ秒時T
vの経過後に後幕マグネットMG2を励磁させる。
Step 13: A release sequence is entered by turning on the release switch SW2, and the exposure control circuit CKT2 drives the aperture AX and raises a main mirror (not shown). Further, the front curtain magnet MG1 is excited, and the shutter speed T
After the passage of v, excite the rear curtain magnet MG2.

この時先幕がスタートすることによってチャージスイッ
チSWcgはオフとなり、チャージ未完状態となる。
At this time, the charge switch SWcg is turned off by the start of the first curtain, and the charge is incomplete.

ステップ4:露出制御が終了すると、シャッタチャージ、
ミラーダウン、フィルム給送のために、マイクロコンピ
ュータμCOMは出力ポートOUT3よりモータドライバMDに
信号を送り、チャージモータMTRを駆動させる。
Step 4: When exposure control ends, shutter charge,
For mirror down and film feeding, the microcomputer μCOM sends a signal from the output port OUT3 to the motor driver MD to drive the charge motor MTR.

ステップ5:チャージモータMTRが回転し、全てのチャー
ジが終了すると、チャージスイッチSWcgがオンとなっ
て、ステップ6へ進む。
Step 5: When the charge motor MTR rotates and all charging is completed, the charge switch SWcg is turned on and the process proceeds to step 6.

ステップ6:チャージ完によりチャージモータMTRを停止
させる。
Step 6: The charge motor MTR is stopped when the charging is completed.

ステップ7:レジスタRDのフィルムカウント値をインクリ
メントする。
Step 7: Increment the film count value of the register RD.

ステップ8:インクリメントされたフィルムカウント値を
EEPROMに書き込むために、フィルムカウンタ書込みサブ
ルーチンをコールする。
Step 8: The incremented film count value
Call the write film counter subroutine to write to the EEPROM.

以上がカメラシステムのメインフローである。次にフィ
ルムカウンタ書込みサブルーチンを第6図により説明す
る。
The above is the main flow of the camera system. Next, the film counter writing subroutine will be described with reference to FIG.

ステップ44:レジスタRDに新しいフィルムカウント値が
入っており、インデックスレジスタIXには次に書き込む
べきEEPROMのアドレスが入っている。したがって、レジ
スタRDのデータをインデックスレジスタIXが指定するア
ドレスに書き込むことで、第2図の時刻T1〜T3の処理が
行われる。
Step 44: Register RD contains the new film count value and index register IX contains the address of the EEPROM to be written next. Therefore, by writing the data in the register RD to the address designated by the index register IX, the processing from time T1 to T3 in FIG. 2 is performed.

ステップ45:書込み時間だけ待つ。Step 45: Wait for the writing time.

ステップ35:インデックスレジスタIXを2だけ手前に戻
し、消去すべきアドレスを指定する。ここでデクリメン
トを2回行い、$3とのアンドをとっているが、これは
アドレスA0のコード番号が4で割り切れることが前提で
ある。
Step 35: The index register IX is moved back by 2, and the address to be erased is designated. Here, the decrement is performed twice and the AND with $ 3 is taken, but this is on the premise that the code number of address A0 is divisible by 4.

ステップ36:第2図の時刻T3〜T5の処理を実行するため
に、インデックスレジスタIXが指定するアドレスのデー
タをレジスタRAに移す。したがって、第2図の例では、
アドレスA1が消去アドレスとしてインデックスレジスタ
IXにより指定されており、アドレスA1のデータ$04がレ
ジスタRAにロードされる。
Step 36: The data at the address designated by the index register IX is transferred to the register RA in order to execute the processing from time T3 to T5 in FIG. Therefore, in the example of FIG.
Address A1 is the index register as the erase address
Specified by IX, data $ 04 at address A1 is loaded into register RA.

ステップ37:制約条件に従い、レジスタRAのコンプリ
メントをとる。
Step 37: Complement the register RA according to the constraint condition.

ステップ38:レジスタRAのデータをインデックスレジス
タIXが指定するアドレスに書き込む。これで時刻T5が実
現する。
Step 38: Write the data in the register RA to the address specified by the index register IX. This realizes time T5.

ステップ39:書込み時間だけ待つ。Step 39: Wait for writing time.

ステップ40:時刻T5〜T7の処理のためにバイト消去を行
う。これは、インデックスレジスタIXが指定するアドレ
スの1バイトをディスチャージする行為である。
Step 40: Byte erase is performed for the processing from time T5 to T7. This is the act of discharging one byte of the address specified by the index register IX.

ステップ41:消去時間だけ待つ。Step 41: Wait for the erase time.

ステップ42:その次に書き込むべきアドレスをインデッ
クスレジスタIXに指定させるために、インデックスレジ
スタIXを3回インクリメントし、$3とのアンドをと
る。これによって書込みは終了し、メインフローに復帰
する。
Step 42: The index register IX is incremented three times and ANDed with $ 3 in order to specify the address to be written next in the index register IX. This completes the writing and returns to the main flow.

次にフィルムカウンタ読出しサブルーチンを説明する。Next, the film counter reading subroutine will be described.

ステップ21:フィルムカウンタ読出しサブルーチンは、
直流コンバータDC/DCの立ち上がり後に実行させるため
に、EEPROMのどのアドレスに正しいフィルムカウント値
が入っているかを探す必要がある。したがって、まずイ
ンデックスレジスタIXに先頭アドレスA0のコード番号$
00をロードする。なお、本例ではアドレスA0のコード番
号を$00としているが、これが$00でない時は、以降の
IX→IX AND $3の演算には全てアドレスA0のコード
番号を加算する必要がある。
Step 21: The film counter read subroutine is
In order to execute after the DC converter DC / DC rises, it is necessary to find out which address in the EEPROM contains the correct film count value. Therefore, the code number $ of the start address A0 is first stored in the index register IX.
Load 00. In this example, the code number of address A0 is set to $ 00, but if it is not $ 00,
It is necessary to add the code number of address A0 for all calculations of IX → IX AND $ 3.

ステップ22:インデックスレジスタIXが指定するアドレ
スのデータをレジスタRAにロードする。
Step 22: Load the data of the address specified by the index register IX into the register RA.

ステップ23:インデックスレジスタIXをインクリメント
し、次のアドレスを指定させる。
Step 23: Increment the index register IX to specify the next address.

ステップ24:レジスタRAが$FFでない時は$FFが見つか
るまでステップ22〜24を繰り返し、$FFを持つアドレス
を見つけたら、ステップ25へ進む。
Step 24: When the register RA is not $ FF, steps 22 to 24 are repeated until $ FF is found. When an address having $ FF is found, the process proceeds to step 25.

ステップ25:インデックスレジスタIXが指定するアドレ
スのデータをレジスタRAにロードする。
Step 25: Load the data of the address specified by the index register IX into the register RA.

ステップ26:インデックスレジスタIXをインクリメント
し、次のアドレスを指定させる。
Step 26: Increment the index register IX to specify the next address.

ステップ27:レジスタRAが$FFの時は$FFでないデータ
を持つアドレスが見つかるまでステップ25〜27を繰り返
し、$FFでないデータを持つアドレスを見つけたら、ス
テップ28へ進む。
Step 27: When the register RA is $ FF, steps 25 to 27 are repeated until an address having non- $ FF data is found. When an address having non- $ FF data is found, the process proceeds to step 28.

ステップ28:インデックスレジスタIXが指定するアドレ
スのデータをレジスタRBにロードする。
Step 28: Load the data of the address specified by the index register IX into the register RB.

ステップ29:インデックスレジスタIXをインクリメント
し、次のアドレスを指定させる。
Step 29: Increment the index register IX to specify the next address.

ステップ30:インデックスレジスタIXが指定するアドレ
スのデータをレジスタRCにロードする。これによって、
第2図の時刻T1〜T7のそれぞれにおいて書換えプロセス
が中断された後、電池Vbatが交換され、測光スイッチSW
1のオンにより動作が再開されて、フィルムカウンタ読
出しサブルーチンが実行された状態では、各レジスタR
A,RB,RCには第3図に示されるようにデータがロードさ
れる。
Step 30: Load the data of the address specified by the index register IX into the register RC. by this,
After the rewriting process is interrupted at each of the times T1 to T7 in FIG. 2, the battery Vbat is replaced and the photometric switch SW
When the film counter read subroutine is executed by restarting the operation when 1 is turned on, each register R
Data is loaded into A, RB, and RC as shown in FIG.

ステップ31:レジスタRA〜RCを使って正しいフィルムカ
ウント値を読み出すデータ解析を開始する。まず、レジ
スタRCが$FFならば、時刻T1、T7で中断した場合に相当
し、ステップ32へ進む。
Step 31: Start data analysis to read the correct film count value using the registers RA to RC. First, if the register RC is $ FF, this corresponds to the case of interruption at times T1 and T7, and the process proceeds to step 32.

ステップ32:時刻T1で中断した場合には、正しいフィル
ムカウント値は$05であり、時刻T7で中断した場合に
は、正しいフィルムカウント値は$06である。そのため
に、レジスタRBのデータをレジスタRDに移し、メインフ
ローへ復帰する。これによって正しいフィルムカウント
値はレジスタRDに入り、また次に書き込むべきEEPROMの
アドレスはインデックスレジスタIXに入る。
Step 32: If interrupted at time T1, the correct film count value is $ 05; if interrupted at time T7, the correct film count value is $ 06. Therefore, the data in the register RB is transferred to the register RD, and the process returns to the main flow. This causes the correct film count value to enter register RD and the next EEPROM address to be written to index register IX.

ステップ33:ステップ31でNOの時は、時刻T2〜T6で中断
した場合に相当する。レジスタRCとレジスタRBの差が$
1の時は時刻T3〜T6で中断した場合に相当し、正しいフ
ィルムカウント値は$06であり、レジスタRCに存在す
る。よって、YESの時はステップ34へ進む。
Step 33: The case of NO in step 31 corresponds to the case of interruption at time T2 to T6. The difference between register RC and register RB is $
The case of 1 corresponds to the case of interruption at times T3 to T6, the correct film count value is $ 06, and it exists in the register RC. Therefore, if YES, the process proceeds to step 34.

ステップ34:レジスタRCに入っている正しいフィルムカ
ウント値をレジスタRDに移し、2回前のアドレスのデー
タを$FFにクリアしておくために、前述のステップ35〜
42のプロセスを実行する。これによって時刻T7のメモリ
構成が実現され、書換え途中の状態から書換え完の状態
に復帰することができると共に、正しいフィルムカウン
ト値はレジスタRDに入り、次に書き込むべきアドレスは
インデックスレジスタIXにストアされる。
Step 34: In order to transfer the correct film count value stored in the register RC to the register RD and clear the data of the address two times before to $ FF, the above-mentioned step 35 to
Executes 42 processes. As a result, the memory configuration at time T7 is realized, the rewriting state can be returned to the rewriting complete state, the correct film count value is stored in the register RD, and the address to be written next is stored in the index register IX. It

ステップ43:ステップ33でNOの時は時刻T2で中断した場
合に相当する。このときは正しいフィルムカウント値は
$06のはずであり、これを実現するために、RD←RB+$
1を行い、即ち$05+$01=$06の演算を行い、レジス
タRDにストアする。そして$06を書き込むために、この
後フィルムカウンタ書込みサブルーチンであるステップ
44以降に進む。これによって、時刻T2で中断した場合に
アドレスA3に残ったデータ??は$06に書き換えられ、ア
ドレスA1は$FFにクリアされる。
Step 43: The case of NO in step 33 corresponds to the case of interruption at time T2. At this time, the correct film count value should be $ 06. To achieve this, RD ← RB + $
1 is performed, that is, the calculation of $ 05 + $ 01 = $ 06 is performed and stored in the register RD. Then, in order to write $ 06, a step which is a film counter writing subroutine after this
Proceed to 44 and later. As a result, the data ?? remaining in the address A3 when interrupted at time T2 is rewritten to $ 06, and the address A1 is cleared to $ FF.

以上示したアルゴリズムによれば、フィルムカウンタの
ようにその値が1ずつ規則的に変化するデータをEEPROM
にエラーフリーで書き換えることができる。即ち、EEPR
OMに書換え途中に万一書換えが中断するなどしても、次
にデータを読み出す際に上記アルゴリズムに従って読み
出すことで書込み時間が長いEEPROMに有効なデータスト
アができる。
According to the algorithm shown above, data whose value changes regularly by 1 like a film counter is stored in the EEPROM.
Can be rewritten without error. That is, EEPR
Even if the rewriting is interrupted while rewriting the OM, the effective data store in the EEPROM with long writing time can be done by reading the data according to the above algorithm when reading the data next time.

図示実施例では、規則性のあるデータとしてフィルムカ
ウント値のようなインクリメントデータを使用したが、
逆にデクリメントデータでもよい。このときには、フィ
ルムカウンタ読出しサブルーチンのステップ33における
RC−RB=$1の条件判別を、RB−RC=$1に変えると共
に、ステップ43をRD←RB−$1にすればよい。
In the illustrated embodiment, the increment data such as the film count value is used as the regular data,
Conversely, decrement data may be used. At this time, in step 33 of the film counter reading subroutine
The condition determination of RC-RB = $ 1 may be changed to RB-RC = $ 1 and step 43 may be changed to RD ← RB- $ 1.

また、インクリメント、デクリメントはともにデータの
変化が1ずつであるが、2ずつ変化するようなパターン
でもステップ33とステップ43を変えるだけで済む。前回
のデータをD(n−1)、今回のデータをD(n)と
し、そのデータの値に数列的な規則性があれば、殆どの
場合にステップ33とステップ43を変えるだけで応用でき
る。上記データパターンは等差数列であり、 D(n)=D(n−1)+m と表され、 ステップ33は RC−RB=m ステップ43は RD←RB+m の処理を行えばよい。
In addition, both increment and decrement change the data by one, but even in a pattern in which the data changes by two, only step 33 and step 43 need be changed. If the previous data is D (n-1) and the current data is D (n), and if the values of the data have a regularity in a series, it can be applied in almost all cases by simply changing step 33 and step 43. . The data pattern is an arithmetic progression and is expressed as D (n) = D (n-1) + m. Step 33 is RC-RB = m. Step 43 is RD ← RB + m.

等比数列の場合には、 D(n)=m×D(n−1) と表され、 ステップ33は RC÷RB=m ステップ43は RD←m×RB の処理を行えばよい。In the case of geometric progression, it is expressed as D (n) = m × D (n−1), step 33 is RC ÷ RB = m, and step 43 is RD ← m × RB.

データの規則性が累乗であるとすると、 D(n)={D(n−1)} と表され、 ステップ33は RC=RBm ステップ43は RD←RBm の処理を行えばよい。If the regularity of the data is a power, it is expressed as D (n) = {D (n-1)} m , step 33 is RC = RB m, step 43 is RD ← RB m .

このように、本発明は数学的規則性のある変化をもつデ
ータであれば殆どの場合に応用することができる、有効
なエラーフリーのEEPROMへのデータ書込み装置というこ
とができる。
As described above, the present invention can be applied as an effective error-free data writing device to an EEPROM, which can be applied to almost any data having a change with mathematical regularity.

したがって、その応用範囲は単にカメラのフィルムカウ
ンタだけでなく、EEPROMを使用する全ての関連機器に応
用できるものである。また記憶媒対としてもEEPROMだけ
でなく、書込み時間の比較的長い書込み消去可能な光磁
気ディスクのような、光、磁気、化学を使用したメモリ
を使用することができる。
Therefore, the application range is not limited to the film counter of the camera, but can be applied to all related devices using the EEPROM. Further, as the storage medium pair, not only the EEPROM but also a memory using light, magnetism, and chemistry, such as a writable and erasable magneto-optical disk having a relatively long writing time, can be used.

更に読出しに関しては、第6図に示される手段には限ら
ず、種々の手段をとり得るものである。
Further, the reading is not limited to the means shown in FIG. 6, and various means can be adopted.

(発明の効果) 以上説明したように、本発明によれば、データ書込み消
去手段によるデータ書換え・消去の実行途中にてデータ
書換え・消去が中断された際に、判定手段にて判定され
た中断前のデータ変遷状態に応じてデータ書込み消去手
段によるデータ書換・消去を完了させるようにしたか
ら、データ書換え・消去の途中で電源供給が中断される
等によりデータ書換え・消去動作が完了する以前の状態
で中断されてしまった際に、この中断状態からデータ書
換え・消去動作の完了状態へ移行することができる。
(Effect of the Invention) As described above, according to the present invention, when the data rewriting / erasing is interrupted during the execution of the data rewriting / erasing by the data writing / erasing means, the interruption judged by the judging means is interrupted. Since the data rewriting / erasing by the data writing / erasing means is completed according to the previous data transition state, before the data rewriting / erasing operation is completed due to the interruption of the power supply during the data rewriting / erasing, etc. When it is interrupted in the state, it is possible to shift from the suspended state to the completed state of the data rewriting / erasing operation.

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

第1図は本発明の一実施例の基本的構成を示すブロック
図、第2図は本発明の一実施例による書換えプロセスの
一例を示す図、第3図は読出し時におけるデータ保持状
態を示す図、第4図は本発明の一実施例の具本的構成を
示すブロック図、第5図は第4図図示具体例の動作のメ
インフローを示すフローチャート、第6図は第4図図示
具体例の動作のサブルーチンを示すフローチャート、第
7図はEEPROMの一般的なメモリマップを示す図、第8図
は従来例による書換えプロセスの一例を示す図、第9図
は従来例による書換えプロセスでのビットレベルを示す
図である。 1……データ入力手段、2……書込み消去手段、3……
記憶媒体、4……アドレス指定手段、μCOM……マイク
ロコンピュータ、CPU……演算ユニット、RA,RB,RC,RD…
…レジスタ、IX……インデックスレジスタ、A0,A1,A2,A
3……アドレス。
FIG. 1 is a block diagram showing a basic configuration of an embodiment of the present invention, FIG. 2 is a diagram showing an example of a rewriting process according to an embodiment of the present invention, and FIG. 3 is a data holding state at the time of reading. FIG. 4 is a block diagram showing a concrete structure of an embodiment of the present invention, FIG. 5 is a flow chart showing a main flow of operation of the concrete example shown in FIG. 4, and FIG. 6 is a concrete diagram shown in FIG. 7 is a flowchart showing a general memory map of an EEPROM, FIG. 8 is a diagram showing an example of a rewriting process according to a conventional example, and FIG. 9 is a rewriting process according to a conventional example. It is a figure which shows a bit level. 1 ... Data input means, 2 ... writing / erasing means, 3 ...
Storage medium, 4 ... Address designation means, .mu.COM ... Microcomputer, CPU ... Arithmetic unit, RA, RB, RC, RD ...
Register, IX Index register, A0, A1, A2, A
3 …… Address.

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】複数のアドレスを有する書込み消去可能な
記憶媒体と、書込みアドレスを所定の順番にしたがって
指定すると共に、消去アドレスとして2以上の一定回数
前にデータが書き込まれたアドレスを指定するアドレス
指定手段と、指定された書込みアドレスに対してのデー
タを予め決められた規則にしたがって変遷させてデータ
を新たなデータに書き換えると共に、指定された消去ア
ドレスに対してのデータを予め決められた規則にしたが
って変遷させてデータ消去を行うデータ書込み消去手段
を有し、新たなデータの書込みに際し、前記アドレス指
定手段により指定された書込みアドレス及び消去アドレ
スに対しての前記データ書込み消去手段による前記デー
タ変遷を行わせると共に、更に前記指定された書込みア
ドレス及び消去アドレスのデータに基づいて前記データ
書込み消去手段によるデータの変遷状態を判定する判定
手段を設け、前記データ書込み消去手段によるデータ書
換え・消去の実行途中にてデータ書換え・消去が中断さ
れた際に、前記判定手段にて判定された中断前のデータ
変遷状態に応じて前記データ書込み消去手段によるデー
タ書換え・消去を完了させることを特徴とする書込み消
去可能な記憶媒体を使用する書込み装置。
1. A writable and erasable storage medium having a plurality of addresses, and an address for designating a write address in a predetermined order and for designating an address to which data is written as an erase address two or more times before a fixed number of times. Designating means and data for a designated write address are changed according to a predetermined rule to rewrite the data with new data, and data for a designated erase address is predetermined rule. The data write / erase means for erasing the data by changing the data in accordance with the data write / erase means for the write address and the erase address designated by the address designating means. And the specified write address and erase address. When the data rewriting / erasing is interrupted during the execution of the data rewriting / erasing by the data writing / erasing means, the determining means for determining the transition state of the data by the data writing / erasing means based on the data A writing apparatus using a writable / erasable storage medium, characterized in that the data rewriting / erasing by the data writing / erasing means is completed in accordance with the data transition state before the interruption determined by the determining means.
JP31737787A 1987-12-17 1987-12-17 Writing device using writable / erasable storage medium Expired - Fee Related JPH0766677B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP31737787A JPH0766677B2 (en) 1987-12-17 1987-12-17 Writing device using writable / erasable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP31737787A JPH0766677B2 (en) 1987-12-17 1987-12-17 Writing device using writable / erasable storage medium

Publications (2)

Publication Number Publication Date
JPH01159894A JPH01159894A (en) 1989-06-22
JPH0766677B2 true JPH0766677B2 (en) 1995-07-19

Family

ID=18087571

Family Applications (1)

Application Number Title Priority Date Filing Date
JP31737787A Expired - Fee Related JPH0766677B2 (en) 1987-12-17 1987-12-17 Writing device using writable / erasable storage medium

Country Status (1)

Country Link
JP (1) JPH0766677B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7551706B2 (en) 2004-12-03 2009-06-23 Kyocera Mita Corporation Counter device and counting method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS60232000A (en) * 1984-05-01 1985-11-18 Meidensha Electric Mfg Co Ltd Data processing system of non-volatile memory

Also Published As

Publication number Publication date
JPH01159894A (en) 1989-06-22

Similar Documents

Publication Publication Date Title
US6154808A (en) Method and apparatus for controlling data erase operations of a non-volatile memory device
US7155559B1 (en) Flash memory architecture with separate storage of overhead and user data
JPH08202626A (en) Memory controller
JPS6196598A (en) Count data memory method of electric erasable p-rom
JPH03171819A (en) Method for computing by means of nonvolatile storage and device therefor
JPH08166877A (en) One-chip microcomputer that can execute correction program and microcomputer that can correct rom
US7062630B2 (en) Storing device for writing data onto a plurality of installed storing mediums, storing control method for the storing device, and program thereof
US5905921A (en) One-chip microcomputer built-in system
US5697004A (en) Camera capable of storing photographing data and display device connectable thereto
JPH0766677B2 (en) Writing device using writable / erasable storage medium
US5847997A (en) PC card
US4978982A (en) Photographic camera with built-in E2.sup. prom
US6523105B1 (en) Recording medium control device and method
JPH11259357A (en) Semiconductor integrated device and nonvolatile memory writing system
JP2953552B2 (en) Non-volatile memory write control method
JPH1091490A (en) Storage device using flash memory
US4912492A (en) Photographic camera with built-in E2 PROM
JP3500470B2 (en) camera
JPH05325593A (en) Controller of flash type eeprom
JPS5958699A (en) Data storage system of nonvolatile ram
JPH07111092A (en) Control method for non-volatile semiconductor storage device
JPH11297082A (en) Method of rewriting data in flash memory and semiconductor memory
JPH05336680A (en) Charger
JPH0373958B2 (en)
JP2001118391A (en) Memory device

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees