Serial data transfer apparatus

Abstract: In the serial data transfer apparatus of the present embodiment, since the time base counter counts by the clock signal (CLK), the count value of the time base counter at the point of time when the reception of the reception serial data (RxD) is completed is written into the reception buffer together with the reception data. Accordingly, in the central processing unit, when the reception serial data (RxD) is to be processed, the time difference until the reception serial data (RxD) is processed can be detected by reading out the count value of the time base counter written in the reception buffer from the reception buffer through the data bus and reading out the count value of the time base counter at present from the time base counter through the data bus, and accordingly, time management of the reception data can be performed.

Description: The present invention relates to a serial data transmitting and/or receiving apparatus. In particular, a first aspect of the present invention relates to a serial data receiving apparatus, comprising a serial data reception circuit for receiving a packet of a plurality of serial data having a predetermined protocol, and storage means for storing the plurality of data of the received packet. Furthermore, a second aspect of the present invention relates to a serial data transmitting apparatus, comprising storage means for storing a plurality of data to be transmitted, a serial data transmission circuit for serially transmitting the plurality of stored data read from the storage means in a packet having a predetermined protocol. Moreover, a third aspect of the present invention provides a serial data transfer apparatus comprising a serial data receiving apparatus according to the first aspect of the invention, and a serial data transmitting apparatus according to the second aspect of the invention. An example of a conventional configuration of such a serial data receiving apparatus is shown in Fig. 1 of the accompanying drawings, in the case where the serial data received by the serial data transfer apparatus is sent to a central processing unit of a microcomputer. In this connection, reference is directed to the document "8-bit Single Chip Microcomputer - µPD78014" issued in August 1991 by NEC Corporation. The serial data reception circuit includes a reception buffer 1 connected to the central processing unit of the microcomputer (not shown in Fig. 1 ) through a data bus 7, a shift clock generation circuit 10, a shift register 2, a control circuit 3, a pointer 4, an input buffer S, a multiplexer 6 connected to the central processing unit through an address bus 8, and a reception serial data input terminal 9. It is to be noted that, according to the protocol of reception serial data (RxD), as seen in Fig. 2(a), a falling edge of the reception serial data (RxD) indicates the starting position of the serial data communication, and first to third units of reception data D R1 -D R3 , each of which consists of 8 bits, are transferred serially following the falling edge. The period for which the first unit of reception data D R1 consisting of 8 bits is transferred is called a first reception frame F R1 ; the period for which the second unit of reception' data D R2 consisting of 8 bits is transferred is called a second reception frame F R2 ; and the period for which the third unit of reception data D R3 consisting of 8 bits is transferred is called a third reception frame F R3 . In the serial data reception circuit, the reception serial data (RxD) is inputted from the reception serial data input terminal 9 to the input buffer 5 and then inputted from the input buffer 5 to the shift clock generation circuit 10, the shift register 2 and the control circuit 3. In the shift clock generation circuit 10, a shift clock signal (SCK) synchronized with the reception serial data (RxD) is generated from the falling edge of the reception serial data (RxD) by using a system clock signal (C1) inputted thereto from the outside. When the falling edge of the reception serial data (RxD) is detected, the control circuit 3 executes the initialization of the communication control thereof, and a clear signal (CLR) for initializing the pointer 4 which designates an address of the reception buffer 1 is outputted from the control circuit 3 to the shift clock generation circuit 10 and a clear terminal CLR' of the pointer 4 as shown in Fig. 2(c). In the shift register 2, the reception serial data (RxD) is shifted one bit at a time in synchronism with a shift clock signal (SCK) transmitted thereto from the shift clock generation circuit 10 so that the first unit of reception data D R1 is fetched into the shift register 2. In this instance, the control circuit 3 calculates the shift amount of the shift register 2 by using the shift clock signal (SCK) transmitted thereto from the shift clock generation circuit 10. At the point of time when the calculated shift amount becomes equal to "8," an increment/write control signal (INC/WR) of high level is outputted from the control circuit 3 to a write control signal input terminal WR of the reception buffer 1 and an increment control signal input terminal INC of the pointer 4 as shown in Fig. 2(b). Here, the increment/write control signal (INC/WR) is a signal to write data in the shift register 2 into the reception buffer 1 and increment the address of the reception buffer 1 designated by the pointer 4. As a result, the first unit of reception data D R1 is written into the address designated by the pointer 4 of the reception buffer 1. Thereafter, the second unit of reception data D R2 and the third unit of reception data D R3 are successively written into the reception buffer 1 in a similar manner as in the case of the first unit of reception data D R1 . After the writing of the third unit of reception data D R3 into the reception buffer 1 is completed, an interrupt requesting signal (INT) of high level representing that the reception of all of the reception serial data has been completed is generated in the control circuit 3 as shown in Fig. 2(d) and then outputted from the control circuit 3 to the central processing unit. When the interrupt requesting signal (INT) is inputted, the central processing unit reads out the designated address of the reception buffer 1 through the address bus (not shown in Fig.1). A read-out control signal (RxBRD) of high level is outputted from the central processing unit to a read-out control signal input terminal RD of the reception buffer 1 and the multiplexer 6, and an address signal is outputted from the central processing unit to an address signal input terminal AD of the reception buffer 1 through the address bus 8 and the multiplexer 6. Consequently, the first to third units of reception data D R1 -D R3 written in the reception buffer 1 are read out from the reception buffer 1 to the central processing unit through the data bus 7. In recent years, systems which employ a large number of microcomputers have been increasing in number. In such a system, the entire system must operate in a synchronized condition. To this end, communications of data are performed very frequently and closely between the microcomputers. In order to allow a plurality of microcomputers to operate closely and efficiently, time management is required for communications of data generally since communications of real time data increase. It is to be noted that real time data signifies data which varies with respect to time. A microcomputer requires, depending upon the program being executed, a certain interval of time until reading out processing of data of the reception buffer 1 is performed actually after the interrupt requesting signal (INT) is accepted. When this time difference exists, some correction is necessary when the real time data to be transferred is to be processed. Further, when serial data is communicated in a fixed period, the microcomputer must know at which time the reception serial data stored in the reception buffer 1 was communicated and execute processing of the reception serial data read out from the reception buffer 1 in accordance with the time. However, the conventional serial data transfer apparatus described above is disadvantageous in that, when the reception serial data is to be received, only the interrupt requesting signal (INT) of high level is generated, and consequently, time management of the reception serial data is impossible and the control essential to communications of the real time data cannot be performed. Further, when the serial data is to be transmitted, it is necessary to recognize the time at which the transmission has actually been performed and correct serial data to be transmitted next in accordance with the time. However, since the conventional serial data transfer apparatus cannot perform the control just described, it is disadvantageous also in that the transmission of real time data cannot be performed. The present invention seeks to provide a serial data receiving and/or transmitting apparatus with which the reception and/or transmission of real time data can be performed readily. The serial data receiving apparatus of the first aspect of the invention is characterised by means for detecting a reception time of the packet of serial data, including: counting means for producing a count value which is incremented in synchronisation with an internal clock running independently of serial data transfer control; and means for controlling writing to the storage means so that, after all of the data of the received packet has been written to the storage means, the count value of the counting means is written to the storage means so that the count value is stored with the corresponding stored data of the received packet. The serial data transmitting apparatus of the second aspect of the invention is characterised by means for detecting a transmission time of the packet of serial data, including: counting means for producing a count value which is incremented in synchronisation with an internal clock running independently of serial data transfer control; and means for controlling writing to the storage means so that, after all of the data to be transmitted in the packet has been read from the storage means, the count value of the counting means is written to the storage means so that the count value is stored with the corresponding stored data for the transmitted packet. In either case the packet of serial data preferably includes a falling edge indicative of a starting position of the packet of serial data, followed by a sequence of data units, each of which consists of a sequence of a predetermined number of bits. It should be noted that patent document GB-A-2177877 describes a system of transfer of data, for example over a local area network, in which time tags are inserted in packets of data at a transmitting end and are extracted from the packets of data at the receiving end. Also, patent document EP-A-0021723 describes a control system which has a parallel input and in which, at any time when any of the binary bits of the parallel input changes, the identity of the bit which has changed and the time of change are stored. Specific embodiments of the present invention will now be described, purely by way of example, with reference to the accompanying drawings, in which: Fig. 1 is a block diagram showing an example of a serial data reception circuit of a conventional serial data transfer apparatus; Fig. 2 is a timing chart illustrating operation of the serial data reception circuit shown in Fig. 1; Fig. 3 is a block diagram showing a serial data reception circuit illustrating a first embodiment of a serial data transfer apparatus of the present invention; Fig. 4 is a block diagram of the shift clock generation circuit shown in Fig. 3; Fig. 5 is a block diagram showing the control circuit shown in Fig. 3; Fig. 6 is a timing chart illustrating operation of the serial data reception circuit shown in Fig. 3; Fig. 7 is a block diagram showing a serial data transmission circuit illustrating a second embodiment of a serial data transfer apparatus of the present invention; Fig. 8 is a block diagram showing the shift clock generation circuit shown in Fig. 7; Fig. 9 is a block diagram showing the control circuit shown in Fig. 7; and Fig. 10 is a timing chart illustrating operation of the serial data transmission circuit shown in Fig. 7. A serial data reception circuit of a serial data transfer apparatus according to the first embodiment of the present invention includes, as shown in Fig. 3, a reception serial data input terminal 19, an input buffer 15, a shift clock generation circuit 20, a shift register 12, a control circuit 13, a time base counter 17, a second multiplexer 18, a reception buffer 11, a pointer 14, and a first multiplexer 16. The input buffer 15 receives a reception serial data (RxD) which is inputted from the outside to the reception serial data input terminal 19. It is to be noted that, according to the protocol of the reception serial data (RxD), as shown in Fig. 6(a), a falling edge of the reception serial data (RxD) indicates the starting position of the serial data communication, and first to third units of reception data D R1 -D R3 each consisting of 8 bits are transferred serially following the falling edge. The shift clock generation circuit 20 generates a shift clock signal (SCK), which is indicative of a communication rate and is synchronized with the reception serial data (RxD) received from the input buffer 15, by using a system clock signal (C1) transmitted thereto from the outside. The shift clock generation circuit 20 includes, as shown in Fig. 4, a first falling edge detection circuit 51, a reset-set flip-flop 52, a serial clock counter 53, and a toggle flip-flop 54. The first falling edge detection circuit 51 detects the falling edge of the reception serial data (RxD) received from the input buffer 15. The reset-set flip-flop 52 is set by an interrupt requesting signal (INT) inputted to a set terminal S thereof from the control circuit 13 and is reset by a signal inputted to a reset terminal R thereof from the first falling edge detection circuit 51. The serial clock counter 53 counts the number of pulses of the system clock signal (C1) received from the outside when an output signal of the reset-set flip-flop 52 transmitted to the reset terminal R thereof is low level. It is to be noted that, since the output signal of the reset-set flip-flop 52 normally is high level, the serial clock counter 53 is in a reset state and is held from operation. The toggle flip-flop 54 reverses the polarity of an output signal thereof each time the output signal of the serial clock counter 53 transmitted to a toggle terminal T thereof changes from low level to high level. When the falling edge of the reception serial data (RxD) is detected by the first falling edge detection circuit 51, the reset-set flip-flop 52 is reset by the output signal of the first falling edge detection circuit 51 so that the output signal of the reset-set flip-flop 52 changes from high level to low level. Consequently, the serial clock counter 53 starts counting the number of pulses of the system clock signal (C1). After the number of pulses of the system clock signal (C1) corresponding to the length of a half bit of the reception serial data (RxD) is counted, the output signal of high level is outputted from the serial clock counter 53 to the toggle terminal T of the toggle flip-flop 54 so that the polarity of the output signal of the toggle flip-flop 54 is reversed. Thereafter, when the serial clock counter 53 counts the number of pulses of the system clock signal (C1) corresponding to the length of a half bit of the reception serial data (RxD), the output signal of high level is outputted from the serial clock counter 53 to the toggle terminal T of the toggle flip-flop 54 so that the polarity of the output signal of the toggle flip-flop 54 is reversed. As the mentioned operation is repeated, the shift clock signal (SCK) is generated which is synchronized with the reception serial data (RxD) and has one pulse for each bit of the reception serial data (RxD). The shift register 12 shifts and fetches the reception serial data (RxD) received from the input buffer 15 one bit at a time in synchronism with the shift clock signal (SCK) received from the shift clock generation circuit 20, and converts the fetched reception serial data (RxD) into parallel data. The control circuit 13 includes, as shown in Fig. 5, a second falling edge detection circuit 31, a bit counter 32, a frame counter 33, a latch 34, a first AND circuit 35, a second AND circuit 36, and an OR circuit 37. The second falling edge detection circuit 31 receives the reception serial data (RxD) from the input buffer 15 and then detects the falling edge of the reception serial data (RxD). When the falling edge of the reception serial data (RxD) is detected in the second falling edge detection circuit 31, an output signal of high level is outputted from the second falling edge detection circuit 31 to the bit counter 32, the frame counter 33, the latch 34 and the first AND circuit 35. As a result, the bit counter 32, the frame counter 33 and the latch 34 are initialized and put into an operating condition and the first AND circuit 35 is put into an operating condition. The bit counter 32 counts the number of pulses of the shift clock signal (SCK) received from the shift clock generation circuit 20 when it is in the operating condition and then outputs a first carry signal (CA 1 ) of high level each time it counts to "8" to detect that one of the first to third units of reception data D R1 -D R3 each consisting of 8 bits has been fetched into the shift register 12. The first carry signal (CA 1 ) is outputted from the bit counter 32 to the frame counter 33 and the OR circuit 37. The frame counter 33 counts the first carry signal (CA 1 ) received from the bit counter 32 when it is in operating condition and then outputs a second carry signal (CA 2 ) of high level each time it counts to "3" to detect that all of the first to third units of reception data D R1 -D R3 have been fetched into the shift register 12. The second carry signal (CA 2 ) is outputted from the frame counter 33 to a clear terminal of the bit counter 32, a clear terminal of the frame counter 33 and the latch 34. As a result, when the second carry signal (CA 2 ) of high level is outputted from the frame counter 33, the bit counter 32 and the frame counter 33 stop their operations. The latch 34 latches the second carry signal (CA 2 ) received from the frame counter 33 in response to a master clock signal (not shown in Fig. 5) received from the outside when it is in operating condition. In particular, when the second carry signal (CA 2 ) of high level is inputted from the frame counter 33 to the latch 34, the output signal, which is high level for only one period of the master clock signal, is outputted from the latch 34. The output signal of the latch 34 is sent to the central processing unit of the microcomputer as the interrupt requesting signal (INT) and is sent to the OR circuit 37 and a time base counter selection signal input terminal SELTBC' of second multiplexer 18 (refer to Fig. 3) as the time base counter selection signal (SELTBC). It is to be noted that the interrupt requesting signal (INT) is also sent to a set terminal S of the reset-set flip-flop 52 of the shift clock generation circuit 20 (refer to Fig. 4). The time base counter selection signal (SELTBC) is a signal for selecting the output signal of the shift register 12 or the output signal of the time base counter 17 as a signal to be fetched into the second multiplexer 18. Were, when the time base counter selection signal (SELTBC) is low level, the output signal of the shift register 12 is selected, but when the time base counter selection signal (SELTBC) is high level, the output signal of the time base counter 17 is selected. The first AND circuit 35 generates a clear signal (CLR) for initializing the pointer 14. When the output signal of the second falling edge detection circuit 31 is high level and a master clock signal (C2) received from the outside is high level, the clear signal (CLR) of high level is outputted from the first AND circuit 35 to a clear terminal CLR' of the pointer 14 (refer to Fig. 3). The second AND circuit 36 and the OR circuit 37 are provided to generate an increment/write control signal (INC/WR) for incrementing an address of the reception buffer 11 designated by the pointer 14 and for writing the output signal of the second multiplexer 18 into the reception buffer 11. When at least one of the first carry signal (CA 1 ) outputted from the bit counter 32 and the time base counter selection signal (SELTBC) outputted from the latch 34 is high level and a master clock signal (C2) inputted from the outside to the second AND circuit 36 is high level, the increment/write control signal (INC/WR) of high level is outputted from the second AND circuit 36 to a write control signal input terminal WR of the reception buffer 11 and an increment control signal input terminal INC of the pointer 14. The time base counter 17 shown in Fig. 3 is a counter which counts up by the clock signal (CLK) received from the outside and is used to effect the management of the reception time. The time base counter 17 is connected to the central processing unit through the data bus 21. The second multiplexer 18 fetches either one of the output signal of the shift register 12 and the output signal of the time base counter 17 in response to the time base counter selection signal (SELTBC) received from the control circuit 13. In particular, the second multiplexer 18 fetches the output signal of the shift register 12 when the time base counter selection signal (SELTBC) is low level, but fetches the output signal of the time base counter 17 when the time base counter selection signal (SELTBC) is high level. The reception buffer 11 writes the output signal of the second multiplexer 18 into an address indicated by the address signal inputted from the first multiplexer 16 to the address signal input terminal AD thereof when the increment/write control signal (INC/WR) inputted from the control circuit 13 to the write control signal input terminal WR thereof is high level. The pointer 14 designates an address of the reception buffer 11. The first multiplexer 16 fetches either one of the output signal of the pointer 14 and the address signal on the address bus 22 in response to a read-out control signal (RxBRD) received from the central processing unit. In particular, the first multiplexer 16 fetches the output signal of the pointer 14 when the read-out control signal (RxBRD) is low level, but fetches the address signal on the address bus 22 when the read-out control signal (RxBRD) is high level. It is to be noted that the reception buffer 11 is connected to the central processing unit through the data bus 21. Next, the operation of the serial data reception circuit shown in Fig. 3 will be described. The reception serial data (RxD) is first received in the input buffer 15 through the reception serial data input terminal 19 and then inputted to the shift clock generation circuit 20, the shift register 12 and the control circuit 13. When the falling edge of the reception serial data (RxD) is detected in the first falling edge detection circuit 51 of the shift clock generation circuit 20, the shift clock signal (SCK) synchronized with the reception serial data (RxD) is outputted from the shift clock generation circuit 20 to the control circuit 13 and the shift register 12 as described above. When the falling edge of the reception serial data (RxD) is detected in the second falling edge detection circuit 31 of the control circuit 13; the bit counter 32, the frame counter 33 and the latch 34 are initialized thereby to effect the initialization of the communication control in the control circuit 13. The clear signal (CLR) of high level is outputted from the first AND circuit 35 of the control circuit 13 to the clear terminal CLR' of the pointer 14, and the pointer 14 is initialized by the clear signal (CLR). In the shift register 12, the reception serial data (RxD) is shifted one bit at a time in synchronism with the shift clock signal (SCK) so that the first unit of reception data D R1 is fetched into the shift register 12. After the first unit of reception data D R1 is fetched into the shift register 12, the first carry signal (CA 1 ) of high level is outputted from the bit counter 32 of the control circuit 13 to the OR circuit 37 as shown in Fig. 6(b). As a result, the increment/write control signal (INC/WR) of high level is outputted from the second AND circuit 36 of the control circuit 13 to the write control signal input terminal WR of the reception buffer 11 and the increment control signal input terminal INC of the pointer 14 as shown in Fig. 6(f). The address of the reception buffer 11 designated by the pointer 14 is incremented in response to the increment/write control signal (INC/WR) of high level. In this instance, since the time base counter selection signal (SELTBC) of low level is outputted from the latch 34 to the second multiplexer 18, the second multiplexer 18 is in the condition wherein it fetches the output signal of the shift register 12. Accordingly, the reception circuit 11 writes the first unit of reception data D R1 inputted thereto from the shift register 12 through the second multiplexer 18 to the address thereof designated by the address signal inputted from the pointer 14 to the address signal input terminal AD through the first multiplexer 16. Thereafter, the second unit of reception data D R2 and the third unit of reception data D R3 are written from the shift register 12 into the reception buffer 11 in a similar manner as in the case of the first unit of reception data D R1 . After the third unit of reception data D R3 has been written into the reception buffer 11, the second carry signal (CA 2 ) of high level is outputted from the frame counter 33 to the clear terminal of the bit counter 32, the clear terminal of the frame counter 33 and the latch 34 as shown in Fig. 6(c). As a result, the operation of the bit counter 32 and the frame counter 33 is stopped, and the time base counter selection signal (SELTBC) which is the output signal of the latch 34 is changed to high level as shown in Fig. 6(d). When the time base counter selection signal (SELTBC) of high level is inputted from the control circuit 13 to the second multiplexer 18, the second multiplexer 18 is put into the condition in which it fetches the output signal of the time base counter 17. Further, when the time base counter selection signal (SELTBC) of high level is inputted from the latch 34 of the control circuit 13 into the OR circuit 37, the increment/write control signal (INC/WR) of high level is outputted from the second AND circuit 36 to the pointer 14 as shown in Fig. 6(f) so that the address of the reception buffer 11 designated by the pointer 14 is incremented. Accordingly, the output signal (count value) of the time base counter 17 is inputted from the second multiplexer 18 to the reception buffer 11 and written into the address of the reception buffer 11 next to the address into which the third unit of reception data D R3 has been written. Since the time base counter 17 counts up by the clock signal (CLK), in the serial data transfer apparatus of the present embodiment, the count value of the time base counter 17 at the point of time when the reception of the reception serial data (RxD) is completed is written into the reception buffer 11 together with the reception data (the first to third units of reception data D R1 -D R3 ). Accordingly, in the central processing unit, when the reception serial data (RxD) is to be processed, the time difference until the reception serial data (RxD) is processed can be detected by reading out the count value of the time base counter 17 written in the reception buffer 11 from the reception buffer 11 through the data bus 21 and reading out the count value of the time base counter 17 at present from the time base counter 17 through the data bus 21, and accordingly, time management of the reception data can be performed. After the third unit of reception data D R3 has been written into the reception buffer 11, the interrupt requesting signal (INT) of high level is inputted from the control circuit 13 to the set terminal S of the reset-set,flip-flop 52 of the shift clock generation circuit 20 (refer to Fig. 4) so that the reset-set flipflop 52 is set, and consequently, the operation of the serial clock counter 53 is stopped. Next, a serial data transmission circuit of a serial data transfer apparatus according to a second embodiment of a serial data transfer apparatus of the present invention will be described with reference to Figs. 7-10. A serial data transmission circuit of a serial data transfer apparatus according to the second embodiment of the present invention includes, as shown in Fig. 7, a transmission buffer 101, a time base counter 107, a shift clock generation circuit 120, a control circuit 103, a shift register 102, a second multiplexer 108, a second OR circuit 109, a third AND circuit 110, a pointer 104, a first multiplexer 106, a fourth AND circuit 111, and a transmission serial data output terminal 112. The transmission buffer 101 temporarily stores therein a transmission serial data (TxD) received from a central processing unit of a microcomputer (not shown in Fig. 7) through a data bus 121 and the output signal (count value) of the time base counter 107. It is to be noted that the transmission serial data (TxD) signifies serial data to be transmitted, and according to the protocol of the transmission serial data (TxD), as shown in Fig. 10(a), a falling edge of the transmission serial data (TxD) indicates the starting position of the serial data communication, and first to third transmission data D T1 -D T3 each consisting of 8 bits are transferred serially following the falling edge. The period for which the first transmission data D T1 consisting of 8 bits is transferred is called a first transmission frame F T1 ; the period for which the second transmission data D T2 consisting of 8 bits is transferred is called a second transmission frame F T2 ; and the period for which the third transmission data D T3 consisting of 8 bits is transferred is called a third transmission frame F T3 . The time base counter 107 counts up by a clock signal (CLK) received from the outside and manages the transmission time. The time base counter 107 is connected to the central processing unit through the data bus 121. The shift clock generation circuit 120 generates a shift clock signal (SCK), which is indicative of a communication rate and synchronized with the transmission serial data (TxD), by using a system clock signal (C1) transmitted thereto from the outside. The shift clock generation circuit 120 includes, as shown in Fig. 8, a first falling edge detection circuit 151, a reset-set flip-flop 152, a serial clock counter 153, and a toggle flip-flop 154. The first falling edge detection circuit 151 detects the falling edge of a transmission starting signal (TxTRG) (refer to Fig. 10(h)) received from the central processing unit. The reset-set flip-flop 152 is set by an interrupt requesting signal (INT) inputted to a set terminal S thereof from the control circuit 103 and is reset by a signal inputted to a reset terminal R thereof from the first falling edge detection circuit 151. The serial clock counter 153 counts the number of pulses of the system clock signal (C1) received from the outside when the output signal of the reset-set flip-flop 152 transmitted to the reset terminal thereof is low level. It is to be noted that, since the output signal of the reset-set flip-flop 152 is normally high level, the serial clock counter 153 is in a reset state and held stopped from operation. The toggle flip-flop 154 reverses the polarity of the output signal thereof each time the output signal of the serial clock counter 153 transmitted to a toggle terminal T thereof changes from low level to high level. When the falling edge of the transmission starting signal (TxTRG) is detected in the first falling edge detection circuit 151, the reset-set flip-flop 152 is reset by the output signal of the first falling edge detection circuit 151 so that the output signal of the reset-set flip-flop 152 changes to low level. Consequently, the serial clock counter 153 starts counting the number of pulses of the system clock signal (C1). After the number of pulses of the system clock signal (C1) corresponding to the length of a half bit of the transmission serial data (TxD) is counted, the output signal (carry signal) of high level is outputted from the serial clock counter 153 to the toggle terminal T of the toggle flip-flop 154 so that the polarity of the output signal of the toggle flip-flop 154 is reversed. After the serial clock counter 153 counts the number of pulses of the system clock signal (C1) corresponding to the length of a half bit of transmission serial data (TxD), the output signal (carry signal) of high level is outputted from the serial clock counter 153 to the toggle terminal T of the toggle flip-flop 154 so that the polarity of the output signal of the toggle flip-flop 154 is reversed. As the operation is repeated, the shift clock signal (SCK) synchronized with the transmission serial data (TxD) and having one pulse for each one bit of the transmission serial data (TxD) is generated. The control circuit 103 includes, as shown in Fig. 9, a second falling edge detection circuit 131, a bit counter 132, a frame counter 133, a latch 134, a first AND circuit 135, a second AND circuit 136, an OR circuit 137 and an inverter circuit 138. The second falling edge detection circuit 131 receives the transmission starting signal (TxTRG) from the central processing unit and detects the falling edge of the transmission starting signal (TxTRG). When the falling edge of the transmission starting signal (TxTRG) is detected in the second falling edge detection circuit 131, the output signal of high level is outputted from then second falling edge detection circuit 131 to the bit counter 132, the frame counter 133, the latch 134 and the first AND circuit 135. As a result, the bit counter 132, the frame counter 133 and the latch 134 are initialized and put into operating condition while the first AND circuit 135 is put into operating condition. When the bit counter 132 is in operating condition, it counts the number of pulses of the shift clock signal (SCK) received from the shift clock generation circuit 120 and outputs a first carry signal (CA 1 ) of high level each time it counts to "8" to detect that each of the first to third transmission data D T1 -D T3 each consisting of 8 bits has been fetched into the shift register 102 (refer to Fig. 10(b)). The first carry signal (CA 1 ) is outputted from the bit counter 132 to the frame counter 133 and the OR circuit 137. When the frame counter is in operating condition, it counts the first carry signal (CA 1 ) received from the bit counter 132 and outputs the second carry signal (CA 2 ) of high level each time it counts to "3" to detect that all of the first to third transmission data D T1 -D T3 have been fetched into the shift register 102 (refer to Fig. 10(c)). The second carry signal CA 2 is outputted from the frame counter 133 to the clear terminal of the bit counter 132, the clear terminal of the frame counter 133 and the latch 134. As a result, when the second carry signal CA 2 of high level is outputted from the frame counter 133, the bit counter 132 and the frame counter 133 stop their operations. The latch 134 latches the second carry signal CA 2 received from the frame counter 133 in response to a master clock signal (not shown in Fig. 9) received from the outside when it is in operating condition. In particular, when the second carry signal CA 2 of high level is inputted from the frame counter 133 to the latch 134, the output signal, which is high level for only one period of the master clock signal, is outputted from the latch 134. The output signal of the latch 134 is sent to the central processing unit as the interrupt requesting signal (INT) and sent to the time base counter selection signal input terminal SELTBC' of the second multiplexer 108 and the second OR circuit 109 (refer to Fig. 6) as the time base counter selection signal (SELTBC). It is to be noted that the interrupt requesting signal (INT) is outputted also to the set terminal S of the reset-set flip-flop 152 of the shift clock generation circuit 120. The time base counter selection signal (SELTBC) is a signal for selecting one of the signals on the data bus 121 and the output signal of the time base counter 107 is a signal to be fetched into the second multiplexer 108 and is also a signal for writing the output signal of the second multiplexer 108 into the transmission buffer 101. Here, when the time base counter selection signal (SELTBC) is low level, the signal on the data bus 121 is selected, but when the time base counter selection signal (SELTBC) is high level, the output signal of the time base counter 107 is selected. Further, when the time base counter selection signal (SELTBC) is high level, the output signal of the second multiplexer 108 is written into the transmission buffer 101. The first AND circuit 135 generates a clear signal (CLR) for initializing the pointer 104. When the output signal of the second falling edge detection circuit 131 is high level and the master clock signal C2 received from the outside is high level, the clear signal (CLR) of high level is outputted from the first AND circuit 135 to a clear terminal CLR' of the pointer 104. The second AND circuit 136, the OR circuit 137 and the inverter circuit 138 are provided to generate an increment/read-out/write control signal (INC/RD/SRWR). Here, the increment/readout/write control signal (INC/RD/SRWR) is a signal for incrementing an address of the transmission buffer 101 designated by the pointer 104, putting the transmission buffer 101 into a read enabled condition and putting the shift register 102 into a write enabled condition. The transmission starting signal (TxTRG) is inputted to the OR circuit 137 after the polarity thereof is reversed in the inverter circuit 138. Accordingly, when at least one of the reversed transmission starting signal (TxTRG) and the first carry signal CA 1 outputted from the bit counter 132 is high level and the master clock signal C2 inputted from the outside to the second AND circuit 136 is high level, the increment/read-out/write control signal (INC/RD/SRWR) of high level is outputted from the second AND circuit 136 to an increment control terminal INC of the pointer 14, a read-out control signal input terminal RD of the transmission buffer 101 and a write control signal input terminal SRWR of the shift register 102. The second multiplexer 108 shown in Fig. 6 fetches either the transmission data (the first to third transmission data D T1 -D T3 ) outputted from the central processing unit into the data bus 121 or the output signal of the time base counter 107 in response to the time base counter selection signal (SELTBC) received from the control circuit 103. In particular, when the time base counter selection signal (SELTBC) is high level, the second multiplexer 108 fetches the output signal of the time base counter 107, but when the time base counter selection.signal (SELTBC) is low level, the second multiplexer 108 fetches the transmission data on the data bus 121. The second OR circuit 109 logically ORs the time base counter selection signal (SELTBC) received from the control circuit 103 and a CPU write signal (TxBWR) received from the central processing unit. Further, the third AND circuit 100 logically ANDs the output signal of the second OR circuit 109 and the master clock signal C2 received from the outside, and the output signal of the third AND circuit 100 is inputted to a write control signal input terminal WR of the transmission buffer 101. Accordingly, when at least one of the time base counter selection signal (SELTBC) and the CPU write signal (TxBWR) is high level and the master clock signal C2 is high level, the write control signal of high level is inputted from the third AND circuit 110 to the write control signal input terminal WR of the transmission buffer 101. The pointer 104 designates an address of the transmission buffer 101. The first multiplexer 106 fetches either the address signal outputted from the central processing unit into an address bus 122 or the output signal of the pointer 104 in response to the CPU write signal (TxBWR) received from the central processing unit. In particular, the first multiplexer 106 fetches the output signal of the pointer 104 when the CPU write signal (TxBWR) is low level but fetches the address signal on the address bus 122 when the CPU write signal (TxBWR) is high level. The output signal of the first multiplexer 106 is transmitted to the address signal input terminal AD of the transmission buffer 101. The fourth AND circuit 111 logically ANDs the transmission starting signal (TxTRG) received from the central processing unit and the output signal of the shift register 102. Next, the operation of the serial data transmission circuit shown in Fig. 7 will be described. The transmission serial data (the first to third transmission data D T1 -D T3 ) is inputted from the central processing unit to the second multiplexer 108 through the data bus 121. The CPU write signal (TxBWR) of low level is inputted from the central processing unit to the third AND circuit 110, and an address signal is inputted from the central processing unit to the first multiplexer 106 through the address bus 122. In this instance, the time base counter selection signal (SELTBC) is low level. Accordingly, the transmission serial data (the first to third transmission data D T1 -D T3 ) is written into the address of the transmission buffer 101 designated by the address signal. The CPU write signal (TxBWR) is changed from low level to high level, and the transmission starting signal (TxTRG) is changed from high level to low level. As a result, when the falling edge of the transmission starting signal (TxTRG) is detected in the first falling edge detection circuit 151 of the shift Clock generation circuit 120, the shift clock signal (SCK) synchronized with the transmission serial data (TxD) is outputted from the shift clock generation circuit 120 to the control circuit 103 and the shift register 102 as described above. The clear signal (CLR) of high level is outputted from the control circuit 103 to the pointer 104 to initialize the pointer 104, and the output signal of the fourth AND circuit 111 is changed to low level so that the falling edge of the transmission serial data (TxD) indicative of the starting of transmission is formed as shown in Fig. 10(a). Thereafter, the increment/readout/write control signal (INC/RD/SRWR) outputted from the control circuit 103 is changed to high level as shown in Fig. 10(f), and the first transmission data D T1 is read out from the address designated by the pointer 104 of the transmission buffer 101 and written into the shift register 102. The first transmission data D T1 written in the shift register 102 is shifted one bit at a time in synchronism with the shift clock signal (SCK) and outputted serially to the fourth AND circuit 111, after which it is outputted from the fourth AND circuit 111 to the outside through the serial data output terminal 112. After the first transmission data D T1 is transmitted, the increment/read-out/write control signal (INC/RD/SRwR) is changed to high level as shown in Fig. 10(f), and the second transmission data D T2 is read out from the transmission buffer 101 and written into the shift register 102. The second transmission data D T2 is transmitted in a similar manner to the case of the first transmission data D T1 . After the second transmission data D T2 is transmitted, the increment/read-out/write control signal (INC/RD/SRWR) is changed to high level as shown in Fig. 10(f), and the third transmission data D T3 is read out from the transmission buffer 101 and written into the shift register 102. The third transmission data D T3 is transmitted in a similar manner to the case of the first transmission data D T1 . After the transmission of the third transmission data D T3 is completed, the time base counter selection signal (SELTBC) is changed to high level as shown in Fig. 10(d). As a result, the count value of the time base counter 107 is selected by the second multiplexer 108, and the output signal of high level is inputted from the third AND circuit 100 to the write control signal input terminal WR of the transmission buffer 101 as shown in Fig. 10(g). Consequently, the count value of the time base counter 107 is written into the address of the transmission buffer 101 following the address into which the third transmission data D T3 has been written. Accordingly, in the serial data transmission circuit, since the count value of the time base counter 107 at the point of time when the transmission of the transmission serial data is completed is written into the transmission buffer 101 following the transmission serial data, the central processing unit can recognize the count value of the time base counter 107 upon the transmission of the transmission serial data. As a result, upon the production of transmission serial data to be transmitted next, by reading out the count value of the time base counter 107 written in the transmission buffer 101 from the transmission buffer 101 through the data bus 122 and reading out the count value of the time base counter 107 regarding the transmission serial data to be transmitted next from the time base counter 107 through the data bus 122, the central processing unit can effect a comparison of the two count values and execute the predetermined processing in accordance with the difference between the count values, that is, the time difference, and accordingly, time management of the transmission serial data can be performed. After the transmission of the third transmission data D T3 is completed, the interrupt requesting signal (INT) of high level is inputted from the control circuit 103 to the set terminal S of the reset-set flip-flop 152 of the shift clock generation circuit 120 so that the reset-set flip-flop 152 is set, and consequently, the operation of the serial clock counter 153 is stopped. In summary, it can be seen that, in the preferred embodiments of the apparatus of the present invention, since the time base counter counts by the clock signal (CLK), the count value of the time base counter at the point of time when the reception of the reception serial data (RxD) is completed is written into the reception buffer together with the reception data. Accordingly, in the central processing unit, when the reception serial data (RxD) is to be processed, the time difference until the reception serial data (RxD) is processed can be detected by reading out the count value of the time base counter written in the reception buffer from the reception buffer through the data bus and reading out the count value of the time base counter at present from the time base counter through the data bus, and accordingly, time management of the reception data can be performed. While this invention has been described in conjunction with preferred embodiments thereof, it will now readily be possible for one skilled in the art to put this invention into practice in various other manners. It will be understood, therefore, that the invention has been described above purely by way of example, and modifications of detail can be made within the scope of the invention.

Claims: A serial data receiving apparatus, comprising: a serial data reception circuit (12,19,20) for receiving a packet of a plurality of serial data having a predetermined protocol; and storage means (11) for storing the plurality of data of the received packet; characterised by: means for detecting a reception time of the packet of serial data, including: counting means (17) for producing a count value which is incremented in synchronisation with an internal clock (CLK) running independently of serial data transfer control; and means (13,14,18) for controlling writing to the storage means so that, after all of the data of the received packet has been written to the storage means, the count value of the counting means is written to the storage means so that the count value is stored with the corresponding stored data of the received packet. A serial data transmitting apparatus, comprising: storage means (101) for storing a plurality of data to be transmitted; a serial data transmission circuit (102,112,120) for serially transmitting the plurality of stored data read from the storage means in a packet having a predetermined protocol; characterised by: means for detecting a transmission time of the packet of serial data, including: counting means (107) for producing a count value which is incremented in synchronisation with an internal clock (CLK) running independently of serial data transfer control; and means (103,104,108) for controlling writing to the Storage means so that, after all of the data to be transmitted in the packet has been read from the storage means, the count value of the counting means is. written to the storage means so that the count value is stored with the corresponding stored data for the transmitted packet. An apparatus as claimed in claim 1 or 2, wherein the packet of serial data includes a falling edge indicative of a starting position of the packet of serial data, followed by a sequence of data units, each of which consists of a sequence of a predetermined number of bits. A serial data transfer apparatus comprising: a serial data receiving apparatus as claimed in claim 1, or claim 3 when dependent on claim 1; and a serial data transmitting apparatus as claimed in claim 2, or claim 3 when dependent on claim 2.

Inventors: NISHIGUCHI YUKIHIRO, NISHIGUCHI, YUKIHIRO, NISHIGUCHI, YUKIHIRO, C/O NEC CORPORATION
Applicants: NIPPON ELECTRIC CO, NEC CORPORATION
Application year: 1993
Main classification: G06F13
IPC codes: G06F13, G06F5