Commit b2e5656444046d9c045cbf1d2ceafe1ef4c63643
1 parent
e1ef3f33
Ajout du timer
Showing
1 changed file
with
23 additions
and
4 deletions
Show diff stats
compteurLettre.txt
... | ... | @@ -5,19 +5,26 @@ |
5 | 5 | .equ DDRC = 0x07 |
6 | 6 | .equ PORTC = 0x08 |
7 | 7 | |
8 | +.equ TCCR0A = 0x24 ; Initialisation du timer | |
9 | +.equ TCCR0B = 0x25 | |
10 | +.equ TMSK0 = 0x6e | |
11 | + | |
8 | 12 | .equ RAMEND = 0x21FF |
9 | 13 | .equ SPH = 0x3E ; initialisation de la pile |
10 | 14 | .equ SPL = 0x3D |
11 | 15 | |
16 | +.def selAfficheur = r19 | |
12 | 17 | .def compteur = r20 |
13 | 18 | .def seg = r21 |
14 | - | |
15 | -.org 0x000 | |
19 | +.org 0x000 | |
16 | 20 | ; Vecteur RESET |
17 | 21 | jmp debut |
18 | 22 | |
19 | -.org 0x0080 | |
23 | +.org 0x002e | |
24 | + ; Vecteur TIMER0 | |
25 | + jmp tmr | |
20 | 26 | |
27 | +.org 0x0080 | |
21 | 28 | afficheur: |
22 | 29 | .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 | 30 | ; 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, ° |
... | ... | @@ -26,11 +33,17 @@ afficheur: |
26 | 33 | debut: |
27 | 34 | DDRA@IO <- 0xFF |
28 | 35 | DDRC@IO <- 0xFF |
29 | - | |
36 | + TTCR0A@IO <- 0x01 | |
37 | + TTCR0B@IO <- 0x04 | |
38 | + TMSK0 <- 0x6E | |
39 | + selAfficheur <- 0x01 | |
40 | + SEI | |
41 | + | |
30 | 42 | boucle: |
31 | 43 | |
32 | 44 | ; On affiche compteur sur le 7 segments |
33 | 45 | seg <- afficheur@ROM[compteur] |
46 | + out portc,selAfficheur | |
34 | 47 | out porta,seg |
35 | 48 | |
36 | 49 | ; On change de chiffre |
... | ... | @@ -51,3 +64,9 @@ tempoA: |
51 | 64 | sbci r24,0 |
52 | 65 | brcc tempoA |
53 | 66 | ret |
67 | + | |
68 | +tmr: | |
69 | + lsl selAfficheur | |
70 | + si selAfficheur > 8 alors selAfficheur <-0x01 | |
71 | + portc@IO <- selAfficheur | |
72 | + ret | ... | ... |