JPH09223213A - Counting method and ic card applying this method - Google Patents

Counting method and ic card applying this method

Info

Publication number
JPH09223213A
JPH09223213A JP8032249A JP3224996A JPH09223213A JP H09223213 A JPH09223213 A JP H09223213A JP 8032249 A JP8032249 A JP 8032249A JP 3224996 A JP3224996 A JP 3224996A JP H09223213 A JPH09223213 A JP H09223213A
Authority
JP
Japan
Prior art keywords
bit
counting
bits
data
counter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP8032249A
Other languages
Japanese (ja)
Inventor
Mayumi Inada
稲田真弓
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.)
Dai Nippon Printing Co Ltd
Original Assignee
Dai Nippon Printing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dai Nippon Printing Co Ltd filed Critical Dai Nippon Printing Co Ltd
Priority to JP8032249A priority Critical patent/JPH09223213A/en
Publication of JPH09223213A publication Critical patent/JPH09223213A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To hardly generate data ghosts at the time of rewriting data and to easily judge the generation position of the data ghost by counting one every time changeover to a bit for indicating ON or OFF is shifted for 1-bit in a fixed direction. SOLUTION: For this IC card 1, an IC module 2 with a built-in memory chip composed of an EEPROM is embedded and a counter for counting composed of plural memory bits is formed inside the chip. Then, the counter for counting is turned to 8-bit constitution for instance and is constituted so as to count one every time th changeover to ON (1) of the bit is shifted for 1bit in the fixed direction. For instance, by successively shifting the changeover to 1 to a high-order bit for a count value 0 (decimal number) when all the bits are OFF (0) and the count value 1 (decimal number) when only a least significant bit is 1, the count value is turned to 2, 3 and 8 (decimal number).

Description

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

【0001】[0001]

【発明の属する技術分野】本発明はプリペイドカード等
に用いられるICカードの計数方法、及びかかる計数方
法を用いたICカードに関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an IC card counting method used for prepaid cards and the like, and an IC card using the counting method.

【0002】[0002]

【従来の技術】従来、書換え可能な読み出し専用メモリ
(EEPROM)を使用した計数方法として、2進数表
現を用いた方法が一般的である。図1は2進数を用いた
8ビットカウンタの計数方法を示したものであり、下位
ビットから上位ビットに、順次、20 、21 、22 、2
3 、24 、25 、26 、27 の重み付けをして0〜25
5までの計数を行えるようにしている。
2. Description of the Related Art Conventionally, as a counting method using a rewritable read-only memory (EEPROM), a method using a binary number expression is generally used. FIG. 1 shows a counting method of an 8-bit counter using a binary number. In order from the lower bit to the upper bit, 2 0 , 2 1 , 2 2 , 2, 2
0 to 25 by weighting 3 , 2 4 , 2 5 , 2 6 and 2 7
Counting up to 5 is possible.

【0003】[0003]

【発明が解決しようとする課題】ところで、図1に示し
た2進数による計数方法では、書換えを行う場合には、
すべてのビットを一旦消し、その後書き直すことにより
行っている。この方法では、全てのビットが常に書換え
可能であるため、データ書換えの途中でなんらかの理由
により処理が停止してしまうと、書き直された値が不正
確になるばかりでなく、プリペイドカードなどの用途で
は減算中にも拘らず値が増加してしまうというデータ化
けが生じてしまう場合もあり、さらにデータ化けが生じ
たことを判定するのが困難であるという問題があった。
本発明は上記課題を解決するためのもので、EEPRO
Mを用いたICカードにおいて、複数のメモリビットを
計数用カウンタとして利用し、データの書換えの際にデ
ータ化けが発生しにくく、かつデータ化けが発生しても
発生位置を容易に判定することができる計数方法及び該
計数方法を用いたICカードを提供することを目的とす
る。
By the way, in the binary counting method shown in FIG. 1, when rewriting is performed,
All bits are erased once and then rewritten. In this method, all bits are always rewritable, so if the processing is stopped for some reason during the data rewriting, not only the rewritten value becomes inaccurate, but also in applications such as prepaid cards. In some cases, the data may be garbled such that the value increases despite the subtraction, and it is difficult to determine that the data has garbled.
The present invention is for solving the above-mentioned problems, and
In an IC card using M, a plurality of memory bits are used as a counter for counting, so that data garbling is unlikely to occur at the time of rewriting data, and even if the data garbling occurs, the occurrence position can be easily determined. An object of the present invention is to provide a possible counting method and an IC card using the counting method.

【0004】[0004]

【課題を解決するための手段】本発明は複数のメモリビ
ットを計数用カウンタとして利用する計数方法におい
て、隣接するビットの「ON」、「OFF」の切り換え
を制御することにより、データ化けの発生を起こりにく
くし、かつデータ化けが発生した場合にその発生位置の
特定を容易にできるようにしたことを特徴とする。
According to the present invention, in a counting method in which a plurality of memory bits are used as a counting counter, garbled data is generated by controlling switching between "ON" and "OFF" of adjacent bits. Is less likely to occur, and when garbled data occurs, it is possible to easily identify the position where the garbled data occurs.

【0005】[0005]

【実施の形態】以下、本発明の実施の形態について説明
する。図2は本発明のICカードに用いられる計数用カ
ウンタの計数方法を説明するための図、図3、図4はデ
ータ書換えの詳細を説明するための図、図5は本発明の
ICカードの外観図である。本発明のICカードはプリ
ペイドカード等として使用されるものであり、図5に示
すように、ICカード1はEEPROMからなるメモリ
チップを内蔵したICモジュール2を埋め込んでおり、
このチップ内には複数のメモリビットからなる計数用カ
ウンタが形成されている。この計数用カウンタは、任意
のメモリビット数からなっている。図2では、計数用カ
ウンタとして8ビット構成の例を示している。本発明の
カウンタはビットの「ON」(図2の「1」)への切り
換えを一定方向に1ビットシフトさせる毎に1計数され
るように構成されており、全てのビットが「OFF」
(図2の「0」)のとき計数値「0」(10進数)、最
下位ビットのみ「1」のとき計数値「1」(10進
数)、順次「1」への切り換えが上位ビットへシフトす
ることにより計数値は「2」→「3」→……「8」(1
0進数)となる。また、最上位ビットが「1」の状態
で、「1」への切換えを順次最下位ビットから上位ビッ
トへシフトすることにより、「9」→「10」→……と
計数(加算)し、全ビットが「1」へ切り換えられたと
き「36」(10進数)となる。なお、上記説明におい
て、「ON」ビットと「OFF」ビットとを入れ換えれ
ば減算器として動作することになる。このようにビット
のON、OFFの切り換えを一定方向にシフトさせて計
数することにより、計数に際してのデータの書換えビッ
トは2ビットに限定され、書換えビットが少ないためデ
ータ化けの発生が起こりにくくなる。なお、この計数方
法で表現できる最大値は、Nビットを利用した場合には
N・(N+1)/2となる。
Embodiments of the present invention will be described below. FIG. 2 is a diagram for explaining a counting method of a counting counter used in the IC card of the present invention, FIGS. 3 and 4 are diagrams for explaining details of data rewriting, and FIG. 5 is a diagram of the IC card of the present invention. It is an external view. The IC card of the present invention is used as a prepaid card or the like. As shown in FIG. 5, the IC card 1 is embedded with an IC module 2 having a built-in memory chip made of an EEPROM.
A counting counter including a plurality of memory bits is formed in the chip. This counting counter has an arbitrary number of memory bits. FIG. 2 shows an example of an 8-bit configuration as the counting counter. The counter of the present invention is configured to count 1 each time one bit is switched in the fixed direction by switching the bit to "ON"("1" in FIG. 2), and all bits are "OFF".
(The count value is "0" (decimal number) when it is "0" in FIG. 2, the count value is "1" (decimal number) when only the least significant bit is "1", and switching to "1" is performed sequentially to the higher bits. By shifting, the count value becomes "2" → "3" → ... "8" (1
It becomes 0 decimal number). Further, when the most significant bit is "1", the switching to "1" is sequentially shifted from the least significant bit to the upper bit to count (add) as "9" → "10" → ... When all the bits are switched to "1", it becomes "36" (decimal number). In the above description, if the "ON" bit and the "OFF" bit are interchanged, it will operate as a subtractor. By thus shifting the ON / OFF of bits in a certain direction and counting, the number of rewriting bits of the data at the time of counting is limited to 2 bits, and since the number of rewriting bits is small, garbled data is less likely to occur. The maximum value that can be represented by this counting method is N · (N + 1) / 2 when N bits are used.

【0006】次に、計数時のデータ書き換えの詳細を図
3により、10進数で10から11への書換えを例にし
て説明する。10を表す状態は、図3(a)に示すよう
に第2ビットが「ON」、第3ビットはOFFである。
そこで、まず第3ビットも「ON」(図3(b))にし
た中間の11′の状態をつくり、連続して第2ビットを
「OFF」にして11とする(図3(c))。このよう
にnビットからn+1ビットへ「ON」をシフトさせる
とき、まず、nビット「ON」のまま、隣接するn+1
ビットを「ON」とする中間の状態をつくり、次いでn
ビットを「OFF」とする。このような方法で書換えを
行うと、図3の例において、書換え途中である11′の
状態でなんらかの原因により、書き込み処理が中断して
も、11′をみることにより10→11への書換え途中
であることが容易に判定することができ、したがって、
正しい値に復帰することが可能である。上記説明は加算
の場合であるが、減算の場合も同様に中間の状態をつく
るようにすればよい。
Next, details of data rewriting at the time of counting will be described with reference to FIG. 3 as an example of rewriting from decimal 10 to 11. In the state indicating 10, the second bit is “ON” and the third bit is OFF, as shown in FIG.
Therefore, first, an intermediate 11 'state is created in which the third bit is also turned "ON" (FIG. 3B), and the second bit is continuously turned "OFF" to be 11 (FIG. 3C). . In this way, when shifting “ON” from n bits to n + 1 bits, first, with n bits “ON”, the adjacent n + 1
Create an intermediate state with the bit "ON", then n
Set the bit to "OFF". When rewriting is performed by such a method, in the example of FIG. 3, even if the writing process is interrupted due to some cause in the state of 11 'which is being rewritten, by looking at 11', rewriting from 10 to 11 is in progress. Can be easily determined, and therefore
It is possible to return to the correct value. Although the above description is for addition, an intermediate state may be similarly created for subtraction.

【0007】このような方法で、殆どの場合データ化け
の発生位置を判定することができるが、例えば、0→
1、8→9、15→16の書換えのように、最下位ビッ
トを書換える場合には上記した中間の状態をつくること
はできない。したがって、このケースの場合も手当てす
る場合には、図4に示すように、最下位ビットの下位
(あるいは最上位ビットの上位)に補助のビットを設け
るようにすればよい。図4の例は、15から16への書
換えについてのものであるが、補助ビットと最下位ビッ
トを「ON」にして中間の状態をつくり、次いで補助ビ
ットを「OFF」にすれば、同様の効果が得られる。
With such a method, the position where the data is garbled can be determined in most cases. For example, 0 →
When the least significant bit is rewritten like the rewriting of 1, 8 → 9, 15 → 16, the above intermediate state cannot be created. Therefore, in the case of dealing with this case as well, as shown in FIG. 4, an auxiliary bit may be provided at the lower order of the least significant bit (or the higher order of the most significant bit). The example of FIG. 4 is for rewriting from 15 to 16, but if the auxiliary bit and the least significant bit are turned “ON” to create an intermediate state, and then the auxiliary bit is turned “OFF”, the same result can be obtained. The effect is obtained.

【0008】[0008]

【発明の効果】以上のように本発明によれば、従来の2
進数表現に比して書換えビット数が少ないため、データ
化けが起こりにくいとともに、データ化けが発生して
も、容易にその発生位置を特定することが可能であるた
め、プリペイドカード等に適用した場合に不正使用防止
等に多大な効果が得られる。また、2進数表現では、メ
モリビット数の変更は、通常、4ビット単位、あるいは
8ビット単位で行われ、メモリビット数を任意に設定で
きなかったが、本発明では1ビット単位でビット数の変
更が可能であるため、任意ビット数のカウンタとして利
用することも可能である。
As described above, according to the present invention, the conventional 2
Since the number of rewriting bits is smaller than that in the decimal notation, it is difficult for data to be garbled, and even if data is garbled, it is possible to easily identify the location where the data is garbled. In addition, a great effect can be obtained in preventing illegal use. Further, in the binary representation, the memory bit number is usually changed in units of 4 bits or 8 bits, and the number of memory bits cannot be set arbitrarily, but in the present invention, the number of bits is changed in units of 1 bit. Since it can be changed, it can also be used as a counter of an arbitrary number of bits.

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

【図1】 2進数を用いた8ビットカウンタの計数方法
を示す図である。
FIG. 1 is a diagram showing a counting method of an 8-bit counter using a binary number.

【図2】 本発明の計数方法を説明するための図であ
る。
FIG. 2 is a diagram for explaining a counting method of the present invention.

【図3】 データ書換えの詳細を説明するための図であ
る。
FIG. 3 is a diagram for explaining details of data rewriting.

【図4】 データ書換えの詳細を説明するための図であ
る。
FIG. 4 is a diagram for explaining details of data rewriting.

【図5】 本発明のICカードの外観図である。FIG. 5 is an external view of an IC card of the present invention.

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

1…ICカード、2…ICモジュール。 1 ... IC card, 2 ... IC module.

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】 複数のメモリビットを計数用カウンタと
して利用する計数方法において、「ON」(または「O
FF」)を表すビットへの切り換えを一定方向に1ビッ
トシフトさせるごとに1計数するようにしたことを特徴
とする計数方法。
1. In a counting method using a plurality of memory bits as a counting counter, "ON" (or "O")
The counting method is characterized in that one is counted every time one bit is shifted in a fixed direction by switching to a bit representing "FF").
【請求項2】 請求項1記載の方法において、計数は
「増」又は「減」の一方向であることを特徴とする計数
方法。
2. The counting method according to claim 1, wherein the counting is in one direction of “increase” or “decrease”.
【請求項3】 請求項1記載の方法において、1計数す
る際、「ON」(または「OFF」)を表すビットに隣
接する「OFF」(または「ON」)を表すビットを
「ON」(または「OFF」)に切り換え、その後、前
記「ON」(または「OFF」)を表すビットを「OF
F」(または「ON」)に切り換えるようにしたことを
特徴とする計数方法。
3. The method according to claim 1, wherein when counting one, a bit representing “OFF” (or “ON”) adjacent to a bit representing “ON” (or “OFF”) is “ON” ( Or "OFF"), and then the bit representing "ON" (or "OFF") is set to "OF".
The counting method is characterized by switching to "F" (or "ON").
【請求項4】 請求項1〜3いずれか1項記載の計数方
法を適用したICカード。
4. An IC card to which the counting method according to claim 1 is applied.
JP8032249A 1996-02-20 1996-02-20 Counting method and ic card applying this method Pending JPH09223213A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP8032249A JPH09223213A (en) 1996-02-20 1996-02-20 Counting method and ic card applying this method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP8032249A JPH09223213A (en) 1996-02-20 1996-02-20 Counting method and ic card applying this method

Publications (1)

Publication Number Publication Date
JPH09223213A true JPH09223213A (en) 1997-08-26

Family

ID=12353744

Family Applications (1)

Application Number Title Priority Date Filing Date
JP8032249A Pending JPH09223213A (en) 1996-02-20 1996-02-20 Counting method and ic card applying this method

Country Status (1)

Country Link
JP (1) JPH09223213A (en)

Similar Documents

Publication Publication Date Title
US5963970A (en) Method and apparatus for tracking erase cycles utilizing active and inactive wear bar blocks having first and second count fields
US6064740A (en) Method and apparatus for masking modulo exponentiation calculations in an integrated circuit
CN101154153B (en) Bit field operation circuit
EP0328063A2 (en) Absolute value calculating circuit having a single adder
US5957996A (en) Digital data comparator and microprocessor
US20070130412A1 (en) Address Decoding Method And Related Apparatus By Comparing Mutually Exclusive Bit-Patterns Of Addresses
JP2001005675A (en) Program converter and processor
JPWO2008056461A1 (en) Cryptographic processing circuit
CN1312632C (en) System and method for using non-alpha channel image data for acceptable alpha channel environment
JPH034936B2 (en)
JPH09223213A (en) Counting method and ic card applying this method
CN113032797B (en) Method for executing encryption operation in processing equipment
US5708842A (en) Apparatus for changing coefficients utilized to perform a convolution operation having address generator which uses initial count number and up/down count inputs received from external
CN111192061A (en) Method and device for judging customer participation in promotion activity based on binary bit design
EP0843253A1 (en) A method for reducing the number of bits needed for the representation of constant values in a data processing device
US7080237B2 (en) Register window flattening logic for dependency checking among instructions
JPS6148174B2 (en)
JP2684995B2 (en) Instruction decoder circuit
JP2003223372A (en) Memory controller and serial memory
JPH1021146A (en) Frequency counter
JPS6223902B2 (en)
JPH11120778A (en) Nonvolatile memory built-in microcomputer
JPH09223198A (en) Ic card with counting function
JPH04143998A (en) Data write method
JPH11161559A (en) Storage device with parity check function