Data storage and retrieval in a calculator

Abstract: A computer or calculator, which can use a retrieved data in any position of an expression, has a calculation mode and data retrieval mode, and comprises an X register for an input data, and a Y register for an operand. In the computer, the content of the X register is loaded into the Y register when a predetermined key operation is conducted in the calculation mode, and then the mode of the computer is set to the data retrieval mode. A retrieved data is loaded into the X register, and the mode of the computer returns to the calculation mode.

Description: The present invention relates to a computer, and more particularly, to a small electronic computer such as a hand-held calculator, an electronic organizer, a scientific calculator, or the like. Generally, a small electronic computer such as a hand-held calculator is designed to be capable of temporarily storing numeric data or a calculation result in a memory and performing calculation by using the numeric data thus stored in the memory. Fig. 6 of the accompanying drawings shows an example of an operation scheme of a calculation in a hand-held calculator in which such a memory function is used. The example shown in Fig. 6 is a calculation of "2 + (Memory)", where "(Memory)" denotes the contents of a data stored in a memory ("123" in this case). The calculation operation is executed in the following sequence: (1) A numeric value "123" is stored in the memory. (2) The display is cleared. (3) "2 +" is input. (4) The numeric value stored in the memory is read out therefrom to be set as an operand. (5) An equal [=] key is pressed to execute the calculation, and the result is displayed. Such a hand-held calculator is also capable of executing the calculation in the sequence reverse to that shown in Fig. 6 (i.e., the calculation of "(Memory) + 2"). Another small computer such as a hand-held scientific calculator is designed to be capable of attaching a data name to a numeric data when storing the numeric data in a memory, and to be further capable of sorting and/or retrieving the data by the data name. Figure 7 shows an example of an operation scheme of a calculation of "(Memory) + 2" in such a scientific calculator in which a numeric data with a data name attached thereto is stored in a memory. The calculation operation is executed in the following sequence: (1) A memory [MEMO] key is pressed to set the mode of the calculator to the data storage mode. (2) A data name ("DOLLAR" in this case) is input. (3) A cursor key is operated so as to enable the input of the contents of a data. (4) The contents of the data "123" are input. (5) An entry [ENT] key is pressed to store the input data. (6) A forward data search [▿] key is pressed to retrieve the desired data by the data name "DOLLAR". The retrieved data is displayed. (7) A plus [+] key is pressed to make the calculation the state "(Memory) +". (8) A numeric key "2" is pressed to execute the calculation of "(Memory) + 2". With the memory function used in such a conventional calculator, it is possible to store numeric data itself, but it is not possible to store it with a data name attached thereto. Therefore, the user must memorize the meaning of the stored data, thus increasing the possibility that the user cannot understand the meaning of the retrieved data. On the other hand, in a computer capable of storing data with a data name attached thereto, it is impossible to retrieve a desired data by a data name in the course of a calculation to use it in the calculation. Thus, such a computer cannot execute a calculation requiring the input of a data after an operator (e.g., "2 + (Memory)"). Therefore, such a computer requires that the data be retrieved by a data name at the beginning of an arithmetical expression (e.g., "(Memory) + 2"), resulting in that the memory function may not be used depending on the contents of the expression. Furthermore, when there arises a need to store other data in the memory in the course of inputting an expression in the calculation mode, it has not been possible to input or store that data without once exiting the calculation mode. There is also known from US-A- 4 530 068 (Nakanishi) an electronic handheld memory device capable of containing character information and numerical information stored together as a pair. Such character information and numerical information is stored in memory in conjunction with a label preselected by the user. The Nakanishi device requires that data be input and stored in memory by way of a data storage mode which is separate from, and does not occur within, any other operation mode. Thus, information under different labels must first be loaded into memory prior to such data being used in a numerical calculation. Thereafter, in the middle of a numerical calculation, for example, the label keys function only as memory keys for retrieving, not storing, data. An object of the present invention is to overcome the above-discussed and numerous other disadvantages and deficiencies of the prior art. According to the present invention as defined in claim 1, there is provided a computer having at least a calculation mode and data storage mode, and comprising: a first register for an input data, a second register for an operand and a data storage region; means for loading the contents of said first register into said second register, when a predetermined key operation is conducted in said calculation mode; means for causing the computer to adopt said data storage mode, after the contents of said first register are loaded into said second register; means for controlling the computer in said data storage mode so as to store in the data storage region a new input data, comprising a data name and data value, and means for loading said new input data into said first register and causing said computer to return to said calculation mode. A preferred embodiment of a computer in accordance with the present invention has one or more operation modes and, in addition to said data storage mode in which the contents and name of an input data are stored in a memory means, a data retrieval mode in which a data stored in said memory means is retrieved by searching its name and the contents of the retrieved data are displayed, and wherein said computer comprises: first mode change means for, in any one of said one or more operation modes, changing the mode of said computer from said one operation mode to said data storage mode, while storing the state of said one operation mode, second mode change means for, in a predetermined operation mode, changing the mode of said computer from said predetermined operation mode to said data retrieval mode, while storing the state of said predetermined operation mode; data process means for causing the contents of data retrieved in said data retrieval mode to become the input data of said predetermined operation mode; and mode return means for returning, based on said stored state, the mode of said computer from said data storage mode to said one operation mode or from said data retrieval mode to said predetermined operation mode. Thus, the invention described herein makes possible the objectives of (1) providing a computer which can store data with a name attached thereto, irrespective of the mode of the computer; (2) providing a computer which can store data with a name attached thereto, in the course of a calculation mode; (3) providing a computer which can retrieve stored data by the data name, and position the retrieved data at any portion of an expression to be performed; and (4) providing a computer which is easy to operate. The invention is further described, by way of example, with reference to the accompanying drawings as follows: Figures 1 and 2 are flowcharts of an electronic calculator according to the invention. Figure 3 illustrates an example of operation with the electronic calculator according to the invention. Figure 4 is a schematic front view of the electronic calculator according to the invention. Figure 5 is a block diagram showing the system configuration of the electronic calculator according to the invention. Figure 6 illustrates an example of operation with a conventional electronic calculator. Figure 7 illustrates an example of operation with a another conventional electronic calculator. Figure 8 is a schematic diagram for illustrating a memory device used in the electronic calculator according to the invention. Figure 9 is a flowchart of the data input process in the electronic calculator according to the invention. Figure 10 is a schematic diagram for illustrating the way of storing the input data in the memory device shown in Fig. 9. Figure 11 is a flowchart of the process conducted when a data search key is operated in the electronic calculator according to the invention. DESCRIPTION OF THE PREFERRED EMBODIMENTS Figure 5 is a block diagram of a scientific hand-held calculator according to the invention. A CPU 3 controls the operations of the calculator. A ROM 4 stores programs for the CPU 3. A RAM 5 has memory regions necessary for controlling the calculator and for storing numeric data and names for the stored data. An LCD driver 6 drives an LCD 1. A key unit 2 comprises various keys for inputting data and names and for controlling the calculator. As shown in Fig. 8(a), the RAM 5 comprises a first arithmetic register X reg , a second arithmetic register Y reg , an input/output buffer 51, and a user data storage region 52. In the user data storage region 52, data l to n are stored. Each stored data has the format shown in Fig. 8(b), in which H denotes the header of the data which is used in a data retrieval, L the length of the data, 53 the name of the data (variable length), and 54 the numeric value of the data (fixed length). Figure 4 shows a front view of the calculator of Fig. 5. To simplify the explanation, Fig. 4 diagrammatically illustrates only the LCD 1 and specific keys necessary for describing the operation of the key unit 2, and thus keys and designation of keys unnecessary for the description are not illustrated in Fig. 4. The LCD 1 comprises a first display region la and a second display region 1b. The first display region la consists of a 12-figure dot matrix which is suitable for displaying a character string such as a data name or the like. The second display, region 1b consists of 7-segment display elements, and can display the contents of a data. The key unit 2 comprises a key 22, a combination of a data mode selection [DATA] key 21 and a forward data search [▿] key 23, a backward data search [Δ] key 24, a cursor [▴▾] key 25, a second-function [2ndF] key 26, and a clear [C·CE] key 27. The key 22 functions as an entry [ENT] key or as an equal [=] key depending upon the mode of the calculator. When the second-function [2ndF] key 26 and data mode selection [DATA] key 21 are pressed, a prompt "NAME?" is displayed in the first display region la to wait for inputting a data name. When a name is input, the name can be attached to a data which is currently displayed in the second display region 1b. After a data name has been set, it is possible to modify the contents of the data provided with the data name, by operating the cursor key 25 to move the cursor to the second display region 1b and then inputting a new data. The forward data search [▿] key 23 and backward data search [Δ] key 24 are used for retrieving a data with a data name. More specifically, the forward data search key 23 is operated to search the data name in alphabetical order, and the backward data search key 24 to search the data name in reverse alphabetical order. The calculator of this embodiment is also provided with a direct search function for searching by the initial character of a data name. In the embodiment having the above-described configuration, it is possible to input the contents of a data and a data name in any of the operation modes (excluding the error state) by executing the algorithm shown in Fig. 1. When the second-function selector [2ndF] key 26 and the data mode selection [DATA] key 21 are pressed, the operation of the calculator enters the data input mode which is a part of the data storage mode, without destroying the expression(s) or numeric value(s) which have been stored or displayed, and the prompt "NAME?" is displayed on the first display region 1a. After the data name has been input, the process of inputting the contents of the data starts. The numeric value currently displayed in the second display region 1b can be input as the contents of the data, and the data name is given to the contents of the data. Alternatively, when the cursor key 25 is operated to move the cursor to the second display region 1b, the numeric value currently displayed can be modified, thereby allowing the input of another numeric value as the contents of the data. When the data input process has been completed, the contents of the input data and the data name are displayed. The data input process will be described in more detail with reference to Fig. 9. First, the volume of the space area in the user data storage region 52 is checked whether it is sufficient for storing the input data (the total of the name and the contents) or not (step S1). In this case, the input data to be stored is "DOLLAR 120" (step 3 of Fig. 3). When the volume of the space area is not sufficient, the operation proceeds to step S5 to return to the initial mode. When the volume of the space area is sufficient, the operation proceeds to step S2. In step S2, the storage location of the input data is decided so that the data names H are arranged in alphabetical order. Then, the input data is stored in the user data storage region 52. The way of storing the input data is illustrated in Fig. 10. It is assumed that the input data is inserted between data n and data n+1. Data n+1 and all the succeeding data are shifted by the length L of the input data so that a space area for storing the input data is formed between data n and data n+1 (Fig. 10(b)). Then, the input data is transferred or copied to the thus formed space area (Fig. 10(c)). The management data for the user data storage region 52 is updated (step S4). Thereafter, in step S5, the mode of the calculator returns to the initial mode, and the display is initialized as shown in step 4 of Fig. 3. The state of waiting a key operation is set. Furthermore, by executing the algorithm shown in Fig. 2, it is possible to retrieve stored data by a data name, and use it in a calculation mode such as the normal calculation mode, the statistic mode, or any other operation mode. When a data retrieval instruction is executed in any of these modes, a retrieval process is performed for the destination data without destroying expressions or data for an arithmetical or statistical operation which have been stored in the register for the arithmetical or statistical operation. The retrieved data is then stored in the memory for calculation. In the memory, when an operand exists, the data is stored as a value to be operated, and, when no operand exists, the data is stored as an operand. When the retrieved data is usable for data calculation, the calculation is performed in the mode which has been effective before execution of the data retrieval. When a numeric value or characters are input, the process for inputting new data is performed. After the completion of the above procedures, the process returns to the original mode. The process conducted when the data search key 23 or 24 is pressed will be described in more detail, referring to Fig. 11. When the data search key 23 or 24 is pressed, it is checked whether the mode is the data retrieval mode or not (step S11). If yes, the operation proceeds to step S16. If no, the judgment is conducted to check whether a data has been input or not (step S12). When an input data exists, a further judgment is conducted in step S13 to check whether an operator has been input. If yes, the input data (the contents of the first register X reg ) is loaded into the second register Y reg for an operand (step S14). Then, the mode is changed to the data retrieval mode, and the address of the top data is set in the pointer (step S15). If the answer is no in step S12 or S13, the operation proceeds directly to step S15. Thereafter, the operation proceeds to step S18, and the data indicated by the pointer is loaded into the input/output buffer 51 so that the contents of the input/output buffer 51 is displayed (step S18). The displayed data is loaded into the first register X reg for an input data (step S19), and a further key operation is waited. If the data search key 23 or 24 is pressed further, the operation proceeds from step S11 to step S16 so that the process for a conventional data retrieval is performed. When the forward data search key 23 is pressed, the address of the next data is set in the pointer, and, when the backward data search key 24 is pressed, the address of the preceding data is set in the pointer (step S16). When an error occurs, the operation proceeds from step S17 to step S20, to set the initial mode, and waits for a key operation. If there is no error, the operation advances to step S18. An example of operaton in the embodiment is shown in Fig. 3. In this example, the calculation of "1.6 x 120 = 192" is conducted. As described above, the prompt message "NAME?" is displayed in the first display region 1a by pressing the second-function selector [2ndF} key 26 and the data mode [DATA] key 21 (step 1). "DOLLAR" is input as a data name and displayed in the first display region 1a (step 2). Thereafter, the second-function selector [2ndF] key 26 and the cursor key 25 are pressed to move the cursor to the second display region 1b. Then, a numeric value "120" is input. The input value is displayed in the second display region 1b (step 3). By pressing the entry [ENT] key 22, the numeric value "120" is stored with the data name of "DOLLAR" (step 4). The clear [C·CE] key 27 is pressed to exit the data input mode and return to the calculation mode (step 5). Next, "1.6 x" is input (step 6). The data name "DOLLAR" is searched by repeatedly pressing the forward data search key 23. When the data name "DOLLAR" and the contents of the data "120" are displayed, the user stops the operation of pressing the forward data search key 23 (step 7). Then, the equal [=] key 22 is pressed to execute the calculation, and the result is displayed (step 8).

Claims: A computer having at least a calculation mode and data storage mode, and comprising: a first register (X) for an input data, a second register (Y) for an operand and a data storage region (52); means for loading the contents of said first register (X) into said second register (Y), when a predetermined key operation is conducted in said calculation mode; means for causing the computer to adopt said data storage mode, after the contents of said first register (X) are loaded into said second register (Y); means for controlling the computer in said data storage mode so as to store in the data storage region (52) a new input data, comprising a data name and data value, and means for loading said new input data into said first register (X) and causing said computer to return to said calculation mode. A computer as claimed in claim 1, having one or more operation modes and, in addition to said data storage mode in which the contents and name of an input data are stored in a memory means, a data retrieval mode in which a data stored in said memory means is retrieved by searching its name and the contents of the retrieved data are displayed, and wherein said computer comprises: first mode change means for, in any one of said one or more operation modes, changing the mode of said computer from said one operation mode to said data storage mode, while storing the state of said one operation mode, second mode change means for, in a predetermined operation mode, changing the mode of said computer from said predetermined operation mode to said data retrieval mode, while storing the state of said predetermined operation mode; data process means for causing the contents of the data retrieved in said data retrieval mode to become the input data of said predetermined operation mode; and mode return means for returning, based on said stored state, the mode of said computer from said data storage mode to said one operation mode or from said data retrieval mode to said predetermined operation mode.

Inventors: AKIZUKI NOBORU, KAWAWAKI FUMIAKI, NISHIDA TAIZOU, AKIZUKI, NOBORU, KAWAWAKI, FUMIAKI, NISHIDA, TAIZOU
Applicants: SHARP KK, SHARP KABUSHIKI KAISHA
Application year: 1989
Main classification: G06F15
IPC codes: G06F15