Syscall 2: Firmware, home

BenchChapter 3: Chains and rings

B02DIMMER

The task

P0 is a PWM pin: OUT P0 sets the share of each period it spends high, 0 to 100 percent.

R1 and C1 smooth the pulses into a steady voltage on CH1.

Hold CH1 at 3 volts. The supply is 5 volts.

The board

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

Key idea

A duty of 100 percent gives the full 5 volts; 50 percent gives half.

Hints

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

Hint 1Show

MOV A, 50 sets A to 50, and OUT P0 then sets the duty.

Hint 2Show

3 volts is three fifths of the supply.

Solution

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

u1SC-2 standard

MOV A, 60
OUT P0
CYCLES
600
at par
ENERGY
1200
at par
NODES
1
at par
INSTRUCTIONS
2
at par