Multi-channel interface for use in microcomputer

Abstract: A serial interface circuit internally provided in a microcomputer includes a shift register is provided with two sets of terminals, each set including a serial data input terminal, a serial data output terminal and a clock terminal, and the two sets of terminals are alternatively used by a serial channel selection flag. Thus, a multi-channel serial interface is realized.

Description: The present invention relates to a microcomputer, and more specifically, to a multi-channel serial interface circuit internally included in a microcomputer. A serial interface function is internally provided in many microcomputers, since it can realize a data transfer with a small number of terminals. In general, the serial interface has been such that data are transferred by using a serial data input terminal, a serial data output terminal and a clock terminal. In recent application systems of microcomputers, it has become difficult for one microcomputer to perform all processings because of diversification in function of the application systems. Therefore, it is now more and more increasing that a main microcomputer is connected with a plurality of slave devices including a slave microcomputer and an electrically erasable ROM (read only memory) by means of a serial interface, so that the processing is shared so as to perform a whole control. In the prior art, for example, if three channel interfaces are required in order to couple with three slave devices, a microcomputer has been constructed to internally include three channels of the same serial interface circuit blocks. Thus, the structure of the conventional serial interface has given rise to an increase of a whole circuit scale of the microcomputer and a cost-up of the application system. In addition, since it is very difficult that the three channels of serial interface circuit blocks internally provided in the microcomputer are simultaneously performed by only one central processing unit provided in the microcomputer, it has been in many practical cases that only two channels are simultaneously operated, and the remaining channel is utilized in an idle time. Therefore, the hardware resources internally provided in the microcomputer could not effectively be utilized. EP-A-0266790 discloses a serial bus interface comprising a shift register for receiving and transmitting serial data via two input/output data lines. A first selector is provided for selecting one of the data lines, and a second selector is provided for selectively coupling the selected data line with the input or the output of the shift register such that the selected data line is used as an output line or an intput line, respectively. Furthermore, the interface comprises a single clock terminal which is coupled via an internal clock generator to a clock input of the shift register. By this means the shift register may be operated by an internal clock (master mode) or by an external clock (slave mode). EP-A-0145319 describes a multiplexer-demultiplexer communication channel which transfers data between a communication controller and a multiplicity of communication ports. In this channel different clock lines for transmission and reception are provided. US-A-4816996 discloses a serial interface in which a plurality of serial transfers are written into a memory together with comment and control information. The interface executes the stored transfers autonomously. It is an object of the invention to provide a multi-channel serial interface circuit internally provided in a microcomputer which has overcome the abovementioned defect of the conventional ones. Another object of the invention is to provide an inexpensive multi-channel serial interface circuit internally provided in a microcomputer. This object is achieved by a serial interface circuit as defined in claim 1; the remaining claims are related to further developments of the invention. As seen from the above, the serial interface circuit in accordance with the present invention internally provided in the microcomputer is characterized in that the serial interface includes at least two sets of terminals, each set including a serial data input terminal, a serial data output terminal and a clock terminal, and the serial interface function is selectively switched between the at least two sets of terminals under a programmed control of the microcomputer. Therefore, the microcomputer can include therein an inexpensive multi-channel serial interface circuit. The above and other objects, features and advantages of the present invention will be apparent from the following description of preferred embodiments of the invention with reference to the accompanying drawings. Figure 1 is a block diagram of a first embodiment of the serial interface in accordance with the present invention; and Figure 2 is a block diagram of a second embodiment of the serial interface in accordance with the present invention. Referring to Figure 1, there is shown a block diagram of a first embodiment of the serial interface in accordance with the present invention internally provided in a microcomputer. The shown serial interface circuit includes an 8-bit shift register 100 having a data input connected to a serial data input terminal Si0 100-2 and a clock input connected to a clock terminal SCK0 100-3, so that the shift register 100 sequentially stores, bit by bit, a level on the Si0 terminal 100-2 in synchronism with a clock signal on the SCK0 terminal 100-3. The shift register 100 also has a data output connected to a serial data output terminal So0 100-1, so that data stored in the shift register 100 are serially shifted out, bit by bit, to the So0 terminal 100-1 in synchronism with the clock signal on the SCK0 terminal 100-3. There is also provided an internal clock generation circuit 101, and a tri-state buffer 103 having an input connected to the internal clock generation circuit 101 and an output connected to the SCK0 terminal 103-1 and hence to the clock input of the shift register 100. A control terminal of the tri-state buffer 103 is connected to a clock selection flag 102 for selection between the internal clock generation circuit 101 and an external clock. Furthermore, the serial interface circuit includes another shift register 110, which has a data input connected to an output of an OR gate 119-1 having two inputs connected to an output of two AND gates 119-3 and 119-2, respectively. A first non-inverting input of the AND gate 119-3 is connected to a second serial data input terminal Sil 130-2, and a non-inverting input of the AND gate 119-2 is connected to a third serial data input terminal Si2 140-2. A second non-inverting input of the AND gate 119-3 and an inverting input of the AND gate 119-2 are connected in common to a serial channel selection flag 111. A data output of the shift register 110 is connected in common to an inverting input of a NAND gate 114 and a first inverting input of a NAND gate 115. A non-inverting input of the NAND gate 114 and a second inverting input of the NAND gate 115 are connected in common to the serial channel selection flag 111. An output of the NAND gate 114 is connected to a second serial data output terminal So1 130-1, and an output of the NAND gate 115 is connected to a third serial data output terminal So2 140-1. The shift register 110 has a clock input connected to an output of an OR gate 116-1 having two inputs connected to an output of two AND gates 116-3 and 116-2, respectively. A first non-inverting input of the AND gate 116-3 is connected to a second clock input terminal SCK1 130-3, and a non-inverting input of the AND gate 116-2 is connected to a third clock input terminal SCK2 140-3. A second non-inverting input of the AND gate 116-3 and an inverting input of the AND gate 116-2 are connected in common to the serial channel selection flag 111. The SCK1 terminal 130-3 is also connected to an output of a tri-state buffer 120, which is controlled by a clock selection flag 121. An input of the tri-state buffer 120 is connected to an output of a NAND gate 117, which in turn has a non-inverting input connected to the serial channel selection flag 111 and an inverting input connected to another internal clock generation circuit 112. The SCK2 terminal 140-3 is connected to an output of a tri-state buffer 122, which is controlled by a clock selection flag 123. An input of the tri-state buffer 122 is connected to an output of a NAND gate 118, which in turn has a first inverting input connected to the serial channel selection flag 111 and a second inverting input connected to the internal clock generation circuit 112. The SCK0 terminal 100-3, the SCK1 terminal 130-3 and the SCK2 terminal 140-3 are normally maintained at a logic value "1", and only when, in the serial data transfer, data from an external is received by the shown serial interface circuit, eight clocks of the logic value "0" are supplied to these clock terminals from the external. Similarly, the clock generation circuits 101 and 112 are configured to normally maintain their output at a logic value "1", and to generate eight clocks of the logic value "0" only when, in the serial data transfer, the shown serial interface circuit transmits data to an external. The shift registers 100 and 110, the clock selection flags 102, 121 and 123, and the serial channel selection flag 111 are written and read by a central processing unit 10 of the microcomputer under a programmed control, for the purpose of controlling the serial interface function. The other portion of the microcomputer is not shown for simplification of the drawing, and therefore, explanation thereof will be omitted. Now, operation will be described in connection with the shift register 100. The 8-bit shift register 100 sequentially fetches the level on the Si0 terminal 100-2 in synchronism with the clock on the SCK0 terminal 100-3, and simultaneously shifts out data stored in the shift register 100 to the So0 terminal 100-1. The clock for the shift operation is supplied either from an external through the SCK0 terminal 100-3, or from the internal clock generation circuit 101. In the case of supplying the clock from the external, the flag 102 is set to a logic value "0", so that the tri-state buffer is rendered off. In the case of using the internal clock, a logic value "1" is set to the clock selection flag 102, so that the output of the clock generation circuit 101 is used. The shift register 110 is provided with two sets of terminals each set including one serial data input terminal, one serial data output terminal and one clock terminal, and the serial channel selection flag 111 is used for selecting either one set of the two sets of terminals. When the serial channel selection flag 111 is at the logic value "1", the Si1 terminal 130-2, the So1 terminal 130-1 and the SCK1 terminal 130-3 are selected as the serial data input terminal, the serial data output terminal and the clock terminal, respectively (these terminals will be called a "serial channel 1" hereinafter). Data on the Si2 terminal 140-2 are blocked by the logic gate 119-2, and data on the Si1 terminal 130-2 pass through the logic gates 119-3 and 119-1 so as to be inputted to the shift register 110. As mentioned above, the output of the shift register 110 is connected in common to the logic gates 114 and 115, but, since the serial channel selection flag 111 is at the logic value "1", the output of the shift register 110 is blocked by the logic gate 115, so that the So2 terminal 140-1 is maintained at the logic value "1". On the other hand, the output of the shift register 110 is transferred to the Si1 terminal 130-1. Similarly, the clock supplied to the shift register 110 is selected by the status of the serial channel selection flag 111. In addition, the clock selection flag 121 designates selection of a source of the clock in connection with the clock terminal 130-3, and the clock selection flag 123 designates selection of a source of the clock in connection with a clock terminal 140-3. Here, if the flag 121 is at the logic value "0", since the tri-state buffer 120 is rendered off, the clock on the SCK1 terminal 130-3 is supplied to the shift register 110. On the other hand, if the flag 121 is at the logic value "1", the output of the clock generation circuit 112 is supplied through the logic gate 117, the tri-state buffer 120 and the logic gates 116-3 and 116-1 to the shift register 110. When the serial channel selection flag 111 is at the logic value "0", the Si2 terminal 140-2, the So2 terminal 140-1 and the SCK2 terminal 140-3 are selected as the serial data input terminal, the serial data output terminal and the clock terminal, respectively (these terminals will be called a "serial channel 2" hereinafter). As the input to the shift register 110, data on the Si2 terminal 140-2 are selected by action of the logic gate 119-2, and the data on the Si1 terminal 130-2 are blocked by the logic gate 119-3. On the other hand, the output of the shift register 110 is transferred through the logic gate 115 to the So2 terminal 140-1, but the Sil terminal 130-1 is fixed to the logic value "1" by action of the logic gate 114. As the clock supplied to the shift register 110, the clock on the SCK2 terminal 140-3 is selected by the function of the logic gates 116-1 to 116-3. Which of the external clock and the internal clock is used is designated by the clock selection flag 123. Figure 2 is a circuit diagram of another embodiment of the present invention. In this second embodiment, a clock generation circuit 200 is newly added to the first embodiment, so that the clock generation circuit 112 is exclusively used for the "serial channel 1", and the clock generation circuit 200 is exclusively used for the "serial channel 2". Therefore, different transfer rates can be used for different serial channels, respectively. Since the other operation of the second embodiment is the same as that of the first embodiment, further explanation will be omitted. As seen from the above explanation, the present invention has a practical advantage capable of providing an inexpensive multi-channel serial interface function. The shown embodiments are an example of two channels, but may be modified to select one of three or more channels. The invention has thus been shown and described with reference to the specific embodiments. However, it should be noted that the present invention is in no way limited to the details of the illustrated structures but changes and modifications may be made within the scope of the appended claims.

Claims: A serial interface circuit internally provided in a microcomputer, the serial interface circuit comprising: at least two serial data input terminals (130-2, 140-2), at least two serial data output terminals (130-1, 140-1), a shift register (110) having a data input, a data output and a clock input and configured to perform a shift operation in synchronism with a clock signal applied to said clock input so that data inputted to said data input are shifted into said shift register and data stored in the shift register are shifted out from said data output, output selection means (114, 115) having an input connected to said data output of said shift register and at least two outputs connected to said at least two serial data output terminals, input selection means (119) having at least two inputs connected to said at least two serial data input terminals and an output connected to said data input of said shift register, channel selection means (111) coupled to said input and output selection means to control said input and output selection means in such a manner that one of said at least two serial data input terminals is selected by said input selection means and coupled to said data input of said shift register, and a corresponding one of said at least two serial data output terminals is selected by said output selection means and coupled to said data output of said shift register, at least two clock terminal (130-3, 140-3) first clock selection means (116) having at least two inputs connected to said at least two clock terminals and an output connected to said clock input of said shift register, said channel selection means being coupled to said input, output, and first clock selection means to control said input, output, and first clock selection means in such a manner that one of said at least two serial data input terminals is selected by said input selection means and coupled to said data input of said shift register and a corresponding one of said at least two clock terminals is selected by said first clock selection means and coupled to said clock input of said shift register, and a corresponding one of said at least two serial data output terminals is selected by said output selection means and coupled to said data output of said shift register, and internal clock generation means (117) having an internal clock output connected to second clock selection means (117, 118) controlled by said channel selection means, wherein each of said at least two clock terminals is connected through switching means (120, 122) to a corresponding output of said second clock selection means, said switching means being controlled by an associated clock selection flag (121, 123), so that one of an external clock supplied to the clock terminal and an internal clock generated by said clock generation means is selected by said associated clock selection flag and supplied to said first clock selection means. A serial interface circuit as claimed in claim 1, comprising: at least two internal clock generation means (112, 200) each having an internal clock ouput connected to one of a corresponding number of inputs of said second clock selection means, said second clock selection means being controlled by said channel selection means, so that one of said at least two internal clock generation means is selected by said second clock selection means and outputted from a corresponding one of said outputs of said second clock selection means. A serial interface circuit claimed in claim 1 or 2, wherein said switching means (120, 122) comprises a tri-state buffer having a control input connected to said associated clock selection flag (121, 123), an input of said tri-state buffer being connected to said second clock selection means and an output of said tri-state buffer being connected to a corresponding one of said at least two clock terminals.

Inventors: MATSUSHIMA OSAMU, MATSUSHIMA, OSAMU, Matsushima, Osamu, c/o NEC Corporation
Applicants: NIPPON ELECTRIC CO, NEC CORPORATION
Application year: 1992
Main classification: G06F13
IPC codes: G06F13, G06F15