M68HC16 Z SERIES
MULTICHANNEL COMMUNICATION INTERFACE
USER’S MANUAL
10-23
10.5 MCCI Initialization
After reset, the MCCI remains in an idle state. Several registers must be initialized be-
fore serial operations begin. A general sequence guide for initialization follows.
A. Global
1. Configure MMCR
a. Write an interrupt arbitration number greater than zero into the IARB field.
b. Clear the STOP bit if it is not already cleared.
2. Interrupt vector and interrupt level registers (MIVR, ILSPI, and ILSCI)
a. Write the SPI/SCI interrupt vector into MIVR.
b. Write the SPI interrupt request level into the ILSPI and the interrupt re-
quest levels for the two SCI interfaces into the ILSCI.
3. Port data register
a. Write a data word to PORTMC.
b. Read a port pin state from PORTMCP.
4. Pin control registers
a. Establish the direction of MCCI pins by writing to the MDDR.
b. Assign pin functions by writing to the MPAR.
B. Serial Peripheral Interface
1. Configure SPCR
a. Write a transfer rate value into the BAUD field.
b. Determine clock phase (CPHA) and clock polarity (CPOL).
c. Specify an 8- or 16-bit transfer (SIZE) and MSB- or LSB-first transfer
mode (LSBF).
d. Select master or slave operating mode (MSTR).
e. Enable or disable wired-OR operation (WOMP).
f. Enable or disable SPI interrupts (SPIE).
g. Enable the SPI by setting the SPE bit.
C. Serial Communication Interface (SCIA/SCIB)
1. To transmit, read the SCSR, and then write transmit data to the SCDR. This
clears the TDRE and TC indicators in the SCSR.
a. SCI control register 0 (SCCR0)
b. Write a baud rate value into the BR field.
2. Configure SCCR1
a. Select 8- or 9-bit frame format (M).
b. Determine use (PE) and type (PT) of parity generation or detection.
c. To receive, set the RE and RIE bits in SCCR1. Select use (RWU) and
type (WAKE) of receiver wakeup. Select idle-line detection type (ILT) and
enable or disable idle-line interrupt (ILIE).
d. To transmit, set TE and TIE bits in SCCR1, and enable or disable WOMC
and TCIE bits. Disable break transmission (SBK) for normal operation.
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
.
..