Skip to content

Commit

Permalink
Merge pull request #81 from importPI19fromDHGE/ASM_Jonathan_Files
Browse files Browse the repository at this point in the history
AVR-ASM Files
  • Loading branch information
ZeroPointMax authored Jun 6, 2021
2 parents e397d56 + fbc2ad6 commit 564a742
Show file tree
Hide file tree
Showing 12 changed files with 988 additions and 6 deletions.
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,7 @@
# extras folder ################################################################

!/[A-Z]*[A-Z]-[A-Z]*[A-Z]/extra
!/[A-Z]*[A-Z]-[A-Z]*[A-Z]/extra/**/
!/[A-Z]*[A-Z]-[A-Z]*[A-Z]/extra/**/*.md
!/[A-Z]*[A-Z]-[A-Z]*[A-Z]/extra/**/*.pdf
!/[A-Z]*[A-Z]-[A-Z]*[A-Z]/extra/**/*.svg
!/[A-Z]*[A-Z]-[A-Z]*[A-Z]/extra/**/*.png
!/[A-Z]*[A-Z]-[A-Z]*[A-Z]/extra/**/*.jpg
!/[A-Z]*[A-Z]-[A-Z]*[A-Z]/extra/**

# just in case #################################################################
!.gitignore
190 changes: 190 additions & 0 deletions ASM-GUENTHER/extra/ASM-Programme/Beispiele/440hz.asm
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 ASM-GUENTHER/extra/ASM-Programme/Beispiele/Interrupt_0_1.asm
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
Loading

0 comments on commit 564a742

Please sign in to comment.