Abstract:
A method and apparatus for data exchange between a master microprocessor and a slave microprocessor, in which the connection is a parallel bus and the data exchange requires a minimum of time. For this purpose, the data are transmitted in a predetermined sequence and in which the transmission-start identifier is a signal train generated by the master processor which is specifically associated with data transmission. Preferably, a master processor and a slave processor are interconnected by the parallel data bus, with buffer memories, such as latches, interposed. A toggle flip-flop is connected to the interrupt input of the slave processor in such a way that merely placing a specific instruction (i.e. command+data) on the bus simultaneously notifies the slave processor to prepare for the exchange of data, thereby saving time.

Description:
This application is a continuation of application Ser. No. 06/810,937, filed Dec. 19, 1985, now abandoned. 
    
    
     The present invention relates generally to a method of exchanging data between a master microprocessor and a slave microprocessor and, more particularly, to a method in which each packet of data exchange is preceded by a specific signal train generated by the master processor. 
     BACKGROUND 
     The coupling, as such, of two microprocessors together has long been known. Data transmission is carried out either serially, through a standard interface, or in parallel, over a so-called data bus. Serial coupling has the disadvantage that the bit-by-bit transmission is very slow. If a general bus connection is used, the component to which the transmission is directed must first be addressed before the data protocol can be transmitted. Particularly in time-critical data transmissions, this system is generally unsatisfactory, since the addressing requires a relatively long period of time. 
     THE INVENTION 
     Accordingly, it is an object to transmit data without consuming extra time in addressing the component to which the data are directed. 
     Briefly, a master processor and a slave processor are interconnected by a parallel data bus, with buffer memories, such as latches, interposed. A toggle flip-flop is connected to the interrupt input of the slave processor in such a way that merely placing a specific instruction (i.e. command + data) on the bus simultaneously notifies the slave processor to prepare for the exchange of data, thereby saving time. The data are transmitted in a predetermined sequence. One advantage is that, if the READ or WRITE commands of the microprocessor are used as the specific signals, the transmission is particularly rapid. 
     A further advantage is that very few additional electrical components and connections are necessary. Still further, it is desirable for one of the microprocessors to generate a signal at the end of the transmission. Thereby, the signal transmission to the receiving microprocessor can be verified, and the possibility of transmitting subsequent signals is created. 
     The formation of the specific signals, particularly the READ- or WRITE-signals, is accomplished by a circuit component, to whose output signal the slave microprocessor can be connected. Thereby, the data transmission is achieved with a minimum of effort. The end of each transmission is preferably signaled over an interrupt line. Commitment of additional circuitry for this purpose is thus rendered unnecessary. 
    
    
     DRAWINGS 
     Further features and advantages of the invention will be apparent from the drawings, in which: 
     FIG. 1 schematically illustrates an example of a data exchange apparatus in accordance with the invention; 
     FIG. 2a and 2b in combination are a flowchart of the operation of the apparatus of FIG. 1; and 
     FIG. 3a, 3b and 3c represent a timing diagram of signals generated during operation of the apparatus. 
    
    
     DETAILED DESCRIPTION 
     FIG. 1 shows a master microprocessor 10, whose Input/Output (I/O) port is connected to the input of a latch 11. A corresponding input of the latch 11 is also connected to the WRITE signal output WR of the master microprocessor 10. The WRITE signal output WR also connects to the input of an OR-gate 14. The output of the latch 11 leads to an I/O port of a slave microprocessor 12. The READ-signal output RD of this slave microprocessor 12 is also connected to the latch 11. A latch 13 is anti-parallel connected to the latch 11 and transfers signals from the I/O port of the slave microprocessor 12 to the I/O port of the master microprocessor 10. The WRITE-signal output WR of the slave microprocessor 12 is connected to the latch 13. Further, the READ-signal output RD of the master microprocessor 10 is connected to the latch 13. In addition, a connection from the READ-signal output RD of the master microprocessor 10 leads to a further input of the OR-gate 14. The output of the OR-gate 14 leads to an input of a toggle flip-flop 15. 
     The toggle flip-flop 15 changes its output condition upon each WRITE- or READ-command of the master microprocessor 10. The output of the toggle flip-flop 15 is connected to the interrupt input INT of the slave microprocessor 12. Further, a port P of the master microprocessor 10 is connected to a corresponding port P of the slave microprocessor 12. 
     Suitable microprocessors are the model 8051 from Intel Corp. The structure and instruction set of this microprocessor are described in publicly available literature, are well known to those skilled in the art, do not per se form part of the present invention, and therefore need not be detailed in the present application beyond the details shown in FIG. 1. Of course, other microprocessors can be used, especially others of the 8000 series from Intel. 
     The question of which I/O ports of the master microprocessor 10 or the slave microprocessor 12 are used for data input or output is a an arbitrary choice depending upon the programming of the microprocessors. Any desired signal line of the available port can be used as the port P. This also is determined by the programming and, as such, does not form part of the present invention. A reset circuit 16 is also provided and is activated upon interruption of power or other electrical disturbances. The reset circuit 16 is connected with the reset input of the master microprocessor 10 and with the toggle flip-flop 15. This prevents the toggle flip-flop 15 from assuming an undefined condition if a disturbance occurs. 
     Operation, with reference to FIG. 2 and FIG. 3: These figures set forth the mode of operation of the data exchange, which may, if desired, comprise data transmission in only one direction. The microprocessor 10 serves as the master microprocessor and undertakes, for example, control tasks for an internal combustion engine of a motor vehicle. The magnitude and variety of the control tasks to be accomplished makes it necessary for the master microprocessor to transfer a portion of its processed output data to the slave microprocessor, so that the latter may take over the real-time output control of these quantities (e.g. sequential fuel injection). A portion of the calculations may also take place in the slave microprocessor. Further, the slave microprocessor can acquire a portion of the data required by the master microprocessor, do preliminary processing of it, and transfer it to the master microprocessor. So that the rapid processing speed of the two microprocessors is not wasted, the data transfer must also be accomplished very rapidly. 
     The master processor 10 has absolute priority over the data transmission, i.e. the master processor 10 calls up the data as needed or forwards them to the slave processor 12 as needed. The slave processor is controlled via its interrupt input, i.e. upon demand of the master processor, the slave processor interrupts whatever program it was running and transmits or receives the data demanded. 
     An important feature is that the data are transferred to and/or from the slave processor in the correct sequence. For this purpose, the data exchange must be commenced at a specific agreed or synchronized starting time. Thereafter, the data sequence is determined by the individual program steps, which are executed by the master processor 10. The aforementioned synchronization prevents incorrect data from ever being sent from slave processor 12 to master processor 10, even upon switching ON of the system, or upon resetting after a disturbance. Incorrect data may include not only incorrect bits, but also a string of correct bits which are transferred at an incorrect time or in an incorrect context, e.g. as a fragment of a longer bit string which would be interpreted differently. 
     FIG. 2a is an example of a flowchart for the operation of the master processor 10, while FIG. 2b is a flowchart for the operation of slave processor 12, during data exchange. To commence data exchange, at step 20, the master processor 10 sends the same data string twice to the latch 11, by means of a WRITE command. Thereafter, at step 21, the master processor continues with its master program. During execution of the twice-iterated WRITE command, the OR-gate 14 toggles the flip-flop (FF) 15 twice. FF 15 thus functions like a register. This produces the signal 40 shown in FIG. 3a. The first WRITE command causes the falling edge, while the second WRITE command causes the rising edge. The interrupt in slave microprocessor 12 is triggered, in the example described, by the falling edge of the interrupt signal. The slave microprocessor 12, which meanwhile has been executing its slave program, as shown at step 30 of FIG. 2b, stops its work in progress upon receipt at step 31 of the interrupt signal. It then switches to execution of a special interrupt program which controls the data exchange by the slave processor. FIG. 3b depicts the respective switch-over points as vertical lines. The time between the interrupt signal and the switch-over is allotted for the slave processor to complete execution of the instruction then in progress. 
     As soon as the slave processor 12 has switched over to the interrupt program, it checks, at step 32, to see what logic state or condition the interrupt line is in. Extra connecting lines are not necessary for this purpose, since the interrupt line can directly accessed. If this interrupt line, after the switch-over, is in the &#34;logical 1&#34; state, this means that the master processor has generated the first two READ or WRITE commands of a data transmission cycle. The slave processor recognizes, from this, that it must start the transmission to receive the first data word. At step 33, it retrieves the data which were written into the latch 11 by the master processor 10 at step 20. At step 34, data are written into the latch 13. After the end of the data exchange, the slave processor 12 generates a signal at port P which comprises a change in the original logic condition there, as shown in FIG. 3c. The first data exchange is completed. 
     After a period of time determined by the master program, the master processor 10 checks by an interrogation signal, at step 22, the port P. If its logic state has changed, the master processor 10 knows that the slave processor 12 has finished its work and has received or transmitted the data required. Since the last data handled were written by the slave processor 12 into the latch 13, the master processor 10 retrieves the data from the latch 13, by generating, at step 23, a READ command directed to the latch 13. This READ command acts via the OR-gate 14 to toggle the flip-flop 15, as shown in FIG. 3a by reference numeral 44. 
     While the master processor 10, after transfer of the data at step 24, continues with its master program, the toggling of the flip-flop 24 generates a new interrupt. The running of the slave program in interrupted, at step 36, by a switch-over to the interrupt routine or program. The slave processor 12 recognizes, from the fact that the interrupt line is in a &#34;logical 0&#34; state, that not the first data word, but rather the second data word is to be read out. It is easy to determine, in the slave processor 12, which data word is to read or written by providing a programmed counter which counts the switch-overs since the synchronization. As described above, data is read into or out of the latches 11 or 13. Upon completion of the READ procedure, the port P is again toggled, as shown in FIG. 3c. 
     The timing diagrams in FIG. 3 illustrate that, after the initializing twice-iterated WRITE command (40) and the following single WRITE or READ command (44), a READ command and a WRITE command follow alternately. If data are to be read in at step 25, for example, the rising edge of the pulse 41 triggers the reading of data into the latch 11 as the result of a WRITE command, while the falling edge triggers reading of data out of the latch 13. 
     Since an interrupt is triggered only by a pulse going from 1 to 0, the single WRITE command at step 26 does not cause an interrupt; rather, the interrupt occurs only after the following READ command at step 27, after the master processor 10 has verified, at step 25, that the slave processor 12 completed its former data transmission. If a complete data packet has been transmitted, it is possible, after a certain lapse of time, to set the interrupt line and the port line P to a &#34;logical 1&#34; state, as shown at the right side of FIG. 3. This setting &#34;high&#34; triggers no further function, since, as previously mentioned, an interrupt occurs only upon a transition from &#34;logical 1&#34; to &#34;logical 0&#34;. 
     An example will show that the method of the present invention permits rapid and secure transmission of data packets. The beginning of the data packet is recognized by the twice-iterated WRITE command. How one flags the beginning of the data transmission is somewhat arbitrary. Instead of a twice-iterated WRITE command, it would be equally possible to use a double READ command from microprocessor 10 or alternating WRITE and READ commands. The master microprocessor 10 writes data into the latch 11 and reads them out of latch 13. These can, for example, be &#34;logical 0&#39;s&#34; if no data have yet been written into latch 13. This must of course be a convention established by the program. 
     It is readily apparent that the above-described alternating WRITE and READ commands could be replaced by a READ and WRITE or a double READ or a double WRITE. This is dependent upon the application. It is also apparent that the interrupt function need not necessarily be triggered over the interrupt input, but could be triggered, for example, by controlling another arbitrarily selected port. 
     The significant feature is that, through a special structuring of the first signal, a synchronization between the two microprocessors 10 and 12 occurs and that the following data transmission is in a predetermined pattern, i.e. the data packet&#39;s sequence has been defined. It is also advantageous that the inputs and outputs already provided on the microprocessors can be used for data transmission purposes, thereby minimizing the number of necessary connections. 
     Those skilled in the art will appreciate that numerous changes and modifications are possible, within the scope of the inventive concept.