Asynchronous Serial Ports (UARTs)
Am186™CC/CH/CU Microcontrollers User’s Manual
13-5
register name indicates that both the UART and the High-Speed UART registers are being
described.
13.5.1.1
Transmit
This section describes the procedure for programming a transmit. To program a receive,
see page 13-6. To use autobaud mode, see page 13-7. Transfers can be done in Polled,
Interrupt, or DMA modes.
13.5.1.1.1
Initializing the Transmitter
Initialize the transmitter with the following steps:
1. Disable the UART by clearing the TMODE bit of the (H)SPCON0 register to 0.
Software can change interrupt masks without disabling the TMODE bit.
2. Set the baud rate with the (H)SPBDV register.
For information about detecting the baud rate automatically, see “Autobaud Mode (High-
Speed UART Only)” on page 13-7.
3. Set the applicable configuration options in the (H)SPCON1 register: break value,
extended write, external/internal clock, and FIFOs (High-Speed UART only). If software
enables FIFOs with the TFEN bit, it should also set the TFLUSH bit at the same time
(or before) to flush the FIFO.
4. Set the interrupts to be taken with the (H)SPIMSK register. Bits in this register are
second-level interrupt enables based on status bits in the (H)SPSTAT register. Set first-
level interrupt enables in the (H)SPCON0 register (see step 5). Note that corresponding
bits must be set in both registers for the interrupt to be taken. If software disables an
interrupt in (H)SPIMSK, it can still read the status from the (H)SPSTAT register.
5. Set the applicable configuration options in the (H)SPCON0 register—interrupts, breaks,
CTS/RTR hardware flow control, parity (odd, even, or none), address bit enable, number
of data bits in serial frame (7 or 8), and stop bit length (one or two)—and enable the
transmit by setting the TMODE bit to 1. All of these bits can be set simultaneously, but
the TMODE bit cannot be set before any of the other bits described in steps 2–5.
13.5.1.1.2
Transmitting Data
When the transmitter is initialized, to send data:
1. Verify that the THRE bit in the (H)SPSTAT register is set to 1 to ensure the transmit
register can be written without loss of data.
2. If FIFOs are being used (High-Speed UART only), instead of polling the THRE bit, verify
that the FIFO is not yet full (TTHRSH bit in the HSPSTAT register is set to 1).
3. To send an address bit with a particular frame w
hen extended writes are disabled
(EXDWR in (H)SPCON1 is 0):
a. Verify that TEMT = 1 to ensure any other transmissions have completed (the
transmitter and the transmit shift register are both empty).
b. Set the transmit AB bit in the (H)SPCON0 register to 1 if this address bit should be
sent as the MSB of TDATA for this frame.
When extended writes are enabled, write the value of the address bit with the data. In
this situation, the value of TEMT does not matter.
4. Write data to the (H)SPTXD register (this sets the THRE bit to 0).
Содержание Am186 CC
Страница 1: ...Am186 CC CH CU Microcontrollers User s Manual Order 21914B...
Страница 4: ...iv Am186 CC CH CU Microcontrollers User s Manual...
Страница 18: ...Table of Contents xviii Am186 CC CH CU Microcontrollers User s Manual...
Страница 24: ...Introduction xxiv Am186 CC CH CU Microcontrollers User s Manual...
Страница 39: ...Architectural Overview Am186 CC CH CU Microcontrollers User s Manual 1 15 Figure 1 6 32 Channel Linecard CH CC...
Страница 40: ...Architectural Overview 1 16 Am186 CC CH CU Microcontrollers User s Manual...
Страница 86: ...System Overview 3 36 Am186 CC CH CU Microcontrollers User s Manual...
Страница 92: ...Emulator Support 4 6 Am186 CC CH CU Microcontrollers User s Manual...
Страница 112: ...DRAM Controller 6 8 Am186 CC CH CU Microcontrollers User s Manual...
Страница 134: ...Interrupts 7 22 Am186 CC CH CU Microcontrollers User s Manual...
Страница 186: ...Programmable I O Signals 9 8 Am186 CC CH CU Microcontrollers User s Manual...
Страница 200: ...Watchdog Timer 11 6 Am186 CC CH CU Microcontrollers User s Manual...
Страница 232: ...Asynchronous Serial Ports UARTs 13 24 Am186 CC CH CU Microcontrollers User s Manual...
Страница 242: ...Synchronous Serial Port SSI 14 10 Am186 CC CH CU Microcontrollers User s Manual...
Страница 264: ...High Level Data Link Control HDLC 15 22 Am186 CC CH CU Microcontrollers User s Manual...
Страница 332: ...Universal Serial Bus USB 18 34 Am186 CC CH CU Microcontrollers User s Manual...
Страница 348: ...Register Summary A 16 Am186 CC CH CU Microcontrollers User s Manual...
Страница 376: ...Index Index 18 Am186 CC CH CU Microcontrollers User s Manual...