;
; Attiny44Assembler.asm
;
; Created: 3/19/2018 11:38:44 AM
; Author : avrbeginners.net
; Modified : Marta Cortés
;

.dseg
.def reg = r16
.equ ledPin = PB2
.cseg//Start code segment
.org 0//initialize stack

; Replace with your application code
rjmp start

delay_05:						;subroutine tag
	ldi r16, 8					;load r16

outer_loop:
 
	ldi r24, low(3037)		;load to r24 the low of 3037 
	ldi r25, high(3037)		;load to r25 the high of 3037	
delay_loop:
	adiw r24, 1				;"add immediate to word": r24:r25 are incremented - >result
	brne delay_loop			; branch if result not 0
 	dec r16					; decrement r16
	brne outer_loop			; branch if result not 0
	ret						; return to rcall + 1

start:
    ldi r16, (1<<PB2)		;0x04 
	out DDRB, r16			;set DDRB-PB2 to output

loop:
	sbi PortB, ledPin		; set bit ledPin in PortB register
	rcall delay_05
	cbi PortB, ledPin		; clear bit ledPin in PortB register
	rcall delay_05
rjmp loop


