Abstract:
A data transfer system comprises data retaining means for retaining n-bit digital data (n being an integer), serial/parallel data converting means for converting the n-bit digital data transferred from the data retaining means from parallel data to serial data or vice versa in synchronism with first clock signals generated at a first clock frequency, counting means for counting second clock signals generated at a second clock frequency, and control means for transferring the n-bit digital data from the data retaining means to the serial/parallel data converting means each time the counting means counts a predetermined number of clock signals.

Description:
BACKGROUND OF THE INVENTION 
     The present invention relates to a data transfer system in a data processing system having a central processing unit (CPU). 
     The data transfer system includes a serial transfer system in which n-bit data (n being an integer) is transferred bit by bit sequentially from a low or high order bit, and a parallel transfer system in which n-bit data is simultaneously transferred in parallel. A floppy disk unit has been widely used as an external storage for a computer or the like. It employs the serial transfer system in which eight-bit data is serially transferred bit by bit. On the other hand, since the eight-bit data is processed in parallel in a data processing unit, a floppy disk controller includes a register connected to a data bus, and a shift register for parallel-to-serial conversion of the data placed between the register and the floppy disk unit. 
     A write operation of involving the writing eight-bit data into the floppy disk unit is now explained. The CPU reads in the eight-bit data from a RAM in accordance with a procedure stored in a ROM and sends out the data to the register. The data loaded in the register is transferred to the shift register in parallel, and the shift register transfers the data, bit by bit, at a constant interval in synchronism with a clock signal, to the floppy disk unit. After the register has transferred the data to the shift register, it sends a transfer request signal (flag bit) to the CPU requesting the next data transfer. In response to the request signal, the CPU reads out the data to be next transferred, from the RAM and transfers it to the register. When the data is loaded into the register, it extinguishes the transfer request signal and keeps the transfer request signal extinguished until that data has been transferred out. In this manner, the CPU responds to the transfer request signal to periodically load the data into the register. One CPU write operation needs a total of approximately 20 machine cycles (system clocks) including a step for checking the presence or absence of the transfer request signal, a step for reading the data to be loaded into the register into the CPU from the RAM and a step for loading the read data into the register. If a general purpose CPU operating at 1 MHz is used, approximately 20 microseconds are needed to complete each write operation. On the other hand, since the transfer rate of the floppy disk unit is usually 500K bits/sec (2 microseconds per bit), sixteen microseconds are needed to transfer the eight-bit data. Since the general purpose CPU cannot process twenty machine cyles in sixteen microseconds, a special and expensive high speed CPU must be used when the floppy disk unit is used. In order to avoid the above problem, a DMA system has been proposed in which the data is transferred not through the CPU but directly between the RAM and the floppy disk unit. In the DMA system, however, not only a DMA control IC, but also a bidirectional address bus buffer and data bus buffer and a control circuit for controlling the direction of the buffers are required. As a result, the circuit is of large scale and hence the DMA data transfer system is complex and expensive. 
     SUMMARY OF THE INVENTION 
     It is an object of the present invention to provide a data transfer system having an increased data transfer rate with a simple configuration without requiring a high CPU operating speed. 
     In accordance with the present invention, multi-bit data is periodically transferred between a data processing unit and an external unit, such as a floppy disk unit, through a register so that the data is transferred between the data processing unit and the shift register without requiring the check of the presence or absence of a transfer request signal. As a result, the period required for the data transfer between the data processing unit and the shift register is shortened. This period is set to be equal to the period of the transfer of the multi-bit data between the shift register and the external unit. In accordance with a further aspect of the present invention, in order to attain precise synchronism between both the transfers of data, the clock signal for controlling operation of the shift register is derived by frequency-dividing a clock signal used in the data processing unit. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 shows a block diagram of one embodiment of the present invention. 
     FIG. 2 shows a flow chart illustrating a CPU operation. 
     FIG. 3 shows a timing chart for the system shown in FIG. 1. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENT 
     Referring to FIG. 1, numeral 1 denotes a central processing unit (CPU), numeral 2 denotes a memory (ROM) which mainly stores a system operation procedure (program), numeral 3 denotes a memory (RAM) which temporarily stores data in the course of system operation, numeral 4 denotes an address bus, numeral 5 denotes a data bus, numeral 6 denotes a clock generator for generating a clock signal (1 MHz) to time the operations of the CPU, numeral 7 denotes a register for temporarily storing eight-bit data, numeral 8 denotes an eight-bit shift register, numeral 9 denotes a frequency divider for frequency-dividing the clock signal by a factor of two, and numeral 11 denotes a floppy disk unit. The register 7 transfers the eight-bit data between the data bus 5 and the shift register 8, and the eight-bit data is transferred in parallel between the register 7 and the shift register 8, while being transferred bit by bit between the shift register 8 and the floppy disk unit 11 each time the clock signal (0.5 MHz) is received from the frequency divider 9. The register 7, the shift register 8 and the frequency divider 9 form a floppy disk controller 10. 
     When the floppy disk unit 11 transfers data to the shift register 8 or receives data therefrom, 128-byte data is transferred as one unit (sector) at a rate of two microseconds per bit. When the CPU executes an instruction, it needs a time period determined by the type of instruction. For example, a certain instruction to read the data of the RAM 3 into the register of the CPU 1 needs five clock signals in the CPU 1, that is, a period of five microseconds, and a certain instruction for loading the data read into the CPU 1 into the register 7 needs six clock signals in the CPU 1, that is, a period of six microseconds. Since the time periods required by the respective types of instructions executed by the CPU 1 are known, the time period can be determined by designating the instruction to be executed by the CPU 1. By selecting the instructions to be executed by the CPU 1 such that the time period from a time point at which the CPU 1 loaded the eight-bit data into the register 7 to a time point at which the CPU reads out the data to be next loaded from the RAM 3 and is ready for loading that data into the register 7, or a time period from a time point at which the CPU 1 received the eight-bit data from the register 7 to a time point at which the CPU 1 writes that data into a predetermined location of the RAM 3 and is ready for receiving the next data from the register 7, is equal to a time period (sixteen microseconds) required for the eight-bit data to be transferred between the shift register 8 and the floppy disk unit 11, the data can be smoothly transferred between the RAM 3 and the floppy disk unit 11 without watching for a transfer request signal. 
     Referring now to FIGS. 2 and 3, the transfer of the data in the RAM 3 to the floppy disk unit 11 is explained. The transfer of the data from the floppy disk unit 11 to the RAM 3 is similar. 
     As shown in FIG. 2, a step for reading the eight-bit data from the RAM 3 to the CPU 1, a step for transferring the read data to the register 7 and a step for checking if the above steps have been repeated 128 times (because the floppy disk unit 11 is driven by 128-byte sector) are required. The program instruction is selected such that those three steps are carried out in sixteen microseconds. One example thereof is shown below by a mnemonic code for Motorola CPU MC 6809. 
     
         ______________________________________ LDX       #$ 8000 LDB       #128L1    LDA       ,x+        6 machine cycles                      (LOAD DATA FROM                      RAM3→CPU1) STA       DATAREG    5 machine cycles                      (LOAD DATA FROM                      CPU1→REG7) DECB                 2 machine cycles BNE       L1         3 machine cycles______________________________________ 
    
     As shown in FIG. 3, the data in the RAM 3 is loaded into a register in the CPU 1 at the trailing edge of a fifth clock signal of the six clock signals required to read the data into the CPU 1, and the data read in the CPU 1 is transferred to the register 7 at the fall of a fifth clock signal of the five clock signals required to transfer the data from the CPU 1 to the register 7. This operation is repeated once in every sixteen microseconds. On the other hand, the eight-bit data in the shift register 8 is transferred to the floppy disk unit 11 by the 0.5 MHz clock signal. Accordingly, the shift register 8 is emptied in every sixteen microseconds so that the data is smoothly transferred from the register 7 to the shift register 8 without transfer error. 
     Since there are various types of instructions which instruct the CPU to exchange the data with the memory, it is desirable to appropriately combine the instructions such that the CPU operation period in the data transfer is equal to the transfer period of the floppy disk unit. If it is not possible to combine the instructions such that the operation period of the CPU and the transfer period of the floppy disk unit are equal, the CPU operation period is set shorter and an instruction which executes essentially no operation (NOP) is added so that the CPU operation period is set to be equal to the transfer period of the floppy disk unit. By setting the operation period of the CPU in the data transfer operation to be equal to the transfer period of the floppy disk unit, the step of checking for the presence or absence of the transfer request signal can be omitted and hence the data can be transferred with a low speed CPU. Since the clock signal for the shift register 8 is derived by frequency-dividing the clock signal of the CPU 1, the operations timed by the clock signals can be exactly synchronized and no problem due to the omit of the check step is encountered. 
     The clock signal frequency f 1  of the CPU 1 and the clock signal frequency f 2  of the shift register 8 may be selected such that a relation of f 1  =f 2  ×N/n is met, where N is the number of clocks required for a series of operations repeated by the CPU 1 to transfer the data and n is the number of bits of the shift register 8. For one sector of data transfer, an error within one byte is permitted.