B51SLEW
The task
P0 reads a square wave that jumps between 0 and 5 volts.
Follow it on CH2 through the PWM pin P1, but move at most 10 percent per tick of P2.
The jumps become ramps.
The board
- Sources
- V1 5 V square at 20 Hz
- Resistors
- R1 1 kΩ
- Capacitors
- C1 1 µF
- Probes
- CH1 and CH2
Key idea
B holds the duty you put out last.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Compare the reading with B: step up by 10 when it is higher and down by 10 when it is lower.
Hint 2Show
When they match, the duty stays where it is.
Solution
Reveal the Full SolutionThe complete program for SLEW. 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.
Follow the input at no more than 10 percent a tick.
u1SC-2 standard
L: IN P2
IN P0
SUB B
JZ L
JG UP
MOV A, B
SUB 10
JMP S
UP: MOV A, B
ADD 10
S: MOV B, A
OUT P1- CYCLES
- 617
- at par
- ENERGY
- 1234
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 12
- at par