146 Rabbit 2000 Microprocessor13.3.2 Master-Slave Messaging ProtocolIn this protocol the master sends messages to the slave and receives an acknowledgementmessage. The protocol can be polled or interrupt driven. Generally, the master sends amessage that has a message type code, perhaps a byte count, and the text of the message.The slave responds with a similar message as an acknowledgement. Nothing happensunless the master sends a message. The slave is not allowed to initiate a message, but theslave could signal the master by using a parallel port line other than /SLAVEATN or byplacing data in one of the registers the master can read without interfering with the mes-sage protocol.The master sends a message byte by storing it in SPD0R. The slave notices that SPD0R isfull and reads the byte. When the master notices that SPD0R is empty because the slaveread it, the master stores the next byte in SPD0R. Either side can tell if any register isempty or full by reading the status register. When the slave acknowledges the messagewith a reply message, the process is reversed. To perform the protocol with interrupts, aslave interrupt can be generated each time the slave receives a character. The slave canacknowledge the master by reading SPD0R if the master is polling for the slave responseto each character. If the master is to be interrupted to acknowledge each character, theslave can create an interrupt in the master by storing a dummy character in SPD0R to cre-ate a master interrupt, assuming that the /SLAVEATTN line is wired to interrupt the mas-ter. The acknowledgement message works in a similar manner, except that the masterwrites a dummy character to interrupt the slave to say that it has the character.Several problems can arise if there are dual interrupts for each character transmitted. Oneproblem is that the message transmission rate will free run at a speed limited by the inter-rupt latency and compute speed of each processor. This could consume a high percentageof the compute resources of one or both processors, starving other processes and espe-cially interrupt routines, for compute time. If this is a problem, then a timed interrupt canbe used to drive the process on one side, thus limiting the data transmission rate.Another solution, which may be better than limiting the transmission rate, is to use inter-rupts only for the first byte of the message on the slave side, and then lower the interruptpriority and conduct the rest of the transaction as a polled transaction. On the master sidethe entire transaction can be a polled transaction. In this case, the entire transaction takesplace in the interrupt routine on the slave, but other interrupts are not inhibited since thepriority has been lowered.A typical slave system consists of a Rabbit microprocessor and a RAM memory con-nected to it. The clock can be provided either by connecting a crystal, or crystals to theslave or by providing an external clock, which could be the master’s clock. The reset lineof the slave would normally be driven by the master. At system startup time the masterresets the slave and cold boots it via the slave port. (The SMODE pins must be configuredfor this.) Once the software is loaded into the slave, the slave can begin to perform itsfunction.