English
Language : 

Z85233 Datasheet, PDF (220/317 Pages) Zilog, Inc. – The Zilog SCC Serial Communication Controller
Application Note
SCC in Binary Synchronous Communications
TRANSMIT OPERATION
To transmit a block of data, the main program calls up the the characters sent to the Z-SCC in the CRC calculation,
9 transmit data routine. With this routine, each message until the Transmit CRC bit is disabled. CRC generation can
block to be transmitted is stored in memory, beginning with be disabled for a particular character by resetting the
location ‘TBUF’. The number of characters contained in TxCRC bit within the transmit routine. In this application,
each block is determined by the value assigned to the however, the Transmit CRC bit is not disabled, so that all
‘COUNT’ parameter in the main module.
characters sent to the Z-SCC are included in the CRC
calculation.
To prepare for transmission, the routine enables the
transmitter and selects the Wait On Transmit function; it The Z-SCC’s transmit underrun/EOM latch must be reset
then enables the wait function. The Wait On Transmit sometime after the first character is transmitted by writing
function indicates to the CPU whether or not the Z-SCC is a Reset Tx Underrun/EOM command to WR0. When this
ready to accept data from the CPU. If the CPU attempts to latch is reset, the Z-SCC automatically appends the CRC
send data to the Z-SCC when the transmit buffer is full, the characters to the end of the message in the case of an
Z-SCC asserts its Wait line and keeps it Low until the underrun condition.
buffer is empty. In response, the CPU extends its I/O
cycles until the Wait line goes inactive, indicating that the Finally, a five-character delay is introduced at the end of
Z-SCC is ready to receive data.
the transmission, which allows the Z-SCC sufficient time to
transmit the last data byte, two CRC characters, and two
The CRC generator is reset and the Transmit CRC bit is sync characters before disabling the transmitter.
enabled before the first character is sent, thus including all
RECEIVE OPERATION
Once the Z-SCC is initialized, it can be prepared to receive
data. First, the receiver is enabled, placing the Z-SCC in
Hunt mode and thus setting the Sync/Hunt bit in status
register RR0 to 1. In Hunt mode, the receiver is idle except
that it searches the incoming data stream for a sync
character match. When a match is discovered between the
incoming data stream and the sync characters stored in
WR6 and WR7, the receiver exits the Hunt mode, resetting
the Sync/Hunt bit in status register RR0 and establishing
the Receive Interrupt On First Character mode. Upon
detection of the receive interrupt, the CPU generates an
Interrupt Acknowledge cycle. The Z-SCC sends to the
CPU vector %2C, which points to the location in the
Program Status Area from which the receive interrupt
service routine is accessed.
The receive data routine is called from within the receive
interrupt service routine. While expecting a block of data,
the Wait On Receive function is enabled. Receive data
buffer RR8 is read, and the characters are stored in
memory locations starting at RBUF. The Start of Text
(%02) character is discarded. After the End of
Transmission character (%04) is received, the two CRC
bytes are read. The result of the CRC check becomes valid
two characters later, at which time, RR1 is read and the
CRC error bit is checked. If the bit is zero, the message
received can be assumed correct; if the bit is 1, an error in
the transmission is indicated.
Before leaving the interrupt service routine, Reset Highest
IUS (Interrupt Under Service), Enable Interrupt on Next
Receive Character, and Enter Hunt Mode commands are
issued to the Z-SCC.
If a receive overrun error is made, a special condition
interrupt occurs. The Z-SCC presents the vector %2E to
the CPU, and the service routine located at address
%447A is executed. The Special Receive Condition
register RR1 is read to determine which error occurred.
Appropriate action to correct the error should be taken by
the user at this point. Error Reset and Reset Highest IUS
commands are given to the Z-SCC before returning to the
main program so that the other lower priority interrupts can
occur.
SOFTWARE
Software routines are presented in the following pages.
These routines can be modified to include various versions of
Bisync protocol, such as Transparent and Nontransparent
modes. Encoding methods other than NRZ (e.g., NRZI, FM0,
FM1) can also be used by modifying WR10.
UM010901-0601
6-85