Created
June 18, 2012 05:40
-
-
Save numinit/2947007 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <avr/io.h> | |
.org 0x0000 | |
rjmp run | |
run: | |
; Clear r1 | |
clr r1 | |
; Load 0x01 into r16 for use later | |
ldi r16, 0x01 | |
; Load the data direction of DIRSET into r17 | |
lds r17, PORTD_DIRSET | |
; OR with r16 | |
or r17, r16 | |
; Commit the data direction | |
sts PORTD_DIRSET, r17 | |
; No interrupts | |
cli | |
; Loop | |
rjmp loop | |
loop: | |
; Load the OUTTGL register into r17 | |
lds r17, PORTD_OUTTGL | |
; OR with r16 | |
or r17, r16 | |
; Commit | |
sts PORTD_OUTTGL, r17 | |
; Delay loop | |
rjmp delay | |
delay: | |
; Load a 50 millisecond delay | |
ldi r24, 0xa8 ; 168 | |
ldi r25, 0x7d ; 125 | |
; Optimized delay loop | |
sbiw r24, 0x01 | |
brne .-4 | |
; Back to the loop | |
rjmp loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment