定时中断无法返回,哪位高手给小弟一个范例参考一下吧,谢谢了!!
这是一个测试过的定时器例子,大家共享
; export symbols
XDEF Entry ; export 'Entry' symbol
ABSENTRY Entry ; for absolute assembly: mark this as application entry point
; include derivative specific macros
INCLUDE 'mc9s12dg128.inc'
ROMStart EQU $2100 ; absolute address to place code/constant data
; variable/data section
ORG RAMStart
; Insert here your data definition. For demonstration, temp_byte is used.
temp_byte ds.b 1
MM ds.b 1
CC ds.b 1
; code section
ORG ROMStart
Entry: CLI ; enable interrupts
; Insert here you own code
MAIN: LDS #$3FFF
MOVB #$FF,DDRB
MOVB #$AA,MM
MOVB #$80,TIOS
MOVW #$AFFF,TC7Hi
MOVB #$07,TSCR2
MOVB #$80,TSCR1
MOVB #$80,TIE
;MOVB #$40,TCTL1
BB: BRA BB ; endless loop
TIMER_INT: LDAA TFLG1
ORAA #$80
STAA TFLG1
LDD TC7
ADDD #$AFFF
STD TC7Hi
LDAB MM
STAB PORTB
COMB
STAB MM
ENDP: RTI
;**************************************************************
;* Interrupt Vectors *
;**************************************************************
ORG $FFFE
fdb Entry ; Reset
ORG Vtimch7
FDB TIMER_INT
[此贴子已经被作者于2006-5-17 12:28:09编辑过]
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |