B80MAGNITUDE
The task
P0 reads a signal on CH1 that swings around 50 percent. P1 is a PWM pin on the base of Q1.
Q1 inverts, and R3 and C1 smooth its collector onto CH2.
Make CH2 show twice the distance from 50, so it rises on both halves of the swing.
The board
- Sources
- V1 2 V sine at 5 Hz, V2 2.5 V, and V3 5 V
- Resistors
- R1 4.7 kΩ, R2 220 Ω, and R3 10 kΩ
- Capacitors
- C1 1 µF
- Transistors
- Q1, an NPN transistor
- Probes
- CH1 and CH2
Key idea
Subtract 50, and flip the sign of a positive result: now it is minus the distance.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Doubled, that is at most 80. Since Q1 inverts, the duty is 100 minus the doubled distance.
Hint 2Show
SUB 50, JL past a NEG, then MUL 2 and ADD 100.
Solution
Reveal the Full SolutionThe complete program for MAGNITUDE. 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.
A full wave rectifier in code, inverted for Q1.
u1SC-2 standard
IN P0
SUB 50
JL N
NEG
N: MUL 2
ADD 100
OUT P1- CYCLES
- 2000
- at par
- ENERGY
- 4000
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 7
- at par