Commit a3eb34912f65710363405df377ac3693f48b68ec
Merge branch 'master' of archives.plil.fr:gbontoux/s6-mp-tutorat
Showing
1 changed file
with
53 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,53 @@ |
1 | +.equ PINA = 0x00 ; définition des adresses des ports | |
2 | +.equ DDRA = 0x01 | |
3 | +.equ PORTA = 0x02 | |
4 | +.equ PINC = 0x06 | |
5 | +.equ DDRC = 0x07 | |
6 | +.equ PORTC = 0x08 | |
7 | + | |
8 | +.equ RAMEND = 0x21FF | |
9 | +.equ SPH = 0x3E ; initialisation de la pile | |
10 | +.equ SPL = 0x3D | |
11 | + | |
12 | +.def compteur = r20 | |
13 | +.def seg = r21 | |
14 | + | |
15 | +.org 0x000 | |
16 | + ; Vecteur RESET | |
17 | + jmp debut | |
18 | + | |
19 | +.org 0x0080 | |
20 | + | |
21 | +afficheur: | |
22 | + .DB 0x3F, 0x30, 0x6D, 0x79, 0x72, 0x5B, 0x5F, 0x31, 0x7F, 0x7B, 0x77, 0x40, 0x4c, 0xfc, 0xcf, 0xc7, 0x40, 0xf6, 0x04, 0x3c, 0x40, 0x0E, 0x37, 0x54, 0x5c, 0x40, 0x40, 0x44, 0x5b, 0x4e, 0x1c, 0x1c, 0x40, 0x40, 0x40, 0x40, 0x63 | |
23 | + ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, ° | |
24 | + | |
25 | + | |
26 | +debut: | |
27 | + DDRA@IO <- 0xFF | |
28 | + DDRC@IO <- 0xFF | |
29 | + | |
30 | +boucle: | |
31 | + | |
32 | + ; On affiche compteur sur le 7 segments | |
33 | + seg <- afficheur@ROM[compteur] | |
34 | + out porta,seg | |
35 | + | |
36 | + ; On change de chiffre | |
37 | + inc compteur | |
38 | + si compteur > 36 alors compteur <- 0 | |
39 | + | |
40 | + ; On attend et on recommence | |
41 | + call tempo | |
42 | + call tempo | |
43 | + call tempo | |
44 | + saut boucle | |
45 | + | |
46 | +tempo: | |
47 | + ldi r24,8 | |
48 | +tempoA: | |
49 | + subi r22,1 | |
50 | + sbci r23,0 | |
51 | + sbci r24,0 | |
52 | + brcc tempoA | |
53 | + ret | ... | ... |