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

📄 qep.s

📁 用ICC编写的程序包括SPI
💻 S
字号:
	.module qep.c
	.area data(ram, con, rel)
_qep_cnt::
	.blkb 2
	.area idata
	.word 0
	.area data(ram, con, rel)
	.blkb 2
	.area idata
	.word 0
	.area data(ram, con, rel)
	.dbfile F:\IccAvr_Pro\qep.c
	.dbsym e qep_cnt _qep_cnt A[4:2]I
	.area vector(rom, abs)
	.org 4
	jmp _int0_isr
	.area data(ram, con, rel)
	.dbfile F:\IccAvr_Pro\qep.c
	.area text(rom, con, rel)
	.dbfile F:\IccAvr_Pro\qep.c
	.dbfunc e int0_isr _int0_isr fV
	.even
_int0_isr::
	st -y,R24
	st -y,R25
	in R24,0x3f
	st -y,R24
	.dbline -1
	.dbline 5
; #include "qep.h"
; int	qep_cnt[QEP_size]={0x0000,0x0000};
; #pragma interrupt_handler int0_isr:2
; void int0_isr(void)
; {
	.dbline 7
;  //external interupt on INT0
;  if(PINC&BIT(QEP_B1))
	sbis 0x13,7
	rjmp L2
	.dbline 8
;  	qep_cnt[0]++;
	lds R24,_qep_cnt
	lds R25,_qep_cnt+1
	adiw R24,1
	sts _qep_cnt+1,R25
	sts _qep_cnt,R24
	xjmp L3
L2:
	.dbline 10
	lds R24,_qep_cnt
	lds R25,_qep_cnt+1
	sbiw R24,1
	sts _qep_cnt+1,R25
	sts _qep_cnt,R24
L3:
	.dbline -2
	.dbline 11
;  else
;  	qep_cnt[0]--;
; }
L1:
	ld R24,y+
	out 0x3f,R24
	ld R25,y+
	ld R24,y+
	.dbline 0 ; func end
	reti
	.dbend
	.area vector(rom, abs)
	.org 8
	jmp _int1_isr
	.area text(rom, con, rel)
	.dbfile F:\IccAvr_Pro\qep.c
	.dbfunc e int1_isr _int1_isr fV
	.even
_int1_isr::
	st -y,R24
	st -y,R25
	in R24,0x3f
	st -y,R24
	.dbline -1
	.dbline 14
; #pragma interrupt_handler int1_isr:3
; void int1_isr(void)
; {
	.dbline 16
;  //external interupt on INT1
;   if(PINC&BIT(QEP_B2))
	sbis 0x13,6
	rjmp L5
	.dbline 17
;  	qep_cnt[1]--;
	lds R24,_qep_cnt+2
	lds R25,_qep_cnt+2+1
	sbiw R24,1
	sts _qep_cnt+2+1,R25
	sts _qep_cnt+2,R24
	xjmp L6
L5:
	.dbline 19
	lds R24,_qep_cnt+2
	lds R25,_qep_cnt+2+1
	adiw R24,1
	sts _qep_cnt+2+1,R25
	sts _qep_cnt+2,R24
L6:
	.dbline -2
	.dbline 20
;  else
;  	qep_cnt[1]++;
; }
L4:
	ld R24,y+
	out 0x3f,R24
	ld R25,y+
	ld R24,y+
	.dbline 0 ; func end
	reti
	.dbend
	.dbfunc e qep_set _qep_set fV
	.even
_qep_set::
	.dbline -1
	.dbline 22
; void qep_set(void)
; {
	.dbline 23
;   qep_cnt[0]=0;
	clr R2
	clr R3
	sts _qep_cnt+1,R3
	sts _qep_cnt,R2
	.dbline 24
;   qep_cnt[1]=0;
	sts _qep_cnt+2+1,R3
	sts _qep_cnt+2,R2
	.dbline -2
	.dbline 25
;   }
L9:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e qep_init _qep_init fV
	.even
_qep_init::
	.dbline -1
	.dbline 27
; void qep_init(void)
; {
	.dbline 28
;  DDRC&=~BIT(QEP_B1);
	cbi 0x14,7
	.dbline 29
;  DDRC&=~BIT(QEP_B2);
	cbi 0x14,6
	.dbline -2
	.dbline 31
; 
; }
L11:
	.dbline 0 ; func end
	ret
	.dbend

⌨️ 快捷键说明

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