diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6da3c28 --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +.PHONY: default cleantmp clean + +default: $(subst md,pdf,$(wildcard *.md)) + +SOURCES=$(wildcard *.asm) $(wildcard *.txt) + +%.pdf: %.html + wkhtmltopdf --title "$* - DJERABA Taky PREUD'HOMME Geoffrey" "$<" "$@" + +%.html: %.tmp ../template.html + pandoc -f markdown+hard_line_breaks "$<" --template ../template.html -o "$@" + +%.tmp: %.md $(SOURCES) + markedpp "$<" > "$@" + +cleantmp: + rm -rf $(subst md,html,$(wildcard *.md)) *.tmp + +clean: cleantmp + rm -rf $(subst md,pdf,$(wildcard *.md)) diff --git a/TP1/Makefile b/TP1/Makefile deleted file mode 100644 index 6da3c28..0000000 --- a/TP1/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -.PHONY: default cleantmp clean - -default: $(subst md,pdf,$(wildcard *.md)) - -SOURCES=$(wildcard *.asm) $(wildcard *.txt) - -%.pdf: %.html - wkhtmltopdf --title "$* - DJERABA Taky PREUD'HOMME Geoffrey" "$<" "$@" - -%.html: %.tmp ../template.html - pandoc -f markdown+hard_line_breaks "$<" --template ../template.html -o "$@" - -%.tmp: %.md $(SOURCES) - markedpp "$<" > "$@" - -cleantmp: - rm -rf $(subst md,html,$(wildcard *.md)) *.tmp - -clean: cleantmp - rm -rf $(subst md,pdf,$(wildcard *.md)) diff --git a/TP1/Makefile b/TP1/Makefile new file mode 120000 index 0000000..d0b0e8e --- /dev/null +++ b/TP1/Makefile @@ -0,0 +1 @@ +../Makefile \ No newline at end of file diff --git a/TP2/Makefile b/TP2/Makefile new file mode 120000 index 0000000..d0b0e8e --- /dev/null +++ b/TP2/Makefile @@ -0,0 +1 @@ +../Makefile \ No newline at end of file diff --git a/TP2/TP2.md b/TP2/TP2.md new file mode 100644 index 0000000..7362e7f --- /dev/null +++ b/TP2/TP2.md @@ -0,0 +1,101 @@ +% Compte-rendu TP2 +% DJERABA Taky PREUD'HOMME Geoffrey +% 03/05/2017 + +# TP2 +Ce TP a pour but de nous familiariser avec la gestion des interruptions et du watchdog sur l'Atmega 2560. + +## Un bouton/une LED et un chien de garde (TP20) + +!include(TP20.txt lang=asmplus) + +Ce programme allume la LED lors de l'appui sur un bouton, et ce jusqu'à une seconde après l'avoir relâché. Si on rappuie sur le bouton pendant l'intervalle des 1s, le compteur est remis à zéro. + +## Chenillard par interruption (TP21) + +```pseudo +chen ← 0b00000001 +port ← 0x00 ; pair : port A, impair : port B +boucle: jump boucle ; On attend là si rien ne se passe + +horaire: +Si (port & 0x01) == 0 alors DecalerGauche chen +Si (port & 0x01) == 1 alors DecalerDroite chen +Si chen != 0 saut boucle +Si (port & 0x01) == 0 alors chen ← 0b00000001 +Si (port & 0x01) == 1 alors chen ← 0b10000000 +Incrementer port ; On change de port +call afficher +Retourner + +antihoraire: +Si (port & 0x01) == 0 alors DecalerDroite chen +Si (port & 0x01) == 1 alors DecalerGauche chen +Si chen != 0 saut boucle +Si (port & 0x01) == 0 alors chen ← 0b10000000 +Si (port & 0x01) == 1 alors chen ← 0b00000001 +Incrementer port ; On change de port +call afficher +Retourner + +afficher: +Si (port & 0x01) == 0 alors PortB@IO ← 0x00 +Si (port & 0x01) == 1 alors PortA@IO ← 0x00 +Si (port & 0x01) == 0 alors PortA@IO ← chen +Si (port & 0x01) == 1 alors PortB@IO ← chen +Retourner +``` + +## Compteur (TP22) + +1) + +```pseudo +d0 ← 0 + +Configurer Watchdog: Interruption toutes les secondes sur wd + +boucle: jump boucle + +wd: +Incrementer d0 +Si d0 > 10 jump d0 ← 0: + +``` +4) + +```pseudo +d2 ← 0 +d1 ← 0 +d0 ← 0 +select ← 0x01 +io ← 0x00 + +Configurer Watchdog: Interruption toutes les secondes sur wd +Configurer timer0: Interruption toutes les 8-16 ms sur tm + +boucle: jump boucle + +wd: +Incrementer d0 +Si d0 < 10 Retourner +d0 ← 0 +Incrementer d1 +Si d1 < 10 Retourner +d1 ← 0 +Incrementer d2 +Si d2 < 10 Retourner +d2 ← 0 +Retourner ; Comportement si >999 : on revient à 000 + +tm: +PortC@IO ← select +Si select = 0x01 alors io ← afficheur@ROM[d0] +Si select = 0x02 alors io ← afficheur@ROM[d1] +Si select = 0x03 alors io ← afficheur@ROM[d2] +DecalerGauche io +Si io > 0x04 alors io ← 0x01 +Retourner +``` + +## Minuteur d'un four (TP23) diff --git a/TP2/TP20.txt b/TP2/TP20.txt new file mode 100644 index 0000000..af6ad83 --- /dev/null +++ b/TP2/TP20.txt @@ -0,0 +1,35 @@ +.equ PINA = 0x00 ; définition des adresses des ports +.equ DDRA = 0x01 +.equ PORTA = 0x02 + +.equ WDTCSR = 0x60 + +.equ RAMEND = 0x21FF +.equ SPH = 0x3E ; initialisation de la pile +.equ SPL = 0x3D + +.org 0x000 + ; Vecteur RESET + jmp debut + +.org 0x0080 + +debut: + DDRA@IO <- 0x01 ; Configuration du port pour mettre la LED en sortie et le bouton en entrée + +attend: + si (PINA@IO & 0x02) == 0 saut attend ; On reste là si le bouton n'est pas appuyé + + ; Dès que le bouton est appuyé + cli ; Activation du chien de garde en mode RESET + WDTCSR <- 0b00010000 ; Autorise la modification du chien de garde + WDTCSR <- 0b00001110 ; Reset le programme après 1 seconde + sei + + PORTA@IO <- 0x01 ; On allume la LED + +boucle: + si (PINA@IO & 0x02) == 0 saut boucle ; On reste ici en attendant que le watchdog arrive à expiration si le bouton est relâché + wdr ; Sinon si le bouton est appuyé on bloque le watchdog à 1s + jmp boucle +