[First construction]
This commit is contained in:
commit
fd1f7eb731
|
@ -0,0 +1,3 @@
|
|||
*.elf
|
||||
*.hex
|
||||
*.o
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/zsh
|
||||
avr-as -mmcu=atmega328p -o main.o main.s
|
||||
avr-ld -o main.elf main.o
|
||||
avr-objcopy -O ihex main.elf main.hex
|
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/zsh
|
||||
DEVICE=/dev/ttyACM0
|
||||
sudo avrdude -p m328p -c arduino -P $DEVICE -U flash:w:main.hex
|
|
@ -0,0 +1,38 @@
|
|||
.equ DDRB, 0x04
|
||||
.equ PORTB, 0x05
|
||||
|
||||
.global main
|
||||
|
||||
main:
|
||||
ldi r16, 1
|
||||
out DDRB, r16
|
||||
ldi r16, 0
|
||||
out PORTB, r16
|
||||
loop_start:
|
||||
com r16
|
||||
out PORTB, r16
|
||||
init_sleep:
|
||||
ldi r18, 0xFF
|
||||
ldi r19, 0xFF
|
||||
ldi r20, 0xFF
|
||||
sleep_outer:
|
||||
cpi r18, 0x00
|
||||
breq loop_start
|
||||
dec r18
|
||||
rjmp sleep_inner1
|
||||
sleep_inner0:
|
||||
cpi r19, 0
|
||||
breq sleep_inner0_reset
|
||||
dec r19
|
||||
rjmp sleep_inner1
|
||||
sleep_inner0_reset:
|
||||
ldi r19, 0xFF
|
||||
rjmp sleep_outer
|
||||
sleep_inner1:
|
||||
cpi r20, 0
|
||||
breq sleep_inner1_reset
|
||||
dec r20
|
||||
rjmp sleep_inner1
|
||||
sleep_inner1_reset:
|
||||
ldi r20, 0x1F
|
||||
rjmp sleep_inner0
|
Loading…
Reference in New Issue