
34#!##1
User
’
s Manual
12-5
1999-08
The shift register of the SSC is connected to both the transmit pin and the receive pin via
the pin control logic (see block diagram). Transmission and reception of serial data is
synchronized and takes place at the same time, i.e. the number of transmitted bits is also
received. Transmit data is written into the Transmit Buffer SSCTB. It is moved to the shift
register as soon as this is empty. An SSC-master (SSCMS=
’
1
’
) immediately begins
transmitting, while an SSC-slave (SSCMS=
’
0
’
) will wait for an active shift clock. When
the transfer starts, the busy flag SSCBSY is set and a transmit interrupt request
(SSCTIR) will be generated to indicate that SSCTB may be reloaded again. When the
programmed number of bits (2...16) has been transferred, the contents of the shift
register are moved to the Receive Buffer SSCRB and a receive interrupt request
(SSCRIR) will be generated. If no further transfer is to take place (SSCTB is empty),
SSCBSY will be cleared at the same time. Software should not modify SSCBSY, as this
flag is hardware controlled.
Note: Only one SSC (etc.) can be master at a given time.
The transfer of serial data bits can be programmed in many respects:
the data width can be chosen from 2 bits to 16 bits
transfer may start with the LSB or the MSB
the shift clock may be idle low or idle high
data bits may be shifted with the leading or trailing edge of the clock signal
the baudrate may be set within a wide range (see baudrate generation)
the shift clock can be generated (master) or received (slave)
This allows the adaptation of the SSC to a wide range of applications, where serial data
transfer is required.
The Data Width Selection
supports the transfer of frames of any length, from 2-bit
“
characters
”
up to 16-bit
“
characters
”
. Starting with the LSB (SSCHB=
’
0
’
) allows
communication e.g. with ASC0 devices in synchronous mode (C166 Family) or 8051 like
serial interfaces. Starting with the MSB (SSCHB=
’
1
’
) allows operation compatible with
the SPI interface.
Regardless which data width is selected and whether the MSB or the LSB is transmitted
first, the transfer data is always right aligned in registers SSCTB and SSCRB, with the
LSB of the transfer data in bit 0 of these registers. The data bits are rearranged for
transfer by the internal shift register logic. The unselected bits of SSCTB are ignored, the
unselected bits of SSCRB will be not valid and should be ignored by the receiver service
routine.
The Clock Control
allows the adaptation of transmit and receive behaviour of the SSC
to a variety of serial interfaces. A specific clock edge (rising or falling) is used to shift out
transmit data, while the other clock edge is used to latch in receive data. Bit SSCPH
selects the leading edge or the trailing edge for each function. Bit SSCPO selects the
level of the clock line in the idle state. So for an idle-high clock the leading edge is a
falling one, a 1-to-0 transition. The figure below is a summary.