MC68302 Applications
MOTOROLA
MC68302 USER’S MANUAL
D-17
* none of the Rx BDs will be available (all BDs Empty = 0). Thus, the
* status of this BD will be saved for examination later.
CMPI.B
#0,SS_BD(A1)
BNE.B
EXIT_TX
* Status bits are all 0
CLR.B
SS_BD(A1)
BTST.B
#WRAP,ST_BD(A1)
BNE.B
Wrap_T
ADDQ.W
#SZ_BD,A1
BRA.B
NxtCTD
Wrap_T
LEA.L
TXBD_01,A1
BRA.B
NxtCTD
EXIT_TX
JMP
OthrlNT
* Back to the main handler, that handles the rest of the events
;Check status bits
;Clear out all status bits
;Test Wrap bit
;
;Increment CTD to next BD
;Back to while loop
;Wrap back to the first Tx BD
;Back to the while loop
;Exit confirmer potion of the handler
********************Data after transmission ********************
* 00030000 0001 0203 0405 141A xxxx xxxx xxxx xxxx # Receiver Buffer 0
* 00030010 0001 0203 0405 141A xxxx xxxx xxxx xxxx # Receiver Buffer 1
* 00030020 0001 0203 0405 141A xxxx xxxx xxxx xxxx # Receiver Buffer 2
* 00030030 0001 0203 0405 141A xxxx xxxx xxxx xxxx # Receiver Buffer 3
* 00030040 0001 0203 0405 141A xxxx xxxx xxxx xxxx # Receiver Buffer 4
* 00030050 0001 0203 0405 141A xxxx xxxx xxxx xxxx # Receiver Buffer 5
* 00030060 0001 0203 0405 141A xxxx xxxx xxxx xxxx # Receiver Buffer 6
* 00030070 0001 0203 0405 141A xxxx xxxx xxxx xxxx # Receiver Buffer 7
00030080 0001 0203 0405 0607 0809 0A0B 0C0D 0E0F # Transmit Buffer
Notice that 141A is the 16-bit CRC
END
D.4 CONFIGURING A UART ON THE MC68302
The following paragraphs discuss a working example of software that configures the
MC68302 SCC3 for the UART mode. The code receives data from the UART receiver on a
character-by-character basis and retransmits it out of the UART transmitter. The code,
which runs as is on the
ADS302 board, is an excellent starting point for understanding how
to program the UART mode or to create a simple UART handler to support a debug monitor.
D.4.1 Purpose of the Code
This code is really a character “echo” generator — every character received is retransmitted
under control of the M68000 core on the MC68302. An automatic echo mode is available
with each SCC in the SCM register. Why do it manually in software The answer is that de-
veloping this concept in software is a good way to begin a more complete design since it
demonstrates reception, transmission, and some real-time issues.
The code receives and transmits data on a character-by-character basis, with interrupts
generated on each character received. Although the MC68302 UART mode has much more
flexibility and power than what is used by this code, many applications just require a simple
low-speed UART channel for debugging during the design. SCC3 is often chosen to run at
9600 baud for this purpose as shown in the example.
The code is shown in standard M68000 assembler. Efficiency was sacrificed, when neces-
sary, to enhance readability. The code is comprised of three basic parts. The first part ini-
tializes the MC68302 with everything required to set up SCC3 for the UART mode. The