Assuming the sbi DDRB0 has just been executed write a loop i

Assuming the \"sbi DDRB,0\" has just been executed write a loop in assembly that will toggle port pin B0 11 times, using the atmega328p.

Solution

.include\"m328pdef.inc\"

sbi ddrb,0 ; making portb pin b0 as an output pin

ldi r21,11

here:

sbi portb,0

rcall delay

cbi portb,0

rcall delay

dec r21

brne here

stop: rjmp stop

delay:

ldi r22,$7f

here4:

ldi r17,$ff

here3:

ldi r18,$ff
here2:

nop
nop
dec r18
brne here2
dec r17
brne here3

dec r22

brne here4
ret

Assuming the \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site