Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MODULE aufgabe_2
- TITLE 'Praktikum 6, Aufgabe 2: Ampelschaltung mit Taster'
- DECLARATIONS
- clk pin 15; "I/O 0, Eingang fuer den Takt
- S0 pin 19 istype 'reg'; "I/O 4
- S1 pin 20 istype 'reg'; "I/O 5
- S2 pin 21 istype 'reg'; "I/O 6
- S3 pin 22 istype 'reg'; "I/O 7
- counter = [S3,S2,S1,S0]; "Counter zuweisen
- y0 pin 37 istype 'com'; "I/O 16 Auto Rot
- y1 pin 32 istype 'com'; "I/O 15 Auto Gelb
- y2 pin 31 istype 'com'; "I/O 14 Auto Gruen
- y3 pin 30 istype 'com'; "I/O 13 Fussgaenger Rot
- y4 pin 29 istype 'com'; "I/O 12 Fussgaenger Gruen
- trigger pin 27; "I/O 10 Trigger für die Ampel
- queue pin 44 istype 'reg'; "I/O 23
- EQUATIONS
- counter.clk = clk;
- queue.clk=clk;
- when (((counter==0)#(counter>=7) & (trigger))) then queue.aset=trigger;
- STATE_DIAGRAM counter;
- State 0:
- [y4,y3,y2,y1,y0] = ^B01100;
- if(queue) then goto 1;
- else goto 0;
- State 1:
- [y4,y3,y2,y1,y0] = ^B01010;
- queue=0;
- goto 2;
- State 2:
- [y4,y3,y2,y1,y0] = ^B01001;
- goto 3;
- State 3:
- [y4,y3,y2,y1,y0] = ^B01001;
- goto 4;
- State 4:
- [y4,y3,y2,y1,y0] = ^B10001;
- goto 5;
- State 5:
- [y4,y3,y2,y1,y0] = ^B10001;
- goto 6;
- State 6:
- [y4,y3,y2,y1,y0] = ^B10001;
- goto 7;
- State 7:
- [y4,y3,y2,y1,y0] = ^B01001;
- goto 8;
- State 8:
- [y4,y3,y2,y1,y0] = ^B01001;
- goto 9;
- State 9:
- [y4,y3,y2,y1,y0] = ^B01011;
- goto 0;
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement