![Rabbit Rabbit 4000 User Manual Download Page 176](http://html1.mh-extra.com/html/rabbit/rabbit-4000/rabbit-4000_user-manual_3116714176.webp)
166
Rabbit 4000 Microprocessor User’s Manual
18.3.3 Master/Slave Communication
1. The master writes data to the appropriate external I/O address on the data bus for the
slave device and register desired. For example, in the setup described here, the master
would write to register SPD2R on the first slave by writing to the address 0xC002
(0xC000 for the I6 strobe, and 0x0002 for SPD2R on that slave).
2. If the master is writing multiple bytes, it should write to SPD0R last since that will
trigger an interrupt on the slave device. If only one byte is being sent, it should be
written to SPD0R.
3. The slave responds to the interrupt, reading the data from the slave port data registers.
18.3.4 Slave/Master Communication
1. The slave writes data to the appropriate slave port data register. If it is writing multiple
bytes, SPD0R should be written last, which enables the /SLVATTN line.
2. The master receives an external interrupt from the /SLVATTN line, and reads the data
out of the slave port data registers via external I/O reads on the data bus.
18.3.5 Handling Interrupts
The interrupt request on the slave is cleared by either the master or the slave accessing one
of the slave port registers. To clear the interrupt without affecting the register values, a
dummy write can be made to SPSR.
18.3.6 Example ISR
A sample interrupt handler is shown below.
slave_isr::
push af ; save used registers
; read the data sent by the master
ioi ld a, (SPD2R)
ld (to_slv_d2), a
ioi ld a, (SPD1R)
ld (to_slv_d1), a
ioi ld a, (SPD0R)
ld (to_slv_d0), a
; if a response is required, perform it here
ld a, (to_mas_d2)
ioi ld (SPD2R), a
ld a, (to_mas_d1)
ioi ld (SPD1R), a
ld a, (to_mas_d0)
ioi ld (SPD0R), a ; this write asserts /SLVATTN
; the interrupt request is cleared by any read/write of the registers
pop af ; restore used registers
ipres
ret
Summary of Contents for Rabbit 4000
Page 1: ...Rabbit 4000 Microprocessor User s Manual 019 0152 070720 H...
Page 18: ...8 Rabbit 4000 Microprocessor User s Manual...
Page 40: ...30 Rabbit 4000 Microprocessor User s Manual...
Page 74: ...64 Rabbit 4000 Microprocessor User s Manual...
Page 82: ...72 Rabbit 4000 Microprocessor User s Manual...
Page 86: ...76 Rabbit 4000 Microprocessor User s Manual...
Page 96: ...86 Rabbit 4000 Microprocessor User s Manual...
Page 182: ...172 Rabbit 4000 Microprocessor User s Manual...
Page 240: ...230 Rabbit 4000 Microprocessor User s Manual...
Page 248: ...238 Rabbit 4000 Microprocessor User s Manual...
Page 256: ...246 Rabbit 4000 Microprocessor User s Manual...
Page 310: ...300 Rabbit 4000 Microprocessor User s Manual...
Page 330: ...320 Rabbit 4000 Microprocessor User s Manual...
Page 348: ...338 Rabbit 4000 Microprocessor User s Manual...