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

Day 8 of 365 · Beginner · Month 1: First steps

Reading and switching devices: l and s

With l you fetch values from a device, with s you write values into it.

Lesson 8 min Week 2

What you learn today

  • Read values with l
  • Write values with s
  • Understand DeviceNotFound

Math alone does not run a station – the chip should control things. Two instructions do that.

Reading with l

l r0 d0 Temperature

Read it as: “Load the value Temperature from the device on pin d0 into r0.” You assign the device on d0 at the housing with a screwdriver, for example a gas sensor.

Writing with s

s d1 On 1

Read it as: “Set the value On of the device on pin d1 to 1.” A wall light on d1 switches on, 0 switches it off again. A register works instead of the 1 as well: s d1 On r5.

Note

With l the register comes first, with s it comes last. Memory aid: the target is always where the result ends up – the register for l, the device for s.

What if no device is attached?

If nothing hangs on d0, the chip reports the error DeviceNotFound and stays on that line. It retries every tick – plug the device in later and it carries on.

A complete example

l r0 d0 Temperature   # sensor on d0
sub r0 r0 273.15      # to degrees Celsius
s d1 Setting r0       # show it on the display on d1

Diagram

Reading with l, writing with s Gas sensor (d0) Temperature 293.15 IC10 r0 = 293.15 Wall light (d1) On 1 l r0 d0 Temperature device → register s d1 On 1 value → device
l (load) fetches a value from the device into a register, s (store) writes a value from the chip into the device.

Exercise

Task

A gas sensor is attached to d0, a wall light to d1.

  1. Read the sensor’s temperature into r0.
  2. Switch the light on.

Hints

Hint 1

Reading: l r0 d0 Temperature.

Hint 2

Switching on means: set the value On to 1.

Quiz

3 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