Commit ab6a4621223a41a40105d5fc1a134456094dc9e1
1 parent
200026c1
Ajout de l'init du CAN et début de la fonction
Showing
1 changed file
with
40 additions
and
5 deletions
Show diff stats
Algorithme
@@ -2,18 +2,42 @@ | @@ -2,18 +2,42 @@ | ||
2 | 2 | ||
3 | ;Initialisation | 3 | ;Initialisation |
4 | 4 | ||
5 | -0x0000: | 5 | +.equ RAMEND = 0x21FF |
6 | +.equ SPH = 0x3E | ||
7 | +.equ SPL = 0x3D | ||
8 | + | ||
9 | +.equ ADMUX = 0x7C | ||
10 | +.equ ADCSRB = 0x7B | ||
11 | +.equ ADCSRA = 0x7A | ||
12 | +.equ ADCL = 0x78 | ||
13 | +.equ ADCH = 0x79 | ||
14 | + | ||
15 | + | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | ||
24 | +.org 0x0000: | ||
6 | JMP debut | 25 | JMP debut |
7 | 26 | ||
8 | -0x0002: | 27 | +.org 0x0002: |
9 | JMP HMJN | 28 | JMP HMJN |
10 | 29 | ||
11 | -0x0004: | 30 | +.org 0x0004: |
12 | JMP MH | 31 | JMP MH |
32 | + | ||
33 | +.org 0x0006: | ||
34 | + JMP CAN | ||
13 | 35 | ||
14 | -0x002E: | 36 | +.org 0x002E: |
15 | JMP inc_heure | 37 | JMP inc_heure |
16 | 38 | ||
39 | + | ||
40 | + | ||
17 | debut: | 41 | debut: |
18 | DDRA = 0x07 | 42 | DDRA = 0x07 |
19 | DDRB = 0xFF | 43 | DDRB = 0xFF |
@@ -23,6 +47,10 @@ debut: | @@ -23,6 +47,10 @@ debut: | ||
23 | EIMSK = 0x037 | 47 | EIMSK = 0x037 |
24 | EICRA = 0x06 | 48 | EICRA = 0x06 |
25 | EICRB = 0x00 | 49 | EICRB = 0x00 |
50 | + LDI R28, low(RAMEND) | ||
51 | + LDI R29, high(RAMEND) | ||
52 | + OUT SPL, R28 | ||
53 | + OUT SPH, R29 | ||
26 | ADMUX <- 0b00010000 | 54 | ADMUX <- 0b00010000 |
27 | ADCSRB <- 0b00000000 | 55 | ADCSRB <- 0b00000000 |
28 | ADCSRA <- 0b11100101 | 56 | ADCSRA <- 0b11100101 |
@@ -169,7 +197,7 @@ MH: | @@ -169,7 +197,7 @@ MH: | ||
169 | reglage: | 197 | reglage: |
170 | H_reglage_jour=Heure_jour[Jour]:Minute_jour[Jour]; | 198 | H_reglage_jour=Heure_jour[Jour]:Minute_jour[Jour]; |
171 | H_reglage_nuit=Heure_nuit[Jour]:Minute_nuit[Jour]; | 199 | H_reglage_nuit=Heure_nuit[Jour]:Minute_nuit[Jour]; |
172 | - T=capteur ;Lecture de la valeur du capteur de température | 200 | + CALL CAN ;Lecture de la valeur du capteur de température |
173 | if(Heure:Minute<H_reglage_jour || Heure:Minute>H_reglage_nuit) | 201 | if(Heure:Minute<H_reglage_jour || Heure:Minute>H_reglage_nuit) |
174 | if(T_nuit-T>0.5 && !chauffe) | 202 | if(T_nuit-T>0.5 && !chauffe) |
175 | demarrage chaudiere ;Démarrage de la chaudière | 203 | demarrage chaudiere ;Démarrage de la chaudière |
@@ -186,6 +214,13 @@ reglage: | @@ -186,6 +214,13 @@ reglage: | ||
186 | chauffe=0 | 214 | chauffe=0 |
187 | RET | 215 | RET |
188 | 216 | ||
217 | + | ||
218 | +CAN: | ||
219 | + T = ADCH | ||
220 | + | ||
221 | + | ||
222 | + | ||
223 | + | ||
189 | inc_heure: | 224 | inc_heure: |
190 | Top_seconde=Top_seconde+1 | 225 | Top_seconde=Top_seconde+1 |
191 | if(Top_seconde==250) | 226 | if(Top_seconde==250) |