|
原码:
原意思是在定时中断中将t_v[15]--;定时一毫秒进一次。
void Msdelay(UW ms)
{
t_v[15]=ms;
while(t_v[15]);
PORTC=0xff;
PORTA=0xff;
PORTD=0xff;
while(1);
}
对应.lss
void Msdelay(UW ms)
{
124: 90 93 44 01 sts 0x0144, r25
128: 80 93 43 01 sts 0x0143, r24
t_v[15]=ms;//此行没问题。
while(t_v[15]);//此行有问题。
12c: 00 97 sbiw r24, 0x00 ; 0
(应该用t_v[15]的地址里的数与0比较才对,这里用r24里的数比较,大家看有没有问题?)
12e: f1 f7 brne .-4 ; 0x12c <Msdelay+0x8>
PORTC=0xff;
130: 8f ef ldi r24, 0xFF ; 255
132: 85 bb out 0x15, r24 ; 21
PORTA=0xff;
134: 8b bb out 0x1b, r24 ; 27
PORTD=0xff;
136: 82 bb out 0x12, r24 ; 18
138: ff cf rjmp .-2 ; 0x138 <Msdelay+0x14>
0000013a <main>:
13a: 0e 94 49 00 call 0x92 ; 0x92 <Sysinit>
13e: 82 e0 ldi r24, 0x02 ; 2
140: 90 e0 ldi r25, 0x00 ; 0
142: 0e 94 92 00 call 0x124 ; 0x124 <Msdelay>
146: fb cf rjmp .-10 ; 0x13e <main+0x4>
00000148 <__vector_1>:
while(1);
} |
阿莫论坛20周年了!感谢大家的支持与爱护!!
知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)
|