This is a screen shot of an AVR assembler program that turns PORTB's least significant bit on and off very quickly.
;
; AssemblerApplication4.asm
;
; Created: 17/05/2018 10:15:30 AM
; Author : peterb
;
; Set up stack pointer and turn PB0 on and off. No delay.
start:
out PORTB,r16
LDI R16, LOW(RAMEND)
OUT SPL, R16
LDI R16, HIGH(RAMEND)
OUT SPH, R16
;better make PB0 an output. Write a 1 into PB0 of DDRB.
clr r16
inc r16
out DDRB,r16
repeat:
clr r18
inc r18
rcall sendtob
clr r18
rcall sendtob
rjmp repeat
; the subroutine is below. Always ends with ret.
sendtob:
out PORTB, r18
ret
No comments:
Post a Comment