Début CR TP3
This commit is contained in:
parent
c7695e6e75
commit
902ec65f1a
6 changed files with 248 additions and 47 deletions
|
|
@ -3,45 +3,39 @@
|
|||
.equ PORTA = 0x02
|
||||
|
||||
.equ RAMEND = 0x21FF
|
||||
.equ SPH = 0x3E ; initialisation de la pile
|
||||
.equ SPH = 0x3E
|
||||
.equ SPL = 0x3D
|
||||
|
||||
.equ SREG = 0x3F
|
||||
|
||||
.equ ADMUX = 0x7C
|
||||
|
||||
.equ ADCSRB = 0x7B
|
||||
.equ ADCSRA = 0x7A
|
||||
.equ ADCH = 0x79
|
||||
.equ ADCL = 0x78
|
||||
|
||||
.org 0x000
|
||||
; Vecteur RESET
|
||||
.org 0x000 ; Vecteur RESET
|
||||
jmp debut
|
||||
|
||||
.org 0x003A
|
||||
.org 0x003A ; Interruption conversion ADC terminée
|
||||
jmp irqadc
|
||||
|
||||
.org 0x0080
|
||||
|
||||
codeAff:
|
||||
|
||||
.db 0b1111110, 0b001100
|
||||
.db 0b0110111, 0b0011111
|
||||
.db 0b1001101, 0b1011011
|
||||
.db 0b1111011, 0b0001110
|
||||
.db 0b1111111, 0b1011111
|
||||
codeAff: ; Représentation des chiffres sur l'afficheur 7-segments
|
||||
.db 0b1111110, 0b001100, 0b0110111, 0b0011111, 0b1001101, 0b1011011, 0b1111011, 0b0001110, 0b1111111, 0b1011111
|
||||
|
||||
debut:
|
||||
; Intialisation de la pile
|
||||
ldi r28, low(RAMEND)
|
||||
ldi r29, high(RAMEND)
|
||||
|
||||
out SPL, r28
|
||||
out SPH, r29
|
||||
|
||||
DDRA@IO <- 0xFF
|
||||
ADMUX <- 0b01100000
|
||||
ADCSRB <- 0b00000000
|
||||
ADCSRA <- 0b11101111
|
||||
DDRA@IO <- 0xFF ; Port A (afficheur 7-segments) en sortie
|
||||
ADMUX <- 0b01100000 ; Sélection de l'ADC0
|
||||
ADCSRB <- 0b00000000 ; Free running mode
|
||||
ADCSRA <- 0b11101111 ; Activation des interruptions
|
||||
|
||||
sei
|
||||
|
||||
|
|
@ -49,11 +43,10 @@ boucle:
|
|||
sleep
|
||||
jmp boucle
|
||||
|
||||
irqadc:
|
||||
PORTA@IO <- codeAff@ROM[ADCH/27]
|
||||
irqadc: ; Dès qu'une lecture est terminée, l'afficher sur l'afficheur
|
||||
PORTA@IO <- codeAff@ROM[ADCH/51] ; On passe d'une valeur sur [0, 255] à [0, 5]
|
||||
reti
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Reference in a new issue