📄 timer.s
字号:
.module timer.c
.area data(ram, con, rel)
_i::
.blkb 2
.area idata
.word 0
.area data(ram, con, rel)
.dbfile E:\公司用\atmega8l\final\nrf905_send1\timer.c
.dbsym e i _i i
_count::
.blkb 2
.area idata
.word 0
.area data(ram, con, rel)
.dbfile E:\公司用\atmega8l\final\nrf905_send1\timer.c
.dbsym e count _count i
_flag::
.blkb 2
.area idata
.word 0
.area data(ram, con, rel)
.dbfile E:\公司用\atmega8l\final\nrf905_send1\timer.c
.dbsym e flag _flag i
.area text(rom, con, rel)
.dbfile E:\公司用\atmega8l\final\nrf905_send1\timer.c
.dbfunc e timer0_init _timer0_init fV
.even
_timer0_init::
.dbline -1
.dbline 14
; //ICC-AVR application builder : 2008-7-29 14:35:46
; // Target : M8
; // Crystal: 4.0000Mhz
; #include "confg.h"
;
; unsigned int i=0,count=0,flag=0;
; int number;
;
; //TIMER0 initialisation - prescale:1024
; // WGM: Normal
; // desired value: 10mSec
; // actual value: 9.984mSec (0.2%)
; void timer0_init(void)
; {
.dbline 16
;
; TCCR0 = 0x00; //stop
clr R2
out 0x33,R2
.dbline 17
; TCNT0 = 0x64; //set count
ldi R24,100
out 0x32,R24
.dbline 18
; TCCR0 = 0x04; //start timer
ldi R24,4
out 0x33,R24
.dbline -2
.dbline 19
; }
L1:
.dbline 0 ; func end
ret
.dbend
.area vector(rom, abs)
.org 18
rjmp _time0
.area text(rom, con, rel)
.dbfile E:\公司用\atmega8l\final\nrf905_send1\timer.c
.dbfunc e time0 _time0 fV
.even
_time0::
st -y,R2
st -y,R3
st -y,R24
st -y,R25
in R2,0x3f
st -y,R2
.dbline -1
.dbline 24
.dbline 25
ldi R24,100
out 0x32,R24
.dbline 26
lds R24,_count
lds R25,_count+1
adiw R24,1
sts _count+1,R25
sts _count,R24
.dbline 27
lds R2,_number
lds R3,_number+1
cp R24,R2
cpc R25,R3
brne L3
.dbline 28
.dbline 29
clr R2
out 0x39,R2
.dbline 30
ldi R24,1
ldi R25,0
sts _flag+1,R25
sts _flag,R24
.dbline 31
L3:
.dbline -2
.dbline 32
;
;
; #pragma interrupt_handler time0:10
; void time0(void)
; {
; TCNT0 = 0x64; //set count
; count++;
; if(count==number)
; {
; TIMSK=0x00;
; flag=1;
; }
; }
L2:
ld R2,y+
out 0x3f,R2
ld R25,y+
ld R24,y+
ld R3,y+
ld R2,y+
.dbline 0 ; func end
reti
.dbend
.dbfunc e init_devices1 _init_devices1 fV
.even
_init_devices1::
.dbline -1
.dbline 35
; //call this routine to initialise all peripherals
; void init_devices1(void)
; {
.dbline 38
;
; //stop errant interrupts until set up
; CLI(); //disable all interrupts
cli
.dbline 39
; timer0_init();
rcall _timer0_init
.dbline 40
; count=0;
clr R2
clr R3
sts _count+1,R3
sts _count,R2
.dbline 41
; flag=0;
sts _flag+1,R3
sts _flag,R2
.dbline 43
;
; TIMSK = 0x01; //timer interrupt sources
ldi R24,1
out 0x39,R24
.dbline 44
; SEI(); //re-enable interrupts
sei
.dbline -2
.dbline 46
; //all peripherals are now initialised
; }
L5:
.dbline 0 ; func end
ret
.dbend
.dbfunc e delay_10ms _delay_10ms fI
; no -> R16,R17
.even
_delay_10ms::
.dbline -1
.dbline 63
;
; /*
; int delay_10ms(int no)
; {
; number=no;
; init_devices1();
; while(1)
; {
; if(flag==1)
; break;
; }
; return 0;
; }
; */
;
; int delay_10ms(int no)
; {
.dbline 64
; for(;no>0;no--)
rjmp L10
L7:
.dbline 65
clr R2
clr R3
sts _i+1,R3
sts _i,R2
rjmp L14
L11:
.dbline 65
L12:
.dbline 65
lds R24,_i
lds R25,_i+1
adiw R24,1
sts _i+1,R25
sts _i,R24
L14:
.dbline 65
lds R24,_i
lds R25,_i+1
cpi R24,188
ldi R30,2
cpc R25,R30
brlo L11
L8:
.dbline 64
subi R16,1
sbci R17,0
L10:
.dbline 64
clr R2
clr R3
cp R2,R16
cpc R3,R17
brlt L7
.dbline 67
; for (i=0;i<700;i++) ;
;
; return 0;
clr R16
clr R17
.dbline -2
L6:
.dbline 0 ; func end
ret
.dbsym r no 16 I
.dbend
.dbfunc e delay_us _delay_us fV
; m -> R20,R21
; us -> R16,R17
.even
_delay_us::
rcall push_gset1
.dbline -1
.dbline 71
; }
;
; void delay_us(uint us)
; {
.dbline 73
; uint m;
; for (m=0;m<us;m++)
clr R20
clr R21
rjmp L19
L16:
.dbline 74
.dbline 74
nop
.dbline 74
nop
.dbline 74
nop
.dbline 74
nop
.dbline 74
nop
.dbline 74
nop
.dbline 75
L17:
.dbline 73
subi R20,255 ; offset = 1
sbci R21,255
L19:
.dbline 73
cp R20,R16
cpc R21,R17
brlo L16
.dbline -2
.dbline 76
; {NOP();NOP();NOP();NOP();NOP();NOP();
; }
; }
L15:
rcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r m 20 i
.dbsym r us 16 i
.dbend
.area bss(ram, con, rel)
.dbfile E:\公司用\atmega8l\final\nrf905_send1\timer.c
_number::
.blkb 2
.dbsym e number _number I
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -