One-chip microcomputer

Abstract: A one-chip microcomputer is provided with an initial reset circuit (12) for producing a first initial reset signal having a first reset period and a second inital reset signal having a second reset period which is longer than the first reset period, an access circuit (4a) for gaining access to an address in a nonvolatile memory (3) such as a built-in ROM to read data therefrom, and I/O buffer circuits (7). A storage circuit and an I/O buffer connected to an I/O terminal with options are provided in the I/O buffer circuit and a function of the I/O terminal with options is selected in conformity with the data set in the storage circuit. The data stored at a predetermined address in the nonvolatile memory is transferred to the storage circuit by operating the access circuit until the termination of the reset period of the second initial reset signal after the termination of the reset period of the first initial reset signal. With this arrangement, as the contents of write data are altered by writing the data to the nonvolatile memory from the outside, an optional function of the I/O terminal with options can be selected in accordance with the alteration.

Description: Technical Field The present invention relates generally to one-chip microcomputers and more particularly to a one-chip microcomputer such that, as what has been turned into a commercial product, either input terminal or output terminal (hereinafter called 'I/O terminal') allows the so-called option of functions; namely, the functional selection of, for instance, a CMOS or open drain output state afterwards. Background Art One-chip microcomputers are widely used as control circuits in cameras, home electric appliances, and other kinds of electronic equipment. At the present stage, these are generally 4- or 8-bit one-chip microcomputers. A one-chip microcomputer of this sort is called a microcontroller and different in internal construction from a general purpose microprocessor in that RAM, ROM and the like, each having a fixed capacity, are connected to a bus and also contained in one chip. The 4- or 8-bit one-chip microcomputer transmits and receives signals via either input buffer or output buffer (I/O buffer) to and from an external circuit. Like RAM, ROM and the like, the I/O buffer is also connected to the bus in the chip. These circuits thus connected to the bus are controlled by a processor (or a controller, these are collectively called a CPU in this specification). In the case of such a one-chip microcomputer having ROM, an application program corresponding to the use of each circuit can be written to the ROM afterwards. Consequently, the ROM in the one-chip microcomputer of this sort is loaded with an application program after it has been manufactured as an LSI, depending on its use; that is, it is utilized as a one-chip microcomputer for the intended purpose. The one-chip microcomputer like this is often equipped with I/O terminals with so-called option, which allows the functional selection of, for instance, a CMOS or open drain output state with respect to one I/O terminal (input or output terminal), the function of the I/O terminal with option being selectively set at a mask option. A one-chip microcomputer of the type that makes an application program writable to ROM afterward also allows the application program to be altered later and this arrangement can be utilized for the development of one-chip microcomputers and for various other uses. However, the selective function added to the I/O terminal with option is unchangeable after a selection is made once as it is implemented at the mask option. As a result, the change of the function added to the I/O terminal with option as an option has been dealt with only through the modification of an external circuit or the provision of an additional external circuit. When the one-chip microcomputer described above is used to develop a system, the fact that the function of the I/O terminal with option is not simply changeable still causes the efficiency of system development to decrease. A one-chip microcomputer having the features included in the first part of claim 1 is known from EP-A-0 374 733. SUMMARY OF THE INVENTION It is an object of the present invention to provide a one-chip microcomputer equipped with an I/O terminal having a so-called option and designed for one of the functions imparted to the I/O terminal to be selected afterwards. This object is met by the micro-computer defined in claim 1. According to the invention, the desired function of the I/O terminal with option can be selected by gaining access to an address in the non-volatile memory and transferring the data held therein to the storage circuit during the period between the first and second reset signals. The contents of write data can be altered by writing the data to the non-volatile memory from the outside. The optional function of the I/O terminal with option thus becomes separated in accordance with the alteration. BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a block diagram of a one-chip microcomputer embodying the present invention. Fig. 2 is a diagram illustrating the relation of an optional EEPROM to an I/O buffer circuit. Fig. 3 is a diagram illustrating the internal construction of an I/O buffer circuit of an optional input-output terminal. DESCRIPTION OF THE PREFERRED EMBODIMENT As shown in Fig. 1, a one-chip microcomputer 10 comprises a CPU 1 including a timing generating circuit, an EEPROM 2 for storing an application program, an EEPROM 3 for storing function- selecting data on selecting one of the functions for an I/O terminal, an address counter 4a for gaining access to the EEPROM 2 and the EEPROM 3, a register 4b for temporarily storing data to be written to the EEPROM 2 and the EEPROM 3, I/O buffer circuits (hereinafter called 'I/O') 5a, 5b,..., 5n, I/O buffer circuits (hereinafter called 'I/O') 6a, 6b,..., 6m, I/O buffer circuits (hereinafter called 'I/O') 7a, 7b,...,71 connected to respective I/O terminals with option, and a mode setting terminal 8. These circuits are mutually connected via a bus 9. The EEPROM 3 selectively adds one of the optional functions prepared beforehand to the I/O 7a, 7b,...71 in conformity with the contents of the data stored therein. The EEPROM 3 for storing data on adding the optional function is also connected to the I/O 7a, 7b,...71 connected to the I/O terminals with option by means of a data line 4c and an address bus 4d other than the bus 9 (in this case, the address bus of the bus 9 may be used instead). A clock generating circuit 11 supplies a clock signal to each circuit of the one-chip microcomputer including the CPU 1 and a clock signal (as designated by 11a) to the address counter + decoder 4a (hereinafter referred to as the address counter 4a including the decoder). When the one-chip microcomputer 10 is supplied with power (i.e., it is turned "on"), the address counter 4a thereby starts to operate after the initial set is released. An initial reset circuit 12 is different from an ordinary one in that the former has a counter therein and when a power supply is turned "on", it produces two kinds of reset signals having different reset periods. A first reset signal 12a remains at a low level (hereinafter called "L") after the power supply is turned "on", resets the address counter 4a and the like, and then releases them from resetting a predetermined period after the power supply is turned "on." During this period, the supply voltage of the one-chip microcomputer 10 reaches the level at which each circuit can operate and approximately 1,024 clock pulses, for instance, from the clock generating circuit 11 are counted after the power supply is turned "on." During this period, the signal first stays at "L" and then reaches a high level (hereinafter "H") at which the reset is released. The circuit for producing the reset signal consists of a counter in addition to a reset circuit using an ordinary capacitor (C) and a resistor (R). A second reset signal 12b remains at "L" after the power supply is turned "on" and its level changes from "L" to "H" when 1,024 clock pulses, for instance, are counted further after the first reset signal 12a reaches "H" at which the reset is released. The CPU 1 and the circuits directly associated therewith are reset by the reset signal. The CPU 1 is released from resetting after the period during which the count operation is performed and set to operate. Simultaneously, various circuits associated with the CPU 1 are also released from resetting. The circuit for producing the second reset signal is formed with a counter, for instance. With the provision of the initial reset circuit 12 for producing two kinds of reset signals having a long and a short period, respectively, the address counter 4a is released from resetting before the other circuits in the one-chip microcomputer 10 and is set to operate. The address counter 4a receives the clock signal 11a until the second reset signal is released and produces addresses from 0 up to 1,023. In other words, the address counter 4a is incremented consecutively by the clock 11a until the second reset signal 12b reaches "H" after the first reset signal 12a attains "H." The EEPROM 3 is kept in the read state during this period and data are read from addresses in the EEPROM 3 corresponding to the respective address values of the address counter 4a. The data thus read are successively transferred via the data line 4c to the I/O 7a, 7b,...71 connected to the I/O terminal with option. The supply voltage of the one-chip microcomputer has already reached the level at which the EEPROM and the I/O operate by then. In other words, the period during which the first reset signal is produced extends up to the time when each of the circuits such as the EEPROM 3, the I/O 7a, 7b,...7l and the like involved in the data transfer above attains at least supply voltage for its operation. A mode detection circuit 13 is connected to the mode setting terminal 8 and used for setting the one-chip microcomputer 10 to various modes by detecting the voltage applied to the mode setting terminal 8. The modes that can be set include a normal operating mode applicable when voltage ranging from 0V - 2V is applied to the terminal, a bus monitor mode applicable when voltage from above 2V up to 3V is applied thereto, a test mode in which external data is received and the CPU 1 is controlled correspondingly when voltage from above 3V up to 5V is applied thereto, and an EEPROM write mode in which data is writable to the EEPROMs 2 and 3 when voltage from above 5V up to 7V is applied thereto. Incidentally, the I/O 5a, 5b,..., 5n are circuits mainly composed of the respective I/O buffers and, though the I/O normally operates as the I/O buffer, it operates as an output circuit for monitoring timing in the test mode and the EEPROM data write mode. The I/O 6a, 6b,..., 6m are also circuits mainly composed of the respective I/O buffers and, though the I/O normally operates as the I/O buffer, it becomes a data input circuit when program data and various data are written to the EEPROMs 2 and 3 in the test mode and the EEPROM write mode. A circuit for storing data such as a latch circuit and the like is contained in each of the I/O, including the I/O 7a, 7b,..., 71. The bus 9 consists of a data bus, an address bus and a control bus and the CPU 1 contains ROM and RAM. The I/O buffer of each I/O is connected to an I/O terminal 20. Fig. 2 is a diagram illustrating the relation of the mode detection circuit 13 to the I/O 6a, 6b,..., 6m. As the I/O 6a, 6b, ..., 6m are similar in construction to one another, the I/O is shown as I/O6. The I/O6 has an input buffer 61, an output buffer 62, latch circuits 63 and 64, a two-input gate circuit 65 and the like. The one side inputs of the input buffer 61, the output buffer 62 and the gate circuit 65 are connected to the I/O terminal 20, respectively. When the mode detection circuit 13 detects the EEPROM write mode, an "H" signal is produced at its output terminal 13a. This output is applied to the other side input of the gate circuit 65 and simultaneously supplied to the input buffer 61 and the output buffer 62 as a disable signal. The operation of the input buffer 61 and the output buffer 62 is thereby halted. Then the gate circuit 64 is opened to let the signal of the I/O terminal 20 pass therethrough and to transmit the signal to the register 4b for storing write data with respect to the address counter 4a, the EEPROMs 2 and 3. This signal is supplied to the storage digit position of the register 4b so provided as to correspond to the digit position of the I/O terminal 20. Consequently, the register 4b receives and stores the signal as 1-bit data. When the predetermined data is stored in the register 4b, it becomes transferable to the address counter 4a, the EEPROMs 2 and 3. First, an input voltage of 3V - 5V is applied to the input of the mode detection circuit 13 and the CPU 1 is controlled from the outside to set an EEPROM write flag "1" among those of the state register provided inside a control circuit 14. When the flag is switched to "1", the value of the address counter 4a can be set from the outside via the I/O 6a, 6b,..., 6m. A write address is then set in the address counter 4a. Subsequently, data can be written at an address in the EEPROM 2 or 3 as designated by the address counter via the I/O 6a, 6b,..., 6m. A series of operations described above is repeated so that data may be written to the EEPROM 2 or 3 from the outside. When the data is thus written, the set value in the address counter 4a may be sequentially incremented under control from the outside. The control circuit 14 has been adapted for use as a state setting circuit for setting the inner part of the one-chip microcomputer 10 to various states and has a state register for choosing either EEPROM 2 or 3. Therefore, a voltage higher than 5V up to 7V is applied to the mode setting terminal 8 when the EEPROMs 2 and 3 are loaded with a program and data. Then data is written at the predetermined address in the EEPROMs 2 and 3 from the outside. In this case, the timing at which data is written should conform to the clock generation while the bus 9 is monitored. Incidentally, the EEPROMs 2 and 3 are disposed in a space entirely different from the address space formed in the bus 9 or what the CPU 1 connected to the bus 9 can access. Therefore, the selection of the EEPROM 2 or 3 is made by, for instance, applying 3 - 5V to the mode detection circuit 13 to set a mode in which the CPU 1 is controlled from the outside and then by setting data or a flag in the state register provided in the control circuit 14. The CPU 1 is used to set an address in the EEPROM 2. As an address space available in the EEPROM 3 ranges from "0" to "1,023" when the two reset signals are taken into consideration, setting the address is carried out by setting a numeric value to the address counter 4a from the outside as described above. Consequently, 1-bit data is stored at each address. Fig. 3 is a diagram illustrating the construction of an I/O7 as what represents the I/O 7a, 7b,..., 71. The I/O7, which is an input buffer, comprises a latch circuit 71 connected to the data line 4c, an address decoder 72 connected to the address bus 4d, an input circuit (input buffer) 73, a pull-up transistor 74 and the like. In the case of the output buffer circuit, the input circuit 73 is replaced with an output circuit (output buffer), though the other components are invariable. In this case, data "1" or "0" is set in the latch circuit 71, whereby the transistor 74 is turned "off" when it is "1" and the input circuit 73 operates as an input circuit without pull-up resistance, whereas the transistor 74 is turned "on" when it is "0" and operates as a circuit with pull-up resistance. VDD in Fig. 3 represents a power supply line. In this circuit arrangement shown as an example, one of the two optional functions can be chosen when the 1-bit data is set in the latch circuit 7. Moreover, it is also possible to utilize the like circuit for choosing between an open drain circuit and an invertor circuit as the output circuit. In addition, a decision can readily be made on choosing not only a pull-up circuit but also a pull-down circuit. These cases can easily be implemented by designing the I/O circuit for the intended purpose. Therefore, various optional functions may be added to the I/O terminal connected to the I/O7. A description will be given of the overall operation of the one-chip microcomputer 10. The data write operation will be described with reference to the EEPROM 3 first. When a signal of voltage exceeding 5V up to 7V is supplied to the mode setting terminal 8, the one-chip microcomputer 10 is set in the EEPROM write mode. Data then becomes writable to the EEPROMs 2 and 3 via the I/O 6a, 6b,..., 6m. As an address space available in the EEPROM 3 ranges from "0" to "1,023", the data to be set is stored in the latch circuits 71 of the respective I/O 7a, 7b,..., 71. In this case, the data stored at each address of the EEPROM 3 is 1-bit to be latched by the latch circuit 71 at an address position where the address value conforms to an decoding address in the address decoder 72; namely, it is "1" or "0." When data on the data to select one of the optional functions is stored in each EEPROM 3 and when data on a necessary application program is stored in the EEPROM 2, a voltage 0V - 2V is applied to the input of the mode detection circuit 13 of the one-chip microcomputer 10, whereby the one-chip microcomputer 10 is set in the normal operating mode. When the power supply of the one-chip microcomputer 10 is turned "on" and set in the operating state, the reset circuit 12 first operates. In this case, the first reset signal 12a changes from "L" to "H" at the timing at which the clock signal is counted up to approximately "1,023." As a result, the address counter 4a is released from resetting. The address counter 4a is sequentially incremented in response to the clock signal 11a from the clock generating circuit 11 at that timing after the counter value exceeds "1,023." At each address thus incremented, the address counter 4a gains access to the address in the EEPROM 3. Then the data from the EEPROM 3 is read via the data line 4c and the data thus read is transmitted to each I/O 7a, 7b,..., 7l. In each I/O7, the address signal (the value of the address counter 4a) is decoded when the address for decoding the address decoder 72 is fed to the address bus 4d and the data supplied from the EEPROM 3 is set in the latch circuit 71 when the decoding signal is produced simultaneously with the self address is accessed. In this manner, the data for use in setting the optional function is successively stored in the I/O from a point of time the clock signal thus generated is counted as "1,024" and the second reset signal 12b changes from "L" to "H" this time when the counted value of the clock signal thus counted becomes "2,048" (=1,024 + 1,024) in value. The internal circuit of the one-chip microcomputer 10 is released from resetting and the one-chip microcomputer 10 returns to the normal operation. The data on selecting one of the optional functions, "1" or "0", has already been set in the latch circuit 71 of each I/O 7a, 7b,..., 7l in accordance with the data stored in the EEPROM 3 by then. As a result, the I/O terminal with option to be connected to the I/O buffer becomes what corresponds the optional function involved. When it is desired to alter the contents of each I/O 7a, 7b,..., 7l, the signal of the voltage exceeding 5V up to 7V is applied to the mode setting terminal 8 and the data in the EEPROM 3 is altered by adapting it to the EEPROM write mode. Another optional function can thus readily be selected and set. In this manner, an optional function with respect to the I/O terminal with option (its I/O) may freely be set afterward simultaneously with the alteration of the application program. In other words, the I/O terminal may be provided with a function corresponding to the option thus intended. Although it has been arranged that a plurality of I/O terminals with option (I/O connected thereto) are set in this embodiment as set forth above, there may be provided only one I/O terminal. Although there has been provided the EEPROM for storing the application program, moreover, such an EEPROM can be dispensed with. Further, the memory for storing the data on selecting one of the optional functions is not limited to the EEPROM. Such a memory is only necessary to be provided in the one-chip microcomputer as a nonvolatile memory which can be rewrited from the outside. In addition, the memory is of any kind and data writing may be executed, depending on the kind of the memory. Although the 1-bit storage memory has been employed as the EEPROM 3 for appending an option to the I/O terminal with option in the embodiment shown, it may be adapted for use as what is capable of storing several bits. Further, such a memory may be adapted for use in storing 8 bits at one address and the data may be transferred simultaneously to each I/O connected to an I/O terminal with eight option in 8-bit parallel. Although the EEPROM 3 is disposed at "0" - "1,023" out of the address space indicated by the address counter 4a in the embodiment shown, it may be arranged in any space as the address space is changeable in the decoder circuit. The number of address spaces to be assigned is only necessary to that of data to be transferred to I/O or greater than the latter. In other words, the period between the reset periods of the first initial reset and the second initial reset signal may be determined correspondingly.

Claims: A one-chip microcomputer having a built-in non-volatile memory (3) that can be rewritten from the outside, a terminal (20) with option, and an access circuit (4a) for gaining access to an address in said non-volatile memory (3) to read data therefrom, wherein upon initialisation, which is triggered by a reset signal, data stored at a predetermined address of said non-volatile memory (3) is transferred to a storage circuit (71), characterised by an initial reset circuit (12) for producing a first initial reset signal having a first reset period and a second initial reset signal having a second reset period which is longer than the first reset period, and a buffer circuit (7) including said storage circuit (71) and a buffer connected to said terminal (20) with option, a function of said terminal with option being selected in conformity with the data set in said storage circuit, wherein the data stored at said predetermined address of said non-volatile memory (3) is transferred to said storage circuit (71) by operating said access circuit (4a) after the termination of the first reset period until the termination of the second reset period. A one-chip microcomputer as claimed in claim 1, wherein the first reset period is set so that the supply voltage reaches the level at which said nonvolatile memory, said storage circuit (71) and said access circuit (4a) are operable and wherein either of the two, the built-in processor (1) and the controller (14), is released from resetting after the termination of the second reset period. A one-chip microcomputer as claimed in claim 2, wherein clock signals are counted so as to determine points of time the first and the second reset periods are terminated. A one-chip microcomputer as claimed in claim 3, wherein a state setting circuit is provided for setting said nonvolatile memory (3) in a write state from the outside, and wherein a data on selecting one of the optional functions for said terminal with option is set in said nonvolatile memory set which is in the write state by said state setting circuit. A one-chip microcomputer as claimed in claim 4, wherein said nonvolatile memory (3) is an EEPROM and wherein said access circuit (4a) has an address counter for gaining access said EEPROM. A one-chip microcomputer as claimed in claim 5, wherein a plurality of terminals (20) with option are provided, a plurality of buffer circuits (7) being connected to respective said terminals. A one-chip microcomputer as claimed in claim 6, wherein said EEPROM (3) is employed as a first EEPROM, whereas a second EEPROM (2) is provided so as to store an application program, wherein said first and said second EEPROMs (2, 3) are separately assigned to respective address spaces to which a processor (1) gains access, and wherein a data on selecting one of the optional functions is stored at an initial address in said first EEPROM (3). A one-chip microcomputer as claimed in claim 7, wherein said first EEPROM (3) stores 1-bit data at each address, said addresses corresponding to respective buffer circuits (7), and wherein said 1-bit data are transferred to said storage circuits of said respective buffer circuits corresponding to said respective addresses. A one-chip microcomputer as claimed in claim 8, wherein each said buffer circuit (7) has a transistor (74) being connected to one of said terminals (20) with option and a power supply line and wherein, as said transistor is turned "on-off" in conformity with the data stored in said storage circuit (71), it acts as a pull-up resistor while it is in the "on" state. A one-chip microcomputer as claimed in claim 9, wherein each said buffer (7) and terminal (20) is either an input or an output. A one-chip microcomputer as claimed in claim 1, wherein said storage circuit is a latch circuit (71).

Inventors: CHIMURA SHIGEMI, MASUMOTO HIROAKI, SUENAGA YOSHIAKI, CHIMURA, SHIGEMI, MASUMOTO, HIROAKI, SUENAGA, YOSHIAKI
Applicants: ROHM CO LTD, ROHM CO., LTD.
Application year: 1991
Main classification: G06F15
IPC codes: G06F15, G06F1