Abstract:
A data processing and/or transfer apparatus communicates information to another apparatus in a mode selected from among several modes depending upon a particular characteristic or status of the other apparatus, or depending upon whether the transmitting apparatus is master relative to the other apparatus.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to image forming apparatus and system for exchanging data between a copying machine and an attachment device thereof. 
     2. Description of the Prior Art 
     In a copying machine which is intended to improve a operability and finely control a quality of copy, a data transfer apparatus for exchanging various data (for example, data indicating copy enable and sorter enable) between the copying machine and an attachment device having a sorter and an input sensor is usually required. As shown in FIG. 1, in a prior art data transfer apparatus of this type, a copy machine 11 has a central processing unit (CPU) 12, an I/O controller 13, an output driver 14, an input interface 15, a CPU power supply circuit 16 and an attachment device power supply circuit 17, and mainly controls key entry and display. An attachment device 18 has a sequence controller 19, an input interface 20A, an output driver 21A, an output load 22A and an input sensor 23A, and controls a copy sequence and a sorter sequence. A flat cable, for example, having a number of lines determined depending on the number of various signals is used to transfer the data between the copying machine 11 and the attachment machine 18. 
     The input interface 15 of the copying machine 11 and the input interface 20A of the attachment device 18 may use photo-couplers as shown in FIG. 2 in order to suppress noises. 
     In any case, however, as the number of types of signals to be transferred increases, the number of pins of a connector increases. As a result, costs of the connector and the cable increase and the reliability of the apparatus is degraded. 
     The applicant of the present invention has proposed an apparatus for serially transferring data among CPU&#39;s in a copying machine having a plurality of CPU&#39;s. However, the proposed apparatus uses, in addition to an exclusive data line, a clock line for synchronizing the CPU&#39;s and a protocol line for communicating transfer enable of the CPU&#39;s. As a result, the number of lines increases. 
     Also, it is inconvenient because of a fixed master and slave relation. 
     SUMMARY OF THE INVENTION 
     It is an object of the present invention to provide data transfer apparatus and system which are free from the above disadvantages. 
     It is another object of the present invention to provide data transfer apparatus and system having a reduced number of lines for transferring data among electronic units. 
     It is another object of the present invention to provide data transfer apparatus and system which facilitates the data transfer among units having computers. 
     It is other object of the present invention to provide an image forming system which is an effective when an image forming apparatus such as a copying machine and a attachment device thereof have microcomputers. 
     It is another object of the present invention to provide a data transfer apparatus which properly handles an error in the data transfer. 
     It is still another object of the present invention to provide a data transfer apparatus which allows each of a plurality of computers contributing to the data transfer to operate either master or slave computer. 
     It is still another object of the present invention to provide data transfer apparatus and system which requires no clock line. 
     It is still another object of the present invention to provide a data transfer apparatus which readily enables the data transfer to a distant place. 
     It is yet another object of the present invention to provide data transfer apparatus and system which can transfer data with a very small number of media. 
     In one aspect, the present invention is a data transfer apparatus adapted to transfer data to another apparatus, comprising means for processing data, communication means for transmitting the processed data to the other apparatus, means operable prior to transmission for discriminating a data processing characteristic of the other apparatus, which characteristic is associated with data transmission, and means for changing the mode of data transmission by the communication means in accordance with the characteristic discriminated by the discriminating means. For example, the discriminating means may transmit a reference signal to the other apparatus and discriminate the characteristic of the other apparatus on the basis of a response signal transmitted by the other apparatus in response to the reference signal. The communication means may also include means for modulating data to be transferred, and the processing means may also be adapted to control image formation of an image forming apparatus. 
     In another aspect, the invention is a data processing apparatus adapted to exchange data with another apparatus, comprising means for processing data, communication means for receiving data to be processed from the other aparatus or for transmitting processed data to the other apparatus, means for manually setting the mode of data exchanged by the communication means, means for discriminating whether the apparatus in question is or is not the master in a master-slave relation with the other apparatus, and means for determining the mode of data exchange on the basis of the result of the discrimination by the discriminating means and also on the basis of the mode set by the setting means. The mode determining means may, for example, determine the speed of data transmission. A switch or other means may be provided for manually instructing whether the apparatus in question is master relative to the other apparatus or not. The communication means may include means for modulating data to be transferred, and the processing means may control image formation of an image forming apparatus. 
     The data processing apparatus may instead use data transfer channels for receiving data from another apparatus or transmitting data thereto, and means for selecting one of the plural channels for data exchange. 
     The above and other objects of the present invention will be apparent from the following description of the invention. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIGS. 1 and 2 show block diagrams of prior art data transfer apparatus, 
     FIG. 3-1 shows a circuit diagram of a configuration of a main portion of a data transfer apparatus in accordance with the present invention, 
     FIG. 3-2 shows a system diagram of the data transfer, 
     FIG. 4 shows signal waveforms for explaining a communication format, 
     FIG. 5 shows a block diagram of a main portion of a microcomputer used in the present invention, 
     FIG. 6 shows a flow chart of a main program of the microcomputer, 
     FIGS. 7 to 18 show flow charts of sub-routines, 
     FIGS. 19, 24 and 29 show block diagrams of other embodiments, 
     FIGS. 20 and 25 show partial circuit diagrams of other embodiments, 
     FIGS. 21, 23, 26 and 28 show other partial circuit diagrams of other embodiments, 
     FIGS. 22 and 27 show transfer waveforms, and 
     FIGS. 30 to 35 show further embodiments. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     FIG. 3-1 shows a circuit diagram of a configuration of a main portion of the data transfer apparatus of the present invention. The data transfer apparatus is equipped with exchangeable transmitter/receivers 20 and 30 in a copying machine 2 and an attachment device 3 such as a sorter shown in FIG. 3-2. The transmitter/receivers 20 and 30 have microcomputers 21 and 31 and interface circuits therefore, respectively, packaged on printed circuit board. The copying machine 2 of FIG. 3-2 has a microcomputer controller which controls a copy sequence and is connected to terminals OUT1 and IN1 of the transmitter/receiver 20. The sorter 3 has a microcomputer controller which controls a sorter sequence and is connected to terminals OUT2 and IN2 of the transmitter/receiver 30. Alternatively, the computers 21 and 31 in the transmitter/receivers 20 and 30 may be constructed to control the copy sequence and the sorter sequence, respectively. In this case, a sequence load such as a motor of a drum 1 of the copying machine 2 is connected to the terminal OUT1, a sequence sensor such as a paper sensor 2 is connected to the terminal IN1, a load such as a drive plunger of a pawl 4 of a sorter 3 is connected to the terminal OUT2 and a sensor such as a jam sensor 5 is connected to the terminal IN2. 
     The copying machine 2 and the sorter 3 exchange control data such that the copying machine 2 operates when the sorter 3 is ready and the sorter 3 switches the operation when a predetermined number of copies have been made by the copying machine. For this purpose, a port R1-0 and a transmission line for coupling the transmitter/receivers 20 and 30 are provided. It comprises lines connected to antenna terminals ANT and a common ground line. Accordingly, the transmission line can be a single wire line. The port R1 is a common input/output port. 
     The microcomputers 21 and 31 each has a function of serial-to-parallel and parallel-to-serial conversions of the data, and the selection of master/slave is effected by switches 22 and 23 connected to the port R4. In the illustrated embodiment, the microcomputer 21 of the copying machine transmitter/receiver 20 is the master and the microcomputer 31 of the attachment device transmitter/receiver 30 is the slave. The microcomputers 21 and 31 each have a power supply terminal Vcc, a ground terminal Vss and control terminals RT, EX and X. When power is supplied to the power supply terminal Vcc, a reset signal is supplied to the control terminal RT to initialize the system. An oscillation resonator Q is connected to the control terminals EX and X and generates a clock pulse of 2 MHz, for example. The microcomputers 21 and 31 may be microprocessors having a ROM (read-only memory) and a RAM (random access memory) in one chip. 
     In the present data transfer apparatus, when data is supplied from the copying machine to the input terminal IN1 which comprises terminals P113-P124 of the master transmitter/receiver 20, the data is amplified by amplifiers 23 and 24 and the amplified data is read in by the microcomputer 21 through the terminals of the ports R2, R3 and K, where it is converted to serial data and it is transmitted to the slave transmitter/receiver 30 from the port R1 through the antenna terminal ANT. The transmitter/receiver 30 receives the serial data through the antenna terminal ANT and supplies it to the port R1 of the microcomputer 31. The microcomputer 31 reconverts the serial data to parallel data and supplies it to the amplifiers 33 and 34 through the terminals of the ports O and P. The amplifiers 33 and 34 amplify the parallel data and transfer the amplified data to the output terminal OUT2 which comprises terminals P201-P212. 
     Similarly, when the slave transmitter/receiver 30 transmits the data to the master transmitter/receiver 20, the attachment device can transfer the data applied to the input terminal IN2 which comprises terminals P213-P224 to the output terminal OUT1 which comprises terminals P101-P112 through the amplifiers 35 and 36, the microcomputer 31, the antenna terminal ANT, the microcomputer 21 and the amplifiers 25 and 26. In this case, the microcomputer 31 carries out the parallel-to-serial data conversion and the microcomputer 21 carries out the serial-to-parallel data conversion. In this manner, the transmitter/receivers 20 and 30 can transmit the data bilaterally. 
     FIG. 4 shows a signal waveform for explaining a communication format used in the data transfer apparatus of FIG. 3. The microcomputers 21 and 31 each execute eleven steps  ○1 - ○11  as shown to transfer one frame of data. In the steps and  ○1  and  ○2 , the master microcomputer 21 and the slave microcomputer 31 carry out the synchronization control for transfer clock. The microcomputer 21 starts the step  ○1  from the step  ○11  in which the transmission line is open, when a bit 0 of the fame changes from &#34;1&#34; to &#34;0&#34; and transmits an 8-bit transfer clock pulse having a period of TM to the microcomputer 31 as a TASK 1. 
     During this period, the microcomputer 31 starts a TASK 2 upon the rise of the bit 0 and measures the period TM of the transfer clock pulse sent from the master eight times (for bits 0-7) and calculates a mean transfer clock period TS, and sends it back to the master microcomputer 21 by bits 8-15 in the step  ○11 . The microcomputer 21 checks if the transfer clock period TM is equal to the average period TS. If TM≠TS, the communication with the microcomputer 31 is not permitted and the microcomputer 21 changes the transmission line to &#34;0&#34; by the bit 16 in the step  ○3  to so inform to the microcomputer 31. On the other hand, if TM=TS, the microcomputer 21 changes the bit 17 to &#34;0&#34; in the step ○4  and starts the execution of a TASK 4. The microcomputer 21 starts to count the transfer clock from the bit 17 in the step  ○4 . 
     In the next steps  ○5  and  ○5 , the microcomputer 21 executes the TASK 3 and transfers the 12-bit serial data (bits 18-29) to the microcomputer 31 and then transfers a 3-bit set of check bits (bits 30-32) in the step  ○6 . The bit 30 of the check bits may be an even parity bit, but in the present embodiment a complement of the previous bit 29 is set. That is, &#34;0&#34; is set in order to clearly distinguish the bits 29 and 30. The bit 31 of the check bits is set depending on the content of the data. In the present embodiment, the value of the bit 25 which is the seventh bit of the 12-bit data, that is &#34;1&#34; is set. The bit 32 of the check bits is &#34;0&#34; in order to represent the final bit. At the end of the bit 32, &#34;1&#34; is set and the transmission line is opened at the bit 33. 
     While the microcomputer 21 executes the TASK 3 in the steps  ○4 - ○6 , the microcomputer 31 executes the TASK 4 to read in the transferred data. In this manner, the microcomputer 21 converts the parallel data supplied to the terminals P113-P124 of the transmitter/receiver 20 to serial data, and sends it out to the transmission line through the antenna terminal ANT, and the microcomputer 31 receives the serial data and reconverts it to the parallel data and supplies it to the terminals P201-P212 of the transmitter/receiver 30. Accordingly, the data supplied to the terminals P113-P124 of the input terminal IN1 of the transmitter/receiver 20 is distributed to the corresponding terminals P201-P212 of the output terminal OUT2 of the transmitter/receiver 30. 
     In the step  ○7 , the microcomputers 21 and 31 switch the transmission/reception mode to prepare for the switching of the direction of the data transmission. In the step  ○8 , the slave microcomputer 31 sets the bits 34 to &#34;0&#34; to start the data transmission and starts to count the transfer clock. Since the microcomputer 31 has already been synchronized with the transfer clock in the steps  ○1  and ○2 , it can serially transmit the 12-bit serial data (bits 35-46) to the microcomputer 21 in the transfer clock period TM in the step ○9 . 
     In the step  ○10 , the microcomputer 31 sends out the 3-bit set of check bits (bits 37-39) to the microcomputer 21 in a similar manner to the step  ○6 . Thus, while the microcomputer 31 executes the TASK 3 to transmit the data, the microcomputer 21 executes the TASK 4 to receive the data. Accordingly, the data supplied to the terminals P213-P224 of the input terminal IN2 of the transmitter/receiver 30 can be supplied to the corresponding terminals P101-P112 of the output terminal OUT1 of the transmitter/receiver 20. In the step  ○11 , both the microcomputers 21 and 31 open the transmission line and execute a TASK 0 in which the microcomputers wait for the start of the step  ○1  for transferring the next data. 
     FIG. 5 shows a block diagram illustrating a configuration of a main portion of each of the microcomputers 21 and 31. The microcomputers 21 and 31 each has a control memory 51, a RAM (random access memory) 52, an arithmetic logic unit (ALU) 53 and an accumulator 54. A ROM (read-only memory) of the control memory 51 contains microinstructions and information necessary to control the data transfer clock period. A decoder DCR decodes data read out of the ROM and a program counter PC specifies a ROM address. A stack STK comprises a group of registers used in a LIFO (last-in first-out) fashion. 
     The RAM 52 has a plurality of memory areas the addresses of which are specified by X and Y address registers. A RAM 1 stores the data supplied to the input terminal IN1 or IN2 and a RAM 2 stores the data to be supplied to the output terminal OUT1 or OUT2. A RAM 3 has memory areas to store the serial input data transmitted from another computer to the port R1 through the antenna terminal ANT. The RAM 52 further has an interrupt counter which is incremented by one when a timer interruption occurs, a memory area for storing the transfer clock period TM, a memory area for storing the measured transfer clock period TS and a memory area for storing input/output data control numbers. 
     Referring to a flow chart of a main program shown in FIG. 6 and flow charts of sub-routines shown in FIGS. 7 to 18, the operation of the data transfer apparatus is now explained. 
     In the microcomputers 21 and 31, when power is supplied and the initialization is carried out by a reset signal, the main program shown in FIG. 6 is started. First, in a step 61, the RAM is cleared, and in the next step 62, a sub-routine &#34;IO DATA&#34; is executed. In the sub-routine &#34;IO DATA&#34;, the microcomputers 21 and 31 read in the input information supplied to the input terminals IN1 and IN2 to the RAM 1 and supply the output information read from the RAM 2 to the output terminals OUT1 and OUT2, respectively. In a step 63, the transfer clock period TM is set to the RAM and the interrupt counter is started. As described above, the transfer clock period TM is stored in the ROM and it determines the serial transfer rate of the data. The interrupt counter is incremented by one each time when a timer interruption occurs. 
     In a step 64, it is checked whether the microcomputers 21 and 31 are master or slave. This is checked by checking if the ports R4-R14 are set or not. In the present embodiment, the microcomputer 21 is the master and the microcomputer 31 is the slave. In a step 65, a sub-routine &#34;TASK 1&#34; is executed and in a step 66 a sub-routine &#34;TASK 2&#34; is executed. Accordingly, the microcomputer 21 sends out the transfer clock pulse to the transfer line by the bits 0-7 in the period TM, and the microcomputer 31 measures the transfer clock period (see step  ○1  of FIG. 4). Then, based on the transfer clock period TS measured by the microcomputer 31, the microcomputer 31 sends back the transfer clock pulse for the period of the bits 8-15 and the microcomputer 21 receives the transfer clock (see step ○2  of FIG. 4). 
     In this manner, the microcomputers 21 and 31 carry out the synchronization control of the transfer clock period, and if the clock period TM≠TS, the mutual communication is permitted. The decision is made in a sub-routine &#34;ERROR&#34; of a step 67. If the clock period TM≠TS, &#34;1&#34; is set to an error flag register. Whether the error flag is &#34;1&#34; or not is determined by the microcomputer 21 in a step 68. If the error flag is &#34;1&#34;, the error flag register is reset in a step 69 and the program goes back to the step 62. If the error flag is &#34;0&#34;, the control is shifted to a step 70. 
     If the error flag is &#34;1&#34;, the master microcomputer 21 falls the transmission line to &#34;0&#34; to inform it to the slave microcomputer 31 as shown in the step  ○3  of FIG. 4. When an error occurs in the microcomputer 31 and the transfer clock period cannot be measured, it is also detected in the sub-routine &#34;ERROR&#34; and the error flag register is set to &#34;1&#34; and the transmission line is fallen to &#34;0&#34;. 
     In the step 70, it is again checked whether the microcomputers 21 and 31 are master or slave, and the master microcomputer 21 sequentially executes subroutines &#34;TASK 3&#34; and &#34;TASK 4&#34; in steps 71 and 72 while the slave microcomputers 31 sequentially execute the sub-routines &#34;TASK 4&#34; and &#34;TASK 3&#34; in the steps 73 and 74. More specifically, the microcomputer 21 first sets the transmission line to &#34;0&#34; in the step  ○4  of FIG. 4, then carries out the steps  ○5  and  ○6  of FIG. 4, transfers the 12-bit serial data by the bits 8-29 and transfers the 3-bit check bits by the bits 30-32. On the other hand, the microcomputer 31 enters into the data reception operation in the step  ○4  and reads in the 12-bit serial data and the 3-bit check bits in the steps  ○5  and ○6 . 
     In this manner, the microcomputer 21 executes the sub-routine &#34;TASK 3&#34; and the microcomputer 31 executes the sub-routine &#34;TASK 4&#34;. 
     After the transmission line has been opened in the step  ○7  of FIG. 4, the microcomputer 31 now executes the sub-routine &#34;TASK 3&#34; of the steps  ○8 - ○10  includig the data transmission for the period of the bits 34-49 while the microcomputer 21 executes the sub-routine &#34;TASK 4&#34;. When the microcomputers 21 and 31 complete the sub-routines &#34;TASK 4&#34; and &#34;TASK 3&#34; in the steps 72 and 74, respectively, the control is shifted to the step 62 for transferring the next data. 
     The steps of the main program have thus been explained. The sub-routines are now explained in sequence. 
     In the sub-routine &#34;IO DATA&#34;, the microcomputers 21 and 31 read in the input data to the RAM 1 in accordance with the data control numbers 0-11 and read out the output data from the RAM 2. As shown in the flow chart of FIG. 7, when the subroutine &#34;IO DATA&#34; is called, the data control numbers are cleared in a step 81, the input data is read into the RAM 1 in steps 82-86, the data control numbers are again cleared in a step 87 and the output data is read out of the RAM 2 in steps 88-92. In the step 82, the input data is checked in accordance with the data control numbers 0-11 assigned to the input terminals P113-P124 of the copying machine transmitter/receiver 20 (FIG. 3-1). Depending on whether the data at the input terminal P113 of the data control number 0, for example, is &#34;1&#34; or &#34;0&#34;, the process branches to a step 83 or 84 and the input data is written into the location of the RAM 1 corresponding to the data control number 0. 
     In a step 85, the data control number is incremented by one. Since the data control number changes from 0 to 1, the result of check in a step 86 to check if the data control number is 12 or not is &#34;NO&#34; and hence the control is returned to the step 82. Similarly, the input data is read into the RAM 1 in accordance with the data control number, and when the data control number reaches 12, the result of check in the step 86 is &#34;YES&#34; and hence the control is shifted to a step 87. In steps 88-92, the output data read out of the RAM 2 in accordance with the data control number is distributed to the output terminals P101-P112 of the transmitter/receiver 20. The control thereof is essentially the same as that in the steps 82-86 and hence the explanation thereof is omitted. 
     As described above, in the step 63 of the main program, the transfer clock period TM is set in the RAM and the interrupt counter is enabled. When the timer interruption occurs, the interrupt routine of FIG. 8 is called and steps 101-103 are executed. Thus, for each interrupt, the content of the interrupt counter is incremented, and if the interrupt counter overflows, that is, if the transmission rate of other microcomputer is different from that of its own, the error flag register is set. 
     The microcomputer 21 executes the sub-routine &#34;TASK 1&#34; in the step 65 of the main program. FIGS. 9 to 12 show flow charts of the sub-routine &#34;TASK 1&#34;. By executing the sub-routine &#34;TASK 1&#34;, the microcomputer 21 sends out the transfer clock pulse of the period TM which is the repetition of &#34;0&#34; and &#34;1&#34; to the transmission line through the antenna terminal ANT and the measures the period TS of the transfer clock pulse sent back from the microcomputer 31. The 8-bit transfer clock pulse (bits 0-7) is generated by alternately setting the antenna terminal ANT and executing a sub-routine &#34;CNT CLR&#34; in the steps 104-120. 
     As shown in FIG. 10, the sub-routine &#34;CNT CLR&#34; comprises steps 134 and 135, and clears the interrupt counter and checks the coincidence of the content of the interrupt counter and the period TM (set in the RAM) to generate the pulse of the constant transfer clock period TM. 
     In steps 121-128 of the sub-routine &#34;TASK 1&#34;, the master microprocessor 21 executes a sub-routine &#34;MEASURE 0&#34; and &#34;MEASURE 1&#34; alternately to measure the period TS of the 8-bit transfer clock pulse sent back from the slave microprocessor 31. 
     FIG. 11 shows a flow chart of the sub-routine &#34;MEASURE 0&#34;. In a step 136, the content of the error flag register is checked, and if it is &#34;1&#34; the control is returned, and if it is &#34;0&#34;, the interrupt counter is cleared in a step 137. In a step 138, it is checked if &#34;1&#34; has been transmitted to the antenna terminal ANT. Since the format is constructed such that the antenna terminal ANT is &#34;1&#34;, the process then goes to a step 139 in which it is checked if the content of the interrupt counter 140 is twice of the transfer clock period TM. The decision in the step 139 is normally &#34;NO&#34; and the process goes back to the step 138. In this manner, the process is looped such that step 138→step 139→step 138→step 139 . . . are repeated. However, when the antenna terminal ANT falls to &#34;0&#34; at a certain time point, the process goes from the step 138 to the step 139 in which the content of the interrupt counter is stored in the corresponding area of the RAM as the measured clock period TS so that the period from &#34;1&#34; to &#34;0&#34; of the antenna terminal ANT, that is, the period TS in which the antenna terminal ANT is &#34;1&#34; is measured. 
     During the looping of the step 138→step 139→step 138→step 139 . . . , the interrupt routine is asynchronously carried out and the interrupt counter 140 is incremented for each interrupt. However, if the antenna terminal ANT does not fall to &#34;0&#34;, the count of the interrupt counter 140 eventually reach a count of TMX2. It indicates a failure of communication and the process goes from the step 139 to a step 141 in which the error flag is set to the error flag register and the process is returned. However, for the measurement of the bit 8, the result of measurement is not adopted because it merely detects the fall from &#34;1&#34; to &#34;0&#34; of the antenna terminal ANT. 
     As shown in FIG. 12, the sub-routine &#34;MEASURE 1&#34; is similar to the sub-routine &#34;MEASURE 0&#34; except that a branch condition for steps 142 and 143 are opposite. 
     Thus, when the 8-bit sent-back clock period (bits 8-14) has been measured, the interrupt counter is cleared in the step 129 of the sub-routine &#34;TASK 1&#34; and the error flag register is checked again in the next step 130. If the content of the error flag register is &#34;1&#34;, the control is returned to the main program, and if the content is &#34;0&#34;, the control is shifted to the step 131, in which a mean value of the measured clock periods TS in calculated. In the present embodiment the mean value of the measured clock periods TS is approximated by a majority rule. In the step 132, the transfer clock TM stored in the RAM is updated. In the step 133, the content of the interrupt counter is compared with the transfer clock period TM and the counting of the interrupt counter is continued until they coincide, when the control is returned to the main program. 
     In parallel with the sub-routine &#34;TASK 1&#34;, the slave microcomputer 31 executes the sub-routine &#34;TASK 2&#34;. FIG. 13 shows a flow chart thereof. Steps 145-157 for measuring the period TM of the transfer clock pulse sent from the master and processing the measured periods are essentially identical to the steps 121-133 of the sub-routine &#34;TASK 1&#34;, and steps 158-173 for sending back the clock pulse to the master based on the measured transfer clock pulse period are essentially identical to the steps 104-120 of the sub-routine &#34;TASK 1&#34;. For the transfer clock period TM of the bit 0, however, the measured period is meaningless because it merely detects the fall of the antenna terminal ANT. After the transfer clock period TM of the bit 6 has been measured, the bit 7 is &#34;1&#34; and the interrupt counter is cleared in the step 153 at the rise of the bit 7. Accordingly, the transfer clock periods TM are measured for the period of the bits 0-6 and the steps 153∝157 are carried out for the period of the bit 7. 
     The sub-routines &#34;MEASURE 0&#34; and &#34;MEASURE 1&#34; in the steps 145-152 comprise the steps shown in the flow charts of FIGS. 11 and 12, and the subroutine &#34;CTR CLR&#34; in the steps 158-173 comprises the steps shown in the flow chart of FIG. 10. 
     FIG. 14 shows a flow chart of the sub-routine &#34;ERROR&#34; of the step 67 in the main program. The sub-routine &#34;ERROR&#34; is executed after the microcomputers 21 and 31 have completed the execution of the &#34;TASK 1&#34; and &#34;TASK 2&#34;, respectively and it is a routine for determining a value of the bit 16 of the communication format (step  ○4  of FIG. 4). Referring to the flow chart of FIG. 14, the interrupt counter is cleared in a step 174, the content of the interrupt counter is compared with the transfer clock period TM in a step 175, and if they are equal, &#34;1&#34; is set to the antenna terminal ANT in a step 176 to indicate that the transfer clock has been synchronized. On the other hand, if they are not equal, it is checked in a step 177 if the error flag register has been set to &#34;1&#34;. If it is &#34;1&#34;, &#34;0&#34; is set to the antenna terminal ANT in a step 178 and the control is returned to the step 175. On the other hand, if the error flag is &#34;0&#34;, &#34;1&#34; is set to the antenna terminal ANT in a step 179, and it is checked in a step 180 if the antenna terminal ANT is &#34;1&#34; or not. The reason for this check is because the antenna terminal ANT can be set to &#34;0&#34; any time in order to indicate an error in the master or the slave and hence it is necessary to check it. 
     If the antenna terminal ANT is &#34;1&#34; in the step 180, the control is shifted to the step 175, and if it is not &#34;1&#34;, the error flag register is set to &#34;1&#34; in a step 181 and the control is returned to the step 175. In this manner, in the sub-routine &#34;ERROR&#34;, it is checked if the error flag register has been set in the sub-routines &#34;TASK 1&#34; and &#34;TASK 2&#34;, and if the error flag has been set to &#34;1&#34;, &#34;0&#34; is set to the antenna terminal ANT. If, the error flag has not been set to &#34;1&#34;, an error in the transmission by other station is detected and if the antenna terminal ANT has been set to &#34;0&#34; by the error in the other station, the error flag register is set to &#34;1&#34;, and when the content of the interrupt counter coincides with the transfer clock period TM at the end of the bit 16, &#34;1&#34; is set to the antenna terminal ANT and the control is returned to the main program. 
     FIGS. 15 and 16 show flow charts of the sub-routine &#34;TASK 3&#34; of the step 71 in the main program. In the sub-routine &#34;TASK 3&#34;, the master microcomputer 21 transfers the data to the slave microcomputer 31. Referring to the flow chart of FIG. 15, in steps 182 and 183, the antenna terminal ANT is reset to &#34;0&#34; and the sub-routine &#34;CTN CLR&#34; is executed and &#34;0&#34; of the bit 17 is sent out. In a step 184, the 12-bit data (bits 18-29) is transferred. FIG. 16 shows a flow chart of a sub-routine &#34;DATA OUT&#34;. Since the data to be transferred has been stored in the RAM 1 in the step 62 of the main program, the readout of the data and the serial transfer of the data are carried out in the sub-routine &#34;DATA OUT&#34; in accordance with the data control number. As shown in FIG. 16, in a step 196, the data control number is cleared, and in steps 197-199, the data stored in the location of the RAM 1 corresponding to the specified data control number is read out and &#34;0&#34; or &#34;1&#34; is set to the antenna terminal ANT depending on whether the data is &#34;0&#34; or &#34;1&#34;. 
     The control for an assigned one-bit period is carried out by the sub-routine &#34;CNT CLR&#34; in a step 200 (see. FIG. 10), and the data control number is incremented in a step 201. After the data corresponding to the data control numbers 0-11 have been transferred, it is detected in a step 202 and the execution of the sub-routine &#34;DATA OUT&#34; is terminated and the control is shifted to a step 185 of the sub-routine &#34;TASK 3&#34;. As described above, the check bits comprise three bits, the bits 30-32 and step 185-188 determine the value of the first bit or the bit 30 of the check bits. In the step 185, it is checked if the check bit 29 is 37 1&#34; or not, and if it is &#34;1&#34; the antenna terminal ANT is set to &#34;0&#34; in the step 186, and if it is &#34;0&#34;, the antenna terminal ANT is set to &#34;1&#34; in the step 187. The sub-routine &#34;CNT CLR&#34; in the step 188 controls the one bit transfer period as the step 184 does. 
     Steps 189-192 for the second bit of the check bits are essentially identical to the steps 185-188 and the value of the bit 25 is directly set to the bit 31. In a step 193, the antenna terminal is set to &#34;0&#34;, and in a step 194, the sub-routine &#34;CNT CLR&#34; is executed and the third bit or the bit 32 of the check bits is sent out to the transmission line. In a final step 195 of the sub-routine &#34;TASK 3&#34;, the antenna terminal ANT is set to &#34;1&#34;. 
     FIGS. 17 and 18 show flow charts of the sub-routine &#34;TASK 4&#34; in the step 72 of the main program. In the sub-routine &#34;TASK 4&#34;, the serial data transmitted from the slave is received and stored in the RAM 3, a transmission error in the data is checked, and if the error is not detected, the data stored in the RAM 3 is transferred to the RAM 2 to send out the data from the terminal OUT1 or OUT2. 
     Referring to the flow chart of FIG. 17, the interrupt counter is cleared in a step 203, and in steps 204 and 205 it is checked if the content of the interrupt counter is equal to double of the transfer clock period TM and if the antenna terminal ANT is &#34;1&#34; or not. If the slave does not start the data transfer when the content of the interrupt counter reaches the double of the transfer clock period TM, that is, if the antenna terminal ANT does not fall to &#34;0&#34;, the master microcomputer 21 does nothing and returns the control to the main program. In this manner, when the data is not transmitted from the slave, the transfer of the input data from the RAM 3 to the RAM 2 is not carried out. 
     In a step 205, when &#34;0&#34; at the antenna terminal ANT is detected, the transfer cycle is started and the sub-routine &#34;CNT CLR&#34; is executed in a step 206. After the period of the bit 34 has been elapsed, the transferred data is read in. In order to sample the data at the mid-point of the transfer clock period TM, the timing therefore is adjusted in a step 207, and the sub-routine &#34;DATA IN&#34; is executed in a step 208. The sub-routine &#34;DATA IN&#34; comprises steps 224-230 for reading in the input data to the RAM 3 in accordance with the data control number. 
     In the step 224, the data control number is cleared, and in the steps 225-227, the data transferred to the antenna terminal ANT is stored in the location of the RAM 3 specified by the data control number. In the step 228, the sub-routine &#34;CNT CLR&#34; is executed to control the period corresponding to the transfer clock period TS. In the step 229, the data control number is incremented by one. In the step 230, it is checked if the data control number has reached 12, and if it has not, the control is returned to the step 225, and if it has reached 12, the control is shifted to the sub-routine &#34;TASK 4&#34;. 
     In the sub-routine &#34;TASK 4&#34;, the data is sampled at the mid-point of the bit 47 (see FIG. 4). The bit 47 is the first bit of the 3-bit check bits and the value thereof is a complement of the bit 46. In the steps 209-213, this relation is checked. If the bit 47 is &#34;0&#34; in the step 209, it is checked in the step 210 if the bit 46 is &#34;1&#34; or not. If the bit 46 is &#34;0&#34;, it is not in a complementary relation to the bit 47 and a check miss flag register is set in the step 212 and the control is shifted to the sub-routine &#34;CNT CLR&#34; of the step 213. On the other hand, if the bit 46 is &#34;1&#34;, the control is shifted to the step 213. When the bit 47 is &#34;1&#34; and the bit 46 is &#34;1&#34;, it is detected in the steps 209 and 211 and the flag register is set. If the bit 47 is &#34;1&#34; and the bit 46 is &#34;0&#34;, the control is shifted from the steps 209 and 211 to the step 213. 
     In the steps 214-218, it is checked if the second bit or the bit 48 of the check bits is equal to the bit 42 or not. In the step 219, it is checked if the third bit or the bit 49 of the check bits is &#34;1&#34; or not, and if it is &#34;1&#34;, the check miss flag register is set in the step 220, and if it is &#34;0&#34;, the control is shifted to the step 221. Finally, in the step 221, it is checked if the content of the check miss flag register is &#34;1&#34; or not to check any error in the data transfer. If the content of the check miss register is not &#34;1&#34;, the data is the RAM 3 is written into the RAM 2, and if it is &#34;1&#34;, the check miss flag register is reset and the control is returned to the main program and the data in the RAM 3 is not written into the RAM 2. Thus, in case of error, new data is not sent out of the terminal OUT1 and OUT2 but the data previously stored in the RAM 3 (serial data in the previous frame) is sent out. 
     The master sub-routines &#34;TASK 3&#34; and &#34;TASK 4&#34; have been explained thus far with reference to FIGS. 15 and 18. The slave sub-routines &#34;TASK 4&#34; (step 73 of the main program) and &#34;TASK 3&#34; (step 74 of the main program) are essentially identical and hence the explanation thereof is omitted. 
     The antenna terminal ANT may include a photoelectric converter and the transmission line may be an optical fiber. 
     As described hereinabove, according to the present embodiment, the copying machine and the attachment device have the microcomputers for carrying out the serial-to-parallel and parallel-to-serial data conversion so that the data can be transferred serially. In addition, the number of pins of connectors for coupling the microcomputers is very small and a highly reliable data transfer apparatus is provided. In addition, the present embodiment is of simple construction and readily applied to the existing copying machine. 
     Furthermore, since the switching of master and slave is readily carried out between the copying machine and the attachment device, they can be used as tranceivers having no distinction of transmitter and receiver. Since the bilateral transmission is possible, a pair of microcomputers of the same function may be installed. Accordingly, an economic data transfer apparatus is provided. 
     When a bit error occurs in the data transfer, it is readily and correctly handled so that a highly reliable data transfer apparatus is provided. 
     An embodiment which further reduces the data transfer media is shown in FIG. 20. 
     FIGS. 19 to 21 and FIG. 23 show configurations of main portions of a data transfer apparatus and FIG. 22 shows an output signal of the unit of FIG. 21. 
     Referring to FIGS. 19 and 20, numerals 27 and 37 denote transmitting units for modulating the serial data and numerals 28 and 38 denote receiving units for demodulating the serial data. As shown in FIGS. 21 and 22, the transmitting units 27 and 37 each comprise a high frequency output circuit for pulse-frequency modulating an input signal to produce a high frequency continuous wave (CW). It supplied the input signal to a signal amplifier (SAMP), a modulator (MOD) and a high frequency amplifier (HFA) serially and modulates it to the high frequency continuous wave (CW) with a carrier being present for a mark portion of the serial digital data and the carrier being absent for a space portion. OSC denotes an oscillator. 
     On the other hand, the receiving units 28 and 38 each comprise, as shown in FIG. 23, a demodulator for converting the high frequency continuous wave modulated by the transmitting unit 27 or 37 to digital data, and it has a carrier detector CDC, a wave shaper WSC and a signal amplifier SAMP. The other elements are identical to those of FIG. 3-1. 
     In FIG. 20, numeral 42 denotes an antenna for air transmission connected to the master transmitting unit 27, and numeral 43 denotes an antenna for air transmission connected to the slave transmitting unit 37. The high frequency output supplied from one of the transmitting units 27 and 37 is radiated to the air through the corresponding antenna 42 or 43 and the signal propagated through the air is absrobed by the other antenna 43 or 42 and supplied to the corresponding receiving unit 38 or 28. 
     The operation of the data transfer apparatus thus constructed is now explained. The data from the pin 0 of the port R1 of the master microcomputer 21 is supplied to the transmitting unit 27 through the antenna terminal ANT ○1 . The high frequency signal from the transmitting unit 27 is radiated to the air by the antenna 42. 
     The signal propagated through the air is absorbed by the slave antenna 43 and supplied to the slave receiving unit 38. The serial digital data demodulated by the receiving unit 38 is supplied to the pin 1 of the port R1 of the slave microcomputer 31. 
     In the present data transfer apparatus, when the data is supplied from the copying machine to the input terminal IN1 comprising the terminals P113-P114 of the transmitter/receiver 20, the data is amplified by the amplifiers 23 and 24 and the amplified data is read into the microcomputer 21 through the terminals of the ports R2, R3 and K. The data is then converted to a serial data, which is transmitted from the port R1 to the transmitter/receiver 30 through the antenna terminal ANT ○1 , the transmitting unit 27, the antenna 42 and the antenna 43. The transmitter/receiver 30 receives the serial data through the receiving unit 38 and the antenna terminal ANT ○2  and supplies it to the port R1 of the microcomputer 31, which in turn reconverts the serial data to a parallel data and supplies it to the amplifiers 33 and 34 through ports O and P. The amplifiers 33 and 34 amplify the parallel data and transfer the amplified data to the output terminal OUT2 comprising the terminals P201-P212. 
     The data transfer from the slave transmitter/receiver 30 to the master transmitter/receiver 20 is similarly carried out. 
     In the present embodiment, a wireless propagation antenna is used as means for radiating the modulated signal to the air although it is not limited thereto. For example, the transmitter/receiver may be a combination of an electromagnet and a Hall IC or a combination of a light emitting element and a photosensitive element. 
     As described hereinabove, according to the present embodiment, a signal cable and a coupling connector therefor used in the prior art apparatus can be omitted. 
     An embodiment of the data transfer apparatus in which data is superimposed on a signal cable connecting the copying machine and the attachment device so that the existing signal cable need not be exchanged when the number of signals increases is now explained. 
     FIGS. 24 to 26 and 28 show the configuration of main portions of the data transfer apparatus in accordance with the present embodiment, and FIG. 27 shows an output signal of the unit of FIG. 26. 
     In FIG. 25, numerals 27 and 37 denote transmitting units for modulation, and numeral 28 and 38 denote receiving units for demodulation. As shown in FIGS. 26 and 27, the transmitting units 27 and 37 each comprise a FS modulator for frequency-shift modulating the input signal and it switches the frequencies f1 and f2 by a switch 39 depending on a mark portion and a space portion of the serial digital data in the input signal. On the other hand, the receiving units 28 and 38 each comprise, as shown in FIG. 27, a FS demodulator for converting the FS modulated input signal to a digital data, and it has a phase locked loop (PLL) 40 including a phase discriminator PD, a low-pass filter LPF and a voltage controlled oscillator VCO, a second low-pass filter LPF and a wave shaper WSC. The other elements are identical to those shown in FIG. 3-1. 
     In FIG. 25, numeral 41 denotes a signal cable for connecting the copying machine 11 with the attachment device 18. The FS-modulated high frequency data is carried over the signal cable 41 to serially transfer the data. Numerals 42 and 43 denote coupling capacitors which high-frequency-couple the signal cable 41 with the transmitting units 27 and 37 and the receiving units 28 and 38. Numeral 44 denotes a high frequency elimination filter. As shown in FIG. 24, the high frequency component superimposed on the signal cable 41 is eliminated by the filter 44. 
     The operation of the data transfer apparatus thus constructed is now explained. The data from the pin 0 of the port R1 of the master microcomputer 21 is supplied to the transmitting unit 27 through the antenna terminal ANT ○1 . The high frequency component of the FS modulated signal from the transmitting unit 27 is superimposed on the signal cable 41 through the capacitor 42. The high frequency component is then supplied to the slave receiving unit 38 through the signal cable 41 and the capacitor 43. The serial digital data demodulated by the receiving unit 38 is supplied to the pin 1 of the port R1 of the slave microcomputer 31. 
     In the present data transfer apparatus, when the data is supplied from the copying machine to the input terminal IN1 comprising the terminals P113-P124 of the transmitter/receiver 20, the data is amplified by the amplifiers 23 and 24, and the amplified data is read into the microcomputer 21 through the ports R2, R3 and K, and the microcomputer 21 converts it to a serial data and transmits it to the transmitter/receiver 30 from the port R1 through the antenna terminal ANT ○1 , the transmitting unit 27, the coupling capacitor 42, the signal cable 41 and the coupling capacitor 43. The transmitter/receiver 30 receives the serial data through the receiving unit 38 and the antenna terminal ANT ○2 and supplies it to the port R1 of the microcomputer 31, which in turn reconverts the serial data to a parallel data and supplies it to the amplifiers 33 and 34 through the terminals of the ports O and P. The amplifiers 33 and 34 amplify the parallel data and supply the amplified data to the output terminal OUT2 comprising the terminals P201-P212. 
     The transmission of the data from the slave transmitter/receiver 30 to the master transmitter/receiver 20 is carried out in a similar manner. In this case, like the previous case, the microcomputer 31 carries out the parallel-to-serial data conversion and the microcomputer 21 carries out the serial-to-parallel data conversion. In this manner, the transmitter/receivers 20 and 30 can transmit the data bilaterally through the signal cable 41. 
     In the present embodiment, by the use of the FS modulation, the number of signals transmitted through the existing signal cable can be remarkably increased, and the existing cable need not be exchanged when the number of signals is to be increased in future. Since the construction is simple, it is readily applicable to the existing copying machine. 
     It is possible to replace the single wire signal cable by an optical fiber by converting the data to be transferred to a light signal. 
     FIG. 29 shows an embodiment of the data transfer apparatus in which the signal cable is omitted by superimposing the data to a power supply line of a power supplied from the copying machine to the attachment device. 
     In FIGS. 25 and 29, numeral 41 denotes a power supply line of a power supplied from the copying machine 11 to the attachment device 18. The FS modulated high frequency data is superimposed on the power supply line 41 to serially transfer the data. Numerals 42 and 43 denote coupling capacitors which high-frequency-couple the power supply line 41 with the transmitting units 27 and 37 and the receiving units 28 and 38. Numeral 45 denotes a filter for eliminating a high frequency component. As shown in FIG. 3, the high frequency component superimposed on the power supply line 41 is eliminated by the filter 44 and then power is supplied to the sequence controller 19. The operation of the data transfer is same as that of FIG. 25. 
     In the present embodiment, the existing signal cable and the connectors therefor can be omitted and a highly reliable serial data transfer apparatus is provided. 
     Referring to FIGS. 30 to 32, switching of the transmission line is explained. 
     FIGS. 30 and 31 and FIGS. 26 and 28 show configurations of major portions of the data transfer apparatus of the present embodiment. In FIGS. 30 and 31, numeral 20 denotes a copying machine tranceiver, a numeral 30 denotes an attachment device tranceiver, numerals 21 and 31 denote data transfer microcomputers for serial-to-parallel and parallel-to-serial converting the data, respectively, and numerals 22 and 32 denote master/slave switches. By turning on or off one of the switches 22 and 32, one of the tranceivers 20 and 30 is switched to the master and the other is switched to the slave. Numerals 23-26 and 33-36 denote amplifiers. 
     In FIGS. 30 and 31, numerals 27 and 37 and numerals 27A and 37A denote transmitter units for FS (frequency shift) modulating the serial digital data, and numerals 28 and 38 and numerals 28A and 38A denote receiver units for demodulating the input data. As shown in FIGS. 31 and 27, the transmitter units 27 and 37 or 27A and 37A each comprises an FS modulation circuit which converts the input signal to a square wave and FS modulates it. Marks and spaces of the input serial digital data are modulated with frequencies f1 and f2 selectively by a switch 40. On the other hand, as shown in FIG. 7, the receiver units 28 and 38 or 28A and 38A each comprises an FS demodulation circuit which converts the FS modulated input signal to a digital data, a phase locked loop having a phase discriminator PD, a low-pass filter LPF and a voltage controlled oscillator VCO, other low-pass filter LPF and a wave shaping circuit WSC. In FIG. 31, numeral 29 denotes a transmission line switch disposed between the master first transmitter unit 27 and the parallelly arranged second spare transmitter unit 27A. When the first transmitter unit 27 is down so that the communication is not attainable, the switch 29 is switched to connect the second transmitter unit 27A to the antenna terminal ANT ○1  of the pin 0 of the port R1 of the master microcomputer 21. Numeral 29A denotes a transmission line switch disposed between the master first receiver unit 28 and the parallelly arranged second spare receiver unit 28A. When the first receiver unit 28 is unable to communicate, the switch 29A is switched to connect the second receiver unit 28A to the antenna terminal ANT ○2  of the pin 1 of the port R1 of the master microcomputer 21. 
     Numeral 39 denotes a transmission line switch disposed between the slave first transmitter unit 37 and the parallelly arranged second spare transmitter unit 37A. When the first transmitter unit 37 is down so that the communication is not attainable, the switch 39 is switched to connect the second transmitter unit 37A to the antenna terminal ANT ○1  of the pin 0 of the port R1 of the slave microcomputer 31. Numeral 39A denotes a transmission line switch disposed between the slave first receiver unit 38 and the parallelly arranged spare second receiver unit 38A. When the first receiver unit 28 is unable to communicate, the switch 39A is switched to connect the second receiver unit 38A to the antenna terminal ANT ○2  of the pin 1 of the port R1 of the slave microcomputer. 
     Numerals 41 and 41A denote power supply lines of powers supplied from the copying machine 11 to the attachment device 18. The FS modulated high frequency data is superimposed on one of the parallel power supply lines 41 and 41A to serially transfer the data. The one power supply line 41 is connected to the master transmitter unit 27 and the master receiver unit 28 through a coupling capacitor 42 and connected to the slave first transmitter unit 37 and the slave receiver unit 38 through a coupling capacitor 43 to form a first data transmission line. The other power supply line 41A is connected to the master second transmitter unit 27A and the master receiver unit 28A through a coupling capacitor 42A and connected to the slave first transmitter unit 37A and the slave receiver unit 38A through a coupling capacitor 43A to form a second data transmission line. Accordingly, the second power supply line 41A serves as a spare data transmission line when the first communication line 41 is down. The power supply line 41 or 41A is RF-coupled to the tranceiver units 27 and 28, and 37 and 38, or 27A and 28, and 37A and 38A, respectively, by the coupling capacitors 42 and 42A or 43 and 43A. 
     Numeral 44 in FIG. 30 denotes a filter circuit for eliminating a high frequency component. The high frequency component superimposed on the power supply of the power supply lines 41 and 41A are eliminated by the filter circuit 44 before the power is supplied to the sequence controller 19. 
     The operation of the data transfer apparatus when the first data transmission line (power supply line) 41 is selected is now explained. The data from the pin 0 of the port R1 of the master microcomputer 21 is supplied to the transmitter unit 27 through the antenna terminal ANT ○1 . The high frequency component of the FS modulated signal from the transmitter unit 27 is superimposed on the power supply line 41 through the capacitor 42. The high frequency component is then supplied to the slave receiver unit 38 through the power supply line 41 and the capacitor 43. The serial digital data demodulated by the receiver unit 38 is supplied to the pin 1 of the port R1 of the slave microcomputer 31. 
     The subsequent operation is similar to that in FIGS. 3-18. 
     The microcomputers 21 and 31 control the synchronization of the transfer clock in a manner shown in FIG. 6, and if the clock period TM is approximately equal to TS, the mutual communication is permitted. The decision is made by the subroutine &#34;ERROR&#34; in a step 67. If the clock period TM is not equal to TS, &#34;1&#34; is set in the error flag register. The status of the error flag is determined by the microcomputer 21 in a step 68, and if the error flag is &#34;1&#34;, the control is shifted to a step 69 and the error flag register is reset. In a step 69-1 (FIG. 32), the TM counter in the RAM is incremented by one, and in a step 69-2, if the count of the TM counter has not reached a predetermined count, the control is returned to the step 62 but if the error flag is &#34;0&#34; the control is shifted to a step 70. The TM counter represents the number of times of communication unable. When the number of times reaches the predetermined count, it is determined that the first transmission line 41 is unable to communicate in a step 69-3 and &#34;1&#34; is set in a transmission line switch flag and the transmission line switches 29 and 39, and 29A and 39A are switched to the positions  ○2  to connect the second transmission line 41A to the microcomputers 21 and 31. Then, the control is shifted back to the step 62. 
     The switching to the second transmission line 41A when the first transmission line 41 is unable to communicate. As described above, since the number of times of communication unable is stored in the TM counter of the RAM in the step 69-1 of FIG. 32 (which is a modification of FIG. 6), if the count reaches the predetermined count in the step 69-2, it is determined that the first transmission line 41 is unable to communicate, and in the step 69-3, &#34;1&#34; is set in the transmission line switch flag and the transmission line switches 29 and 29A, and 39 and 39A shown in FIG. 31 are switched to the positions  ○2 . As a result, as shown in FIG. 31, the transmitter unit 27 and the receiver unit 28 in tne copying machine tranceiver unit 20 are replaced by the spare transmitter unit 27A and the spare receiver unit 28A and the first transmission line 41 is replaced by the second transmission line 41A. In the attachment device tranceiver unit 30, the tranceiver units 37 and 38 are replaced by he spare tranceiver units 37A and 38A and the data transfer is resumed through the second transmission line 41A. 
     Accordingly, in the present embodiment, the first and second transmission lines are parallelly arranged between the copying machine and the attachment device so that when the first transmission line is unable to communicate the second transmission line is used to recover the communication. Thus, the existing signal cable and the connectors coupled thereto can be omitted and hence a highly reliable serial data transfer apparatus is provided. In addition, it is readily adaptable to the existing copying machine. 
     The manual selection of the transmission rate is now explained with reference to FIGS. 33 and 34. 
     In FIG. 33, numeral 40 denotes a master transmission rate selection switch connected to the port R4 of the microcomputer 21. The other portion is identical to that of FIG. 3-1. When the switch 40 is in an open position as shown, the transfer clock period TM is selected, and when it is switched to a close position, the transfer clock period TM&#39; is selected. Numeral 41 denotes a slave transmission rate selection switch connected to the port R4 of the microcomputer 31. When the switch 41 is in an open position, the transfer clock period TM is selected, and when it is switched to a close position, the transfer clock period TM&#39; is selected. 
     When the microcomputer 31 is in the slave mode by the master/slave switches 22 and 32, the selection of the transmission rate is effected in the master station and the function of the slave transmission rate selection switch 41 is suppressed. Accordingly, the switch 41 functions only when the microcomputer 31 is in the master mode. The other portion is identical to that of FIGS. 3-18. 
     In the step 63 of the main program shown in FIG. 6, the sub-routine &#34;TM SET&#34; of FIG. 34 is called and the steps 93-97 are executed. In the step 93, it is checked if the microcomputer 21 or 31 has been selected as the master by the master/slave switch 22 or 32, and if it has not, the control is shifted to the step 94 to set the count &#34;TM&#34; to the memory area for the period TM in the RAM, and the control is shifted to the step 97. On the other hand, if it has been selected as the master, the control is shifted to the step 95 to determine if the transmission rate selection switch 40 or 41 is open or closed. If it is open, that is, if the switch flag is &#34;1&#34;, the control is shifted to the step 94 to set the count &#34;TM&#34; in the memory area for the period TM in the RAM and the control is shifted to the step 97. If the switch 40 or 41 is closed, that is, if the switch flag is &#34;0&#34;, the count &#34;TM&#39;&#34; is set to the period TM in the RAM in the step 96 and the control is shifted to the step 97. In the step 97, an interrupt counter is started and the control is returned to the main program of FIG. 6. 
     The transmission rate of the master can be switched to correspond to the transmission rate of the slave by the &#34;TM SET&#34; means so that the problem of impossibility of communication due to the difference between the operation times of the master and the slave is resolved and the apparatus is readily adaptable to the change of the transmission status of the transmission line. 
     In the step 63 of the main program, the transfer clock period TM or TM&#39; is set to the RAM as described above and the interrupt counter is enabled. When a timer interrupt occurs, the interrupt routine of FIG. 8 is called and the steps 101-103 are executed. It is an interrupt of much shorter time interval than the pulse duration of FIG. 4. For each interrupt, the content of the interrupt counter is incremented, and when the interrupt counter overflows, that is, if the transmission rate of the partner station is significantly different from that of its own, the error flag register is set. The other portion is identical to that of FIGS. 3-18. 
     Referring to FIG. 35, the auto-selection of the transmission rate is explained. The microcomputers 21 and 31 control the synchronization of the transfer clock in the manner shown in FIG. 6, and if the clock period TM is equal to TM, the mutual communication is permitted. The decision is made by the sub-routine &#34;ERROR&#34; in the step 67. If the clock period TM is not equal to TS, &#34;1&#34; is set to the error flag register. The status of the error flag register is determined by the microcomputer 21 in the step 68, and if the error flag is &#34;1&#34;, the control is shifted to the step 69 and the error flag register is reset to recognize the mutual communication unable. Then, the control is returned to the step 62 to restart from the initial condition. The TM counter in the RAM is incremented by one to change the transmission rate. If the error flag is &#34;0&#34;, the control is shifted to the step 70. 
     In the step 63, the routine &#34;TM SET&#34; of FIG. 35 is called and the steps 93-100-1 are executed. In the step 93, it is checked if the master mode has been selected by the switch 27 or 37, and if it has not, &#34;TM0&#34; is set to the clock period TM of the RAM in the step 94. If the master mode has been selected, the steps 95-99 are executed. If the count of the TM counter of the RAM is no longer than &#34;2&#34;, &#34;TM0&#34;-&#34;TM2&#34; is set to the transfer clock period TM of the RAM depending on the count. If the count of the TM counter of the RAM is no smaller than &#34;3&#34;, the TM counter is cleared to &#34;0&#34; in the step 100. The interrupt counter is started in the step 100-1 and the control is returned to the main program. 
     In the step 63 of the main program, the transfer clock period TM is set in the RAM as described above and the interrupt counter is enabled. When the timer interrupt occurs, the interrupt routine of FIG. 8 is called and the steps 101-103 are executed. For each interrupt, the content of the interrupt counter is incremented, and if the interrupt counter overflows, the error flag register is set. 
     In the present embodiment, the master sends out the clock pulse indicating the transmission rate to the slave prior to the transfer of the serial data, and if the communication with the slave is not established, the setting of the period TM of the RAM is changed depending on the count of the TM counter of the RAM, that is, the number of times of communication unable and the master repeats the above operation with a sequence of different transmission rates until the communication is established. Accordingly, the data can be serially transferred at any transmission rate depending on the ability of the slave. 
     When the number of times of communication unable exceeds a predetermined number, the transmission line may be switched or an alarm may be displayed as shown in FIG. 32. 
     In the above embodiments, the apparatus may be constructed such that the master and the slave are established in at least two of the terminals such as copier, printer, word processor, family computer, auto-document feeder and sorter. Accordingly, the transfer data may be any of video data, information processing data and control data.