trafficlights_2.awl 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. FUNCTION "Ampelsteuerung" : VOID
  2. TITLE =
  3. VERSION : 0.1
  4. BEGIN
  5. NETWORK
  6. TITLE =Takt/Zähler
  7. U "Takt_0.5Hz";
  8. ZV Z 0;
  9. NOP 0;
  10. NOP 0;
  11. NOP 0;
  12. U( ;
  13. O( ;
  14. L MW 12;
  15. L 16;
  16. ==I ;
  17. ) ;
  18. O "S0";
  19. ON "S1";
  20. ) ;
  21. R Z 0;
  22. L Z 0;
  23. T MW 12;
  24. NOP 0;
  25. NOP 0;
  26. NETWORK
  27. TITLE =Autoampel Rot
  28. U( ;
  29. L MW 12;
  30. L 9;
  31. >=I ;
  32. ) ;
  33. U "S1";
  34. UN "S0";
  35. = "H1";
  36. NETWORK
  37. TITLE =Autoampel Gelb
  38. U( ;
  39. U( ;
  40. L MW 12;
  41. L 7;
  42. >=I ;
  43. ) ;
  44. UN "H1";
  45. O( ;
  46. L MW 12;
  47. L 15;
  48. >=I ;
  49. ) ;
  50. ) ;
  51. U "S1";
  52. O ;
  53. U "S0";
  54. U "Takt_0.5Hz";
  55. = "H2";
  56. NETWORK
  57. TITLE =Autoampel Grün
  58. U( ;
  59. L MW 12;
  60. L 7;
  61. <=I ;
  62. ) ;
  63. UN "H2";
  64. U "S1";
  65. UN "S0";
  66. = "H3";
  67. NETWORK
  68. TITLE =Fußgängeranpel Rot
  69. U( ;
  70. O( ;
  71. L MW 12;
  72. L 14;
  73. >=I ;
  74. ) ;
  75. O( ;
  76. L MW 12;
  77. L 10;
  78. <=I ;
  79. ) ;
  80. ) ;
  81. U "S1";
  82. UN "H5";
  83. UN "S0";
  84. = "H4";
  85. NETWORK
  86. TITLE =Fußgängerampel Grün
  87. U( ;
  88. L MW 12;
  89. L 10;
  90. >=I ;
  91. ) ;
  92. U( ;
  93. L MW 12;
  94. L 14;
  95. <=I ;
  96. ) ;
  97. U "S1";
  98. UN "H4";
  99. UN "S0";
  100. = "H5";
  101. END_FUNCTION
  102. ORGANIZATION_BLOCK OB 1
  103. TITLE = "Main Program Sweep (Cycle)"
  104. VERSION : 0.1
  105. VAR_TEMP
  106. OB1_EV_CLASS : BYTE ; //Bits 0-3 = 1 (Coming event), Bits 4-7 = 1 (Event class 1)
  107. OB1_SCAN_1 : BYTE ; //1 (Cold restart scan 1 of OB 1), 3 (Scan 2-n of OB 1)
  108. OB1_PRIORITY : BYTE ; //Priority of OB Execution
  109. OB1_OB_NUMBR : BYTE ; //1 (Organization block 1, OB1)
  110. OB1_RESERVED_1 : BYTE ; //Reserved for system
  111. OB1_RESERVED_2 : BYTE ; //Reserved for system
  112. OB1_PREV_CYCLE : INT ; //Cycle time of previous OB1 scan (milliseconds)
  113. OB1_MIN_CYCLE : INT ; //Minimum cycle time of OB1 (milliseconds)
  114. OB1_MAX_CYCLE : INT ; //Maximum cycle time of OB1 (milliseconds)
  115. OB1_DATE_TIME : DATE_AND_TIME ; //Date and time OB1 started
  116. END_VAR
  117. BEGIN
  118. NETWORK
  119. TITLE =
  120. CALL "Ampelsteuerung" ;
  121. NOP 0;
  122. END_ORGANIZATION_BLOCK
  123. ORGANIZATION_BLOCK OB 100
  124. TITLE =
  125. VERSION : 0.1
  126. VAR_TEMP
  127. OB100_EV_CLASS : BYTE; // B#16#13, Event class 1, Entering event state, Event logged in diagnostic buffer
  128. OB100_STRTUP : BYTE; // B#16#81/82/83/84 Method of startup
  129. OB100_PRIORITY : BYTE; // Priority of OB execution
  130. OB100_OB_NUMBR : BYTE; // 100 (Organization block 100, OB 100)
  131. OB100_RESERVED_1 : BYTE;
  132. OB100_RESERVED_2 : BYTE;
  133. OB100_STOP : WORD; // Event that caused CPU to stop (W#16#4XXX)
  134. OB100_STRT_INFO : DWORD; // Information on how system started
  135. OB100_DATE_TIME : DATE_AND_TIME; // Date and time OB 100 started
  136. END_VAR
  137. BEGIN
  138. // Ampel einschalten
  139. SET;
  140. = "S1";
  141. END_ORGANIZATION_BLOCK