MOTOROLA
INITIALIZATION AND PROGRAMMING EXAMPLES
M68HC16 Z SERIES
E-26
USER’S MANUAL
*
has overflowed ten times.
*
****************************************************************************
INCLUDE
'EQUATES.ASM'
;table of EQUates for common register
;addresses
INCLUDE
'ORG00000.ASM'
;initialize reset vector
INCLUDE
'ORG00008.ASM'
;initialize interrupt vectors
*
We are choosing User Defined Interrupt Vector 9 (interrupt vector 64
*
at address $0080) to be the base vector number (VBA) for the GPT
*
because the least significant nibble in the address must be a $0.
*
The VBA should be reflected in the GPT Interrupt Configuration
*
Register (ICR) at $YFF904.
ORG
$0080
;Address for interrupt vector 64
DC.W
PAOV_ROUTINE
;Adjusted Priority Channel -- PAC
DC.W
IC1_ROUTINE
;Input Capture 1
DC.W
IC2_ROUTINE
;Input Capture 2
DC.W
IC3_ROUTINE
;Input Capture 3
DC.W
BDM
;Output Compare 1
DC.W
OC2_ROUTINE
;Output Compare 2
DC.W
BDM
;Output Compare 3
DC.W
BDM
;Output Compare 4
DC.W
BDM
;Input Capture 4 / Output Compare 5
DC.W
BDM
;Timer Overflow
DC.W
BDM
;Pulse Accumulator Overflow -- elevated
DC.W
BDM
;Pulse Accumulator Input
ORG
$0200
;start program after interrupt vectors
*****
Initialization Routines
*****
INCLUDE
'INITSYS.ASM'
;initially set EK=F, XK=0, YK=0, ZK=0
;set sys clock at 16.78 MHz, disable
COP
INCLUDE
'INITRAM.ASM'
;turn on 1k internal SRAM at $10000
;set stack in bank 1 (SK=1, SP=03FE)
INCLUDE
'INITSCI.ASM'
;set SCI baud rate at 9600
;enable SCI transmitter and receiver
*
Set up the interrupts
LDD
#$008E
;Give the GPT an IARB of $E
STD
GPTMCR
;so we can generate interrupts
LDD
#$A640
;elevate interrupt priority of PAOV,
STD
ICR
;set GPT IRQ level to 6,
;& assign vector 64 (User vector 9) of the
;interrupt/exception vector table as the
;GPT's Interrupt Vector Base Address
LDAB
#$17
;set OC2, IC1, IC2, IC3 to generate interrupts
STAB
TMSK1
LDAB
#$25
;set PAC Overflows to generate interrupts