
Chapter 6
;--timer interrupt entry----------------------------------------
ORG
0x0010
TIMERINT:
JBC 0x05, 0
; check for TCIF/MIF flag
JMP TCCINT
; if TCIF=1, go to TCCINT
JMP MTCINT
; else, go to MTCINT
TIMERRET:
; return from timer interrupt
MOV A, 0x14
; restore status register from R14
MOV 0x03, A
MOV A, 0x13
; restore accumulator from R13
BC 0x03, 2
; correct zero flag according to R14
JBC 0x14, 2
BS 0x03, 2
RETI
;--------------------------------------------------------------
ORG
0x0020
POWERON:
; power-on reset procedure
CLR 0x0C
; write 0 to port 2
CLR 0x0D
; write 0 to port 3
MOV A, @0
IOW 0xD
; set port 2 as output
IOW 0xE
; set port 3 as output
;--setup timer interrupt----------------------------------------
MOV A, @0b00011100
; set TCC/MTC prescaler bit
IOW 0x5
; TCC & MTC ratio = 1:256
MOV A, @0x80
; set TCC counter initial value
MOV 0x01, A
MOV A, @0xC0
; set MTC counter re-load value
MOV 0x06, A
MOV A, @0b10001100
; enable global and TCC/MTC
MOV 0x05, A
; timer interrupts
LOOP: JMP LOOP
; idle looping
;--timer interrupt subroutine-----------------------------------
TCCINT:
MOV A, @0x80
; re-write TCC counter initial
; value
MOV 0x01, A
COM 0x0C
; complement the port 2 output
BC 0x05, 0
; clear TCIF flag
JMP TIMER_RET
; go to timer interrupt return
MTCINT:
COM 0x0D
; complement the port 3 output
BC 0x05, 1
; clear MTIF flag
JMP TIMER_RET
; go to timer interrupt return
EM60000 Series User’s Manual
Software Application
•
89
Содержание EM60000 series
Страница 8: ...Contents viii Contents EM60000 Series User s Manual ...
Страница 24: ...Chapter 2 16 Architecture EM60000 Series User s Manual ...
Страница 54: ...Chapter 4 46 Special Function Control EM60000Series User s Manual ...
Страница 80: ...Chapter 5 72 Instruction Set EM60000Series User s Manual ...