📄 xunhuan.s
字号:
.module xunhuan.c
.area data(ram, con, rel)
_Table::
.blkb 2
.area idata
.byte 252,96
.area data(ram, con, rel)
.blkb 2
.area idata
.byte 218,242
.area data(ram, con, rel)
.blkb 2
.area idata
.byte 'f,182
.area data(ram, con, rel)
.blkb 2
.area idata
.byte 190,224
.area data(ram, con, rel)
.blkb 2
.area idata
.byte 254,246
.area data(ram, con, rel)
.dbfile D:\icc\程序\循环移位\xunhuan.c
.dbsym e Table _Table A[10:10]c
.area text(rom, con, rel)
.dbfile D:\icc\程序\循环移位\xunhuan.c
.dbfunc e Delay _Delay fV
; j -> R20,R21
; i -> R16,R17
.even
_Delay::
rcall push_gset1
.dbline -1
.dbline 8
; #include<iom8v.h>
; #define uchar unsigned char
; #define uint unsigned int
; uchar Table[10]={0xfc,0x60,0xda,0xf2,0x66,0xb6,0xbe,0xe0,0xfe,0xf6};//共阴7段码
;
;
; void Delay(uint i) // 延时程序
; {uint j;
.dbline 9
; for(;i!=0;i--)
rjmp L5
L2:
.dbline 10
.dbline 10
ldi R20,500
ldi R21,1
rjmp L9
L6:
.dbline 10
L7:
.dbline 10
subi R20,1
sbci R21,0
L9:
.dbline 10
cpi R20,0
cpc R20,R21
brne L6
X0:
.dbline 10
L3:
.dbline 9
subi R16,1
sbci R17,0
L5:
.dbline 9
cpi R16,0
cpc R16,R17
brne L2
X1:
.dbline -2
L1:
rcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r j 20 i
.dbsym r i 16 i
.dbend
.dbfunc e Init_IO _Init_IO fV
.even
_Init_IO::
.dbline -1
.dbline 15
; {for(j=500;j!=0;j--);}
; }
;
;
; void Init_IO(void) //IO口设置 全部设为输出
; {
.dbline 16
; DDRD=0xff;
ldi R24,255
out 0x11,R24
.dbline 17
; PORTD=0xff;
out 0x12,R24
.dbline 18
; DDRB=0xff;
out 0x17,R24
.dbline 19
; PORTB=0x00;
clr R2
out 0x18,R2
.dbline -2
L10:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Display _Display fV
; i -> R20
.even
_Display::
rcall push_gset1
.dbline -1
.dbline 23
; }
;
; void Display(void)
; {
.dbline 25
; uchar i;//uchar j; uchar n;
; for(i=0;i<4;i++)
clr R20
rjmp L15
L12:
.dbline 26
.dbline 27
mov R18,R20
clr R19
ldi R16,239
ldi R17,0
rcall lsl16
out 0x12,R16
.dbline 28
ldi R16,20
ldi R17,0
rcall _Delay
.dbline 31
ldi R24,<_Table
ldi R25,>_Table
mov R30,R20
clr R31
add R30,R24
adc R31,R25
ldd R2,z+0
out 0x18,R2
.dbline 32
ldi R16,200
ldi R17,0
rcall _Delay
.dbline 36
L13:
.dbline 25
inc R20
L15:
.dbline 25
cpi R20,4
brlo L12
.dbline -2
L11:
rcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r i 20 c
.dbend
.dbfunc e main _main fV
.even
_main::
.dbline -1
.dbline 40
; {
; PORTD=(0xef<<i); //<<是左移.0是位选
; Delay(20);
; //PORTD=(~(0x80>>i);) //>>右移,~是取反
;
; PORTB=Table[i];//0xfc;//
; Delay(200);
;
;
;
; }
; }
;
; void main (void)
; {
.dbline 41
; Init_IO();
rcall _Init_IO
rjmp L18
L17:
.dbline 43
.dbline 43
rcall _Display
.dbline 44
L18:
.dbline 42
rjmp L17
X2:
.dbline -2
L16:
.dbline 0 ; func end
ret
.dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -