Abstract:
A calculator which adds or subtracts input numerical data to or from the content of a first register in response to an actuation of an addition or subtraction key, stores the result of the addition or subtraction in the first register, further adds or subtracts the above-mentioned input numerical data to or from the content of a second register determined by the number of actuations of the addition or subtraction key, and stores the result of the latter addition or subtraction into the second register.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to a calculator capable, in response to an actuation of the addition or subtraction key, of executing addition or subtraction of the input numerical data with the contents of registers and storing the results of such addition or subtraction in the respective registers. 
     2. Description of the Prior Art 
     Consider the mathematical problem presented by the following: a wholesaler delivers merchandise x to the retailers A, B and C in the respective monetary amounts of xA, xB and xC, another merchandise y in the amounts of yA, yB and yC, and still another merchandise z in the amounts of zA, zB and zC. Prior art having required calculation of electronic devices the total sales amounts Sx, Sy and Sz of merchandises x, y and z and the total sales amounts T A , T B  and T C  of retailers A, B and C, separately according to the following equations: 
     
         Sx=xA+xB+xC, Sy=yA+yB+yC, Sz=zA+zB+zC, 
    
     
         T.sub.A =xA+yA+zA, T.sub.B =xB+yB+zB, T.sub.C =xC+yC+zC. 
    
     Moreover the grand total of the sales has had to be further calculated according to the equation S T  =Sx+Sy+Sz or S T  =T A  +T B  +T C , and these calculations require quite cumbersome operations. 
     SUMMARY OF THE INVENTION 
     Therefore, an object of the present invention is to provide a calculator avoiding the necessity of the calculations being repeated with the same data in the case of making summations in different ways from the same group of data. 
     Another object of the present invention is to provide a calculator capable, in calculating summations according to equations such as Sx=xA+xB+xC, Sy=yA+yB+yC and Sz=zA+zB+zC, of providing other sums T A , T B , T C  and S T  at the same time. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     These and other objects of the present invention will be made more apparent from the following description of the preferred embodiment to be taken in conjunction with the attached drawings, in which: 
     FIG. 1 is a schematic block diagram showing an embodiment of a calculation in accordance with the present invention; and 
     FIG. 2 is a chart showing the control sequence for the circuit shown in FIG. 1. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     Now the present invention will be explained in detail by means of an embodiment in which the present invention is applied to an electronic calculator. 
     FIG. 1 shows an electronic calculator embodying the present invention in a block diagram. 
     A keyboard KB comprises numeral keys N of the numerals of 0 to 9, function keys F such as &#34;+&#34;, &#34;-&#34;, &#34;=&#34;, etc., and display keys S in which the keys T1, T2, T3 and T give a visual display of the content respectively of registers C1, C2, C3 and M to be explained later. 
     A control unit CU supplies various control signals (CDSP, CE, CT, CITM, CC1, CC2, CC3, CM, Cj and CALU) and data signals CUS to the circuits to be explained later in response to the keyboard signal KBS from the keyboard KB or signals from other portions of the system. There are shown 4-bit parallel registers E, T, ITEM, C1, C2, C3 and M. The register E stores input numerical data, ITEM is an item count register for counting the number of actuations of the key &#34;+&#34; or &#34;-&#34;, and registers T, C1, C2, C3 and M are used for storing the results of addition or subtraction. 
     A display device DISP provides a visual display of the data in the registers. 
     An arithmetic logic unit ALU conducts processings such as addition or subtraction on the data supplied on a bus line B in response to the control signal CALU supplied from control unit CU. 
     A transfer judgement unit J senses the data in the register C1, C2 or C3 to or from which the data in the register E is added or subtracted according to the content of the item count register ITEM, transfers thus sensed data to arithmetic logic unit ALU and also transfers the result of such addition or subtraction with those data in the register E to its original register. The above-mentioned control unit CU is composed of a sequence control comprising a clock generator, gates and other logic network, a read-only memory ROM storing the microinstructions for controlling various circuits in the form of a program sequence, and a flag circuit F. 
     Now the operations of the above-mentioned embodiment will be discussed with reference to the block diagram shown in FIG. 1 and the control flow chart shown in FIG. 2. 
     The control unit CU generates following signals in response to the signals from the keyboard KB under the conditions of the remaining portions of the system: 
     CDSP: a signal for controlling the display unit DISP; 
     CE: a signal for transferring data from the register E to the busline B or from the busline B to the register E; 
     CT: a signal for transferring data from the register T to the busline B or from the busline B to the register T; 
     CITM: a signal for transferring data from the register ITEM to the busline B, or from the busline B to the register ITEM, or from the register ITEM to the transfer judgement unit J; 
     CC1: a signal for transferring data from the register C1 to the busline B, or from the busline B to the register C1, or from the register C1 to the transfer judgement unit J; 
     CC2: a signal for transferring data from the register C2 to the busline B, or from the busline B to the register C2, or from the register C2 to the transfer judgement unit J; 
     CC3: a signal for transferring data from the register C3 to the busline B, or from the busline B to the register C3, or from the register C3 to the transfer judgement unit J; 
     CM: a signal for transferring data from the register M to the busline B, or from the busline B to the register M; 
     CALU: a signal for transferring data from the arithmetic logic unit ALU to the busline B, or from the busline B to said unit ALU, or from unit ALU to the transfer judgement unit J; and 
     CJ: a signal for controlling the transfer judgement unit J. 
     For example, upon actuation of the addition &#34;+&#34; key after the entry of numerical data from the keyboard KB to the register E, the program counter in the above-mentioned read-only memory ROM is set at the step (1) in FIG. 2, and the control signals composed of the aforementioned microinstructions are supplied in sequence from the memories addressed by the program counter to various circuits for executing the required process. At first the control signals CE, CT and CALU are produced to transfer the data from the registers E and T to the arithmetic logic unit ALU, to execute the required addition operation therein and to transfer the result thereof to the register T. Then in response to the control signals CITM and CALU the data in the item count register ITEM is transferred to the arithmetic logic unit ALU, increased by one therein, and the result is again stored in the item count register ITEM. Then the content of the item count register ITEM is determined in the step (2), and the program counter PC is set at the step (3), (4) or (5) respectively when the count is &#34;1&#34;, &#34;2&#34; or &#34;3&#34;. For example in case the count is &#34;2&#34;, the program counter PC is set at the step (4), at which, control signals CE, CC2 and ALU are developed to transfer the data from the register E and the register C2 to the arithmetic logic unit ALU, to execute the addition operation therein and to store the result of the addition in the register C2, whereby the sequence is transferred to the display routine. 
     Upon subsequent actuation of the equal &#34;=&#34; key, the control signals CT, CM and CALU are generated to transfer the data from the registers T and M to the arithmetic logic unit ALU, to execute the addition operation therein and to store the result of the addition in the register M. Also the flag F is set in the control unit CU. Upon subsequent actuation of a numeral key, etc., for starting a new calculation, the register T and the item count register ITEM are reset to &#34;0&#34; by sensing the state of flag F. 
     Because of the above-explained functions of the addition &#34;+&#34; key and the equal &#34;=&#34; key, the key operations in the sequence of xA[+]xB[+]xC[+][=], yA[+]yB[+]yC[+][=], zA[+]zB[+]zC[+][=] in the foregoing example would provide the aforementioned sums S x , S y  and S z  on the register T in response to the respective actuations of the &#34;=&#34; key. After the above-mentioned key sequence, the contents of the registers C1, C2, C3 and M respectively corresponding to the aforementioned sums T A , T B , T C  and S T  would be obtained by actuating the keys T1, T2, T3 and T. 
     In this manner it is rendered possible to obtain the sums T A , T B , T C  and S T  simultaneously with the key operations for calculating the sums S x , S y , and S z , without requiring separate key operations for calculating the sums S x , S y , S z  ; T A , T B , T C  ; and S T .