📄 numled.s
字号:
.module numled.c
.area lit(rom, con, rel)
_seg_table::
.byte 192,249
.byte 164,176
.byte 153,146
.byte 130,248
.byte 128,144
.byte 136,131
.byte 198,161
.byte 134,142
.dbfile C:\调试程序\mega48\ADC\numled.c
.dbsym e seg_table _seg_table A[16:16]kc
.area data(ram, con, rel)
.dbfile C:\调试程序\mega48\ADC\numled.c
_led_buff::
.blkb 2
.area idata
.byte 0,0
.area data(ram, con, rel)
.dbfile C:\调试程序\mega48\ADC\numled.c
.blkb 2
.area idata
.byte 0,0
.area data(ram, con, rel)
.dbfile C:\调试程序\mega48\ADC\numled.c
.dbsym e led_buff _led_buff A[4:4]c
.area text(rom, con, rel)
.dbfile C:\调试程序\mega48\ADC\numled.c
.dbfunc e delay_us _delay_us fV
; time -> R16,R17
.even
_delay_us::
.dbline -1
.dbline 7
; #include<iom48v.h>
; const unsigned char seg_table[16]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,
; 0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};
; unsigned char led_buff[4]={0,0,0,0};
; /* 微秒级延时程序 */
; void delay_us(int time)
; {
L2:
.dbline 9
; do
; {
.dbline 10
; time--;
subi R16,1
sbci R17,0
.dbline 11
; }
L3:
.dbline 12
; while (time>1);
ldi R24,1
ldi R25,0
cp R24,R16
cpc R25,R17
brlt L2
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbsym r time 16 I
.dbend
.dbfunc e delay_ms _delay_ms fV
; time -> R20,R21
.even
_delay_ms::
rcall push_gset1
movw R20,R16
.dbline -1
.dbline 16
; }
; /* 毫秒级延时程序 */
; void delay_ms(unsigned int time)
; {
rjmp L7
L6:
.dbline 18
.dbline 19
ldi R16,1000
ldi R17,3
rcall _delay_us
.dbline 20
subi R20,1
sbci R21,0
.dbline 21
L7:
.dbline 17
; while(time!=0)
cpi R20,0
cpc R20,R21
brne L6
X0:
.dbline -2
L5:
rcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r time 20 i
.dbend
.dbfunc e display _display fV
; i -> R20
.even
_display::
rcall push_gset1
.dbline -1
.dbline 24
; {
; delay_us(1000);
; time--;
; }
; }
; void display(void)
; {
.dbline 26
; unsigned char i;
; DDRB=0xff;
ldi R24,255
out 0x4,R24
.dbline 27
; PORTB=0xff;
out 0x5,R24
.dbline 28
; DDRD|=0xf0;
in R24,0xa
ori R24,240
out 0xa,R24
.dbline 29
; PORTD|=0xf0;
in R24,0xb
ori R24,240
out 0xb,R24
.dbline 30
; for(i=0;i<4;i++)
clr R20
rjmp L13
L10:
.dbline 31
.dbline 32
ldi R24,<_led_buff
ldi R25,>_led_buff
mov R30,R20
clr R31
add R30,R24
adc R31,R25
ldd R2,z+0
out 0x5,R2
.dbline 33
mov R17,R20
subi R17,252 ; addi 4
ldi R16,1
rcall lsl8
mov R2,R16
com R2
in R3,0xb
and R3,R2
out 0xb,R3
.dbline 34
ldi R16,1
ldi R17,0
rcall _delay_ms
.dbline 35
in R24,0xb
ori R24,240
out 0xb,R24
.dbline 36
L11:
.dbline 30
inc R20
L13:
.dbline 30
cpi R20,4
brlo L10
.dbline -2
L9:
rcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r i 20 c
.dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -