English
Language : 

MC68HC16Z1 Datasheet, PDF (471/500 Pages) Freescale Semiconductor, Inc – M68HC16Z Series
Freescale Semiconductor, Inc.
ORG
$0200
;start program after interrupt table
***** Initialize *****
INIT:
;initialization stuff
TEMP EQU
SCCNT EQU
MNCNT EQU
HRCNT EQU
$0006
$0004
$0002
$0000
;variable space used in hex to asc routine
;stores the current number of seconds
;stores the current number of minutes
;stores the current number of hours
INITSYS:
LDAB
TBEK
LDAB
TBXK
TBYK
TBZK
LDD
STD
LDAA
STAA
LDAB
STAB
#$0F
#$00
#$00CF
SIMMCR
#$7F
SYNCR
#$C0
SYPCR
;The following section is normally part of
;INCLUDE 'INITSYS.ASM', but we want to
;leave the COP on.
;point EK to bank F for register access
;point XK to bank 0
;point YK to bank 0
;point ZK to bank 0
;initialize the SIM MCR
;this is redundant; it happens at reset
;set system clock to 16.78 Mhz
;enable the watchdog (COP)
;and set time-out period to 8 seconds
INCLUDE
INCLUDE
'INITRAM.ASM'
'INITSCI.ASM'
;turn on internal SRAM at $10000
;set stack in bank 1 (SK=1, SP=03FE)
;set SCI baud rate at 9600 baud
;enable SCI transmitter and receiver
LDD
STD
LDD
STD
LDD
STD
LDD
Autovector:
STD
LDAB
STAB
LDAB
TBZK
LDZ
LDD
STD
STD
STD
STD
LDAB
#$0638
PICR
#$0110
PITR
#$FFF9
CSBAR3
#$7801
CSOR3
#$FF
PFPAR
#$01
#$0000
#$0000
SCCNT,Z
MNCNT,Z
HRCNT,Z
TEMP,Z
RSR
;set the periodic interrupt at request level 6
;& assign vector #56 (address $00070) to it
;initialize PITR to interrupt every 1 sec
;initialize Chip Sel Base Reg for Autovector
;on an IACK cycle: A24-A11=$FFF8, blK_sz = 8K
;initialize Chip Sel Option Reg for
;asynchronous, any Interrupt Priority Level
;set port F pins to be IRQ pins
;this is redundant: it happens at reset
;set zk nibble to bank 1 for variable access
;index those variables from $10000
;clear sccnt register
;clear mncnt register
;clear hrcnt register
;clear “save” variable space
;find out who caused the last reset
M68HC16 Z SERIES
USER’S MANUAL
INITIALIZATION AND PROGRAMMING EXAMPLES
For More Information On This Product,
Go to: www.freescale.com
E-19