Abstract:
A counter has an electrically erasable and programmable read-only memory (EEPROM), a write circuit, and a read circuit. The EEPROM, which can be rewritten at least V times, is divided into count areas M O , . . . , M N  each capable of storing count values from zero to V, and a number area for storing a number K from zero to N identifying the count area currently in use. The write circuit uses the count areas M O , . . . , M N  in succession to store counts as high as N×V. The read circuit obtains the current count value by reading K from the number area, reading the contents C of the Kth count area M K , and calculating C+(V×K).

Description:
BACKGROUND OF THE INVENTION 
     This invention relates to a counter for counting repetitive phenomena, such as the number of pages printed by a page printer. 
     Electrophotographic page printers and copiers are equipped with counters that count the cumulative number of pages or copies printed to determine replacement times for supplies and components such as toner and photosensitive drums, or to indicate when the printer or copier is at the end of its service life. Examples of counters employed in the prior art include mechanical counters, electronic counters using a battery-backed-up memory to store the count value, and electronic counters using a floppy disk to store the count value. These prior-art counters are expensive, and are inconveniently large. 
     Counts can more conveniently be kept in an electrically erasable and programmable read-only memory (EEPROM), which does not require battery back-up. Current EEPROMs, however, can be rewritten only about ten to twenty thousand times, which is far less than the number of pages printed by a page printer or copier during its service life. For this reason, EEPROM-based counters have not been used. 
     SUMMARY OF THE INVENTION 
     It is accordingly an object of the present invention to provide a compact, inexpensive counter capable of counting up to high values. 
     The invented counter has an EEPROM with memory cells capable of being rewritten at least V times, where V is a positive integer. The EEPROM comprises count areas M O , M 1 , . . . , M N  each having sufficient memory cells to store integer values from zero to V. The EEPROM also includes a number area having sufficient memory cells to store integer values from zero to N, where N is a positive integer. When the counter receives a value A from a sensor, a write circuit in the counter adds A to the contents C of the K-th count area M K , where K is the integer stored in the number area. If C+A&lt;V, the write circuit write the sum C+A back to the K-th count area M K . If C+A≧V, the writes circuit writes C+A-V in the (K+1)th count area M K+1  and writes K+1 in the number area. When the current count value is required, a read circuit in the counter reads the contents K of the number area and the contents C of the K-th count area M K , calculates C+(K×V), and provides this value as output. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram of the invented counter. 
     FIG. 2 is a flowchart of the count writing procedure. 
     FIG. 3 is a flowchart of the count reading procedure. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     A novel counter for counting phenomena detected by a sensor will be described with reference to the drawings. The sensor may be any device that provides a value A to be added to the count stored in the counter. In the case of a page printer or copier, the sensor is a device that counts pages one by one, providing a value A of one for each page, the value A thus being representable by a single pulse signal. The invented counter is not limited to this case, however; it can also accept integer values A greater than one. 
     With reference to FIG. 1, signals from the sensor 2 are routed through a control section 4 to a memory control circuit 6. The memory control circuit 6 reads and writes data in an EEPROM 8. The counter consists of the memory control circuit 6 and the EEPROM 8. The control section 4 controls the device, such as a page printer or copier, in which the counter is used. 
     The EEPROM 8 is a well-known semiconductor device comprising memory cells that can be read an unlimited number of times and written a limited number of times by means of electrical signals. The number of times the memory contents of a memory cell in the EEPROM can be rewritten reliably is specified by the EEPROM manufacturer, and will be denoted below by the symbol V. The memory cells in the EEPROM 8 retain their contents even when electrical power is not supplied. 
     The EEPROM 8 is divided into N+1 count areas 10, denoted M O  to M N  in the drawing, each having sufficient memory cells to store integer values from zero to V. An additional number area 12 has sufficient memory cells to store integer values from zero to N. 
     The memory control circuit 6 comprises a write circuit 14 and a read circuit 16. The write circuit 14 can read values from the EEPROM 8, perform arithmetic and logic operations on these values and the value A supplied by the sensor 2, and write values obtained as results back to the EEPROM 8. The read circuit 16 can read values from the EEPROM 8, perform arithmetic operations on these values, and provide the results as the output of the counter. 
     More specifically, the write circuit 14 has an add module 18 for reading the contents C of the K-th count area M K  of the EEPROM 8, where K is the value stored in the number area 12, and adding A to the value of C to produce a sum C+A. The write circuit 14 also has a compare module 20 for comparing the sum C+A with the value V, and a write-back module 22 for writing the sum C+A in the Kth count area M K . An update module 24 in the write circuit 14 writes the value C+A-V in the (K+1)th count area M K+1  and the value K+1 in the number area 12. 
     The update module 24 preferably also writes the value V in the K-th count area M K . The update module 24 may be further adapted to set a flag bit in the K-th count area M K  to indicate that the Kth count area M K  is full. 
     The read circuit 16 reads the contents K of the number area 12 and the contents C of the Kth count area M K , calculates C+(K×V), and provides the value of C+(K×V) as the output of the counter to count processing circuits 26 in the control section 4. In a page printer, for example, the processing circuits 26 include circuits that check the current count value and display messages asking the user to take necessary maintenance action. 
     In order to read the contents C of the Kth count area M K , the write circuit 14 and the read circuit 16 must determine the address of the K-th count area M K  in the EEPROM 8. Two possible address determination methods will be described below. 
     In the first method, the write circuit 14 and the read circuit 16 read the contents K of the number area and calculate the address of the Kth count area M K  from the value of K. For example, if the area M O , M 1 , M 2 , . . . are contiguous two-byte areas disposed in ascending address order, the write circuit 14 and the read circuit 16 can calculate the address of the Kth count area M K  by doubling the value of K. 
     In the second address determination method, the EEPROM 8 has a pointer area 28 for storing the address of the Kth count area M K , and the write circuit 14 and the read circuit 16 determine the address of the Kth count area M K  simply by reading the contents of the pointer area 28. When C+A≧V, the update module 24 in the write circuit 14 updates the contents of the pointer area 28 by writing the address of the (K+1)th count area M K+1  in the pointer area 28. If the areas M 0 , M 1 , M 2 , . . . are disposed addresses ascending at regular intervals, the update module 24 can update the pointer area 28 by adding a fixed integer value to the contents of the pointer area 28. 
     Next the operation of the counter will be described with reference to flowcharts in FIGS. 2 and 3. The flowchart in FIG. 2 depicts the operation of the write circuit 14. The flowchart in FIG. 3 depicts the operation of the read circuit 16. 
     With reference to FIG. 2, when the write circuit 14 receives a value A from the sensor 2, it begins by obtaining address information from the EEPROM 8 (step 30). Specifically, the write circuit 14 reads the contents of the number area 12 if the first address determination method is adopted, or the contents of the pointer area 28 if the second address determination method is adopted. From this information, the write circuit 14 determines the address of the Kth count area M K  as already described (step 32). 
     Next the add module 18 reads the contents C of the Kth count area M K  and calculates the sum C+A (step 34). The compare module 20 compares the sum C+A with the value V (step 36). If C+A&lt;V, the write-back module 22 is activated to write the sum C+A back to the Kth count area M K  (step 38). 
     If C+A≧V, the update module 24 is activated to update the address information by writing the value K+1 in the number area 12 (step 40). If the second address determination method is adopted, the update module 24 also writes the address of the (K+1)th count area M K+1  in the pointer area 28. Then the update module 24 writes the value V in the Kth count area M K , and the value C+A-V in the (K+1)th count area M K+1  (step 42). 
     Completion of step 38 or step 42 ends the count writing procedure. 
     With reference to FIG. 3, when the control section 4 requests the current count value, the read circuit 16 begins by obtaining address information from the EEPROM 8 (step 44) and determining the address of the Kth count area M K  (step 46). These two steps are identical to steps 30 and 32 in FIG. 2. Next, the read circuit 16 obtains the contents C of the Kth count area M K  (step 48) and the contents K of the number area (step 50), and calculates C+(K×V) (step 52). This ends the count reading procedure. The value C+(K×V) is output to count processing circuits 26 in the control section 4 in FIG. 1. 
     Before the counter is used, values of zero are stored in all count areas M O  to M N , and in the number area 12. If the second address determination method is adopted, the address of the zero-th count area M O  is stored in the pointer area 28. 
     When the value in the number area 12 reaches N, no further count areas beyond the current count area M N  are available for storing counts. The memory control circuit 6 can be provided with a circuit that sends information to the control section 4 at this time, notifying the control section 4 that all count areas have been used. Alternatively, this information can be sent to the control section 4 when the value in the number area 12 is N and the compare module 20 finds that C+A≧V. 
     By storing counts from zero to V in each of the count areas M O , M 1 , . . . , M N  the invented counter can count at least as high as (N+1)×V, even though a given memory cell in the EEPROM 8 can be reliably rewritten only V times. If N is one thousand and V is ten thousand, for example, then the counter can count as high as ten million, which is more than adequate for counting the pages printed or copied by a page printer or copier during its service life. 
     The invented counter is compact and inexpensive. The EEPROM 8 can comprise a single semiconductor chip, or part of a single chip. No back-up battery is required. The memory control circuit 6 can also be implemented in a single semiconductor chip: either an application-specific integrated circuit, or a general-purpose single-chip microcomputer programmed to execute the functions of the write circuit 14 and the read circuit 16. It may be possible to implement the memory control circuit 6 and the EEPROM 8 on the same semiconductor chip. Alternatively, the memory control circuit 6 can be made part of the control section 4 of the page printer, copier, or other device in which the counter is used. 
     The counter described above can be modified in various ways without departing from the spirit and scope of the present invention. For example, functions common to both the write circuit 14 and the read circuit 16, such as reading the contents of the count, number, and pointer areas, can be provided in common modules shared by the write circuit 14 and the read circuit 16. In FIG. 3, if the contents K of the number area are obtained in step 44, then step 50 can be omitted.