⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interrupt.asm

📁 本人编写的无线电话程序,给予PIC18C801设计,包括了uCOS的移植以及菜单,自己设计的拼音注入法,完整地一级汉字库,希望对大家有所帮助
💻 ASM
字号:
#include p18c801.inc
#include app.inc
#define		SAVE_BANK0_PUSH_END			0x37;0x2A					;0x000~~0x02A
#define		SAVE_BANK0_PUSH_NUM			SAVE_BANK0_PUSH_END+1

;GLOBAL	HighLevelIsr

EXTERN	OSIntNesting
EXTERN	LowLevelIntProc
EXTERN	OSTimeTick
EXTERN	Func_Receive_ISR
;EXTERN	Timer1ISR
EXTERN	OSIntExit
EXTERN intvec_h
EXTERN intvec_l
;Buffer left to save necessary registers 
ASMDATA UDATA ;0x080
	PCLATH_SAVE	RES	1
	PCLATU_SAVE	RES	1
	TBLPTRU_SAVE	RES	1
	TBLPTRH_SAVE	RES	1
	TBLPTRL_SAVE	RES	1
	TABLAT_SAVE		RES	1
	WREG_SAVE		RES 1
	BSR_SAVE		RES 1
	STATUS_SAVE		RES 1

;The entry to low priority interrupt
LowInterruptVector	org		0x18
	goto	LowInterruptHandler

;The entry to high priority interrupt
HighInterruptVector	org		0x08
	goto	HighInterruptHandler
;========================================================
ASMCODE CODE
;=======================================================
;Code begin here
LowInterruptHandler
	lpush_all

	MOVLB	high OSIntNesting
	incf	OSIntNesting,0x01,1
	;===================================================
	;Process all the low level interrupt except for TMR1
	call 	LowLevelIntProc	
	;===================================================
TIMER1_INT:
	BTFSS	PIR1,TMR1IF,0			;0:TMR1IF. Skip if "1"
	bra		Restore_REGS
	bcf		PIR1,0,0			;PIR1bits.TMR1IF=0;

	movff	TMR1L,PRODL
	movff	TMR1H,PRODH
	movlw	0xA0
	addwf	PRODL,0x01,0
	movlw	0xFB
	addwfc	PRODH,0x01,0
	
	movff	PRODH,TMR1H
	movff	PRODL,TMR1L
	call	OSTimeTick
	;Call other service for TMR1. For its vector is the first one,
	; its ISR can be called like this
	bra		e1
e0:
	movff	intvec_l+2, PCLATU
	movff	intvec_l+1, PCLATH
	movlb	0
	movf	intvec_l, 0, 0x1
	movwf	PCL,0
e1:
	rcall	e0


Restore_REGS:
	call	OSIntExit
	lpop_all
	retfie 0

HighInterruptHandler
	hpush_all
	call 	Func_Receive_ISR

;	bra		h1
;h0:
;	movff	intvec_h+2, PCLATU
;	movff	intvec_h+1, PCLATH
;	movlb	0
;	movf	intvec_h, 0, 0x1
;	movwf	PCL,0
;h1:
;	rcall	h0
	hpop_all
	retfie 0
;=======================================================
	END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -