AVR-Code, 2024-11-02

.include "m8def.inc"

ldi r16, 0xff
out DDRB, r16

ldi r16, 0b01010101
out PORTB, r16

end: rjmp end
Image IMG_4478
.include "m8def.inc"

ldi r16, HIGH (RAMEND)
out SPH, r16
ldi r16, LOW (RAMEND)
out SPL, r16

ldi r16, 0xff
out DDRB, r16

ldi r16, 0xff
loop1:
out PORTB, r16
rcall sleep
dec r16
rjmp loop1

sleep:
push r16
push r17
ldi r17, 0xff
sleep_loop1:
ldi r16, 0xff
sleep_loop2:
dec r16
brne sleep_loop2
dec r17
brne sleep_loop1

pop r17
pop r16
ret

https://www.ituenix.de/html/vid/IMG_4479.mov

.include "m8def.inc"

.org 0x000
rjmp RESTART
.org INT0addr
rjmp ExtInt0
.org INT1addr
rjmp ExtInt1

RESTART:

ldi r16, HIGH (RAMEND)
out SPH, r16
ldi r16, LOW (RAMEND)
out SPL, r16
ldi r16, 0xff
out DDRB, r16
ldi r16, 0x00
out DDRD, r16

    ldi r16, (1 << ISC01) | (1 << ISC11)
    out MCUCR, r16
    ldi r16, (1 << INT0) | (1 << INT1)
    out GICR, r16

sei

end: rjmp end

ExtInt0:
ldi r16, 0xff
out PORTB, r16
reti

ExtInt1:
ldi r16, 0x00
out PORTB, r16
reti

https://www.ituenix.de/html/vid/IMG_4480.mov