English
Language : 

MC68HC16Z1 Datasheet, PDF (476/500 Pages) Freescale Semiconductor, Inc – M68HC16Z Series
Freescale Semiconductor, Inc.
E.2.3 QSM/SCI Programming Example
The following programming example involves using a port of the serial communication
interface (SCI), one of the serial interfaces of the queued serial module (QSM), to dis-
play a message on a dummy terminal.
Refer to SECTION 9 QUEUED SERIAL MODULE for more information on the QSM
or the SCI.
E.2.3.1 Example 6 - Using an SCI Port
* Description : This program uses the SCI port to display
*
a shameless message on a dummy terminal. It includes
*
a subroutine to print a single character to the SCI
*
and a subroutine that uses the single character
*
subroutine to print an entire string.
*
*************************************************************************
INCLUDE
addresses
INCLUDE
INCLUDE
'EQUATES.ASM'
'ORG00000.ASM'
'ORG00008.ASM'
;table of EQUates for common register
;initialize reset vector
;initialize interrupt vectors
ORG $0200
;start program after exception vector table
***** Initialize *****
INIT:
INCLUDE 'INITSYS.ASM'
INCLUDE 'INITRAM.ASM'
INCLUDE 'INITSCI.ASM'
;initially set EK=F, XK=0, YK=0, ZK=0
;set sys clock at 16.78 MHz, disable COP
;turn on internal SRAM at $10000
;set stack (SK=1, SP=03FE)
;set the SCI baud rate to 9600 baud
;enable the SCI receiver and transmitter
LDAB #$00
TBXK
LDAB #$01
TBZK
LDZ #$0000
;set XK to bank 0 for STRING access
;set ZK to bank 1 for delay counter access
;clear IZ for later use with delay counter
***** Main Program *****
MAIN
LDX #STRING
JSR SEND_STRING
BRA MAIN
;point to the beginning of ASCII string
;go output the ASCII string
;branch back to main
***** Subroutines *****
SEND_STRING:
LDAB 0,X
BEQ STRING_DONE
JSR SEND_CH
;subroutine to send out the entire ASCII string
;get next byte in string as pointed to by IX
;if B=00, then goto delay between messages
;go send out the byte
E-24
INITIALIZATION AND PROGRAMMING EXAMPLES
For More Information On This Product,
Go to: www.freescale.com
M68HC16 Z SERIES
USER’S MANUAL