Serial data communication system and apparatus
This application is a continuation of application Ser. No. 838,902, filed Mar. 12, 1986 now abandoned. 
    
    
     BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     This invention relates to a serial data communication system using serial data for half-duplex communication. 
     2. Description of the Prior Art 
     The data communication systems may be, as well known, divided into categories, namely the parallel and serial types. From the point of view of the transmission speed, the parallel communication is, of course, preferable. But, because of its necessity of an equal number of communication lines to the number of bits of data to be transmitted, it is inferior in cost advantage to the serial communication. 
     Also, in performing the serial communication, which of the full duplex and half-duplex communication methods is chosen is determined by taking into account the various factors such as cost and kinds of data to be transmitted. Most of the ordinary communication control systems employ the half-duplex communication method. 
     It has been customary that even this serial half-duplex communication system necessitates at least one data line and at least two busy lines which let one station know the operative position of a transmitter-receiver of the other station. 
     Yet, to realize a communication system having a great number of microprocessors, it is desired to reduce the required total number of lines thus simplifying the structure of construction. 
     SUMMARY OF THE INVENTION 
     With the foregoing in mind, it is a first object of the invention to provide a serial data communication system in which only one busy line suffices for detecting the operative positions of transmitter-receivers between two stations, while nevertheless permitting the serial half-duplex communication method t be employed. 
     A second object of the invention is to apply the serial data communication system to an imaging apparatus in which a serial data communication is carried out, whereby the states of a transmitter-receiver are made detectable by using only one busy line. 
     A third object of the invention is to provide a serial data communication system applied to an imaging apparatus having two stations therein between which serial data are communicated, whereby each other&#39;s operative positions of transmitter-receivers of the stations are made detectable by using only one busy line. 
     A further object of the invention is to provide a serial data communication system applied to an imaging apparatus having a lens portion and another portion besides the lens portion equipped with respective transmitter-receivers, whereby one busy line suffices in connecting two such transmitter-receivers with each other to detect each other&#39;s operative positions. 
     To achieve these objectives, the serial data communication system is constructed in such a way that the operative positions of a transmitter and a receiver of each other&#39;s station are tested based on single-line informations. In such a manner, the half-duplex communication is thus performed. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIGS. 1A and 1B are respectively a schematic diagram and a table illustrating the principle of the invention. 
     FIG. 2 is a flow chart of an example of transmission control program for the system of the invention. 
     FIG. 3 is a block diagram illustrating the construction of an embodiment of a transmitter-receiver according to the present invention. 
     FIG. 4 is a pulse timing chart illustrating a manner in which the system of FIG. 3 operates. 
     FIG. 5 is a flow chart illustrating an example of variation of the step S3 of FIG. 2. 
     FIG. 6 is a perspective view of the outer appearance of an imaging apparatus comprising a body and an interchangeable lens mounting to which the invention is applied. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT 
     The present invention is next described in detail in connection with an embodiment thereof. 
     In FIG. 1A, the fundamental principle of the invention is depicted. That is, it is through one busy line BUSY that two stations A and B communicate with each other. What logic level that busy line takes depending on the opening and closing states of two switches SWA and SWB at either terminal end of the busy line BUSY is shown in FIG. 1B. 
     The switches SWA and SWB are provided in the stations A and B respectively as shown in FIG. 1A. Either in the progress of transmission, or when ready to transmit data (for example, when the data to be transmitted is stored in a buffer, or a data transmission is requested), the one of the switches which is in the operator&#39;s station namely, SWA or SWB, is either in OFF state or opened. Conversely when there is no will to send, that switch SWA or SWB is left in ON state. 
     When in the receiving mode, these switches are operated in a similar manner to that described above. In more detail, when data are being received, the one of the switches which is in the receiving station is in OFF state. Conversely when waiting for data, that switch is left in ON state. 
     Now assuming that data are sent from station A to station B, then the operation is controlled as follows: At first, the switch SWA in station A is moved from ON to OFF state. Then, the logic level of the busy line BUSY is checked. If the busy line BUSY is found to be low level, (see row II in FIG. 1B), as this represents that the switch SWB in the receiving station B is in ON state (data waiting state), the data transmission from station A to station B is determined to be possible. 
     Conversely to this, if the level of the busy line BUSY is found high when the switch SWA of the transmitting station A is opened, as this represents that the switch SWB of the receiving station B is in OFF, the station B is determined as having will to send (or in the progress of transmitting). So it becomes impossible for the transmitting station A to send data. 
     In actual practice, to assure safety data communication, it is of great importance that before the start of data transmission, such checking of the busy line is repeated two or more times. 
     If it casually happens that the stations A and B start to send at the same time, the busy line BUSY takes high level (see row IV in FIG. 1B). This will lead to recycle the aforesaid checking countlessly. It is, therefore, preferable to give priority to one of the two stations A and B so that even when the switches SWA and SWB are simultaneously open, the host station (for example, station A) is allowed to transmit. 
     The flow chart of FIG. 2 specifies a procedure of operations of checking the busy line, controlling the operation of the switches, and so on to allow for one of the two stations to be taken as the host, and to make it possible for the host station to get priority in transmission. 
     Now assuming that the station A is the host, and the station B is the lower rank station, and that both stations happen to transmit at the same time, how to control the procedure is explained by reference to the flow chart Data to be transmitted is first stored in a transmission buffer at each of the stations A and B. So the test for the presence of the data in step S1 results in opening both switches SWA and SWB in step S2. Because the busy line BUSY then changes its level to high, the test in step S3 results in NO. A loop then begins that the host station checks the level of the busy line BUSY again (Steps S3→S6→S3). 
     Meanwhile, as to the station B, because it is not assumed to be the host station, the test in step S6 results in NO, causing the switch SWB to be set in ON in step S7. Thus, another loop returns to the initial state (step S1). 
     Therefore, for the second time the station A checks the busy line BUSY, as the station B which is not the host has already set its switch SWB in ON, the station A is allowed to start transmission. (Step S3 to step S4). Since at this time the station B becomes the receiving station, it is hindered from starting a transmitting operation until the operation of the transmitting station A terminates. 
     For note, the terms &#34;transmission start (unable to receive)&#34; mean that when the station A starts to transmit, it &#34;inhibits itself from performing the receiving operation&#34;. 
     As is obvious from the above-described flow chart, in case when the data to be transmitted are present in the host station, the checking of the busy line BUSY is recycled without limitation until the data become possible to be transmitted. In the other case when the data to be transmitted are in the station other than the host station, it is also possible to control so that he transmission is abandoned after some number of cycles of checking the busy line have been done, (or the state of the impossibility of transmission has been detected). 
     Also, in the above-described step S3, it is possible to control so that the checking of the busy line is recycled two or more times as shown in FIG. 5. This is very advantageous. It is in the flow of FIG. 5 that the procedure of operation is specified so that a transmission starts only when the number of cycles of having detected that the busy line BUSY is low level reaches N (where N is an integer not less than 2). The reason why such a segment is introduced is that the use of only one cycle of checking the busy line does not provide a sufficient reliability in determining that the transmission is allowable, for, as the checking takes place in synchronism with the rising edge of the clock pulse, there is some possibility of making a level detection error. Particularly with the partner station when in the progress of transmission, it will lead to destroy the data Therefore, the detection error is fatal. Hence, the introduction of the segment that the checking of the busy line is recycled over a plurality of times for every one transmitting operation into the flowchart of determining whether or not the transmission is allowable produces a great advantage. 
     FIG. 3 in an electrical circuit diagram, partly in block form, illustrates the details of the construction and arrangements of the elements of a transmitter-receiver employing the present invention in each of the stations A and B. 
     In block A, 1 is a flag signal (DATARDY) having a function of informing a central processing unit or CPU (not shown) that data are present in the receiver. 
     2 is a reading out command signal (/RDENBL) by which the received data are read out to the CPU through a data bus 3. 
     4 is writing data (WRDATA) which are to be stored in a buffer 6. 
     5 is a standard clock signal. 
     6 is the data buffer having a parallel-in serial-out function. 
     8 is another data buffer of a serial-in parallel-out function. 
     9 is a frequency divider for producing clocks for the transmitter and the receiver. 
     10 is a transmission status counter. 
     11 is a reception status counter. 
     12 is a logic circuit (bit adding circuit) for inserting a start bit and a stop bit into before and after the data to be transmitted. 
     13 is a latch circuit for a flag (/TXEMP) representing that there are no data to be sent to the transmitter. 
     14 is a latch circuit for the transmitter to check the busy line. 
     15 is a latch circuit for latching the transmitting data. 
     16 is a latch circuit for latching the flag (DATARDY). 
     The operation of transmitting 8-bit data from the station A to the station B is next described by reference to the timing chart of FIG. 4. 
     The transmitter in the station A first sets TXBUSY to high level. As, at this time, the level of the busy line is latched in the latch 14 in synchronism with the inverted clock by an inverter 17, the transmission status counter 10 performs checking two times in timings (i). 
     Since, at the aforesaid points in time, BUSY=L is detected, data (8 bits) starts to be transmitted. It is to be noted here that the logic circuit 12 sets the data line to &#34;L&#34; for the length of time equal to one bit as the start bit START preceding the 8-bit data. After the 8-bit data have been transmitted, the logic circuit 12 changes the data line to &#34;H&#34; at which it is maintained for the length of two bits as the stop bit STOP. 
     Such transmitting data for one clock are latched by the latch circuit 15. It sends the data to the station B through the data line. 
     Meanwhile, in the station B, the start bit START is checked in the timed relation (ii). So the station B knows that the data have sent in. The reception status counter included in the receiver RX of the station B sets RXBUSY to &#34;H&#34;. As a result, the line A: TXBUSY in the station A and the line B: RXBUSY in the station B both become &#34;H&#34;. So, the busy line takes BUSY=H. Since, at this time, the reception status counter 11 in the station A receives a receiver clear (RCLR) signal from the transmission status counter 10 of its own station, the receiving operation is inhibited. In the station B, on the other hand, since its transmission status counter (not shown) receives an RXBUSY signal of high level from its reception status counter, the transmitting operation is inhibited. 
     The receiver RX in the station B reads in the transmitted 8-bit data in timed relation (iii). And, in final, upon detection of the stop bit STOP in timed relation (iv), it sets the latch circuit 16. So that the flag DATARDY lets the CPU know that the data have been and are received and then changes the line B: RXBUSY to &#34;L&#34; (low level). Thus, the receiving ends. 
     Conversely when the data transmission takes place from the station B to the station A, the transmitter in the station B first checks the busy line by setting the line TXBUSY of the transmission counter to &#34;H&#34; (in timing (v)). After the termination of checking of the busy line, the transmitter in the station B sends out the start bit, 8-bit data and stop bits in sequence. 
     Meanwhile, the receiver in the station A after having detected the start bit in timed relation (vi) reads in the data (in timed relation (vii) At the last, by checking the stop bit, it sets the flag DATARDY in timed relation (viii), causing A: RXBUSY=L. As a result we have BUSY=L. 
     As has been described above, according to the embodiment of the invention, the use of one busy line enables the operating situation of the partner of the communication to be examined. This makes it possible to realize a half-duplex type serial data communication system of simplified form. 
     Also, in the embodiment, it is through terminals that the stations A and B are connected with each other as shown in FIG. 3. This implies that the paired stations are releasably connectable with each other, thereby giving a great advantage In more detail, since, according to the invention, one busy line suffices for grasping the operating situation of the communication partner, the necessary number of interconnection terminals can be reduced as compared with the prior art of having to employ at least two busy lines. The rate of occurrence of malfunction due to the poor contact between the interconnection terminals can be remarkably reduced. 
     Such an advantage becomes prominent when the system of the invention is installed in an image pickup apparatus (image forming apparatus) which comprises a body 100 and an interchangeable lens mounting 200 (accessory) therefor provided with respective transmitter-receivers each including a microcomputer or microcomputers, for example. In view of a very high frequency of attaching and detaching the lens mounting to and from the body, the reduction of the number of busy lines to a half will rapidly decrease the rate of encountering malfunctions due to the poor contact of the interconnection terminals. 
     In FIG. 6, the body is provided with power, busy, data and ground terminals T21 to T24 respectively in a lens mount ring 18 having a screw-threaded portion 19. 
     A hole 26 is bored in the ring 18, behind which is a switch for detecting when the attaching of the lens to the body is completed, as an actuator pin 25 in an adapter 18&#39; of the lens mounting enters through the hole 26. This adapter 18&#39; has a screw-threaded portion 19&#39; and interconnection terminals T&#39; 21 to T&#39; 24 arranged to contact with the terminals T21 to T24 respectively when the lens mounting is coupled with the body in an adjusted angular position by the pin 25-and-hole 26 connection. 
     As has been described above, according to the present invention, the structure of construction of such apparatus can be simplified thanks to the possibility for one busy line of grasping the operating situation of the transmitter-receiver of the partner station.