What you learn today
- Digital diverters
- Flip-flop splitters
- Count items
Two arc furnaces, one ore chute. If both run, they should share the ore. If one stands still, everything should go to the other. You need no sorter for that – the chute itself can do it with the digital parts.
The digital flip flop splitter
StructureChuteDigitalFlipFlopSplitterLeft (and …Right) has one input and two outputs. Mode says where the next item goes: 0 to output 1, 1 to output 2. On top of that it counts:
| LogicType | Meaning |
|---|---|
Setting | this many items to output 1, then switch (0 to 300) |
SettingOutput | this many items to output 2, then switch back |
Quantity | items since the last switch |
With Setting 3 and SettingOutput 1 three items go left, one right, always alternating. If the value of the current side is 0, it never switches by itself.
Digital diverters
With both values at 0 the splitter becomes a diverter: it no longer switches itself, and the chip fixes with Mode where everything goes.
and tmp a b
bnez tmp batch
seqz tmp a
sbn SPLITTER HASH("Verteiler") Mode tmp
If both furnaces run, the splitter divides 3 to 1. If only one runs, it gets everything.
Counting items
The digital chute valve counts by itself: with Setting 10 it lets exactly ten items through after opening and then closes itself. That is a batch. The chip opens it on a button press and recognises by the change from open to closed that a batch has gone through:
seqz tmp open
and tmp tmp old
move old open
That is a falling edge – the counterpart to the rising edge of the button.
If somebody closes the valve by hand in the middle of the batch, the chip still counts ten. Whoever needs it exactly reads Quantity on closing: the valve only resets it to 0 when it closes by itself.
Exercise
Task
If both arc furnaces “OfenA” and “OfenB” run (On 1), the flip flop splitter “Verteiler” divides 3 to 1 (Setting 3, SettingOutput 1). Otherwise both values are 0 and Mode sends everything to the running furnace: Mode 1 when furnace A stands still, otherwise 0. The chute valve “Charge” has Setting 10; a press on “Nachfuellen” opens it. When it closes, “Teile” counts up by 10.
Hints
Hint 1
Both run: and tmp a b, then with select the values 3 and 1 or 0.
Hint 2
Fixed mode only when not both run: bnez tmp batch, then seqz tmp a.
Hint 3
Counting batches: falling edge from seqz tmp open and old, add times BATCH.
Quiz
4 questions. You pass from 60 % – the server does the grading.
Complete the day
- Passed the simulator exercise
- Passed the quiz with at least 60 %
Without an account progress is saved in this browser only.
Report a mistake in this lesson
Please sign in to report. Sign in