19 SPI
19-8
EPSON
S1C17704 TECHNICAL MANUAL
19.6 SPI Interrupt
The SPI module can generate the following two types of interrupts:
• Transmit buffer empty interrupt
• Receive buffer full interrupt
The SPI module has one interrupt signal to be output to the interrupt controller (ITC) and it is shared with the two
causes of interrupt. To determine the cause of interrupt that has occurred, read the status flags.
Transmit buffer empty interrupt
Set the SPTIE bit (D4/SPI_CTL register) to 1 when using this interrupt. If SPTIE is set to 0 (default), an
interrupt request by this cause will not be sent to the ITC.
∗
SPTIE
: Transmit Data Buffer Empty Interrupt Enable Bit in the SPI Control (SPI_CTL) Register (D4/0x4326)
When the transmit data set in the transmit data buffer is transferred to the shift register, the SPI module sets the
SPTBE bit (D0/SPI_ST register) to 1 to indicate that the transmit data buffer is empty. At the same time, the
SPI module outputs an interrupt request pulse to the ITC if the transmit buffer empty interrupt has been enabled
(SPTIE = 1).
∗
SPTBE
: Transmit Data Buffer Empty Flag in the SPI Status (SPI_ST) Register (D0/0x4320)
If other interrupt conditions are satisfied, an interrupt is generated.
The SPI interrupt handler routine should read the SPTBE flag to check if the interrupt has occurred due to a
transmit buffer empty or another cause. When SPTBE = 0, the SPI interrupt handler routine can write the next
transmit data to the transmit data buffer.
Receive buffer full interrupt
Set the SPRIE bit (D5/SPI_CTL register) to 1 when using this interrupt. If SPRIE is set to 0 (default), an
interrupt request by this cause will not be sent to the ITC.
∗
SPRIE
: Receive Data Buffer Full Interrupt Enable Bit in the SPI Control (SPI_CTL) Register (D5/0x4326)
When data received in the shift register is loaded to the receive data buffer, the SPI module sets the SPRBF
bit (D1/SPI_ST register) to 1 to indicate that the received data buffer is full. At the same time, the SPI module
outputs an interrupt request pulse to the ITC if the receive buffer full interrupt has been enabled (SPRIE = 1).
∗
SPRBF
: Receive Data Buffer Full Flag in the SPI Status (SPI_ST) Register (D1/0x4320)
If other interrupt conditions are satisfied, an interrupt is generated.
The SPI interrupt handler routine should read the SPRBF flag to check if the interrupt has occurred due to a
receive buffer full or another cause. When SPRBF = 1, the SPI interrupt handler routine can read the received
data from the receive data buffer.
ITC registers for SPI interrupts
The following shows the control bits of the ITC provided for the SPI module:
Interrupt flag
∗
IIFT6
: SPI Interrupt Flag in the Interrupt Flag (ITC_IFLG) Register (D14/0x4300)
Interrupt enable bit
∗
IIEN6
: SPI Interrupt Enable Bit in the Interrupt Enable (ITC_EN) Register (D14/0x4302)
Interrupt level setup bits
∗
IILV6[2:0]
: SPI Interrupt Level Bits in the Internal Interrupt Level Setup (ITC_ILV3) Register 3 (D[2:0]/0x4314)
When the SPI outputs an interrupt request pulse, the interrupt flag IIFT6 is set to 1.
If the interrupt enable bit IIEN6 has been set to 1, the ITC sends an interrupt request to the S1C17 Core. To
disable the SPI interrupt, set the IIEN6 bit to 0.
The IIFT6 flag is always set to 1 by the SPI interrupt request pulse, regardless of how the IIEN6 bit is set (even
when set to 0).
The interrupt level setup bits IILV6[2:0] set the interrupt level (0 to 7) of the SPI interrupt.
Summary of Contents for S1C17704
Page 1: ...TECHNICAL MANUAL S1C17704 CMOS 16 BIT SINGLE CHIP MICROCOMPUTER ...
Page 22: ...1 OVERVIEW 1 10 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 42: ...3 MEMORY MAP BUS CONTROL 3 12 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 82: ...6 INTERRUPT CONTROLLER ITC 6 26 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 108: ...8 CLOCK GENERATOR CLG 8 8 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 112: ...9 PRESCALER PSC 9 4 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 138: ...10 I O PORTS P 10 26 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 156: ...11 16 BIT TIMERS T16 11 18 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 208: ...14 8 BIT OSC1 TIMER T8OSC1 14 16 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 234: ...16 STOPWATCH TIMER SWT 16 14 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 242: ...17 WATCHDOG TIMER WDT 17 8 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 264: ...18 UART 18 22 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 300: ...20 I2C 20 20 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 320: ...21 REMOTE CONTROLLER REMC 21 20 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 360: ...24 ON CHIP DEBUGGER DBG 24 6 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...
Page 362: ...25 BASIC EXTERNAL WIRING DIAGRAM 25 2 EPSON S1C17704 TECHNICAL MANUAL THIS PAGE IS BLANK ...