
M68HC11
REFERENCE MANUAL
MAIN TIMER AND REAL-TIME INTERRUPT
MOTOROLA
10-47
Listing — Timer Examples
Sheet 4 of 16
* Since most of us don’t think in hexadecimal, let’s
* change to decimal before printing. The subroutine
* (HTODP) is shown at the end of this listing.
*
* The display will look like...
*
*ppppp Cyc fffff Hz --- or like---
*Freq. is too high
*
* where ppppp is period in cycles & fffff is freq.
* (decimal)
*
* EVB subroutines will be used and when done we will
* jump back to the beginning and repeat continuously.
*
JSR
.OUTCRL
LDX
#PERC
JSR
HTOD
JSR
P5DEC
LDX
#MSGCYC
JSR
.OUTSTO
LDX
#FREQH
JSR
HTOD
JSR
P5DEC
LDX
#MSGHZ
JSR
.OUTSTO
JTOP
JMP
PERTOP
c064 bd ff c4
c067 ce d0 0f
c06a bd c3 33
c06d bd c2 df
c070 ce c3 d3
c073 bd ff ca
c076 ce d0 13
c079 bd c3 33
c07c bd c2 df
c07f ce c3 e0
c082 bd ff ca
c085 7e c0 00
[6]
[3]
[6]
[6]
[3]
[6]
[3]
[6]
[6]
[3]
[6]
[3]
Print a <cr,lf>
Point at hex period
Convert to 5 digit decimal
Print 5 digit decimal
Point at “ Cycles ”
Print message segment
Point at hex frequency
Convert to 5 digit decimal
Print 5 digit decimal
Point at “ Hz”
Print message segment
To top & measure another period
c088 ce c3 e4
c08b bd ff c7
c08e 20 f5
[3]
[6]
[3]
OUTRNG
LDX
JSR
BRA
#MSGER1
.OUTSTR
JTOP
Point at "Freq. is too high"
Print msg w/leading <cr,lf>
To top & measure another period
*
********* END Ex 10-1b
***
* TIMER EXAMPLE 10-2 Measuring Pulses With Input Capture
*
* Uses interrupts.
* Measures time between a rising edge and a falling edge
* (period of a positive pulse) at the IC1 pin.
* Overflows not considered so max is 65,536 cyc
* Min time measurable with this program is about __ cyc
*
* This program rune on an EVB board and displays results
* on the EVB terminal display.
***
* Initialization Portion
*
PWINZ
LDS
LDAA
STAA
LDX
STX
c090 8e 00 47
c093 86 7e
c095 97 e8
c097 ce c0 d8
c09a df e9
[3]
[2]
[3]
[3]
[4]
# $0047
# $7E
PVIC1
#SV2IC1
PVIC1+1
Top of User’s stack area on EVB
Jump (extended) Opcode
IC1 Pseudo Vector
Address of IC1 service routine
Finish JMP inst to IC1 routine