
INCW
$0000,X
;increments the first word in the RAM at
RTI
;address $30000
INT
RTI
;unused interrupts point here
4.3 Configuring Internal RAM
The internal RAM can be mapped to any 2 Kbyte boundary in the address map, but it must not overlap
the module control registers or be mapped to addresses $80000 to $7FFFFF which are inaccessible to
the CPU16. The RAM is in low power stop mode out of reset. To initialize the RAM, write the desired
base address to the RAM base address and status register (a write-once only register) and clear the
STOP bit to enable the RAM.
If battery backup for the RAM is not used, connect the VSTBY pin to ground. When using the ICD16 de-
bugger, make sure not to display any potentially uninitialized memory in the F3 and F6 windows, be-
cause the debugger tries to read this memory and will display error messages if it is uninitialized.
4.4 Configuring the Queued Serial Module
The queued serial module (QSM) is divided into two submodules: the serial communications interface
(SCI) and the queued serial peripheral interface (QSPI). The following sections give basic examples of
QSM configuration. See the
QSM Reference Manual (QSMRM/AD) for more detailed information.
4.4.1 Configuring the SCI
The following example program can be assembled with IASM16. This example is in the “sci_init.asm”
file in the archive “16Z1_init” on the Freeware Data System. The program prints a five-character mes-
sage to the screen. Do the following before running this program:
1. Connect an RS-232 cable from the PC serial port to the target board.
2. When using ICD16, set the serial communications protocol for the COM port being used, 9600
baud, no parity, eight data bits, and one stop bit. For example, when using COM 2, type in the
command: serial 2 9600 n 8 1
3. When using ICD16, enable the serial communications by typing: serialon
4. Load and run the program.
* SCI INITIALIZATION: This program initializes the SCI and prints the message
* “12345” to a dumb terminal.
INCLUDE
'EQUATES.ASM'
;EQUates for common register addresses
INCLUDE
'INIT_RES.ASM'
;initialize reset vector
INCLUDE
'INIT_INT.ASM'
;initialize interrupt vectors
ORG
$200
;begin program at $200, immediately after
;the exception table
INIT_SIM
LDAB #$0F
;point to bank $F for internal register addressing
TBEK
CLRB
TBXK
LDAA #$7F
STAA SYNCR
;increase clock speed
CLR SYPCR
;disable software watchdog
INIT_SCI
LDD #$0037
STD SCCR0
;set the SCI baud rate to 9600
LDD #$000C
STD SCCR1
;enable the receiver and transmitter
PRINT
LDX #MESSAGE
;load the address of the message
;to be printed into address register X.
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
..
.