Syscall 2: Firmware, home

BenchChapter 5: Half duplex

B30ASTABLE

The task

P0 charges C1 through R1, and P1 reads C1 back as a digital input.

P1 reads 1 once C1 passes 3 volts, and 0 once it falls under 1.5 volts.

Make it oscillate: charge until P1 reads 1, then drain until it reads 0, and repeat.

The board

The chip of ASTABLEChip u1 with 2 ports: P0 digital out, reaching R1, C1, CH1; P1 digital in, reaching R1, C1, CH1.u1CHIP SC-2P0DIGITAL OUTR1, C1, CH1P1DIGITAL INR1, C1, CH1
The chip's ports, each with its kind and the parts its signal reaches. Cyan reads, lemon writes.
Resistors
R1 10 kΩ
Capacitors
C1 1 µF
Probes
CH1

Key idea

Raise P0, then wait in a loop while P1 reads 0.

Hints

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

Hint 1Show

Then drop P0 and wait while P1 reads 1.

Hint 2Show

The two thresholds set the swing on CH1. The chip only has to react.

Solution

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

Charge until P1 reads high, drain until it reads low.

u1SC-2 standard

MOV A, 1
OUT P0
H: IN P1
JZ H
MOV A, 0
OUT P0
L: IN P1
JNZ L
CYCLES
600
at par
ENERGY
1200
at par
NODES
1
at par
INSTRUCTIONS
8
at par