Blame view

compteur.txt 956 Bytes
930282df   Geoffrey PREUD'HOMME   Afficheur numérique
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  .equ PINA = 0x00 ; définition des adresses des ports

  .equ DDRA = 0x01

  .equ PORTA = 0x02

  .equ PINC = 0x06

  .equ DDRC = 0x07

  .equ PORTC = 0x08

  

  .equ RAMEND = 0x21FF

  .equ SPH = 0x3E ; initialisation de la pile

  .equ SPL = 0x3D

  

  .def compteur = r20

  .def seg = r21

  

  .org 0x000

      ; Vecteur RESET

      jmp debut

  

  .org 0x0080

  

  afficheur:

      .DB 0x3F, 0x30, 0x6D, 0x79, 0x72, 0x5B, 0x5F, 0x31, 0x7F, 0x7B

      ;      0,    1,    2,    3,    4,    5,    6,    7,    8,    9

  

  

  debut:

      DDRA@IO <- 0xFF

      DDRC@IO <- 0xFF

  

  boucle:

  

      ; On affiche compteur sur le 7 segments

      seg <- afficheur@ROM[compteur]

      out porta,seg

      

      ; On change de chiffre

      inc compteur

      si compteur > 9 alors compteur <- 0

  

      ; On attend et on recommence

      call tempo

      call tempo

      call tempo

      saut boucle

  

  tempo:

      ldi r24,8

  tempoA:

      subi r22,1

      sbci r23,0

      sbci r24,0

      brcc tempoA

      ret