Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;
- ; arduino_assembly_blink.asm
- ;
- ; Created: 21/10/2019 18:58:07
- ; Author : Giovanni Vangelista
- ; Site: https://www.make4future.com
- ;Turns an LED on for 100ms, then off for 100ms, repeatedly.
- ;This program use a on-board LED of your arduino. On the arduino UNO, NANO, MEGA and ZERO it is attached to digital pin 13 (PB5)
- ldi r16,0B00000000 ;write on the register r16 a binary value
- ldi r17,0B00100000
- out DDRB,r17 ;Set the port out equal to the r17 value (1=output;0=input)
- Start:
- out PortB,r17 ;scrivo su portX i valori del registro rX
- call timer ;call subroutine named 'timer'
- out PortB,r16
- call timer
- rjmp Start ;go to 'Start'
- timer: ;subroutine of delay (100ms)
- ldi r18, 9
- ldi r19, 30
- ldi r20, 229
- L1: dec r20
- brne L1
- dec r19
- brne L1
- dec r18
- brne L1
- nop
- ret ;return from subroutine
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement