SCC Application Notes
AMD
7–14
7.3.4
When the SCC has been initialized and enabled, it is ready for communication. The trans-
mitter buffer and the receive FIFO are both empty. An interrupt will not be generated until
the software writes the first character to the transmit buffer. Once the first character is in
the SCC shift register, the first transmit interrupt will occur. The SCC then continues to
issue interrupts to the interrupt controller until the end of the message. At the end of the
message, a Reset Transmitter Interrupt Pending (WR0) is issued to clear the transmit
interrupt. After the last character is read into the SCC, the interrupts will cease until an-
other message is written into the transmitter.
Interrupt Routine
Once an interrupt is received and the interrupt controller vectors to the interrupt routine,
RR2 is read from channel B. The value read from RR2 is the vector, including status. This
vector shows the status of the highest priority interrupt pending (IP) at the time it is read.
Once the highest priority interrupt condition is cleared, RR2 will show the status of the
next highest interrupt pending, if one is present. This allows multiple interrupts to be serv-
iced without the overhead of the interrupt acknowledge cycle of the interrupt controller.
MIE is disabled and then enabled to guarantee an edge for an edge-sensitive interrupt
controller.
The following example shows how the interrupt routine should be coded.
BEGIN:
;
;
TXEMPTY:
;
LAST:
;
;
RXFULL:
;
SPECIAL;
INPUT
TEST
JE TXEMPTY
TEST
JUMP
OUT
OUT
IRET ;Return to Main
RR2
Bit 4 ;Test for Tx Empty
;Jump to Transmit Routine
Bit 5
;Test for Rx full
RXFULL ;Jump to Receive Routine
WR9 00 ;MIE Disabled
EOI ;Output EOI to Interrupt Controller
;Read RR2 from channel B
TEST NOMORE ;Test a last character flag
JE LAST ;Jump to LAST if no more characters
OUTPUT CHAR ;Output character to data port
DEC CHARCOUNT ;Decrement character count
JUMP BEGIN ;Jump to BEGIN to test for more IP
OUTPUT RR0,28H ;Reset Tx Interrupt Pending
JUMP BEGIN ;Jump to BEGIN to test for more IP
INPUT RR1 ;Read RR1
COMPARE RR1,00 ;Test for special condition bit set
JUMP NE ;Jump to SPECIAL
INPUT CHAR ;Input charcater from data port
JUMP BEGIN ;Jump to BEGIN to test for more IP
.
.
This means a framing error, receive overrun error or parity error
has occurred. Character may be read but data is not correct.
A flag should be set to post the error.
.
.
OUTPUT RR0, 30H ;Reset Error Command
JUMP BEGIN ;Jump to BEGIN to test for more IP
Figure 7–5. SCC Interrupt Routine