Lesson 1. The screen and car A: a lift that goes by its buttons
In picturesAfter this lesson the house has one car: you press buttons on its panel — it moves, opens its doors at the right floors, rings a chime and decides by itself where to go next: first all the floors in one direction, then it turns around. The screen shows where the car is, whether its doors are open, which buttons are pressed and where it is going.
1.1. The idea: the car is a machine with memory
The car remembers four things:
- where it is — the position, 5 bits: the floor (3 bits) and the step between floors (2 bits);
- where it goes — the direction, 1 bit;
- whether the doors are open — a timer, 3 bits;
- which buttons are pressed — 8 latches.
Once a cycle (Clock 2Hz, half a second) the machine looks at all of this and decides: stand, open the doors, go up or down. The car passes a floor in 4 cycles — 2 seconds, and keeps its doors open for 2 seconds too.
1.2. The idea: one way while there is somewhere to go
The rule of real lifts: keep going one way and stop at every pressed floor on the way; you may turn around only when no pressed buttons are left ahead. For that the car needs two facts:
UPR— a pressed button above the car;DNR— a pressed button below.
"Above" and "below" come from OR chains — a thermometer: for a car at the 4th floor "above" is 5, 6, 7, 8 and "below" is 1, 2, 3. The decision at a floor:
- up:
UPR AND (going up OR NOT DNR); - down:
DNR AND (going down OR NOT UPR).
1.3. The idea: a button is a latch, not a flip-flop
A button is pressed for a fraction of a second, and a cycle is half a second: a flip-flop that stores only on the edge would miss the press. So the button sets a latch at once. Three things clear it: the doors opened at this floor, the Cancel button (it clears all the car buttons at once) and reset. Pressed the wrong floor — Cancel, then the right one.
1.4. Building
A new project. You need the gates NOT, NAND, NOR, AND, OR, XOR: already in the library from another kit of the series — take them; want to build from scratch — lesson 0; straight to the point — paste lesson 0 (Cmd+I).
Step 1. Chip SRLatch — latch: S stores 1, R stores 0
If SRLatch is already in the library (from another kit of the series), skip this step.
| Part | Leg | Label |
|---|---|---|
| Input port | output | R |
| Input port | output | S |
| Output port | input | Q |
| Output port | input | nQ |
| NOR | I0 I1 O0 | R nQ Q |
| NOR | I0 I1 O0 | S Q nQ |
Ctrl+G → name SRLatch. Legs: inputs R, S; outputs Q, nQ.
Step 2. Chip DLatch — data latch
If DLatch is already in the library (from another kit of the series), skip this step.
| Part | Leg | Label |
|---|---|---|
| Input port | output | D |
| Input port | output | EN |
| Output port | input | Q |
| Output port | input | nQ |
| NOT | I0 O0 | D nD |
| AND | I0 I1 O0 | D EN setD |
| AND | I0 I1 O0 | nD EN rstD |
| SRLatch | S R Q nQ | setD rstD Q nQ |
Ctrl+G → name DLatch. Legs: inputs D, EN; outputs Q, nQ.
Step 3. Chip DFF — flip-flop: stores D on the CLK edge
If DFF is already in the library (from another kit of the series), skip this step.
| Part | Leg | Label |
|---|---|---|
| Input port | output | D |
| Input port | output | CLK |
| Output port | input | Q |
| Output port | input | nQ |
| NOT | I0 O0 | CLK nCLK |
| DLatch | D EN Q | D nCLK mid |
| DLatch | D EN Q nQ | mid CLK Q nQ |
Ctrl+G → name DFF. Legs: inputs D, CLK; outputs Q, nQ.
Step 4. Chip FA — full adder
If FA is already in the library (from another kit of the series), skip this step.
| Part | Leg | Label |
|---|---|---|
| Input port | output | A |
| Input port | output | B |
| Input port | output | CI |
| Output port | input | S |
| Output port | input | CO |
| XOR | I0 I1 O0 | A B p |
| XOR | I0 I1 O0 | p CI S |
| AND | I0 I1 O0 | A B g |
| AND | I0 I1 O0 | p CI pc |
| OR | I0 I1 O0 | g pc CO |
Ctrl+G → name FA. Legs: inputs A, B, CI; outputs S, CO.
Step 5. Chip MUX2 — one of two
If MUX2 is already in the library (from another kit of the series), skip this step.
| Part | Leg | Label |
|---|---|---|
| Input port | output | A |
| Input port | output | B |
| Input port | output | S |
| Output port | input | Y |
| NOT | I0 O0 | S nS |
| NAND | I0 I1 O0 | A nS na |
| NAND | I0 I1 O0 | B S nb |
| NAND | I0 I1 O0 | na nb Y |
Ctrl+G → name MUX2. Legs: inputs A, B, S; outputs Y.
Step 6. Chip AND3 — AND with 3 inputs
If AND3 is already in the library (from another kit of the series), skip this step.
| Part | Leg | Label |
|---|---|---|
| Input port | output | A |
| Input port | output | B |
| Input port | output | C |
| Output port | input | Y |
| AND | I0 I1 O0 | A B ab |
| AND | I0 I1 O0 | ab C Y |
Ctrl+G → name AND3. Legs: inputs A, B, C; outputs Y.
Step 7. Chip OR3 — OR with 3 inputs
If OR3 is already in the library (from another kit of the series), skip this step.
| Part | Leg | Label |
|---|---|---|
| Input port | output | A |
| Input port | output | B |
| Input port | output | C |
| Output port | input | Y |
| OR | I0 I1 O0 | A B ab |
| OR | I0 I1 O0 | ab C Y |
Ctrl+G → name OR3. Legs: inputs A, B, C; outputs Y.
Step 8. Chip OR4 — OR with 4 inputs
If OR4 is already in the library (from another kit of the series), skip this step.
| Part | Leg | Label |
|---|---|---|
| Input port | output | A |
| Input port | output | B |
| Input port | output | C |
| Input port | output | D |
| Output port | input | Y |
| OR | I0 I1 O0 | A B ab |
| OR | I0 I1 O0 | C D cd |
| OR | I0 I1 O0 | ab cd Y |
Ctrl+G → name OR4. Legs: inputs A, B, C, D; outputs Y.
Step 9. Chip OR8 — OR with 8 inputs
If OR8 is already in the library (from another kit of the series), skip this step.
| Part | Leg | Label |
|---|---|---|
| Input port | output | A |
| Input port | output | B |
| Input port | output | C |
| Input port | output | D |
| Input port | output | E |
| Input port | output | F |
| Input port | output | G |
| Input port | output | H |
| Output port | input | Y |
| OR4 | A B C D Y | A B C D lo |
| OR4 | A B C D Y | E F G H hi |
| OR | I0 I1 O0 | lo hi Y |
Ctrl+G → name OR8. Legs: inputs A, B, C, D, E, F, G, H; outputs Y.
Step 10. Chip DEC8 — decoder 3 → 8: exactly one of eight wires is lit
If DEC8 is already in the library (from another kit of the series), skip this step.
| Part | Leg | Label |
|---|---|---|
| Input port | output | I0 |
| Input port | output | I1 |
| Input port | output | I2 |
| Output port | input | Y0 |
| Output port | input | Y1 |
| Output port | input | Y2 |
| Output port | input | Y3 |
| Output port | input | Y4 |
| Output port | input | Y5 |
| Output port | input | Y6 |
| Output port | input | Y7 |
| NOT | I0 O0 | I0 n0 |
| NOT | I0 O0 | I1 n1 |
| NOT | I0 O0 | I2 n2 |
| AND3 | A B C Y | n2 n1 n0 Y0 |
| AND3 | A B C Y | n2 n1 I0 Y1 |
| AND3 | A B C Y | n2 I1 n0 Y2 |
| AND3 | A B C Y | n2 I1 I0 Y3 |
| AND3 | A B C Y | I2 n1 n0 Y4 |
| AND3 | A B C Y | I2 n1 I0 Y5 |
| AND3 | A B C Y | I2 I1 n0 Y6 |
| AND3 | A B C Y | I2 I1 I0 Y7 |
Ctrl+G → name DEC8. Legs: inputs I0, I1, I2; outputs Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7.
Step 11. The screen: the picture and 152 legs
Segment LCD from the palette, ⚙ → ⬆ → project/lift/screen/lift-screen.png (88 × 130 dots). Turn on Ghost. Marking: S, click a blob (the wand), Enter, the name, Enter — a leg appears on the body, a label with its name next to it. Each segment is one blob, one click. The shaft letters, floor numbers and walls are the background — do not mark them.
Mark the whole screen at once, all three shafts: the legs of shafts B and C, the ▶ and the call squares are not connected yet and stay dark — their wires come in lessons 2–4. Digit segments: a is the top, then clockwise, g is the middle.
| On the screen | Leg name |
|---|---|
| shaft A, floor 1 — car frame | AC0 |
| shaft A, floor 2 — car frame | AC1 |
| shaft A, floor 3 — car frame | AC2 |
| shaft A, floor 4 — car frame | AC3 |
| shaft A, floor 5 — car frame | AC4 |
| shaft A, floor 6 — car frame | AC5 |
| shaft A, floor 7 — car frame | AC6 |
| shaft A, floor 8 — car frame | AC7 |
| shaft A, floor 1 — door leaves (inside the frame) | AD0 |
| shaft A, floor 2 — door leaves (inside the frame) | AD1 |
| shaft A, floor 3 — door leaves (inside the frame) | AD2 |
| shaft A, floor 4 — door leaves (inside the frame) | AD3 |
| shaft A, floor 5 — door leaves (inside the frame) | AD4 |
| shaft A, floor 6 — door leaves (inside the frame) | AD5 |
| shaft A, floor 7 — door leaves (inside the frame) | AD6 |
| shaft A, floor 8 — door leaves (inside the frame) | AD7 |
| shaft A, bar between floors 1 and 2 | AM0 |
| shaft A, bar between floors 2 and 3 | AM1 |
| shaft A, bar between floors 3 and 4 | AM2 |
| shaft A, bar between floors 4 and 5 | AM3 |
| shaft A, bar between floors 5 and 6 | AM4 |
| shaft A, bar between floors 6 and 7 | AM5 |
| shaft A, bar between floors 7 and 8 | AM6 |
| shaft A, floor 1 — dot on the right (car button) | AK0 |
| shaft A, floor 2 — dot on the right (car button) | AK1 |
| shaft A, floor 3 — dot on the right (car button) | AK2 |
| shaft A, floor 4 — dot on the right (car button) | AK3 |
| shaft A, floor 5 — dot on the right (car button) | AK4 |
| shaft A, floor 6 — dot on the right (car button) | AK5 |
| shaft A, floor 7 — dot on the right (car button) | AK6 |
| shaft A, floor 8 — dot on the right (car button) | AK7 |
| shaft A, floor 1 — ▶ on the left (call assigned) | AG0 |
| shaft A, floor 2 — ▶ on the left (call assigned) | AG1 |
| shaft A, floor 3 — ▶ on the left (call assigned) | AG2 |
| shaft A, floor 4 — ▶ on the left (call assigned) | AG3 |
| shaft A, floor 5 — ▶ on the left (call assigned) | AG4 |
| shaft A, floor 6 — ▶ on the left (call assigned) | AG5 |
| shaft A, floor 7 — ▶ on the left (call assigned) | AG6 |
| shaft A, floor 8 — ▶ on the left (call assigned) | AG7 |
| shaft A, digit above the shaft — segment a | AFa |
| shaft A, digit above the shaft — segment b | AFb |
| shaft A, digit above the shaft — segment c | AFc |
| shaft A, digit above the shaft — segment d | AFd |
| shaft A, digit above the shaft — segment e | AFe |
| shaft A, digit above the shaft — segment f | AFf |
| shaft A, digit above the shaft — segment g | AFg |
| shaft A, arrow ▲ | AUP |
| shaft A, arrow ▼ | ADN |
| shaft B, floor 1 — car frame | BC0 |
| shaft B, floor 2 — car frame | BC1 |
| shaft B, floor 3 — car frame | BC2 |
| shaft B, floor 4 — car frame | BC3 |
| shaft B, floor 5 — car frame | BC4 |
| shaft B, floor 6 — car frame | BC5 |
| shaft B, floor 7 — car frame | BC6 |
| shaft B, floor 8 — car frame | BC7 |
| shaft B, floor 1 — door leaves (inside the frame) | BD0 |
| shaft B, floor 2 — door leaves (inside the frame) | BD1 |
| shaft B, floor 3 — door leaves (inside the frame) | BD2 |
| shaft B, floor 4 — door leaves (inside the frame) | BD3 |
| shaft B, floor 5 — door leaves (inside the frame) | BD4 |
| shaft B, floor 6 — door leaves (inside the frame) | BD5 |
| shaft B, floor 7 — door leaves (inside the frame) | BD6 |
| shaft B, floor 8 — door leaves (inside the frame) | BD7 |
| shaft B, bar between floors 1 and 2 | BM0 |
| shaft B, bar between floors 2 and 3 | BM1 |
| shaft B, bar between floors 3 and 4 | BM2 |
| shaft B, bar between floors 4 and 5 | BM3 |
| shaft B, bar between floors 5 and 6 | BM4 |
| shaft B, bar between floors 6 and 7 | BM5 |
| shaft B, bar between floors 7 and 8 | BM6 |
| shaft B, floor 1 — dot on the right (car button) | BK0 |
| shaft B, floor 2 — dot on the right (car button) | BK1 |
| shaft B, floor 3 — dot on the right (car button) | BK2 |
| shaft B, floor 4 — dot on the right (car button) | BK3 |
| shaft B, floor 5 — dot on the right (car button) | BK4 |
| shaft B, floor 6 — dot on the right (car button) | BK5 |
| shaft B, floor 7 — dot on the right (car button) | BK6 |
| shaft B, floor 8 — dot on the right (car button) | BK7 |
| shaft B, floor 1 — ▶ on the left (call assigned) | BG0 |
| shaft B, floor 2 — ▶ on the left (call assigned) | BG1 |
| shaft B, floor 3 — ▶ on the left (call assigned) | BG2 |
| shaft B, floor 4 — ▶ on the left (call assigned) | BG3 |
| shaft B, floor 5 — ▶ on the left (call assigned) | BG4 |
| shaft B, floor 6 — ▶ on the left (call assigned) | BG5 |
| shaft B, floor 7 — ▶ on the left (call assigned) | BG6 |
| shaft B, floor 8 — ▶ on the left (call assigned) | BG7 |
| shaft B, digit above the shaft — segment a | BFa |
| shaft B, digit above the shaft — segment b | BFb |
| shaft B, digit above the shaft — segment c | BFc |
| shaft B, digit above the shaft — segment d | BFd |
| shaft B, digit above the shaft — segment e | BFe |
| shaft B, digit above the shaft — segment f | BFf |
| shaft B, digit above the shaft — segment g | BFg |
| shaft B, arrow ▲ | BUP |
| shaft B, arrow ▼ | BDN |
| shaft C, floor 1 — car frame | CC0 |
| shaft C, floor 2 — car frame | CC1 |
| shaft C, floor 3 — car frame | CC2 |
| shaft C, floor 4 — car frame | CC3 |
| shaft C, floor 5 — car frame | CC4 |
| shaft C, floor 6 — car frame | CC5 |
| shaft C, floor 7 — car frame | CC6 |
| shaft C, floor 8 — car frame | CC7 |
| shaft C, floor 1 — door leaves (inside the frame) | CD0 |
| shaft C, floor 2 — door leaves (inside the frame) | CD1 |
| shaft C, floor 3 — door leaves (inside the frame) | CD2 |
| shaft C, floor 4 — door leaves (inside the frame) | CD3 |
| shaft C, floor 5 — door leaves (inside the frame) | CD4 |
| shaft C, floor 6 — door leaves (inside the frame) | CD5 |
| shaft C, floor 7 — door leaves (inside the frame) | CD6 |
| shaft C, floor 8 — door leaves (inside the frame) | CD7 |
| shaft C, bar between floors 1 and 2 | CM0 |
| shaft C, bar between floors 2 and 3 | CM1 |
| shaft C, bar between floors 3 and 4 | CM2 |
| shaft C, bar between floors 4 and 5 | CM3 |
| shaft C, bar between floors 5 and 6 | CM4 |
| shaft C, bar between floors 6 and 7 | CM5 |
| shaft C, bar between floors 7 and 8 | CM6 |
| shaft C, floor 1 — dot on the right (car button) | CK0 |
| shaft C, floor 2 — dot on the right (car button) | CK1 |
| shaft C, floor 3 — dot on the right (car button) | CK2 |
| shaft C, floor 4 — dot on the right (car button) | CK3 |
| shaft C, floor 5 — dot on the right (car button) | CK4 |
| shaft C, floor 6 — dot on the right (car button) | CK5 |
| shaft C, floor 7 — dot on the right (car button) | CK6 |
| shaft C, floor 8 — dot on the right (car button) | CK7 |
| shaft C, floor 1 — ▶ on the left (call assigned) | CG0 |
| shaft C, floor 2 — ▶ on the left (call assigned) | CG1 |
| shaft C, floor 3 — ▶ on the left (call assigned) | CG2 |
| shaft C, floor 4 — ▶ on the left (call assigned) | CG3 |
| shaft C, floor 5 — ▶ on the left (call assigned) | CG4 |
| shaft C, floor 6 — ▶ on the left (call assigned) | CG5 |
| shaft C, floor 7 — ▶ on the left (call assigned) | CG6 |
| shaft C, floor 8 — ▶ on the left (call assigned) | CG7 |
| shaft C, digit above the shaft — segment a | CFa |
| shaft C, digit above the shaft — segment b | CFb |
| shaft C, digit above the shaft — segment c | CFc |
| shaft C, digit above the shaft — segment d | CFd |
| shaft C, digit above the shaft — segment e | CFe |
| shaft C, digit above the shaft — segment f | CFf |
| shaft C, digit above the shaft — segment g | CFg |
| shaft C, arrow ▲ | CUP |
| shaft C, arrow ▼ | CDN |
| floor 1 — square at the number (floor call) | H0 |
| floor 2 — square at the number (floor call) | H1 |
| floor 3 — square at the number (floor call) | H2 |
| floor 4 — square at the number (floor call) | H3 |
| floor 5 — square at the number (floor call) | H4 |
| floor 6 — square at the number (floor call) | H5 |
| floor 7 — square at the number (floor call) | H6 |
| floor 8 — square at the number (floor call) | H7 |
Step 12. Power, clock, reset
Clock — click the body up to 2Hz: a cycle is half a second, the car passes a floor in 4 cycles (2 seconds) and keeps the doors open for 4 cycles. RST is the reset switch; nR is its inverse, it stands in front of every flip-flop.
| Part | Leg | Label |
|---|---|---|
| Power | output | VCC |
| Ground | output | GND |
| Clock | output | CLK |
| Input (switch) | output | RST |
| NOT | I0 O0 | RST nR |
Step 13. Car A panel
Eight floor buttons and Cancel. Put them in a column to the right of the screen, «8» on top: this is the panel inside car A. Press them with the mouse.
| Part | Leg | Label |
|---|---|---|
| Button «1» | output | AB0 |
| Button «2» | output | AB1 |
| Button «3» | output | AB2 |
| Button «4» | output | AB3 |
| Button «5» | output | AB4 |
| Button «6» | output | AB5 |
| Button «7» | output | AB6 |
| Button «8» | output | AB7 |
| Button «Cancel» | output | ACAN |
Step 14. Where the car is
The position is 5 bits: p4 p3 p2 is the floor (0–7, on the screen 1–8), p1 p0 is the step between floors. atF = 1 when the step is 0: the car stands exactly at a floor. DEC8 lights one wire y0–y7 — the floor of the car.
| Part | Leg | Label |
|---|---|---|
| NOR | I0 I1 O0 | p0 p1 atF |
| NOT | I0 O0 | atF natF |
| DEC8 | I0 I1 I2 Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 | p2 p3 p4 y0 y1 y2 y3 y4 y5 y6 y7 |
Step 15. Doors open
The door timer t2 t1 t0 (step «Door timer»): while it is not 0, the doors are open (OPEN).
| Part | Leg | Label |
|---|---|---|
| OR3 | A B C Y | t0 t1 t2 OPEN |
| NOT | I0 O0 | OPEN ndoor |
Step 16. Car at a floor
AC<f> — the car stands at floor f: this is also the frame on the screen. O<f> — the doors are open at floor f: it clears the button of this floor.
| Part | Leg | Label |
|---|---|---|
| AND | I0 I1 O0 | y0 atF AC0 |
| AND | I0 I1 O0 | AC0 OPEN O0 |
| AND | I0 I1 O0 | y1 atF AC1 |
| AND | I0 I1 O0 | AC1 OPEN O1 |
| AND | I0 I1 O0 | y2 atF AC2 |
| AND | I0 I1 O0 | AC2 OPEN O2 |
| AND | I0 I1 O0 | y3 atF AC3 |
| AND | I0 I1 O0 | AC3 OPEN O3 |
| AND | I0 I1 O0 | y4 atF AC4 |
| AND | I0 I1 O0 | AC4 OPEN O4 |
| AND | I0 I1 O0 | y5 atF AC5 |
| AND | I0 I1 O0 | AC5 OPEN O5 |
| AND | I0 I1 O0 | y6 atF AC6 |
| AND | I0 I1 O0 | AC6 OPEN O6 |
| AND | I0 I1 O0 | y7 atF AC7 |
| AND | I0 I1 O0 | AC7 OPEN O7 |
Step 17. Car buttons — latches
A button is pressed for a fraction of a second, and a cycle is half a second: a flip-flop would miss the press. So the button sets a latch SRLatch at once. kr<f> clears the latch: the doors are open at this floor, or Cancel (kc — it clears all eight), or reset. While it is being cleared, a press does not get through: a latch must not get S and R together. The AK<f> output is the dot to the right of the shaft.
| Part | Leg | Label |
|---|---|---|
| OR | I0 I1 O0 | ACAN RST kc |
| OR | I0 I1 O0 | O0 kc kr0 |
| NOT | I0 O0 | kr0 nkr0 |
| AND | I0 I1 O0 | AB0 nkr0 ks0 |
| SRLatch | S R Q | ks0 kr0 AK0 |
| OR | I0 I1 O0 | O1 kc kr1 |
| NOT | I0 O0 | kr1 nkr1 |
| AND | I0 I1 O0 | AB1 nkr1 ks1 |
| SRLatch | S R Q | ks1 kr1 AK1 |
| OR | I0 I1 O0 | O2 kc kr2 |
| NOT | I0 O0 | kr2 nkr2 |
| AND | I0 I1 O0 | AB2 nkr2 ks2 |
| SRLatch | S R Q | ks2 kr2 AK2 |
| OR | I0 I1 O0 | O3 kc kr3 |
| NOT | I0 O0 | kr3 nkr3 |
| AND | I0 I1 O0 | AB3 nkr3 ks3 |
| SRLatch | S R Q | ks3 kr3 AK3 |
| OR | I0 I1 O0 | O4 kc kr4 |
| NOT | I0 O0 | kr4 nkr4 |
| AND | I0 I1 O0 | AB4 nkr4 ks4 |
| SRLatch | S R Q | ks4 kr4 AK4 |
| OR | I0 I1 O0 | O5 kc kr5 |
| NOT | I0 O0 | kr5 nkr5 |
| AND | I0 I1 O0 | AB5 nkr5 ks5 |
| SRLatch | S R Q | ks5 kr5 AK5 |
| OR | I0 I1 O0 | O6 kc kr6 |
| NOT | I0 O0 | kr6 nkr6 |
| AND | I0 I1 O0 | AB6 nkr6 ks6 |
| SRLatch | S R Q | ks6 kr6 AK6 |
| OR | I0 I1 O0 | O7 kc kr7 |
| NOT | I0 O0 | kr7 nkr7 |
| AND | I0 I1 O0 | AB7 nkr7 ks7 |
| SRLatch | S R Q | ks7 kr7 AK7 |
Step 18. The thermometer: what is below, what is above
a<f> = 1 if the car is below floor f; b<f> = 1 if it is above. These are OR chains from the lit y: for a car at the 4th floor a5, a6, a7 and b0…b2 are lit. For the 1st and 8th floor y0 and y7 themselves are enough.
| Part | Leg | Label |
|---|---|---|
| OR | I0 I1 O0 | y0 y1 a2 |
| OR | I0 I1 O0 | a2 y2 a3 |
| OR | I0 I1 O0 | a3 y3 a4 |
| OR | I0 I1 O0 | a4 y4 a5 |
| OR | I0 I1 O0 | a5 y5 a6 |
| OR | I0 I1 O0 | a6 y6 a7 |
| OR | I0 I1 O0 | y7 y6 b5 |
| OR | I0 I1 O0 | b5 y5 b4 |
| OR | I0 I1 O0 | b4 y4 b3 |
| OR | I0 I1 O0 | b3 y3 b2 |
| OR | I0 I1 O0 | b2 y2 b1 |
| OR | I0 I1 O0 | b1 y1 b0 |
Step 19. Work above? Below?
UPR — a pressed button above the car: the OR of «button f AND the car is below f». DNR — the same downwards.
| Part | Leg | Label |
|---|---|---|
| AND | I0 I1 O0 | AK1 y0 ru1 |
| AND | I0 I1 O0 | AK2 a2 ru2 |
| AND | I0 I1 O0 | AK3 a3 ru3 |
| AND | I0 I1 O0 | AK4 a4 ru4 |
| AND | I0 I1 O0 | AK5 a5 ru5 |
| AND | I0 I1 O0 | AK6 a6 ru6 |
| AND | I0 I1 O0 | AK7 a7 ru7 |
| OR8 | A B C D E F G H Y | ru1 ru2 ru3 ru4 ru5 ru6 ru7 GND UPR |
| AND | I0 I1 O0 | AK0 b0 rd0 |
| AND | I0 I1 O0 | AK1 b1 rd1 |
| AND | I0 I1 O0 | AK2 b2 rd2 |
| AND | I0 I1 O0 | AK3 b3 rd3 |
| AND | I0 I1 O0 | AK4 b4 rd4 |
| AND | I0 I1 O0 | AK5 b5 rd5 |
| AND | I0 I1 O0 | AK6 y7 rd6 |
| OR8 | A B C D E F G H Y | rd0 rd1 rd2 rd3 rd4 rd5 rd6 GND DNR |
Step 20. The button of this floor
hK — the button of the floor where the car is, is pressed. gOK — «going down or nothing above»: it is used in the decision and in lesson 2.
| Part | Leg | Label |
|---|---|---|
| AND | I0 I1 O0 | AK0 y0 hk0 |
| AND | I0 I1 O0 | AK1 y1 hk1 |
| AND | I0 I1 O0 | AK2 y2 hk2 |
| AND | I0 I1 O0 | AK3 y3 hk3 |
| AND | I0 I1 O0 | AK4 y4 hk4 |
| AND | I0 I1 O0 | AK5 y5 hk5 |
| AND | I0 I1 O0 | AK6 y6 hk6 |
| AND | I0 I1 O0 | AK7 y7 hk7 |
| OR8 | A B C D E F G H Y | hk0 hk1 hk2 hk3 hk4 hk5 hk6 hk7 hK |
| NOT | I0 O0 | dir ndir |
| NOT | I0 O0 | UPR nUPR |
| OR | I0 I1 O0 | ndir nUPR gOK |
Step 21. Here: stop
here — we stand at a floor, the doors are closed, the button of this floor is pressed: open the doors. It also rings the chime (the last step).
| Part | Leg | Label |
|---|---|---|
| AND3 | A B C Y | atF ndoor hK here |
Step 22. Decision: up or down
At a floor (doors closed, nothing to do here) the car decides: up if there is work above and (we go up or nothing below); down — the other way round. Keep going one way while there is work there, and only then turn around.
| Part | Leg | Label |
|---|---|---|
| NOT | I0 O0 | DNR nDNR |
| OR | I0 I1 O0 | dir nDNR uOK |
| AND | I0 I1 O0 | UPR uOK mvUp |
| AND | I0 I1 O0 | DNR gOK mvDn |
| NOT | I0 O0 | here nhere |
| AND3 | A B C Y | atF ndoor nhere decide |
Step 23. Direction
At a floor the direction is decided again (mvUp; no work — «down»), on the way and with open doors it is kept. Flip-flop dir: 1 means up.
| Part | Leg | Label |
|---|---|---|
| MUX2 | A B S Y | dir mvUp decide dirN |
| AND | I0 I1 O0 | dirN nR dirD |
| DFF | D CLK Q | dirD CLK dir |
Step 24. Moving
go — move on this cycle: between floors always (a lift does not stop mid-shaft), at a floor if we decided to go.
| Part | Leg | Label |
|---|---|---|
| OR | I0 I1 O0 | mvUp mvDn mv |
| AND | I0 I1 O0 | decide mv go1 |
| OR | I0 I1 O0 | natF go1 go |
Step 25. Position counter
Five FA add +1 (up) or 11111 (that is −1: down) to the position — or 0 when standing. AND with nR — reset to the 1st floor.
| Part | Leg | Label |
|---|---|---|
| NOT | I0 O0 | dirN ndirN |
| AND | I0 I1 O0 | go ndirN dn |
| FA | A B CI S CO | p0 go GND q0 c0 |
| FA | A B CI S CO | p1 dn c0 q1 c1 |
| FA | A B CI S CO | p2 dn c1 q2 c2 |
| FA | A B CI S CO | p3 dn c2 q3 c3 |
| FA | A B CI S CO | p4 dn c3 q4 c4 |
| AND | I0 I1 O0 | q0 nR pd0 |
| DFF | D CLK Q | pd0 CLK p0 |
| AND | I0 I1 O0 | q1 nR pd1 |
| DFF | D CLK Q | pd1 CLK p1 |
| AND | I0 I1 O0 | q2 nR pd2 |
| DFF | D CLK Q | pd2 CLK p2 |
| AND | I0 I1 O0 | q3 nR pd3 |
| DFF | D CLK Q | pd3 CLK p3 |
| AND | I0 I1 O0 | q4 nR pd4 |
| DFF | D CLK Q | pd4 CLK p4 |
Step 26. Door timer
Opened (here) — 4 (100), open — minus 1 (three FA add 111), closed — 0. The doors stay open for 4 cycles — 2 seconds.
| Part | Leg | Label |
|---|---|---|
| FA | A B CI S CO | t0 VCC GND u0 e0 |
| FA | A B CI S CO | t1 VCC e0 u1 e1 |
| FA | A B CI S CO | t2 VCC e1 u2 e2 |
| AND | I0 I1 O0 | u0 OPEN v0 |
| AND | I0 I1 O0 | u1 OPEN v1 |
| AND | I0 I1 O0 | u2 OPEN v2a |
| OR | I0 I1 O0 | v2a here v2 |
| AND | I0 I1 O0 | v0 nR td0 |
| DFF | D CLK Q | td0 CLK t0 |
| AND | I0 I1 O0 | v1 nR td1 |
| DFF | D CLK Q | td1 CLK t1 |
| AND | I0 I1 O0 | v2 nR td2 |
| DFF | D CLK Q | td2 CLK t2 |
Step 27. Arrows
An arrow is lit while there is work or the car is moving: ▲ — direction up, ▼ — down.
| Part | Leg | Label |
|---|---|---|
| OR8 | A B C D E F G H Y | AK0 AK1 AK2 AK3 AK4 AK5 AK6 AK7 rAny |
| OR | I0 I1 O0 | rAny natF busy |
| AND | I0 I1 O0 | dir busy AUP |
| AND | I0 I1 O0 | ndir busy ADN |
Step 28. The screen: door leaves, bar, digit
AD<f> — the door leaves: the car is at floor f and the doors are closed. AM<f> — the car is on the way between floors f and f+1. The floor digit comes from the one lit y: a segment is lit on the floors where it is needed (a — on 2, 3, 5, 6, 7, 8 …), so each segment is one OR.
| Part | Leg | Label |
|---|---|---|
| AND | I0 I1 O0 | AC0 ndoor AD0 |
| AND | I0 I1 O0 | AC1 ndoor AD1 |
| AND | I0 I1 O0 | AC2 ndoor AD2 |
| AND | I0 I1 O0 | AC3 ndoor AD3 |
| AND | I0 I1 O0 | AC4 ndoor AD4 |
| AND | I0 I1 O0 | AC5 ndoor AD5 |
| AND | I0 I1 O0 | AC6 ndoor AD6 |
| AND | I0 I1 O0 | AC7 ndoor AD7 |
| AND | I0 I1 O0 | y0 natF AM0 |
| AND | I0 I1 O0 | y1 natF AM1 |
| AND | I0 I1 O0 | y2 natF AM2 |
| AND | I0 I1 O0 | y3 natF AM3 |
| AND | I0 I1 O0 | y4 natF AM4 |
| AND | I0 I1 O0 | y5 natF AM5 |
| AND | I0 I1 O0 | y6 natF AM6 |
| OR8 | A B C D E F G H Y | y1 y2 y4 y5 y6 y7 GND GND AFa |
| OR8 | A B C D E F G H Y | y0 y1 y2 y3 y6 y7 GND GND AFb |
| OR8 | A B C D E F G H Y | y0 y2 y3 y4 y5 y6 y7 GND AFc |
| OR8 | A B C D E F G H Y | y1 y2 y4 y5 y7 GND GND GND AFd |
| OR3 | A B C Y | y1 y5 y7 AFe |
| OR4 | A B C D Y | y3 y4 y5 y7 AFf |
| OR8 | A B C D E F G H Y | y1 y2 y3 y4 y5 y7 GND GND AFg |
Step 29. Chime
Speaker from the palette: click the icon on the left — «buzzer» mode, the grille — tone 880. It rings while the doors are opening (here).
| Part | Leg | Label |
|---|---|---|
| Speaker (buzzer, 880) | SPKR | here |
1.5. Check
Do not fold the board — in lesson 2 the floor call buttons are added to it.
RSTon and off. On the screen in shaftA: the car is at the 1st floor — a frame with door leaves (doors closed), digit 1 above the shaft, no arrows.- Press 5. A dot lights to the right of the shaft at the 5th floor, ▲ above the shaft. The car moves: the frame goes out, a bar is lit between floors, the digit grows 1 → 2 → 3 → 4. After 8 seconds the car is at the 5th: the chime rings, the frame is empty (doors open), the dot goes out, ▲ goes out. 2 seconds later the leaves appear — the doors closed.
- Press 7, 8 and 3. The car goes up: opens its doors at the 7th, then at the 8th, then ▼ — and goes down to the 3rd. It would not go to the 3rd on the way up: first all the work in one direction, then the turn.
- Press 6, then Cancel, then 5. The dot at 6 goes out, the car goes to the 5th.
- Press 1 and, while the car moves, — Cancel. The car reaches the nearest floor and stops without opening its doors: a lift does not stop mid-shaft.
- The car stands with closed doors — press the button of its floor: the doors open at once. While the doors are open, the button of this floor does not light.
| What you see | What it is |
|---|---|
| frame with door leaves | the car stands at a floor, doors closed |
| empty frame | the car stands at a floor, doors open |
| bar between floors | the car is moving |
| dot right of the shaft | that floor's button is pressed in the car |
| digit above the shaft | the car floor (on the way — the lower one) |
| ▲ / ▼ | where it goes while there is work |
| shafts B, C, ▶, squares | dark — we connect them in lessons 2–4 |
Lesson 1 paste (Cmd+I)
You need the gates NOT, NAND, NOR, AND, OR, XOR (lesson 0 or its paste) and the parts of steps 1–10 (SRLatch … DEC8) — they are at the start of the paste; if they are already in the library, delete their chip blocks. The screen (Segment LCD) and the chime tone are done by hand, steps 11 and 29.
# Lesson 1 — the screen and car A: position, car buttons and Cancel, doors, up / down / here.# Paste: Cmd+I into a project with the gates. Segment LCD and Clock 2Hz — by hand. # ---------- parts (if already in the library, delete their blocks) ---------- chip SRLatch { portIn(R) portIn(S) portOut(Q) portOut(nQ) NOR(R, nQ, Q) NOR(S, Q, nQ)}chip DLatch { portIn(D) portIn(EN) portOut(Q) portOut(nQ) NOT(D, nD) AND(D, EN, setD) AND(nD, EN, rstD) SRLatch(S=setD, R=rstD, Q=Q, nQ=nQ)}chip DFF { portIn(D) portIn(CLK) portOut(Q) portOut(nQ) NOT(CLK, nCLK) DLatch(D=D, EN=nCLK, Q=mid) DLatch(D=mid, EN=CLK, Q=Q, nQ=nQ)}chip FA { portIn(A) portIn(B) portIn(CI) portOut(S) portOut(CO) XOR(A, B, p) XOR(p, CI, S) AND(A, B, g) AND(p, CI, pc) OR(g, pc, CO)}chip MUX2 { portIn(A) portIn(B) portIn(S) portOut(Y) NOT(S, nS) NAND(A, nS, na) NAND(B, S, nb) NAND(na, nb, Y)}chip AND3 { portIn(A) portIn(B) portIn(C) portOut(Y) AND(A, B, ab) AND(ab, C, Y)}chip OR3 { portIn(A) portIn(B) portIn(C) portOut(Y) OR(A, B, ab) OR(ab, C, Y)}chip OR4 { portIn(A) portIn(B) portIn(C) portIn(D) portOut(Y) OR(A, B, ab) OR(C, D, cd) OR(ab, cd, Y)}chip OR8 { portIn(A) portIn(B) portIn(C) portIn(D) portIn(E) portIn(F) portIn(G) portIn(H) portOut(Y) OR4(A=A, B=B, C=C, D=D, Y=lo) OR4(A=E, B=F, C=G, D=H, Y=hi) OR(lo, hi, Y)}chip DEC8 { portIn(I0) portIn(I1) portIn(I2) portOut(Y0) portOut(Y1) portOut(Y2) portOut(Y3) portOut(Y4) portOut(Y5) portOut(Y6) portOut(Y7) NOT(I0, n0) NOT(I1, n1) NOT(I2, n2) AND3(A=n2, B=n1, C=n0, Y=Y0) AND3(A=n2, B=n1, C=I0, Y=Y1) AND3(A=n2, B=I1, C=n0, Y=Y2) AND3(A=n2, B=I1, C=I0, Y=Y3) AND3(A=I2, B=n1, C=n0, Y=Y4) AND3(A=I2, B=n1, C=I0, Y=Y5) AND3(A=I2, B=I1, C=n0, Y=Y6) AND3(A=I2, B=I1, C=I0, Y=Y7)} power(VCC)ground(GND)clock(CLK)input(RST)NOT(RST, nR)button{label="1"}(AB0)button{label="2"}(AB1)button{label="3"}(AB2)button{label="4"}(AB3)button{label="5"}(AB4)button{label="6"}(AB5)button{label="7"}(AB6)button{label="8"}(AB7)button{label="Cancel"}(ACAN)NOR(p0, p1, atF)NOT(atF, natF)DEC8(I0=p2, I1=p3, I2=p4, Y0=y0, Y1=y1, Y2=y2, Y3=y3, Y4=y4, Y5=y5, Y6=y6, Y7=y7)OR3(A=t0, B=t1, C=t2, Y=OPEN)NOT(OPEN, ndoor)AND(y0, atF, AC0)AND(AC0, OPEN, O0)AND(y1, atF, AC1)AND(AC1, OPEN, O1)AND(y2, atF, AC2)AND(AC2, OPEN, O2)AND(y3, atF, AC3)AND(AC3, OPEN, O3)AND(y4, atF, AC4)AND(AC4, OPEN, O4)AND(y5, atF, AC5)AND(AC5, OPEN, O5)AND(y6, atF, AC6)AND(AC6, OPEN, O6)AND(y7, atF, AC7)AND(AC7, OPEN, O7)OR(ACAN, RST, kc)OR(O0, kc, kr0)NOT(kr0, nkr0)AND(AB0, nkr0, ks0)SRLatch(S=ks0, R=kr0, Q=AK0)OR(O1, kc, kr1)NOT(kr1, nkr1)AND(AB1, nkr1, ks1)SRLatch(S=ks1, R=kr1, Q=AK1)OR(O2, kc, kr2)NOT(kr2, nkr2)AND(AB2, nkr2, ks2)SRLatch(S=ks2, R=kr2, Q=AK2)OR(O3, kc, kr3)NOT(kr3, nkr3)AND(AB3, nkr3, ks3)SRLatch(S=ks3, R=kr3, Q=AK3)OR(O4, kc, kr4)NOT(kr4, nkr4)AND(AB4, nkr4, ks4)SRLatch(S=ks4, R=kr4, Q=AK4)OR(O5, kc, kr5)NOT(kr5, nkr5)AND(AB5, nkr5, ks5)SRLatch(S=ks5, R=kr5, Q=AK5)OR(O6, kc, kr6)NOT(kr6, nkr6)AND(AB6, nkr6, ks6)SRLatch(S=ks6, R=kr6, Q=AK6)OR(O7, kc, kr7)NOT(kr7, nkr7)AND(AB7, nkr7, ks7)SRLatch(S=ks7, R=kr7, Q=AK7)OR(y0, y1, a2)OR(a2, y2, a3)OR(a3, y3, a4)OR(a4, y4, a5)OR(a5, y5, a6)OR(a6, y6, a7)OR(y7, y6, b5)OR(b5, y5, b4)OR(b4, y4, b3)OR(b3, y3, b2)OR(b2, y2, b1)OR(b1, y1, b0)AND(AK1, y0, ru1)AND(AK2, a2, ru2)AND(AK3, a3, ru3)AND(AK4, a4, ru4)AND(AK5, a5, ru5)AND(AK6, a6, ru6)AND(AK7, a7, ru7)OR8(A=ru1, B=ru2, C=ru3, D=ru4, E=ru5, F=ru6, G=ru7, H=GND, Y=UPR)AND(AK0, b0, rd0)AND(AK1, b1, rd1)AND(AK2, b2, rd2)AND(AK3, b3, rd3)AND(AK4, b4, rd4)AND(AK5, b5, rd5)AND(AK6, y7, rd6)OR8(A=rd0, B=rd1, C=rd2, D=rd3, E=rd4, F=rd5, G=rd6, H=GND, Y=DNR)AND(AK0, y0, hk0)AND(AK1, y1, hk1)AND(AK2, y2, hk2)AND(AK3, y3, hk3)AND(AK4, y4, hk4)AND(AK5, y5, hk5)AND(AK6, y6, hk6)AND(AK7, y7, hk7)OR8(A=hk0, B=hk1, C=hk2, D=hk3, E=hk4, F=hk5, G=hk6, H=hk7, Y=hK)NOT(dir, ndir)NOT(UPR, nUPR)OR(ndir, nUPR, gOK)AND3(A=atF, B=ndoor, C=hK, Y=here)NOT(DNR, nDNR)OR(dir, nDNR, uOK)AND(UPR, uOK, mvUp)AND(DNR, gOK, mvDn)NOT(here, nhere)AND3(A=atF, B=ndoor, C=nhere, Y=decide)MUX2(A=dir, B=mvUp, S=decide, Y=dirN)AND(dirN, nR, dirD)DFF(D=dirD, CLK=CLK, Q=dir)OR(mvUp, mvDn, mv)AND(decide, mv, go1)OR(natF, go1, go)NOT(dirN, ndirN)AND(go, ndirN, dn)FA(A=p0, B=go, CI=GND, S=q0, CO=c0)FA(A=p1, B=dn, CI=c0, S=q1, CO=c1)FA(A=p2, B=dn, CI=c1, S=q2, CO=c2)FA(A=p3, B=dn, CI=c2, S=q3, CO=c3)FA(A=p4, B=dn, CI=c3, S=q4, CO=c4)AND(q0, nR, pd0)DFF(D=pd0, CLK=CLK, Q=p0)AND(q1, nR, pd1)DFF(D=pd1, CLK=CLK, Q=p1)AND(q2, nR, pd2)DFF(D=pd2, CLK=CLK, Q=p2)AND(q3, nR, pd3)DFF(D=pd3, CLK=CLK, Q=p3)AND(q4, nR, pd4)DFF(D=pd4, CLK=CLK, Q=p4)FA(A=t0, B=VCC, CI=GND, S=u0, CO=e0)FA(A=t1, B=VCC, CI=e0, S=u1, CO=e1)FA(A=t2, B=VCC, CI=e1, S=u2, CO=e2)AND(u0, OPEN, v0)AND(u1, OPEN, v1)AND(u2, OPEN, v2a)OR(v2a, here, v2)AND(v0, nR, td0)DFF(D=td0, CLK=CLK, Q=t0)AND(v1, nR, td1)DFF(D=td1, CLK=CLK, Q=t1)AND(v2, nR, td2)DFF(D=td2, CLK=CLK, Q=t2)OR8(A=AK0, B=AK1, C=AK2, D=AK3, E=AK4, F=AK5, G=AK6, H=AK7, Y=rAny)OR(rAny, natF, busy)AND(dir, busy, AUP)AND(ndir, busy, ADN)AND(AC0, ndoor, AD0)AND(AC1, ndoor, AD1)AND(AC2, ndoor, AD2)AND(AC3, ndoor, AD3)AND(AC4, ndoor, AD4)AND(AC5, ndoor, AD5)AND(AC6, ndoor, AD6)AND(AC7, ndoor, AD7)AND(y0, natF, AM0)AND(y1, natF, AM1)AND(y2, natF, AM2)AND(y3, natF, AM3)AND(y4, natF, AM4)AND(y5, natF, AM5)AND(y6, natF, AM6)OR8(A=y1, B=y2, C=y4, D=y5, E=y6, F=y7, G=GND, H=GND, Y=AFa)OR8(A=y0, B=y1, C=y2, D=y3, E=y6, F=y7, G=GND, H=GND, Y=AFb)OR8(A=y0, B=y2, C=y3, D=y4, E=y5, F=y6, G=y7, H=GND, Y=AFc)OR8(A=y1, B=y2, C=y4, D=y5, E=y7, F=GND, G=GND, H=GND, Y=AFd)OR3(A=y1, B=y5, C=y7, Y=AFe)OR4(A=y3, B=y4, C=y5, D=y7, Y=AFf)OR8(A=y1, B=y2, C=y3, D=y4, E=y5, F=y7, G=GND, H=GND, Y=AFg)speaker{mode="buzz", tone=880}(here)Stuck? Something doesn't work →