stationeers.de Mod workshop · Dominik1199
DE Sign in
  1. Home
  2. IC10 academy
  3. Day 81

Day 81 of 365 · Beginner · Month 3: First systems

Step-by-step sequences

A sequence of several steps: the step number sits in a register, every step has its own job and its own condition for moving on.

Lesson 16 min Week 12

What you learn today

  • Step in a register
  • Advance on a condition
  • Restart the sequence

The hangar door should not just spring open. First a warning lamp flashes, then the door opens, stays open for a while and closes again while the lamp is still warning. That is a sequence: several steps one after another, each with its own job.

The step sits in a register

Every step gets a number. A register remembers which step the sequence is in right now:

StepWhat happensnext when …
0idle, door closedthe button is pressed
1warning lamp onPREWARN ticks have passed
2door openOPENTIME ticks have passed
3door closed, lamp still onPREWARN ticks have passed

After step 3 it goes back to step 0. Then the sequence is ready for the next start.

Branching by step

At the start of every pass the chip jumps to the code of the current step:

beq step 1 s1
beq step 2 s2
beq step 3 s3
# step 0 is here

Every step block sets its outputs and checks its condition. If it is met, the block writes the next number and resets the time:

s1:
move warning 1
blt time PREWARN output    # not done yet
move step 2
move time 0
j output

In the end all blocks land at output:. There the chip writes the devices, exactly once per pass.

Time within a step

A counter time runs up every tick and is reset to 0 on every change of step. That way every step knows how long it has been running, and you need no separate counter per step.

Warning

Do not forget the j output at the end of a block. Otherwise the chip runs into the next block and does two steps in one tick.

Tip

Step 0 is the idle state: door closed, lamp off. In the game the register keeps its old value after an upload. Set step to 0 with move before the start label, then the sequence always starts cleanly.

Diagram

Flow with a conditional jump start: yield · l r0 r0 > 303.15? hot: On 1 On 0 yes: bgt jumps no: next line j start
At the start of every pass the chip jumps to the block of the current step. All blocks end at the shared output.

Exercise

Task

Build the sequence for the hangar door from the table above.

  • Button “Tortaster” (StructureLogicButton): the edge starts the sequence, but only in step 0.
  • Door “Hangartor” (StructureCompositeDoor, value Open), flashing light “Torwarnung”.
  • After step 3 back to step 0, a new press starts the sequence again.
  • If the button is missing, everything stays idle.

Hints

Hint 1

After the inputs: beq step 1 s1, beq step 2 s2, beq step 3 s3. What follows is step 0.

Hint 2

Every block: set outputs, blt time … output, otherwise the next step number and move time 0.

Hint 3

Every block ends with j output – only the last one may run straight into the label.

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

Esc
↑ ↓ selectEnter open/ opens search anywhere