Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. MODULE aufgabe_2
  2.  
  3. TITLE 'Praktikum 6, Aufgabe 2: Ampelschaltung mit Taster'
  4.  
  5. DECLARATIONS
  6. clk pin 15; "I/O 0, Eingang fuer den Takt
  7. S0 pin 19 istype 'reg'; "I/O 4
  8. S1 pin 20 istype 'reg'; "I/O 5
  9. S2 pin 21 istype 'reg'; "I/O 6
  10. S3 pin 22 istype 'reg'; "I/O 7
  11. counter = [S3,S2,S1,S0]; "Counter zuweisen
  12.  
  13. y0 pin 37 istype 'com'; "I/O 16 Auto Rot
  14. y1 pin 32 istype 'com'; "I/O 15 Auto Gelb
  15. y2 pin 31 istype 'com'; "I/O 14 Auto Gruen
  16. y3 pin 30 istype 'com'; "I/O 13 Fussgaenger Rot
  17. y4 pin 29 istype 'com'; "I/O 12 Fussgaenger Gruen
  18.  
  19. trigger pin 27; "I/O 10 Trigger für die Ampel
  20. queue pin 44 istype 'reg'; "I/O 23
  21.  
  22.  
  23. EQUATIONS
  24. counter.clk = clk;
  25. queue.clk=clk;
  26. when (((counter==0)#(counter>=7) & (trigger))) then queue.aset=trigger;
  27.  
  28.  
  29. STATE_DIAGRAM counter;
  30.  
  31. State 0:
  32. [y4,y3,y2,y1,y0] = ^B01100;
  33. if(queue) then goto 1;
  34. else goto 0;
  35. State 1:
  36. [y4,y3,y2,y1,y0] = ^B01010;
  37. queue=0;
  38. goto 2;
  39. State 2:
  40. [y4,y3,y2,y1,y0] = ^B01001;
  41. goto 3;
  42. State 3:
  43. [y4,y3,y2,y1,y0] = ^B01001;
  44. goto 4;
  45. State 4:
  46. [y4,y3,y2,y1,y0] = ^B10001;
  47. goto 5;
  48. State 5:
  49. [y4,y3,y2,y1,y0] = ^B10001;
  50. goto 6;
  51. State 6:
  52. [y4,y3,y2,y1,y0] = ^B10001;
  53. goto 7;
  54. State 7:
  55. [y4,y3,y2,y1,y0] = ^B01001;
  56. goto 8;
  57. State 8:
  58. [y4,y3,y2,y1,y0] = ^B01001;
  59. goto 9;
  60. State 9:
  61. [y4,y3,y2,y1,y0] = ^B01011;
  62. goto 0;
  63.  
  64. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement