Syscall 2: Firmware, home

BenchChapter 5: Half duplex

B34SOFT START

The task

A soft start brings a supply up gently instead of all at once.

On each tick of P1, raise the duty on P0 by 10 percent, from 0 up to 80.

Then hold it at 80 for good.

The board

The chip of SOFT STARTChip u1 with 2 ports: P0 pwm out, reaching R1, C1, CH1; P1 timer 20 cycles.u1CHIP SC-2P0PWM OUTR1, C1, CH1P1TIMER 20 CYCLES
The chip's ports, each with its kind and the parts its signal reaches. Cyan reads, lemon writes.
Resistors
R1 1 kΩ
Capacitors
C1 1 µF
Probes
CH1

Key idea

B can keep the duty between ticks: MOV B, A stores it and MOV A, B brings it back.

Hints

Each hint goes a step further than the one before. Open them one at a time.

Hint 1Show

Compare the duty with 80 before you raise it. Once it is there, skip the rest.

Hint 2Show

After SUB 80 and the test, ADD 90 gives the old duty plus 10.

Solution

Reveal the Full SolutionThe complete program for SOFT START. Open it only when you want the answer.

The reference program

The game's own solution. It passes every test and scores exactly par on every benchmark.

Climb 10 percent a tick to 80, then hold.

u1SC-2 standard

L: IN P1
MOV A, B
SUB 80
JZ L
ADD 90
MOV B, A
OUT P0
CYCLES
101
at par
ENERGY
202
at par
NODES
1
at par
INSTRUCTIONS
7
at par