I have been working on learning ASM and Im just NOT doing very well I have been trying to write a simple
Blink program and i am seeing NOTHING here is my program can anyone tell me what Im doing Wrong
Im expecting about a 20HZ blink.. not exactly but close. All i get is darkness
.NOLIST
.INCLUDE "tn13def.inc"
.LIST
.ORG 0
.equ Count16 = 60000
sbi DDRB,DDB0
MAIN:
cbi PORTB,PORTB0
ldi R25,HIGH(Count16)
ldi R24, LOW(Count16)
Loop16:
sbiw R24,1
brne Loop16
sbi PORTB,PORTB0
RJMP MAIN
pert
November 18, 2017, 4:09am
2
Delay from cbi to sbi = 60000 loops.
Delay from sbi to cbi = how much?
Hint: writing ones to PINB register toggles the corresponding bits in PORTB.
should be about 50ms am i wrong i know it will not be exact because all the instructions take cycles also
There is just one rjmp between the execution of sbi and cbi. It does not take 20 ms.
well how long will it take ?approximately
i am not looking for someone to write code for me i really want to learn this
Unroll the loop (in a text editor or on paper).
Next to each section / instruction jot down roughly how long it takes to execute.
is my 16 bit loop write ?