Syscall 2: Firmware, home

BenchChapter 4: Stars and hubs

B22FOLLOWER

The task

V1 sends a square wave through R1 into C1, so its edges reach P0 slowly.

P0 reads 1 once CH1 climbs past 3 volts, and 0 once it falls under 1.5 volts.

Copy P0 to the LED on P1, so the LED follows what the chip reads.

The board

The chip of FOLLOWERChip u1 with 2 ports: P0 digital in, reaching R1, C1, V1, CH1; P1 digital out, reaching R2, D1, CH2.u1CHIP SC-2P0DIGITAL INR1, C1, V1, CH1P1DIGITAL OUTR2, D1, CH2
The chip's ports, each with its kind and the parts its signal reaches. Cyan reads, lemon writes. On a narrow screen, scroll the board sideways to see all of it.
Sources
V1 5 V square at 50 Hz
Resistors
R1 3.3 kΩ and R2 330 Ω
Capacitors
C1 1 µF
LEDs
D1 green
Probes
CH1 and CH2

Key idea

IN P0 puts the reading in A. OUT P1 writes A to the LED.

Hints

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

Hint 1Show

A program loops by itself: after its last line it starts again from the first.

Hint 2Show

The LED lags behind V1. That delay comes from C1, not from your program.

Solution

Reveal the Full SolutionThe complete program for FOLLOWER. 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.

The LED copies what P0 reads.

u1SC-2 standard

IN P0
OUT P1
CYCLES
600
at par
ENERGY
1200
at par
NODES
1
at par
INSTRUCTIONS
2
at par