C165UTAH
High-Speed Synchronous Serial Interface
Data Sheet
312
2001-02-23
Port Control
The SSC uses three pins of Port 3 to communicate with the external world. Pin P3.13/
SCLK serves as the clock line, while pins P3.8/MRST (Master Receive / Slave Transmit)
and P3.9/MTSR (Master Transmit / Slave Receive) serve as the serial data input/output
lines.
The operation of these pins depends on the selected operating mode (master or slave).
In order to enable the alternate output functions of these pins instead of the general
purpose I/O operation, the respective port latches have to be set to '1', since the port
latch outputs and the alternate output lines are ANDed. When an alternate data output
line is not used (function disabled), it is held at a high level, allowing I/O operations via
the port latch. The direction of the port lines depends on the operating mode. The SSC
will automatically use the correct alternate input or output line of the ports when switching
modes. The direction of the pins, however, must be programmed by the user, as shown
in the tables. Using the open drain output feature helps to avoid bus contention problems
and reduces the need for hardwired hand-shaking or slave select lines. In this case it is
not always necessary to switch the direction of a port pin. The table below summarizes
the required values for the different modes and pins.
Note: In the table above, an 'x' means that the actual value is irrelevant in the respective
mode, however, it is recommended to set these bits to '1', so they are already in
the correct state when switching between master and slave mode.
14.3
Baud Rate Generation
The serial channel SSC has its own dedicated 16-bit baud rate generator with 16-bit
reload capability, allowing baud rate generation independent from the timers.
The baud rate generator is clocked with the CPU clock divided by 2 (fCPU/2). The timer
is counting downwards and can be started or stopped through the global enable bit
SSCEN in register SSCCON. Register SSCBR is the dual-function Baud Rate
Generator/Reload register. Reading SSCBR, while the SSC is enabled, returns the
content of the timer. Reading SSCBR, while the SSC is disabled, returns the
SSC Port Control
Pin
Master Mode
Slave Mode
Function
Port Latch Direction
Function
Port Latch Direction
SCLK
Serial Clock
Output
P3.13 = ’1’
DP3.13=’1’ Serial Clock
Input
P3.13 = ’x’
DP3.13=’0’
MTSR
Serial Data
Output
P3.9 = ’1’
DP3.9 = ’1’ Serial Data
Input
P3.9 = ’x’
DP3.9 = ’0’
MRST
Serial Data
Input
P3.8 = ’x’
DP3.8 = ’0’ Serial Data
Output
P3.8 = ’1’
DP3.8 = ’1’