📄 timer0.s
字号:
.module timer0.c
.area data(ram, con, rel)
_LedNum::
.blkb 2
.area idata
.byte 8,7
.area data(ram, con, rel)
.blkb 2
.area idata
.byte 6,5
.area data(ram, con, rel)
.blkb 2
.area idata
.byte 4,3
.area data(ram, con, rel)
.blkb 2
.area idata
.byte 2,1
.area data(ram, con, rel)
.dbfile G:\Mega8程序\TCXO评估板\LedShow\timer0.c
.dbsym e LedNum _LedNum A[8:8]c
.area vector(rom, abs)
.org 18
rjmp _timer0
.area data(ram, con, rel)
.dbfile G:\Mega8程序\TCXO评估板\LedShow\timer0.c
L2:
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile G:\Mega8程序\TCXO评估板\LedShow\timer0.c
L3:
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile G:\Mega8程序\TCXO评估板\LedShow\timer0.c
.area text(rom, con, rel)
.dbfile G:\Mega8程序\TCXO评估板\LedShow\timer0.c
.dbfunc e timer0 _timer0 fV
.dbsym s cTimes L3 c
.dbsym s cPos L2 c
.even
_timer0::
rcall push_lset
.dbline -1
.dbline 7
; #include <iom8v.h>
; #include <macros.h>
; extern void spark(unsigned char pos,unsigned char num);
; unsigned char LedNum[8]={8,7,6,5,4,3,2,1};
; #pragma interrupt_handler timer0:10
; void timer0(void)
; {
.dbline 17
; static unsigned char cPos=0;
; static unsigned char cTimes=0;
; /*
; if (++cTimes==1)
; {
; cTimes=0;
; cPos++;
; }
; */
; cPos++;
lds R24,L2
subi R24,255 ; addi 1
sts L2,R24
.dbline 18
; cPos&=0b00001111;
andi R24,15
sts L2,R24
.dbline 19
; spark(cPos,LedNum[cPos]);
ldi R24,<_LedNum
ldi R25,>_LedNum
lds R30,L2
clr R31
add R30,R24
adc R31,R25
ldd R18,z+0
lds R16,L2
rcall _spark
.dbline -2
L1:
rcall pop_lset
.dbline 0 ; func end
reti
.dbend
.dbfunc e timer0_init _timer0_init fV
.even
_timer0_init::
.dbline -1
.dbline 22
; }
; void timer0_init(void)
; {
.dbline 23
; TIMSK|=0x01;
in R24,0x39
ori R24,1
out 0x39,R24
.dbline 24
; TCCR0=0x03;//分频系数8(1/8)
ldi R24,3
out 0x33,R24
.dbline 25
; TCNT0=0xdf;//预置数
ldi R24,223
out 0x32,R24
.dbline -2
L4:
.dbline 0 ; func end
ret
.dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -