Applications Information
10-24
MC68307 USER’S MANUAL
MOTOROLA
10.4 MC68307 UART DRIVER EXAMPLES
The MC68307 UART driver code listed in this section was developed from MC68681
DUART driver software. The two principal changes described below are (a) the implemen-
tation of one UART channel, and (b) the use of the UART timer as the UART baud rate
well commented initialization, status, input and output routines.
(a) Where the DUART implemented two serial channels, the MC68307 UART implements
one. Accordingly, the memory map has changed to include only those registers appropri-
ate to the single channel (channel A).
(b) For peak integration of the MC68307, all internal module clocks are based on the sin-
gle processor clock. So, while the MC68681 based the standard baud rate settings of its
clock select register on a fixed 3.6864MHz external clock source, the MC68307’s baud
rate is developed from its 16.67MHz to D.C. range processor clock source. Therefore, the
MC68307 uses its programmable UART timer to prescale this processor clock source,
and generate the baud rate reference as desired.
The equation to calculate the UART timer prescaler for a desired baud rate is:
Baud rate generator prescaler = 68307 clock frequency/[16 x 2 x (UART baud rate)]
where, Baud rate generator prescaler = {UBG1:UBG2}
e.g., For 9600 baud from a 16.67MHz clock, the UART timer prescaler is 54 decimal (36
Hex). So, UBG1 = 0x00 and UBG2 = 0x36.
NOTE
The standard baud rate settings of the MC68307’s UART clock
select register (UCSR) are only relevant if the processor clock
frequency is a suitable multiple of 3.6864 MHz.
10.4.1 Software Listing 3
SIO
EQU
$FFF101
; Serial IO Base Address
* PORTW
EQU
1
; Byte wide port
PORTW
EQU
2
; Word wide port
* PORTW
EQU
4
; Long word wide port
CON_INDEX
EQU
0
UMR1
EQU
0*PORTW
; Mode register 1
UMR2
EQU
0*PORTW
; Mode register 2
USR
EQU
1*PORTW
; Status register
UCSR
EQU
1*PORTW
; Clock select register
UCR
EQU
2*PORTW
; Command register
URB
EQU
3*PORTW
; Receiver buffer register
UTB
EQU
3*PORTW
; Transmitter buffer regiseter
UACR
EQU
4*PORTW
; Auxiliary control register