7- 50
MC68341 USER’S MANUAL
MOTOROLA
7.5.2 Serial Module Example Configuration Code
The following code is an example of a configuration sequence for the serial module.
***************************************************************************
* MC68341 basic serial module register initialization example code.
* This code is used to initialize the 68341's internal serial module registers,
* providing basic functions for operation.
* It sets up serial channel A for communication with a 9600 baud terminal.
* Note: All serial module registers must be accessed as bytes.
***************************************************************************
* equates
***************************************************************************
MBAR
EQU
$0003FF00
Address of SIM41 Module Base Address Reg.
MODBASE
EQU
$FFFFF000
SIM41 MBAR address value
***************************************************************
* Serial module equates
SERIAL
EQU
$700
Offset from MBAR for serial module regs
MCRH
EQU
$0
serial MCR high byte
MCRL
EQU
$1
serial MCR low byte
* Serial register offsets from serial base address
MR1A
EQU
$10
Mode register 1 A
MR2A
EQU
$20
Mode register 2 A
SRA
EQU
$11
Status register A
CSRA
EQU
$11
Clock select reg A
CRA
EQU
$12
Command reg A
ACR
EQU
$14
Auxiliary control reg
OPCR
EQU
$1D
Output port control reg
OP_BS
EQU
$1E
Output port bit set (write 1 to set)
OP_BR
EQU
$1F
Output port bit reset (write 1 to clear)
***************************************************************************
* Initialize Serial channel A
***************************************************************************
LEA
MODBASE+SERIAL,A0 Pointer to serial channel A
* Module configuration register:
* Enable serial module for normal operation, ignore FREEZE, select the
* crystal clock. Supervisor/user serial registers unrestricted.
* Interrupt arbitration at priority $02.
MOVE.B
#$00,MCRH(A0)
MOVE.B
#$02,MCRL(A0)
* WAIT FOR TRANSMITTER EMPTY (OR TIMEOUT)
MOVE.W
#$2000,D0
init loop counter
XBMTWAIT EQU
*
BTST
#3,SRA(A0)
TX empty in status reg?
NOP
DBNE
D0,XBMTWAIT
loop until set or timeout
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
..
.