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

📄 timer.s

📁 使用8880实现DTMF通信及拨号的程序.
💻 S
字号:
	.module timer.c
	.area text(rom, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\timer.c
	.dbfunc e timer1_init _timer1_init fV
	.even
_timer1_init::
	.dbline -1
	.dbline 7
; #include <iom8v.h>
; #include "main.h"
; #include "shell.h"
; #include "8880.h"
; #include "serial.h"
; void timer1_init(void)
; {
	.dbline 8
;  TCCR1B = 0x00; //stop
	clr R2
	out 0x2e,R2
	.dbline 9
;  TCNT1H = 0xE3; //setup
	ldi R24,227
	out 0x2d,R24
	.dbline 10
;  TCNT1L = 0xE1;
	ldi R24,225
	out 0x2c,R24
	.dbline 11
;  OCR1AH = 0x1C;
	ldi R24,28
	out 0x2b,R24
	.dbline 12
;  OCR1AL = 0x1F;
	ldi R24,31
	out 0x2a,R24
	.dbline 13
;  OCR1BH = 0x1C;
	ldi R24,28
	out 0x29,R24
	.dbline 14
;  OCR1BL = 0x1F;
	ldi R24,31
	out 0x28,R24
	.dbline 15
;  ICR1H  = 0x1C;
	ldi R24,28
	out 0x27,R24
	.dbline 16
;  ICR1L  = 0x1F;
	ldi R24,31
	out 0x26,R24
	.dbline 17
;  TCCR1A = 0x00;
	out 0x2f,R2
	.dbline 18
;  TIMSK |= 0x04;
	in R24,0x39
	ori R24,4
	out 0x39,R24
	.dbline -2
L1:
	.dbline 0 ; func end
	ret
	.dbend
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\timer.c
_x::
	.blkb 2
	.area idata
	.word 0
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\timer.c
	.dbsym e x _x I
	.area vector(rom, abs)
	.org 16
	rjmp _timer1_ovf_isr
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\timer.c
	.area text(rom, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\timer.c
	.dbfunc e timer1_ovf_isr _timer1_ovf_isr fV
;              i -> R20,R21
	.even
_timer1_ovf_isr::
	st -y,R0
	st -y,R1
	st -y,R2
	st -y,R3
	st -y,R4
	st -y,R5
	st -y,R6
	st -y,R7
	st -y,R8
	st -y,R9
	st -y,R16
	st -y,R17
	st -y,R18
	st -y,R19
	st -y,R24
	st -y,R25
	st -y,R26
	st -y,R27
	st -y,R30
	st -y,R31
	in R0,0x3f
	st -y,R0
	st -y,R20
	st -y,R21
	.dbline -1
	.dbline 24
; }
; 
; int x=0;
; #pragma interrupt_handler timer1_ovf_isr:iv_TIM1_OVF
; void timer1_ovf_isr(void)
; {
	.dbline 27
;  int i;
;  //TIMER1 has overflowed
;  TCNT1H = 0xE3; //reload counter high value
	ldi R24,227
	out 0x2d,R24
	.dbline 28
;  TCNT1L = 0xE1; //reload counter low value
	ldi R24,225
	out 0x2c,R24
	.dbline 29
;  switch (sysoption.calling)
	lds R20,_sysoption+1
	clr R21
	cpi R20,1
	ldi R30,0
	cpc R21,R30
	breq L7
X0:
	cpi R20,2
	ldi R30,0
	cpc R21,R30
	breq L17
X1:
	rjmp L3
L7:
	.dbline 31
;  {		case 1:
;  			 if (sysoption.timer==40){
	lds R24,_sysoption+3
	cpi R24,40
	brne L8
X2:
	.dbline 31
	.dbline 32
; 			   	M8880_Handdown;
	cbi 0x15,5
	.dbline 33
; 				for (i=0;i<10;i++) delay(0xffff);
	clr R20
	clr R21
L11:
	.dbline 33
	ldi R16,65535
	ldi R17,255
	rcall _delay
L12:
	.dbline 33
	subi R20,255  ; offset = 1
	sbci R21,255
	.dbline 33
	cpi R20,10
	ldi R30,0
	cpc R21,R30
	brlt L11
X3:
	.dbline 34
;  				serial_send(noresponse);
	lds R16,_noresponse
	lds R17,_noresponse+1
	rcall _serial_send
	.dbline 35
; 				sysoption.calling=0;
	clr R2
	sts _sysoption+1,R2
	.dbline 36
; 				TCCR1B=0x0;
	out 0x2e,R2
	.dbline 37
; 			 }else	 sysoption.timer++;
	rjmp L4
L8:
	.dbline 37
	lds R24,_sysoption+3
	subi R24,255    ; addi 1
	sts _sysoption+3,R24
	.dbline 38
; 			 break;
	rjmp L4
L17:
	.dbline 40
; 		case 2:
; 			   	sysoption.calling=3;
	ldi R24,3
	sts _sysoption+1,R24
	.dbline 41
; 				serial_send("answered");
	ldi R16,<L19
	ldi R17,>L19
	rcall _serial_send
	.dbline 42
; 				TCCR1B=0;
	clr R2
	out 0x2e,R2
	.dbline 43
; 				break;
L3:
L4:
	.dbline -2
L2:
	.dbline 0 ; func end
	ld R21,y+
	ld R20,y+
	ld R0,y+
	out 0x3f,R0
	ld R31,y+
	ld R30,y+
	ld R27,y+
	ld R26,y+
	ld R25,y+
	ld R24,y+
	ld R19,y+
	ld R18,y+
	ld R17,y+
	ld R16,y+
	ld R9,y+
	ld R8,y+
	ld R7,y+
	ld R6,y+
	ld R5,y+
	ld R4,y+
	ld R3,y+
	ld R2,y+
	ld R1,y+
	ld R0,y+
	reti
	.dbsym r i 20 I
	.dbend
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\timer.c
L19:
	.blkb 9
	.area idata
	.byte 'a,'n,'s,'w,'e,'r,'e,'d,0
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\timer.c
;  }
; }

⌨️ 快捷键说明

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