128
Rabbit 3000 Microprocessor User’s Manual
17.3.2 Clocked Serial Mode
The following steps explain how to set up Serial Ports A – D for the clocked serial mode.
When the internal clock is selected, the Rabbit 3000 is in control of all transmit and receive
operations. When an external clock is selected, the other device controls all transmit and
receive operation. For both situations the decision between polling and interrupt-driven
methods is application-dependent.
1. Write the interrupt vector for the interrupt service routine to the internal interrupt table.
2. Set up the desired data transmit and clock pins by writing to the appropriate parallel
port function register (PCFR or PDFR).
3. Select the appropriate mode by writing to SxCR (receive input port and clock source).
Also select the interrupt priority.
4. Select additional options by writing to SxER (clock polarity, bit order, and clock source
if external).
5. Write the desired divider value to TATxR for the appropriate serial port.
6. There are two methods to transfer a byte:
write the byte to SxDR and then write 10 (or 11) to bits 6–7 of SxCR to enable the
transfer;
write the byte to SxAR which will automatically start the transfer.
If the internal clock is selected, the transmission will begin immediately; if an external
clock is selected, the transmission will begin when the clock is detected.
7. To receive a byte, write 01 to bits 6-7 of SxCR to start the receive operation. If the
internal clock is selected, the clock will begin immediately and the data will be read; if
an external clock is selected, the receive will occur when the clock is detected.