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

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

Project: unit converter

Your first project: a calculator chip that converts temperatures and pressures into all common units.

Project 20 min Week 1

What you learn today

  • Convert °C, K and °F
  • Convert kPa to atm
  • Store results in fixed registers

The first week is done: you know registers, numbers and basic math. Time to put it together. Projects are a bit bigger than exercises and consist of several milestones – each one is a test of its own, and you see right away which are green.

The task

A chip should convert readings so you can compare them with tables from the internet or from friends. Two values come in:

RegisterContent
r0temperature in °C
r3pressure in kPa

In the game a sensor would deliver the values. Here the test sets the registers before your program starts – so you can focus on the math.

The formulas

TargetCalculation
Kelvin°C + 273.15
Fahrenheit°C · 1.8 + 32
AtmosphereskPa / 101.325
barkPa / 100

Fahrenheit needs two instructions, because there are no formulas with brackets. Compute into the target register and keep working there:

mul r2 r0 1.8
add r2 r2 32

Milestones

  1. r1 = temperature in Kelvin
  2. r2 = temperature in Fahrenheit
  3. r4 = pressure in atmospheres
  4. r5 = pressure in bar
  5. Everything together: a frosty Mars morning at −33 °C and 0.6 kPa
Tip

Do not overwrite r0 and r3 – you need the inputs for several calculations. An endless loop is not needed yet, that comes in week 3.

Note

101.325 kPa is one standard atmosphere. In the game a well-tuned room sits roughly there.

Diagram

Data flow of an arithmetic instruction add r1 r0 273.15 r0 = 21 273.15 + r1 = 294.15 the target always comes first
Every calculation reads values, computes and stores the result in the target register – line by line.

Project task

Task

r0 holds a temperature in °C, r3 a pressure in kPa (set by the test).

  • r1 = Kelvin
  • r2 = Fahrenheit
  • r4 = atmospheres (kPa / 101.325)
  • r5 = bar (kPa / 100)

Milestones

  1. Milestone 1: Kelvin
  2. Milestone 2: Fahrenheit
  3. Milestone 3: atmospheres
  4. Milestone 4: bar
  5. Milestone 5: Mars morning at −33 °C and 0.6 kPa

Hints

Hint 1

Kelvin: add r1 r0 273.15.

Hint 2

Fahrenheit in two lines: mul r2 r0 1.8, then add r2 r2 32.

Hint 3

Pressure: two div with r3 as input.

Quiz

2 questions. You pass from 60 % – the server does the grading.

Complete the day

  • Passed all milestones of the project
  • 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