Created
December 30, 2015 21:49
-
-
Save Michal-Fularz/d9f1fe7e73c5385add15 to your computer and use it in GitHub Desktop.
Amin's first foray into AVR uC world!
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 <tn2313def.inc> | |
;******************************************************* | |
rjmp Start | |
;******************************************************* | |
Delay1: | |
push r16 | |
push r17 | |
Loops: | |
ldi r16, 255 | |
DelayLoop1: | |
dec r16 | |
cpi r16,0 | |
ldi r17, 255 | |
DelayLoop2: | |
dec r17 | |
cpi r17,0 | |
brne DelayLoop2 | |
brne DelayLoop1 | |
brne Loops | |
pop r17 | |
pop r16 | |
ret | |
Delay2: | |
push r20 | |
ldi r20, 10 | |
DelayLoop3: | |
dec r20 | |
cpi r20,0 | |
rcall Delay1 | |
brne DelayLoop3 | |
pop r20 | |
dec r20 | |
cpi r20, 0 | |
brne Delay2 | |
ret | |
;******************************************************* | |
Start: | |
;ustawienie adresów pamięci RAM | |
ldi r16, low(RAMEND) | |
out SPL, r16 | |
;ustawienie odpowiednich portów jako wejścia/wyjścia | |
ser r16 | |
out DDRD, r16 | |
ldi r16, 0x7F | |
out DDRB, r16 | |
;wyświetlenie liter | |
Project: | |
ldi r17, 0x01 | |
FrequencyLoop: | |
com r17 | |
andi r17, 0x7F | |
out PORTB, r17 | |
com r17 | |
andi r17, 0x7F | |
cpi r17, 0x01 | |
breq LETTER_A | |
cpi r17, 0x02 | |
breq LETTER_S | |
cpi r17, 0x04 | |
breq LETTER_M1 | |
cpi r17, 0x08 | |
breq LETTER_M2 | |
Ending: | |
lsl r17 | |
ldi r20, 5 | |
rcall Delay2 | |
cpi r17, 0x10 | |
breq Project | |
rjmp FrequencyLoop | |
;wyświetlenie litery A | |
LETTER_A: | |
ldi r16, 0x77 | |
out PORTD, r16 | |
rjmp Ending | |
;wyświetlenie litery S | |
LETTER_S: | |
ldi r16, 0x5B | |
out PORTD, r16 | |
rjmp Ending | |
;wyświetlenie pierwszej części litery M | |
LETTER_M1: | |
ldi r16, 0x66 | |
out PORTD, r16 | |
rjmp Ending | |
;wyświetlenie drugiej części litery M | |
LETTER_M2: | |
ldi r16, 0x72 | |
out PORTD, r16 | |
rjmp Ending |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment