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

📄 time1_area.s

📁 基于ATmega8开发的关于医疗康复的机器人
💻 S
字号:
	.module time1_area.c
	.area text(rom, con, rel)
	.dbfile F:\Work\Data\程序\修订版~1.1\time1_area.c
	.dbfunc e timer1_init _timer1_init fV
	.even
_timer1_init::
	.dbline -1
	.dbline 5
; #include"main_H.h"
; 
; /*******************定时器1初始化子程序定时为1秒*****************/   
; void timer1_init(void)
; {
	.dbline 6
;  	TCCR1B = 0x00;
	clr R2
	out 0x2e,R2
	.dbline 7
;  	TCNT1H = 0xe1;    		//定时器为1秒
	ldi R24,225
	out 0x2d,R24
	.dbline 8
;  	TCNT1L = 0x7c;   		
	ldi R24,124
	out 0x2c,R24
	.dbline 9
;  	TCCR1B = 0x05;  		//分率系数为1024
	ldi R24,5
	out 0x2e,R24
	.dbline -2
L1:
	.dbline 0 ; func end
	ret
	.dbend
	.area vector(rom, abs)
	.org 16
	rjmp _timer1_ovf_isr
	.area text(rom, con, rel)
	.dbfile F:\Work\Data\程序\修订版~1.1\time1_area.c
	.dbfunc e timer1_ovf_isr _timer1_ovf_isr fV
	.even
_timer1_ovf_isr::
	st -y,R24
	st -y,R25
	in R24,0x3f
	st -y,R24
	.dbline -1
	.dbline 15
; } 
; 
; /*******************定时器1中断服务子程序********************/
; #pragma interrupt_handler timer1_ovf_isr:iv_TIMER1_OVF 
; void timer1_ovf_isr(void)
; {
	.dbline 16
;  	CLI();
	cli
	.dbline 17
;  	TCNT1H = 0xe1; 			//定时器为1秒
	ldi R24,225
	out 0x2d,R24
	.dbline 18
;  	TCNT1L = 0x7c; 
	ldi R24,124
	out 0x2c,R24
	.dbline 19
;  	second++;       		//秒变量加1
	lds R24,_second
	lds R25,_second+1
	adiw R24,1
	sts _second+1,R25
	sts _second,R24
	.dbline 20
;  	SEI();
	sei
	.dbline -2
L2:
	.dbline 0 ; func end
	ld R24,y+
	out 0x3f,R24
	ld R25,y+
	ld R24,y+
	reti
	.dbend
; }

⌨️ 快捷键说明

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