|
XA-C3 Datasheet, PDF (27/68 Pages) NXP Semiconductors – XA 16-bit microcontroller family 32K/1024 OTP CAN transport layer controller 1 UART, 1 SPI Port, CAN 2.0B, 32 CAN ID Filters, transport layer co-proce | |||
|
◁ |
Philips Semiconductors
XA 16-bit microcontroller family
32K/1024 OTP CAN transport layer controller
1 UART, 1 SPI Port, CAN 2.0B, 32 CAN ID filters, transport layer co-processor
Preliminary specification
XA-C3
1. Reception is initiated in Mode 1, 2, or 3 by the incoming start bit if
REN_0 = 1.
Serial Port Control Register
The serial port control and status register is the Special Function
Register S0CON, shown in Figure 16. This register contains not only
the mode selection bits, but also the 9th data bit for transmit and
receive TB8_0 (S0CON[3]) and RB8_0 (S0CON[2]), and the serial
port interrupt bits Transmit Interrupt flag TI_0 (S0CON[1]) and
Receive Interrupt flag RI_0 (S0CON[0]) .
Transmit Interrupt Flag
In order to allow easy use of the doubleâbuffered UARTâ0
transmitter feature, the TI_0 flag is set by the UARTâ0 hardware
under two conditions. The first condition is the completion of any
byte transmission. This occurs at the end of the stop bit in modes 1,
2, or 3, or at the end of the eighth data bit in mode 0. The second
condition is when S0BUF is written while the UARTâ0 transmitter is
idle.
Generally, UART transmitters generate one interrupt per byte
transmitted. However, UARTâ0 generates one additional interrupt
(as defined by the stated conditions for setting the TI_0 flag). This
additional interrupt does not occur if doubleâbuffering is bypassed
as explained below. Note: If characterâoriented transmission is used
(not blockâtransmission of characters), there could be a second
interrupt for each character transmitted, depending on the timing of
the writes to S0BUF. For this reason, it is generally better to bypass
doubleâbuffering when UARTâ0 is used in characterâoriented
mode. This is also true if UARTâ0 is polled rather than
interruptâdriven. The interrupt occurs at the end of the last byte
transmitted when the UART becomes idle. Among other things, this
allows a program to determine when a message has been
transmitted completely. The interrupt service routine should handle
this additional interrupt.
The recommended way to use transmit doubleâbuffering in an
application program is to have the UART interrupt service routine
handle a single byte for each interrupt occurrence. Thus, the
program will not require any special considerations for
doubleâbuffering. Transmitted bytes will then be tightly packed with
no intervening gaps. Note: Be aware that higher priority interrupts
may cause delays in servicing a transmitter interrupt, and this would
defeat doubleâbuffering.
9-Bit Mode
Because the ninth data bit TB8_0 (S0CON[3]) is not
doubleâbuffered, you must insure S0CON[3] contains the intended
ninth data bit whenever it is transmitted. Alternatively, to synchronize
the ninth data bit with the rest of the data stream, you could bypass
doubleâbuffering.
Bypassing Double-Buffering
The UART transmitter may be used as if it is singleâbuffered. The
recommended UART transmitter interrupt service routine (ISR)
technique to bypass doubleâbuffering first clears the TI_0 flag
(S0CON[1]) upon entry into the ISR, as in standard practice. This
clears the interrupt that activated the ISR. Secondly, the TI_0 flag is
cleared immediately following each write to S0BUF. This clears the
interrupt flag that would otherwise direct the program to write to the
second transmitter buffer. If there is any possibility that a higher
priority interrupt might become active between the write to S0BUF
and the clearing of the TI_0 flag, the interrupt system may have to
be temporarily disabled during that sequence by clearing, then
setting the EA bit (IEL[7]).
CLOCKING SCHEME AND BAUD RATE
GENERATION
Clock Rates for all UART Modes
For UART Modes 0 and 2 the UART clock rate is determined by a
fixed division of the oscillator clock. For Modes 1 and 3 the UART
clock rate is determined by the overflow rates of either T1 or T2.
Baud Rates for UART Modes 0 and 2
In UART Mode 0, the baud rate is fixed at fosc/16. In Mode 2,
however, it is fixed rate at fosc/32.
Baud Rate Calculations for UART Modes 0 and 2
Baud Rate for UART Mode 0:
Baud_Rate = fosc/16
Baud Rate for UART Mode 2:
Baud_Rate = fosc/32
Baud Rates for UART Modes 1 and 3
Table 9 shows the relationship of TCLK to preâscalar settings for all
Timers T0, T1, and T2.
Table 9. TCLK Frequencies
Preâscalar
Value
4
16
64
â
PT1 ; SCR[3]
0
0
1
1
PT0 ;
SCR[2]
0
1
0
1
TCLK
fosc/4
fosc/16
fosc/64
reserved
Thus, when Timers T0, T1, and T2 are used to establish the baud
rate for Baud Clock, the maximum speed of timers/(Baud Clock) is
fosc/4 (since the minimum preâscalar value N is equal to 4).
Consequently, the maximum Baud_Rate equals Timer_Rate (timer
overflow) divided by 16, i.e., fosc/64.
Baud Rate Calculations for UART Modes 1 and 3
Baud Rate calculations for UART Mode 1 and 3:
Baud_Rate = Timer_Rate/16
Timer_Rate = fosc/(N x (Timer_Range â Timer_Reload_Value))
where N = the TCLK prescaler value (4, 16, or 64).
and Timer_Range = 256 for Timer 1 in Mode 2.
and Timer_Range = 65536 for Timer 1 in Mode 0 and
Timer 2 in countâup mode.
The timer reload value may be calculated as follows:
Timer_Reload_Value = Timer_Range â
(fosc/(Baud_Rate*N*16))
NOTES:
1. The maximum baud rate for UARTâ0 in Mode 1 or 3 is fosc/64.
2. The lowest possible baud rate (for a given oscillator frequency
and N value) may be found by using a timer reload value of 0.
2000 Jan 25
20
|
▷ |