-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from importPI19fromDHGE/ASM_Jonathan_Files
AVR-ASM Files
- Loading branch information
Showing
12 changed files
with
988 additions
and
6 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
/*********************************** | ||
* * | ||
* Was tut das Programm * | ||
* * | ||
* Autor: André Grimm * | ||
* erstellt am: * | ||
* Version 0.1 * | ||
* * | ||
***********************************/ | ||
|
||
.nolist | ||
.include "m8515def.inc" | ||
.list | ||
|
||
/********************************************* | ||
* * | ||
* Hardwarebeschreibung: * | ||
* * | ||
* STK500 -> * | ||
* * | ||
*********************************************/ | ||
|
||
.def work = R16 | ||
|
||
.equ Pieper=0 | ||
.equ pinToToggle= 1 | ||
.equ timeToWait= 277 | ||
/***************** | ||
* * | ||
* Macros * | ||
* * | ||
*****************/ | ||
;Berechnung Basistakt 1MHZ -> 100k HZ --> 1 Mio pro Sekunden | ||
;Takt dauert 1/(1 Mio) Sekunden | ||
; 1 / 440 | ||
;Wechsel alle 440 * 1 / 1 Mio Sekunden = 440*10^-6 | ||
; | ||
////////////////////////////////////////////////////////////// | ||
// | ||
// Funktions- und Parameterbeschreibung | ||
// | ||
////////////////////////////////////////////////////////////// | ||
.macro name | ||
.endm | ||
|
||
/*************************** | ||
* * | ||
* Interrupt Vektor Tabelle * | ||
* * | ||
***************************/ | ||
.org 0x0000 | ||
rjmp start | ||
reti | ||
reti | ||
reti | ||
reti | ||
reti | ||
reti | ||
reti | ||
reti | ||
reti | ||
reti | ||
reti | ||
reti | ||
reti | ||
reti | ||
reti | ||
reti | ||
|
||
|
||
/********************* | ||
* * | ||
* Interrupt Handler * | ||
* * | ||
*********************/ | ||
|
||
////////////////////////////////////// | ||
// | ||
// Funktionsbeschreibung | ||
// | ||
////////////////////////////////////// | ||
intName: | ||
reti | ||
|
||
|
||
/******************************** | ||
* * | ||
* Initialisierung * | ||
* * | ||
********************************/ | ||
start: | ||
;init Stack | ||
ldi work, LOW(RAMEND) | ||
out SPL, work | ||
ldi work, HIGH(RAMEND) | ||
out SPH, work | ||
|
||
;init registers | ||
ldi R16, 0xFF ; de facto work | ||
out DDRA, R16 ; alle pins am port A sind Ausgänge | ||
|
||
;init TIMER | ||
|
||
|
||
/**************** | ||
* * | ||
* Hauptprogramm * | ||
* * | ||
****************/ | ||
;CPU Takt 200kHz | ||
|
||
main: | ||
rcall warte | ||
rcall togglePin | ||
rjmp main | ||
|
||
|
||
/*ldi R18, 100 | ||
outerloop: | ||
ldi R17, 248 | ||
loop: | ||
nop ; 1 Takt | ||
dec R17 ; 1 Takt | ||
;wiederholen solange R17 nicht null | ||
BRNE loop ; 1 if condition is false, 2 if condition is true | ||
;2 Takte | ||
dec R18 ; 1 Takt | ||
;wiederholen solange R17 nicht null | ||
BRNE loop2 | ||
*/ | ||
|
||
|
||
;warte eine halbe Sekunde | ||
|
||
|
||
|
||
|
||
|
||
/***************** | ||
* * | ||
* Unterprogramme * | ||
* * | ||
*****************/ | ||
|
||
|
||
////////////////////////////////////////////////////////////// | ||
// | ||
// schaltet Pin Um | ||
|
||
// Pin steht in Konstante pinToToggle | ||
// | ||
////////////////////////////////////////////////////////////// | ||
togglePin: | ||
push R15 | ||
in R15, SREG | ||
push R18 | ||
ldi R18, pinToToggle | ||
in work, PORTA | ||
eor work, R18 | ||
out PORTA, work | ||
|
||
pop R18 | ||
out SREG, R15 | ||
pop R15 | ||
ret | ||
|
||
warte: | ||
push R15 | ||
in R15, SREG | ||
push R24 | ||
push R25 | ||
|
||
ldi R24, LOW(timeToWait) | ||
ldi R25, HIGH(timeToWait) | ||
|
||
markeWarteloop: | ||
sbiw R24, 1 | ||
brne markeWarteloop | ||
|
||
pop R25 | ||
pop R24 | ||
out SREG, R15 | ||
pop R15 | ||
ret | ||
|
||
|
||
|
||
|
136 changes: 136 additions & 0 deletions
136
ASM-GUENTHER/extra/ASM-Programme/Beispiele/Interrupt_0_1.asm
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/*********************************** | ||
* * | ||
* Was tut das Programm * | ||
* * | ||
* Autor: Maximilian Kerst * | ||
* G190367PI * | ||
* erstellt am: * | ||
* * | ||
***********************************/ | ||
|
||
.nolist | ||
.include "m8515def.inc" | ||
.list | ||
|
||
/********************************************* | ||
* * | ||
* Hardwarebeschreibung: * | ||
* * | ||
* STK500 -> * | ||
* * | ||
*********************************************/ | ||
|
||
.def work = R16 | ||
.def status = R15 | ||
|
||
/***************** | ||
* * | ||
* Macros * | ||
* * | ||
*****************/ | ||
|
||
////////////////////////////////////////////////////////////// | ||
// | ||
// Funktions- und Parameterbeschreibung | ||
// | ||
////////////////////////////////////////////////////////////// | ||
.macro name | ||
.endm | ||
|
||
/*************************** | ||
* * | ||
* Interrupt Vektor Tabelle * | ||
* * | ||
***************************/ | ||
.org 0x0000 | ||
rjmp start | ||
rjmp t1h ; 2 External Interrupt 0 | ||
rjmp t2h ; 3 External Interrupt 1 | ||
reti ; 4 Timer1 Cature Event | ||
reti ; 5 Timer1 Compare Match A | ||
reti ; 6 Timer1 Compare Match B | ||
reti ; 7 Timer1 Overflow | ||
reti ; 8 Timer0 Overflow | ||
reti ; 9 Serial Transfer Complete | ||
reti ; 10 | ||
reti ; 11 | ||
reti ; 12 | ||
reti ; 13 | ||
reti ; 14 External Interrupt 2 | ||
reti ; 15 Timer0 Compare Match | ||
reti ; 16 | ||
reti ; 17 | ||
|
||
|
||
/********************* | ||
* * | ||
* Interrupt Handler * | ||
* * | ||
*********************/ | ||
|
||
////////////////////////////////////// | ||
// | ||
// Funktionsbeschreibung | ||
// | ||
////////////////////////////////////// | ||
t1h: | ||
|
||
in status, SREG | ||
in work, PORTB | ||
ldi R17, 0b00000001 | ||
eor work, R17 | ||
out PORTB, work | ||
out SREG, status | ||
reti | ||
|
||
t2h: | ||
|
||
in status, SREG | ||
in work, PORTB | ||
ldi R17, 0b00000010 | ||
eor work, R17 | ||
out PORTB, work | ||
out SREG, status | ||
reti | ||
|
||
|
||
/******************************** | ||
* * | ||
* Initialisierung * | ||
* * | ||
********************************/ | ||
start: | ||
;init Stack | ||
ldi work, LOW(RAMEND) | ||
out SPL, work | ||
ldi work, HIGH(RAMEND) | ||
out SPH, work | ||
|
||
;init registers | ||
|
||
ldi work, 0xFF | ||
out DDRB, work | ||
|
||
ldi work, 0b11000010 | ||
out PORTB, work | ||
|
||
ldi work, 0b00001100 | ||
out PORTD, work | ||
|
||
ldi work, 0b11000000 | ||
out gicr, work | ||
|
||
ldi work, 0x0F | ||
out mcucr, work | ||
|
||
SEI | ||
|
||
|
||
/**************** | ||
* * | ||
* Hauptprogramm * | ||
* * | ||
****************/ | ||
main: | ||
|
||
rjmp main |
Oops, something went wrong.