Pub

jeudi 11 mars 2021

myTinyPLC : feu tricolore amélioré

 Voici un autre exemple de programmation avec myTinyPLC. Cette fois, on améliore le feu tricolore en le dotant de deux modes de fonctionnement : le cycle normal, rouge, vert, jaune et un mode jaune clignotant seul. On va se servir des quatre temporisations disponibles et du potentiomètre qu'on utilisera en fait comme un commutateur pour passer d'un mode à l'autre (potentiomètre en position 1 : cycle normal, potentiomètre en position 2 : cycle jaune clignotant).

Schéma électrique :

|    ___     ___     ___  
|    tm6     tm7     tm8                m6    | timer 5 s
+----]/[-----]/[-----]/[--+-------+----( )----+
|                         |       |           |
|                         |       |     m7    | timer 8 s
|                         |       +----( )----+
|                         |                   |
|                         |   p1        m8    | timer 1 s
|                         +--] [--+----( )----+
|                                 |           |
|     tm8    tm9              p2  |     m9    | timer 2 s
+----]/[-----]/[-------------] [--+----( )----+
|                                             |  normal:   p1=1, p2=0
                                                 flashing: p1=0, p2=1
|                                             |
|    tm8                                o2    | yellow LED
+----] [-------------------------------( )----+   1 s
|    ___                                      |
|    tm8     tm6              p1        o1    | red LED
+----]/[-----] [-------------] [-------( )----+   4 s
|    ___     ___                              |
|    tm8     tm6     tm7      p1        o3    | green LED
+----]/[-----]/[-----] [-----] [-------( )----+   3 s
|                                             |

Le programme IL :

  //
  // Advanced Traffic Light
  // IL program for myTinyPLC v.1.2
  //
  stp[1] = 5;  // number 5
  stp[2] = 66; // set timer delay 6
  stp[3] = 8;  // number 8
  stp[4] = 67; // set timer delay 7
  stp[5] = 1;  // number 1
  stp[6] = 68; // set timer delay 8
  stp[7] = 2;  // number 2
  stp[8] = 69; // set timer delay 9
  //
  stp[9] = 26; // read timer 6
  stp[10] = 83; // NOT
  stp[11] = 27; // read timer 7
  stp[12] = 83; // NOT
  stp[13] = 81; // AND
  stp[14] = 28; // read timer 8
  stp[15] = 83; // NOT
  stp[16] = 81; // AND
  stp[17] = 56; // write m6
  stp[18] = 57; // write m7
  stp[19] = 71; // read p1
  stp[20] = 81; // AND
  stp[21] = 28; // read timer 8
  stp[22] = 83; // NOT
  stp[23] = 29; // read timer 9
  stp[24] = 83; // NOT
  stp[25] = 81; // AND
  stp[26] = 72; // read p2
  stp[27] = 81; // AND
  stp[28] = 82; // OR
  stp[29] = 58; // write m8
  stp[30] = 59; // write m9
  stp[31] = 28; // read tm8
  stp[32] = 42; // write o2
  stp[33] = 83; // NOT
  stp[34] = 26; // read tm6
  stp[35] = 81; // AND
  stp[36] = 71; // read p1
  stp[37] = 81; // AND
  stp[38] = 41; // write o1
  stp[39] = 28; // read tm8
  stp[40] = 83; // NOT
  stp[41] = 26; // read tm6
  stp[42] = 83; // NOT
  stp[43] = 81; // AND
  stp[44] = 27; // READ tm7
  stp[45] = 81; // AND
  stp[46] = 71; // read p1
  stp[47] = 81; // AND
  stp[48] = 43; // write o3
  stp[49] = 99; // END


**** Guy F8ABX - 11/03/2021 ***

Aucun commentaire:

Enregistrer un commentaire