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

📄 int.asm.bak

📁 应用松翰母体开发的航模飞机的源代码!有舵机控制功能
💻 BAK
字号:
;************************************************
;Name	:InterruptSub
;Function:
;Input  :
;Output	:
;Register Used:
;*************************************************
InterruptSub:
	XCH	A,AccBuf
	XCH	A,PFLAG
	B0MOV	PflagBuf,A
	
	b0bts0	FTC0IRQ		;//Analyse the Interrupt resourc
	jmp	TC0INTR
	
	b0bts0	ft0irq
	jmp	t0intr

	b0bts0	FP00IRQ
	jmp	P00INTR

Interrupt90:
	XCH	A,PflagBuf
	B0MOV	PFLAG,A
	XCH	A,AccBuf	;//For release the Acc And Pflag
	RETI
;--------------------------------------------------------
;--------------------------------------------------------
TC0INTR:
	incms	timer1800us
	nop
	bts1	ptwing
	jmp	mnint000
	mov	a,timer1800us
	sub	a,#6
	bts1	fc
	jmp	mnint00
	bset	t1800usflag
	clr	timer1800us
	jmp	mnint00
mnint000:
	mov	a,timer1800us
	sub	a,#84
	bts1	fc
	jmp	mnint00
	bset	t18msflag
	clr	timer1800us
mnint00:
	incms	timer5ms
	nop
	mov	a,timer5ms
	sub	a,#25
	bts1	fc
	jmp	TC0INTR90
	bset	t5msflag
	clr	timer5ms	
	bset	t5msflag1
	bset	t5msflag2
	bset	t5msflag3
	bset	t5msflag4
	
TC0INTR90:
	b0bclr	FTC0IRQ
	jmp	Interrupt90
;--------------------------------------------------------
;--------------------------------------------------------
t0intr:
	mov	a,#6
	sub	a,levecount
	bts0	fc
	jmp	t0intr10
	bset	errorflag
	jmp	t0intr90
t0intr10:
	incms	levecount
	nop
t0intr90:
	bclr	ft0irq
	jmp	interrupt90
;--------------------------------------------------------
;--------------------------------------------------------
P00INTR:		
	bclr	fp00irq
	bclr	ft0enb
	mov	a,t0c
	bts1	singleflag	
	jmp	disasm100				
	mov	level,a		;上升沿进入
	jmp	disasm200		
disasm100:
	mov	leveh,a		;下降沿进入
	jmp	disasm200
disasm200:
	clr	t0c		
	bset	ft0enb	
	bts0	singleflag
	jmp	disasm220
	jmp 	disasm210
disasm210:
	@p00_edge	1		;下降沿进入,设为上升沿中断
	bts0	firstflag
	jmp	disasm221
	mov	a,levecount
	bts0	fz
	jmp	disasm80
	bset	firstflag
	clr	levecount
	clr	inputcount
	jmp	disasm90	
disasm220:
	@p00_edge	2		;上升沿进入,设为下降沿中断	
	mov	a,#56			;448us=8x56
	sub	a,level
	bts0	fc
	jmp	disasm80		;小于448us,出错
	mov	a,#75			;600us=8x75
	sub	a,level
	bts0	fc
	jmp	disasm90		;小于600us,返回
	jmp	disasm80		;大于600us,出错

disasm221:
	clr	tablecount
	incms	inputcount
	nop
	mov	a,inputcount
	sub	a,#5
	bts1	fc
	jmp	chksignaltable
	jmp	disasm80	
chksignaltable:				;查询控制信号的档位
	b0mov	y,#signaltable$m
	b0mov	z,#signaltable$l
	mov	a,tablecount
	add	z,a
	mov	a,#0
	adc	y,a
	movc
	sub	a,leveh
	bts0	fc
	jmp	chksignaltableend	
	jmp	signaltableadd
signaltableadd:
	incms	tablecount
	nop
	jmp	chksignaltable
chksignaltableend:
	mov	a,tablecount	
	bts0	fz
	jmp	disasm80		;error
	sub	a,#11
	bts0	fc
	jmp	disasm80		;error
	mov	a,tablecount
	mov	gearbuf,a
	mov	a,inputcount
	@jmp_a	5
	jmp	disasm90
	jmp	gearwing
	jmp	gearempennage
	jmp	gearscrew
	jmp	gearswing	
gearwing:
	mov	a,gearbuf
	cmprs	a,wingbuf1
	jmp	gearwing10
	incms	samebuf1
	nop
	mov	a,samebuf1
	sub	a,samecontant
	bts1	fc
	jmp	disasm90
	mov	a,wingbuf1
	mov	wingbuf,a
	jmp	disasm90
gearwing10:
	mov	a,gearbuf
	mov	wingbuf1,a	
	clr	samebuf1
	jmp	disasm90
gearempennage:
	mov	a,gearbuf
	cmprs	a,empennagebuf1
	jmp	gearempennage10
	incms	samebuf2
	nop
	mov	a,samebuf2
	sub	a,samecontant
	bts1	fc
	jmp	disasm90
	mov	a,empennagebuf1
	mov	empennagebuf,a
	jmp	disasm90
gearempennage10:
	mov	a,gearbuf
	mov	empennagebuf1,a	
	clr	samebuf2
	jmp	disasm90
gearscrew:
	mov	a,gearbuf
	cmprs	a,screwbuf1
	jmp	gearscrew10
	incms	samebuf3
	nop
	mov	a,samebuf3
	sub	a,samecontant
	bts1	fc
	jmp	disasm90
	mov	a,screwbuf1
	mov	screwbuf,a
	jmp	disasm90
gearscrew10:
	mov	a,gearbuf
	mov	screwbuf1,a	
	clr	samebuf3
	jmp	disasm90
gearswing:
	mov	a,gearbuf
	cmprs	a,swingbuf1
	jmp	gearswing10
	incms	samebuf4
	nop
	mov	a,samebuf4
	sub	a,samecontant
	bts1	fc
	jmp	disasm90
	mov	a,swingbuf1
	mov	swingbuf,a
	jmp	disasm90
gearswing10:
	mov	a,gearbuf
	mov	swingbuf1,a	
	clr	samebuf4
	jmp	disasm90
disasm80:
	@p00_edge	2		;出错,设为下降沿中断
	clr	inputcount
	clr	levecount
	bclr	firstflag	
disasm90:
P00INTR90:
	jmp	Interrupt90
;***********************************************
mnint:
	bts1	t5msflag
	jmp	mnint90
	bclr	t5msflag
	call	dkeychat	
mnint10:
	incms	timer500ms
	nop
	mov 	a,timer500ms
	sub	a,#100
	bts1	fc
	jmp	mnint90
	clr	timer500ms
	bset	t500msflag

mnint90:
	ret
;***********************************************	
	
signaltable:
	dw	030h	;0
	dw	03fh	;1	
	dw	04fh	;2
	dw	05eh	;3	
	dw	06eh	;4	
	dw	07dh	;5	
	dw	08dh	;6	
	dw	09ch	;7	
	dw	0ach	;8	
	dw	0bbh	;9	
	dw	0cbh	;10
	dw	0ffh	;11
	
	
	

⌨️ 快捷键说明

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