161
Note that the slave port on the master Rabbit processor is not used; the master uses the
data bus to send and receive data to the slave port data registers on the slave devices.
In this setup, pins PE6 and PE7 are set up as I/O strobe chip selects for the two slave devices,
and PE0 and PE1 are used as external interrupt inputs to monitor the /SLAVEATTN signals
from the slaves.
In this setup, the slave port is used as follows:
The slave responds to the interrupt and reads the slave port data registers.
When the slave wishes to send data to the master, it writes the slave port data registers,
writing SPD0R last, which enables the /SLAVEATTN signal.
When the master detects the change on /SLAVEATTN, it reads the slave port data
registers.
19.3.1 Master Setup
1. Enable the I/O strobes on PE6 and PE7 by writing to the appropriate Parallel Port E pin
and external I/O registers.
2. Enable the external interrupts on PE0 and PE1 by writing to the appropriate external
interrupt registers.
19.3.2 Slave Setup
1. Write the vector to the interrupt service routine to the internal interrupt table.
2. Configure SPCR to select the interrupt priority (note that interrupts will be enabled
once this value is set).
Table 19-3. Typical Slave Port Connections
Master
Slave #1
Slave #2
Data Bus
D0–D7
SD0–SD7
PA0–PA7
SD0–SD7
PA0–PA7
Address Bus
A0–A1
SA0–SA1
PB4–PB5
SA0–SA1
PB4–PB5
I/O Read Strobe
/IORD
/SRD
PB3
/SRD
PB3
I/O Write Strobe
/IOWR
/SWR
PB2
/SWR
PB2
Slave #1 Chip Select
(I/O strobe I7)
PE7
/SCS
PB6
–
—
Slave #2 Chip Select
(I/O strobe I6)
PE6
—
/SCS
PB6
External Interrupt 0
(from Slave #1)
PE0
/SLAVEATTN
PB7
—
External Interrupt 1
(from Slave #2)
PE1
—
/SLAVEATTN
PB7