单片机开发资料光盘-双龙-686M.zip
源代码在线查看: delayfunction.s
.module delayfunction.c
.area text
.dbfile E:\grc\licc\例子10.3.2\delayfunction.c
.dbfunc s delay _delay fI
; i -> R20,R21
; delayValue -> R16,R17
.even
_delay::
rcall push_gset1
.dbline 3{
; #include /* 定义 8515 */
; void delay(int delayValue)
; {
.dbline 5
clr R20
clr R21
rjmp L5
L2:
.dbline 5
L3:
.dbline 5
subi R20,255 ; offset = 1
sbci R21,255
L5:
.dbline 5
; int i;
; for(i=0;i cp R20,R16
cpc R21,R17
brlt L2
.dbline 6}
; }
L1:
rcall pop_gset1
ret
.dbsym r i 20 I
.dbsym r delayValue 16 I
.dbfunc s main _main fI
; runner -> R20
.even
_main::
.dbline 8{
; void main(void)
; {
.dbline 9
; unsigned char runner = 0x01;
ldi R20,1
.dbline 10
; DDRB = 0xff; /* Port B 输出 */
ldi R24,255
out 0x17,R24
.dbline 11
; for (;;) /* 死循环 */
L7:
.dbline 12
; {
.dbline 13
; if (runner) runner tst R20
breq L11
.dbline 13
lsl R20
rjmp L12
L11:
.dbline 14
; else runner = 0x01;
ldi R20,1
L12:
.dbline 15
; PORTB = runner;
out 0x18,R20
.dbline 16
; delay(32767);
ldi R16,255
ldi R17,127
rcall _delay
.dbline 17
; }
.dbline 11
.dbline 11
rjmp L7
X0:
L6:
ret
.dbline 12}
.dbsym r runner 20 c