Jameco Electronics 3000 User Manual

Page of 349
208
Rabbit 3000 Microprocessor
for this.) Once the software is loaded into the slave, the slave can begin to perform its 
function.
As a simple example, suppose that the slave is to be used as a four-port UART. It has the 
capability to send or receive characters on any of its four serial ports. Leaving aside the 
question of setup for parameters, such as the baud rate, we could define a protocol as fol-
lows.
SPD0R readable by master is a status register with bits indicating which of the four 
receivers and four transmitters is ready, that is, has a character received or is ready to 
send a character.
SPD0R writable by the master is a control register used to send commands to the slave.
SPD1R is used to send or receive data characters or control bytes.
The line /SLAVEATTN is wired to the external interrupt request of the master so that 
the master is interrupted when the slave writes to SPD0R. Typically the slave will write 
to SPD0R when there is a change of status on one of the serial ports.
The slave can interrupt the master at any time by storing to SPD0R. It will do this every 
time an enabled transmitter is ready to accept a character or every time an enabled receiver 
receives a character. When it stores to SPD0R, it will store a code indicating the reason for 
the interrupt, that is, receive or transmit and channel number. If the cause is receive, the 
received character will also be placed in SPD1R writable by the slave. When the master is 
interrupted for any reason, the master will sneak a peek at SPD0R by reading SPSR. If the 
interrupt is caused by a receive character, it will remove the character from SPD1R and 
read SPD0R to handshake with the slave.
If the master is interrupted for transmitter ready, as determined by the sneak peek, it will 
place the outgoing character in SPD1R and write a code to SPD0R indicating transmit and 
channel number. This will cause the slave to be interrupted, and the slave will take the 
character and handshake by reading SPD0R. This handshake does not interrupt the master.