Syscall 2: Firmware, home

BenchChapter 7: Frames and loops

B47INVERTING

The task

P0 reads a sine wave as a percent of the supply.

Turn it upside down on CH2: put out 100 minus the reading as a PWM duty on P1.

The board

The chip of INVERTINGChip u1 with 2 ports: P0 analog in, reaching V1, CH1; P1 pwm out, reaching R1, C1, CH2.u1CHIP SC-2P0ANALOG INV1, CH1P1PWM OUTR1, C1, 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 2 V sine at 50 Hz and V2 2.5 V
Resistors
R1 1 kΩ
Capacitors
C1 1 µF
Probes
CH1 and CH2

Key idea

NEG flips the sign of A.

Hints

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

Hint 1Show

Minus the reading, plus 100, is 100 minus the reading.

Hint 2Show

A reading of 90 percent becomes a duty of 10 percent.

Solution

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

Put out 100 minus the reading.

u1SC-2 standard

IN P0
NEG
ADD 100
OUT P1
CYCLES
400
at par
ENERGY
800
at par
NODES
1
at par
INSTRUCTIONS
4
at par