English
Language : 

MC68HC16Z1CPV16 Datasheet, PDF (467/500 Pages) Freescale Semiconductor, Inc – Symbols and Operators, CPU16 Register Mnemonics
Freescale Semiconductor, Inc.
LDD
#$3030
STD
CSOR1
LDD
#$0303
STD
CSBAR2
LDD
#$7830
STD
CSOR2
LDD
#$3FFF
STD
CSPAR0
;set Chip Select 1, lower byte, write only
;set Chip Select 2 to fire at base addr $30000
;set Chip Select 2, both bytes, read and write
;set Chip Selects 0,1,2 to 16-bit ports
***** The Main Program *****
MAIN:
LDAB
TBXK
LDX
#$00
#STRING
;Move data from another place in memory
;into the U1 and U3 RAM slots.....
;set XK to bank 0 for access to the STRING
;load the starting address of STRING into IX
LDAB
TBZK
LDZ
#$03
#0000
;set ZK to bank 3
;for access to U1 & U3 during write in XLOOP
;clear IZ so ZK:IZ = $30000
XLOOP: LDD
STD
AIX
AIZ
CMPA
BEQ
CMPB
BNE
0,X
0,Z
#2
#2
#$00
PRINT
#$00
XLOOP
;load two bytes from $10000 into accum. D
;store accum. D into U1 and U3 RAM:
;the chip select logic takes care of us!
;increment X index register to next word
;increment Z index register to next word
;end xloop if the end of the string $00 is
;detected in either accumulator A or B
PRINT:
LDAB
TBXK
LDX
JSR
BRA
#$03
#$0000
SEND_STRING
PRINT
;This loop reads its string from the U1 and U3
;slots and prints it at the dummy terminal....
;set XK:IX index to point to bank 3
;point to the beginning of the ASCII string
;go output the ASCII string
;loop back and print again
***** Subroutines *****
SEND_STRING:
LDAB
BEQ
JSR
AIX
BRA
STRING_DONE:
RTS
0,X
STRING_DONE
SEND_CH
#1
SEND_STRING
;subroutine to send out the entire ASCII
;string
;get next char in string as pointed to by IX
;if B=00, then message is done
;go send out a character
;increment IX to point to the next ASCII char
;loop back
;go back to whence we came
SEND_CH:
time
LDAA
ANDA
SCSR
#01
;subroutine to send out one character at a
;read the SCI status reg to check TDRE bit
;check only the tdre flag bit
M68HC16 Z SERIES
USER’S MANUAL
INITIALIZATION AND PROGRAMMING EXAMPLES
For More Information On This Product,
Go to: www.freescale.com
E-15