Page 12 - SERIE N11 micro 2
P. 12

PortB ⟸……...                                           Vdelay_ms(55000) ;
        Attente (55s)                                          end ;
        fin si                                                 …………………….
        Si non                                                 Begin
        Debut                                                  portb:=2;
        PortB ⟸……...                                           delay_ms(500);
        Attente (0,5s)                                         portb:=0;
        PortB ⟸……...                                           …………………….
        Attente (0,5s)                                         end ;
        fin si                                                 end ;
        fin faire                                              end .
        fin
       Exercice N°12 :
       Compteur modulo 10
       1 °) Compléter l'algorithme d'un compteur modulo 10.
       2°) Compléter le programme pascal correspondant.
          16                         17    7                    13
         15   OSC1/CLKIN      RA0    18    1   A           QA   12
                                               B
                                                           QB
             OSC2/CLKOUT
                              RA1
          4                   RA2    1     2   C           QC   11
                                                                10
                                     2
                                           6
                              RA3
             MCLR        RA4/T0CKI   3     4   D           QD   9
                                                           QE
                                               BI/RBO
                                     6     5   RBI         QF   15
                                           3
                                                                14
                           RB0/INT   7         LT          QG
                              RB1
                              RB2    8        7448
                                     9
                              RB3    10
                              RB4
                              RB5    11
                                     12
                              RB6    13
                              RB7
            PIC16F84A
        Algorithme : compteur m10                        Program compteur_m10;
        variable i :entier                               var i:integer ;  // déclaration d'une variable de type entier
        debut                                            begin
        TrisA ⟸ %…………. PortA ⟸ % …………..  trisA :=%.................... ; Port… :=%……………………. ;
        Tant que vrai faire                              while …… do                           // boucle infinie
        debut                                            begin
        Pour i variant de ….. jusqu’à ····· faire        for i:= …… to …… do              // boucle répétitive
        debut                                            begin
        PortA ⟸ …..                                      PortA := ………….;
        Attente (0,5s)                                   delay_ms(………. );
        fin tant que                                     end ;
        fin pour                                         end ;
        fin                                              end .
       Exercice N°13 :
       Compteur modulo 60
       1 °) Compléter le programme pascal d'un compteur modulo 60.











                                                                                                                12
   7   8   9   10   11   12   13   14   15   16   17