.cseg .org $0 jmp Reset duan:.db $c0,$f9,$a4,$b0,$99,$92,$82,$f8,$80,$90 ;wei: .db $ef,$df,$bf,7f .org $009A Reset: ldi r16,0xFF out DDRB,r16 out PORTB,r16 out DDRD,r16 out PORTD,r16 out DDRE,r16 out PORTE,r16 ldi r16,7 ldi XL,0x20 ldi XH,0x03 i0: st X+,r16 dec r16 cpi r16,0x00 brne i0 mov r1,r16 main: ldi r17,0x77 sbiw X,4 ;ldi r16,0xff L1: ld r18,X+ ldi ZL,low(duan<<1) ldi ZH,high(duan<<1) add ZL,r18 adc ZH,r1 lpm r18,Z call LED lsl r17 ;设断点 mov r19,r17 ori r19,0x0f out PORTD,r19 call Delayms ;设断点 ldi r16,0xff out PORTD,r16 cpi XL,0x24 brne L1 jmp main LED: in r0,sreg push r0 push r18 push r17 mov r17,r18 lsr r17 andi r17,0x40 in r16,PORTB andi r16,0xbf eor r17,r16 out PORTB,r17 mov r17,r18 lsl r17 andi r17,0xe0 in r16,PORTE andi r16,0x10 eor r17,r16 andi r18,0x0f or r17,r18 ;andi r18,0x27 ;or r18,r16 out PORTE,r17 pop r17 pop r18 pop r0 out sreg,r0 ret Delay: ldi r22,1 delay1: ldi r23,255 delay2: ldi r24,255 delay3: dec r24 brne delay3 dec r23 brne delay2 dec r22 brne delay1 ret .exit 给这些代码加注释
最新发布